MCPcopy Index your code
hub / github.com/FoundationVision/ByteTrack / evaluate_sort

Method evaluate_sort

yolox/evaluators/mot_evaluator.py:223–343  ·  view source on GitHub ↗

COCO average precision (AP) Evaluation. Iterate inference on the test dataset and the results are evaluated by COCO API. NOTE: This function will change training mode to False, please save states if needed. Args: model : model to evaluate. Retu

(
        self,
        model,
        distributed=False,
        half=False,
        trt_file=None,
        decoder=None,
        test_size=None,
        result_folder=None
    )

Source from the content-addressed store, hash-verified

221 return eval_results
222
223 def evaluate_sort(
224 self,
225 model,
226 distributed=False,
227 half=False,
228 trt_file=None,
229 decoder=None,
230 test_size=None,
231 result_folder=None
232 ):
233 """
234 COCO average precision (AP) Evaluation. Iterate inference on the test dataset
235 and the results are evaluated by COCO API.
236
237 NOTE: This function will change training mode to False, please save states if needed.
238
239 Args:
240 model : model to evaluate.
241
242 Returns:
243 ap50_95 (float) : COCO AP of IoU=50:95
244 ap50 (float) : COCO AP of IoU=50
245 summary (sr): summary info of evaluation.
246 """
247 # TODO half to amp_test
248 tensor_type = torch.cuda.HalfTensor if half else torch.cuda.FloatTensor
249 model = model.eval()
250 if half:
251 model = model.half()
252 ids = []
253 data_list = []
254 results = []
255 video_names = defaultdict()
256 progress_bar = tqdm if is_main_process() else iter
257
258 inference_time = 0
259 track_time = 0
260 n_samples = len(self.dataloader) - 1
261
262 if trt_file is not None:
263 from torch2trt import TRTModule
264
265 model_trt = TRTModule()
266 model_trt.load_state_dict(torch.load(trt_file))
267
268 x = torch.ones(1, 3, test_size[0], test_size[1]).cuda()
269 model(x)
270 model = model_trt
271
272 tracker = Sort(self.args.track_thresh)
273
274 for cur_iter, (imgs, _, info_imgs, ids) in enumerate(
275 progress_bar(self.dataloader)
276 ):
277 with torch.no_grad():
278 # init tracker
279 frame_id = info_imgs[2].item()
280 video_id = info_imgs[3].item()

Callers 1

mainFunction · 0.95

Calls 11

updateMethod · 0.95
evaluate_predictionMethod · 0.95
is_main_processFunction · 0.90
SortClass · 0.90
postprocessFunction · 0.90
time_synchronizedFunction · 0.90
gatherFunction · 0.90
synchronizeFunction · 0.90
write_results_no_scoreFunction · 0.70
evalMethod · 0.45

Tested by

no test coverage detected