imabackstabber commited on
Commit
d8242be
·
1 Parent(s): ed25de7

test mmdet pipeline

Browse files
app.py CHANGED
@@ -14,7 +14,7 @@ except:
14
  os.system('pip install /home/user/app/main/transformer_utils')
15
 
16
  os.system('cp -rf /home/user/app/assets/conversions.py /home/user/.pyenv/versions/3.9.18/lib/python3.9/site-packages/torchgeometry/core/conversions.py')
17
- DEFAULT_MODEL='smpler_x_h32' # for config
18
  OUT_FOLDER = '/home/user/app/demo_out'
19
  os.makedirs(OUT_FOLDER, exist_ok=True)
20
 
 
14
  os.system('pip install /home/user/app/main/transformer_utils')
15
 
16
  os.system('cp -rf /home/user/app/assets/conversions.py /home/user/.pyenv/versions/3.9.18/lib/python3.9/site-packages/torchgeometry/core/conversions.py')
17
+ DEFAULT_MODEL='posotmetro' # for config
18
  OUT_FOLDER = '/home/user/app/demo_out'
19
  os.makedirs(OUT_FOLDER, exist_ok=True)
20
 
common/utils/preprocessing.py CHANGED
@@ -58,7 +58,7 @@ def sanitize_bbox(bbox, img_width, img_height):
58
  return bbox
59
 
60
 
61
- def process_bbox(bbox, img_width, img_height, ratio=1.25):
62
  bbox = sanitize_bbox(bbox, img_width, img_height)
63
  if bbox is None:
64
  return bbox
 
58
  return bbox
59
 
60
 
61
+ def process_bbox(bbox, img_width, img_height, ratio=1.2):
62
  bbox = sanitize_bbox(bbox, img_width, img_height)
63
  if bbox is None:
64
  return bbox
main/config/config_postometro.py ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import os.path as osp
3
+
4
+ # will be update in exp
5
+ num_gpus = -1
6
+ exp_name = 'output/exp1/pre_analysis'
7
+
8
+ # quick access
9
+ save_epoch = 1
10
+ lr = 1e-5
11
+ end_epoch = 10
12
+ train_batch_size = 16
13
+
14
+ syncbn = True
15
+ bbox_ratio = 1.2
16
+
17
+ # continue
18
+ continue_train = False
19
+ start_over = True
20
+
21
+ # dataset setting
22
+ agora_fix_betas = True
23
+ agora_fix_global_orient_transl = True
24
+ agora_valid_root_pose = True
25
+
26
+ # all
27
+ dataset_list = ['Human36M', 'MSCOCO', 'MPII', 'AGORA', 'EHF', 'SynBody', 'GTA_Human2', \
28
+ 'EgoBody_Egocentric', 'EgoBody_Kinect', 'UBody', 'PW3D', 'MuCo', 'PROX']
29
+ trainset_3d = ['MSCOCO','AGORA', 'UBody']
30
+ trainset_2d = ['PW3D', 'MPII', 'Human36M']
31
+ trainset_humandata = ['BEDLAM', 'SPEC', 'GTA_Human2','SynBody', 'PoseTrack',
32
+ 'EgoBody_Egocentric', 'PROX', 'CrowdPose',
33
+ 'EgoBody_Kinect', 'MPI_INF_3DHP', 'RICH', 'MuCo', 'InstaVariety',
34
+ 'Behave', 'UP3D', 'ARCTIC',
35
+ 'OCHuman', 'CHI3D', 'RenBody_HiRes', 'MTP', 'HumanSC3D', 'RenBody',
36
+ 'FIT3D', 'Talkshow' , 'SSP3D', 'LSPET']
37
+ testset = 'EHF'
38
+
39
+ use_cache = True
40
+ # downsample
41
+ BEDLAM_train_sample_interval = 5
42
+ EgoBody_Kinect_train_sample_interval = 10
43
+ train_sample_interval = 10 # UBody
44
+ MPI_INF_3DHP_train_sample_interval = 5
45
+ InstaVariety_train_sample_interval = 10
46
+ RenBody_HiRes_train_sample_interval = 5
47
+ ARCTIC_train_sample_interval = 10
48
+ # RenBody_train_sample_interval = 10
49
+ FIT3D_train_sample_interval = 10
50
+ Talkshow_train_sample_interval = 10
51
+
52
+ # strategy
53
+ data_strategy = 'balance' # 'balance' need to define total_data_len
54
+ total_data_len = 4500000
55
+
56
+ # model
57
+ smplx_loss_weight = 1.0 #2 for agora_model for smplx shape
58
+ smplx_pose_weight = 10.0
59
+
60
+ smplx_kps_3d_weight = 100.0
61
+ smplx_kps_2d_weight = 1.0
62
+ net_kps_2d_weight = 1.0
63
+
64
+ agora_benchmark = 'agora_model' # 'agora_model', 'test_only'
65
+
66
+ model_type = 'smpler_x_h'
67
+ encoder_config_file = 'main/transformer_utils/configs/smpler_x/encoder/body_encoder_huge.py'
68
+ encoder_pretrained_model_path = 'pretrained_models/vitpose_huge.pth'
69
+ feat_dim = 1280
70
+
71
+ ## =====FIXED ARGS============================================================
72
+ ## model setting
73
+ upscale = 4
74
+ hand_pos_joint_num = 20
75
+ face_pos_joint_num = 72
76
+ num_task_token = 24
77
+ num_noise_sample = 0
78
+
79
+ ## UBody setting
80
+ train_sample_interval = 10
81
+ test_sample_interval = 100
82
+ make_same_len = False
83
+
84
+ ## input, output size
85
+ input_img_shape = (256, 256)
86
+ input_body_shape = (256, 256)
87
+ output_hm_shape = (16, 16, 12)
88
+ input_hand_shape = (256, 256)
89
+ output_hand_hm_shape = (16, 16, 16)
90
+ output_face_hm_shape = (8, 8, 8)
91
+ input_face_shape = (192, 192)
92
+ focal = (5000, 5000) # virtual focal lengths
93
+ princpt = (input_body_shape[1] / 2, input_body_shape[0] / 2) # virtual principal point position
94
+ body_3d_size = 2
95
+ hand_3d_size = 0.3
96
+ face_3d_size = 0.3
97
+ camera_3d_size = 2.5
98
+
99
+ ## training config
100
+ print_iters = 100
101
+ lr_mult = 1
102
+
103
+ ## testing config
104
+ test_batch_size = 32
105
+
106
+ ## others
107
+ num_thread = 2
108
+ vis = False
109
+
110
+ ## directory
111
+ output_dir, model_dir, vis_dir, log_dir, result_dir, code_dir = None, None, None, None, None, None
main/inference.py CHANGED
@@ -76,6 +76,7 @@ class Inferer:
76
  num_bbox = len(mmdet_box)
