Closed zhenzhiwang closed 1 year ago
Hi,
Thank you, I assume you are asking about how to create posetrack_gt_data.pickle
for train and validation set?
Here is the code we used for creating those pickle files. Hope this helps?
def make_groundtruth_posetrack(train=False):
### folder structure
# _DATA/posetrack
# _DATA/posetrack/train
# _DATA/posetrack/val
# _DATA/posetrack/annotations
# _DATA/posetrack/annotations/train
# _DATA/posetrack/annotations/val
if(train):
videos_seq = "_DATA/datasets/posetrack/list_videos_train.npy"
subfolder = "train/"
else:
videos_seq = "_DATA/datasets/posetrack/list_videos_val.npy"
subfolder = "val/"
videos_seq = np.load(videos_seq)
video_data = {}
posetrack_home = os.path.expanduser('_DATA/posetrack')
for video in videos_seq:
video_data[video] = {}
posetrack_annotations = os.path.join(posetrack_home, 'annotations')
coco = COCO(os.path.join(posetrack_annotations, subfolder + video + '.json'))
img_ids = coco.getImgIds()
imgs = coco.loadImgs(img_ids)
posetrack_images = []
for img in imgs:
if not img['is_labeled']: pass
else: posetrack_images.append(img)
for selected_im in posetrack_images:
ann_ids = coco.getAnnIds(imgIds=selected_im['id'])
anns = coco.loadAnns(ann_ids)
frame_name_x = []; gt_idx = []; gt_bbox = []
for ann_x in anns:
try:
if(ann_x['bbox'][2]>0 and ann_x['bbox'][3]>0):
frame_name_x.append(selected_im['file_name'][11:])
gt_idx.append(ann_x['track_id'])
gt_bbox.append(ann_x['bbox'])
except:
pass
video_data[video][selected_im['file_name'][11:].split("/")[-1]] = [frame_name_x, gt_idx, gt_bbox]
unique_gt_ids = []
for frame in video_data[video]:
bad_gt_ids = video_data[video][frame][1]
for ix in bad_gt_ids:
unique_gt_ids.append(ix)
unique_gt_ids = np.unique(np.array(unique_gt_ids))
new_ids = np.array(list(range(len(unique_gt_ids))))
for frame in video_data[video]:
bad_gt_ids = video_data[video][frame][1]
new_ids = []
for ix in bad_gt_ids:
idx = np.where(np.array(unique_gt_ids)==ix)[0]
new_ids.append(idx[0])
video_data[video][frame].append(new_ids)
if(train):
joblib.dump(video_data, '_DATA/datasets/posetrack/gt_data_train.pkl')
else:
joblib.dump(video_data, '_DATA/datasets/posetrack/gt_data_val.pkl')```
Yes I need the script to create posetrack_gt_data.pickle
file. Thank you a lot!
By the way, I really appreciate it if you could share the training code, such as the code for loading dataset and construct losses. Thank you again!
Thanks, We haven't trained any neural networks with tracking data. We just optimized 4 numbers for the distance function (https://github.com/brjathu/PHALP/blob/92206ec13310dfd6dd6a8fb01c97aac8ca82ae96/deep_sort_/nn_matching.py#L86). We will release the optimization code as soon as possible.
Hi brjathu,
Thanks for sharing your great work! I am wondering how you convert the original Posetrack groundtruth to be the one you used in this repo? I want to train this method but find no suitable groundtruth for the training set. I will really appreciate if you could provide the script for converting the GT format. Thank you again.