MCPcopy Create free account
hub / github.com/FoundationVision/ByteTrack / txt2img

Function txt2img

tools/txt2video.py:99–186  ·  view source on GitHub ↗
(visual_path="visual_val_gt")

Source from the content-addressed store, hash-verified

97
98
99def txt2img(visual_path="visual_val_gt"):
100 print("Starting txt2img")
101
102 valid_labels = {1}
103 ignore_labels = {2, 7, 8, 12}
104
105 if not os.path.exists(visual_path):
106 os.makedirs(visual_path)
107 color_list = colormap()
108
109 gt_json_path = 'datasets/mot/annotations/val_half.json'
110 img_path = 'datasets/mot/train/'
111 show_video_names = ['MOT17-02-FRCNN',
112 'MOT17-04-FRCNN',
113 'MOT17-05-FRCNN',
114 'MOT17-09-FRCNN',
115 'MOT17-10-FRCNN',
116 'MOT17-11-FRCNN',
117 'MOT17-13-FRCNN']
118
119
120 test_json_path = 'datasets/mot/annotations/test.json'
121 test_img_path = 'datasets/mot/test/'
122 test_show_video_names = ['MOT17-01-FRCNN',
123 'MOT17-03-FRCNN',
124 'MOT17-06-FRCNN',
125 'MOT17-07-FRCNN',
126 'MOT17-08-FRCNN',
127 'MOT17-12-FRCNN',
128 'MOT17-14-FRCNN']
129 if visual_path == "visual_test_predict":
130 show_video_names = test_show_video_names
131 img_path = test_img_path
132 gt_json_path = test_json_path
133 for show_video_name in show_video_names:
134 img_dict = dict()
135
136 if visual_path == "visual_val_gt":
137 txt_path = 'datasets/mot/train/' + show_video_name + '/gt/gt_val_half.txt'
138 elif visual_path == "visual_yolox_x":
139 txt_path = 'YOLOX_outputs/yolox_mot_x_1088/track_results/'+ show_video_name + '.txt'
140 elif visual_path == "visual_test_predict":
141 txt_path = 'test/tracks/'+ show_video_name + '.txt'
142 else:
143 raise NotImplementedError
144
145 with open(gt_json_path, 'r') as f:
146 gt_json = json.load(f)
147
148 for ann in gt_json["images"]:
149 file_name = ann['file_name']
150 video_name = file_name.split('/')[0]
151 if video_name == show_video_name:
152 img_dict[ann['frame_id']] = img_path + file_name
153
154
155 txt_dict = dict()
156 with open(txt_path, 'r') as f:

Callers 1

txt2video.pyFile · 0.85

Calls 1

colormapFunction · 0.85

Tested by

no test coverage detected