Spaces:
Sleeping
Sleeping
imabackstabber
commited on
Commit
•
d8f27c1
1
Parent(s):
64b1698
try using yolox
Browse files
main/__pycache__/config.cpython-39.pyc
CHANGED
Binary files a/main/__pycache__/config.cpython-39.pyc and b/main/__pycache__/config.cpython-39.pyc differ
|
|
main/inference.py
CHANGED
@@ -48,6 +48,11 @@ class Inferer:
|
|
48 |
model = init_detector(config_file, checkpoint_file, device=self.device) # or device='cuda:0'
|
49 |
self.model = model
|
50 |
|
|
|
|
|
|
|
|
|
|
|
51 |
def infer(self, original_img, iou_thr, multi_person=False, mesh_as_vertices=False):
|
52 |
from utils.preprocessing import process_bbox, generate_patch_image
|
53 |
from utils.vis import render_mesh
|
|
|
48 |
model = init_detector(config_file, checkpoint_file, device=self.device) # or device='cuda:0'
|
49 |
self.model = model
|
50 |
|
51 |
+
# checkpoint_file = osp.join(CUR_DIR, '../pretrained_models/mmdet/yolox_x_8x8_300e_coco_20211126_140254-1ef88d67.pth')
|
52 |
+
# config_file= osp.join(CUR_DIR, '../pretrained_models/mmdet/yolox_x_8x8-300e_coco.py')
|
53 |
+
# model = init_detector(config_file, checkpoint = checkpoint_file, device=self.device) # or device='cuda:0'
|
54 |
+
# self.model = model
|
55 |
+
|
56 |
def infer(self, original_img, iou_thr, multi_person=False, mesh_as_vertices=False):
|
57 |
from utils.preprocessing import process_bbox, generate_patch_image
|
58 |
from utils.vis import render_mesh
|
pretrained_models/mmdet/yolox_s_8x8-300e_coco.py
ADDED
@@ -0,0 +1,102 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
img_scale = (640, 640) # height, width
|
2 |
+
|
3 |
+
# model settings
|
4 |
+
model = dict(
|
5 |
+
type='YOLOX',
|
6 |
+
input_size=img_scale,
|
7 |
+
random_size_range=(15, 25),
|
8 |
+
random_size_interval=10,
|
9 |
+
backbone=dict(type='CSPDarknet', deepen_factor=0.33, widen_factor=0.5),
|
10 |
+
neck=dict(
|
11 |
+
type='YOLOXPAFPN',
|
12 |
+
in_channels=[128, 256, 512],
|
13 |
+
out_channels=128,
|
14 |
+
num_csp_blocks=1),
|
15 |
+
bbox_head=dict(
|
16 |
+
type='YOLOXHead', num_classes=80, in_channels=128, feat_channels=128),
|
17 |
+
train_cfg=dict(assigner=dict(type='SimOTAAssigner', center_radius=2.5)),
|
18 |
+
# In order to align the source code, the threshold of the val phase is
|
19 |
+
# 0.01, and the threshold of the test phase is 0.001.
|
20 |
+
test_cfg=dict(score_thr=0.01, nms=dict(type='nms', iou_threshold=0.65)))
|
21 |
+
|
22 |
+
# dataset settings
|
23 |
+
data_root = 'data/coco/'
|
24 |
+
dataset_type = 'CocoDataset'
|
25 |
+
|
26 |
+
train_pipeline = [
|
27 |
+
dict(type='Mosaic', img_scale=img_scale, pad_val=114.0),
|
28 |
+
dict(
|
29 |
+
type='RandomAffine',
|
30 |
+
scaling_ratio_range=(0.1, 2),
|
31 |
+
border=(-img_scale[0] // 2, -img_scale[1] // 2)),
|
32 |
+
dict(
|
33 |
+
type='MixUp',
|
34 |
+
img_scale=img_scale,
|
35 |
+
ratio_range=(0.8, 1.6),
|
36 |
+
pad_val=114.0),
|
37 |
+
dict(type='YOLOXHSVRandomAug'),
|
38 |
+
dict(type='RandomFlip', flip_ratio=0.5),
|
39 |
+
# According to the official implementation, multi-scale
|
40 |
+
# training is not considered here but in the
|
41 |
+
# 'mmdet/models/detectors/yolox.py'.
|
42 |
+
dict(type='Resize', img_scale=img_scale, keep_ratio=True),
|
43 |
+
dict(
|
44 |
+
type='Pad',
|
45 |
+
pad_to_square=True,
|
46 |
+
# If the image is three-channel, the pad value needs
|
47 |
+
# to be set separately for each channel.
|
48 |
+
pad_val=dict(img=(114.0, 114.0, 114.0))),
|
49 |
+
dict(type='FilterAnnotations', min_gt_bbox_wh=(1, 1), keep_empty=False),
|
50 |
+
dict(type='DefaultFormatBundle'),
|
51 |
+
dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels'])
|
52 |
+
]
|
53 |
+
|
54 |
+
train_dataset = dict(
|
55 |
+
type='MultiImageMixDataset',
|
56 |
+
dataset=dict(
|
57 |
+
type=dataset_type,
|
58 |
+
ann_file=data_root + 'annotations/instances_train2017.json',
|
59 |
+
img_prefix=data_root + 'train2017/',
|
60 |
+
pipeline=[
|
61 |
+
dict(type='LoadImageFromFile'),
|
62 |
+
dict(type='LoadAnnotations', with_bbox=True)
|
63 |
+
],
|
64 |
+
filter_empty_gt=False,
|
65 |
+
),
|
66 |
+
pipeline=train_pipeline)
|
67 |
+
|
68 |
+
test_pipeline = [
|
69 |
+
dict(type='LoadImageFromFile'),
|
70 |
+
dict(
|
71 |
+
type='MultiScaleFlipAug',
|
72 |
+
img_scale=img_scale,
|
73 |
+
flip=False,
|
74 |
+
transforms=[
|
75 |
+
dict(type='Resize', keep_ratio=True),
|
76 |
+
dict(type='RandomFlip'),
|
77 |
+
dict(
|
78 |
+
type='Pad',
|
79 |
+
pad_to_square=True,
|
80 |
+
pad_val=dict(img=(114.0, 114.0, 114.0))),
|
81 |
+
dict(type='DefaultFormatBundle'),
|
82 |
+
dict(type='Collect', keys=['img'])
|
83 |
+
])
|
84 |
+
]
|
85 |
+
|
86 |
+
data = dict(
|
87 |
+
samples_per_gpu=8,
|
88 |
+
workers_per_gpu=4,
|
89 |
+
persistent_workers=True,
|
90 |
+
train=train_dataset,
|
91 |
+
val=dict(
|
92 |
+
type=dataset_type,
|
93 |
+
ann_file=data_root + 'annotations/instances_val2017.json',
|
94 |
+
img_prefix=data_root + 'val2017/',
|
95 |
+
pipeline=test_pipeline),
|
96 |
+
test=dict(
|
97 |
+
type=dataset_type,
|
98 |
+
ann_file=data_root + 'annotations/instances_val2017.json',
|
99 |
+
img_prefix=data_root + 'val2017/',
|
100 |
+
pipeline=test_pipeline))
|
101 |
+
|
102 |
+
evaluation = dict(interval=1, metric='bbox')
|
pretrained_models/mmdet/yolox_x_8x8-300e_coco.py
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
_base_ = './yolox_s_8x8-300e_coco.py'
|
2 |
+
|
3 |
+
# model settings
|
4 |
+
model = dict(
|
5 |
+
backbone=dict(deepen_factor=1.33, widen_factor=1.25),
|
6 |
+
neck=dict(
|
7 |
+
in_channels=[320, 640, 1280], out_channels=320, num_csp_blocks=4),
|
8 |
+
bbox_head=dict(in_channels=320, feat_channels=320))
|
pretrained_models/mmdet/yolox_x_8x8_300e_coco_20211126_140254-1ef88d67.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1ef88d67f9c912a7c3a6df4f4d9bdf391cf70df867e6c9d7f249c7a3990e3dec
|
3 |
+
size 396898755
|