77
 
78
  ## loop all detected bboxes
 
79
  for bbox_id in range(num_bbox):
80
  mmdet_box_xywh = np.zeros((4))
81
  # xyxy -> xywh
@@ -91,6 +92,8 @@ class Inferer:
91
  # align these pre-processing steps
92
  bbox = process_bbox(mmdet_box_xywh, original_img_width, original_img_height)
93
 
 
 
94
  # test mmdet pipeline
95
  if bbox is not None:
96
  top_left = (int(bbox[0]), int(bbox[1]))
@@ -142,5 +145,5 @@ class Inferer:
142
  # vis_img = render_mesh(vis_img, mesh, smpl_x.face, {'focal': focal, 'princpt': princpt},
143
  # mesh_as_vertices=mesh_as_vertices)
144
  # vis_img = vis_img.astype('uint8')
145
- return vis_img, num_bbox, mmdet_box
146
 
 
76
  num_bbox = len(mmdet_box)
77
 
78
  ## loop all detected bboxes
79
+ ok_bboxes = []
80
  for bbox_id in range(num_bbox):
81
  mmdet_box_xywh = np.zeros((4))
82
  # xyxy -> xywh
 
92
  # align these pre-processing steps
93
  bbox = process_bbox(mmdet_box_xywh, original_img_width, original_img_height)
94
 
95
+ ok_bboxes.append(bbox)
96
+
97
  # test mmdet pipeline
98
  if bbox is not None:
99
  top_left = (int(bbox[0]), int(bbox[1]))
 
145
  # vis_img = render_mesh(vis_img, mesh, smpl_x.face, {'focal': focal, 'princpt': princpt},
146
  # mesh_as_vertices=mesh_as_vertices)
147
  # vis_img = vis_img.astype('uint8')
148
+ return vis_img, num_bbox, ok_bboxes
149