yolox/evaluators/coco_evaluator.py
def evaluate(self, model, distributed=False, half=False, test_size=None):
        """
        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.

        Returns:
            ap50_95 (float) : COCO AP of IoU=50:95
            ap50 (float) : COCO AP of IoU=50
            summary (sr): summary info of evaluation.
        """
        model.eval()
        ids = []
        data_list = []
        progress_bar = tqdm if self.is_main_process else iter

        inference_time = 0
        nms_time = 0
        n_samples = len(self.dataloader) - 1

        for cur_iter, (imgs, _, info_imgs, ids) in enumerate(progress_bar(self.dataloader)):
            # skip the the last iters since batchsize might be not enough for batch inference
            is_time_record = cur_iter < len(self.dataloader) - 1
            if is_time_record:
                start = time.time()

            imgs = mge.tensor(imgs.cpu().numpy())
            outputs = model(imgs)

            if is_time_record:
                infer_end = time_synchronized()
                inference_time += infer_end - start

            outputs = postprocess(
                outputs, self.num_classes, self.confthre, self.nmsthre
            )
            if is_time_record:
                nms_end = time_synchronized()
                nms_time += nms_end - infer_end

            data_list.extend(self.convert_to_coco_format(outputs, info_imgs, ids))

        statistics = mge.tensor([inference_time, nms_time, n_samples])
        if distributed:
            statistics = F.distributed.all_reduce_sum(statistics)
            statistics /= dist.get_world_size()
            results = gather_pyobj(data_list, obj_name="data_list", target_rank_id=0)
            for x in results[1:]:
                data_list.extend(x)

        eval_results = self.evaluate_prediction(data_list, statistics)
        dist.group_barrier()
        return eval_results

        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.

        Returns:
            ap50_95 (float) : COCO AP of IoU=50:95
            ap50 (float) : COCO AP of IoU=50
            summary (sr): summary info of evaluation.
        
COCO average precision (AP) Evaluation. Iterate inference on the test dataset
and the results are evaluated by COCO API.

This function will change training mode to False, please save states if needed.
COCO average precision ( AP ) Evaluation . Iterate inference on the test dataset and the results are evaluated by COCO API . This function will change training mode to False please save states if needed .
def evaluate(self, model, distributed=False, half=False, test_size=None):
        model.eval()
        ids = []
        data_list = []
        progress_bar = tqdm if self.is_main_process else iter
        inference_time = 0
        nms_time = 0
        n_samples = len(self.dataloader) - 1
        for cur_iter, (imgs, _, info_imgs, ids) in enumerate(progress_bar(self.dataloader)):
            is_time_record = cur_iter < len(self.dataloader) - 1
            if is_time_record:
                start = time.time()
            imgs = mge.tensor(imgs.cpu().numpy())
            outputs = model(imgs)
            if is_time_record:
                infer_end = time_synchronized()
                inference_time += infer_end - start
            outputs = postprocess(
                outputs, self.num_classes, self.confthre, self.nmsthre
            )
            if is_time_record:
                nms_end = time_synchronized()
                nms_time += nms_end - infer_end
            data_list.extend(self.convert_to_coco_format(outputs, info_imgs, ids))
        statistics = mge.tensor([inference_time, nms_time, n_samples])
        if distributed:
            statistics = F.distributed.all_reduce_sum(statistics)
            statistics /= dist.get_world_size()
            results = gather_pyobj(data_list, obj_name="data_list", target_rank_id=0)
            for x in results[1:]:
                data_list.extend(x)
        eval_results = self.evaluate_prediction(data_list, statistics)
        dist.group_barrier()
        return eval_results
def evaluate ( self , model , distributed = False , half = False , test_size = None ) : model . eval ( ) ids = [ ] data_list = [ ] progress_bar = tqdm if self . is_main_process else iter inference_time = 0 nms_time = 0 n_samples = len ( self . dataloader ) - 1 for cur_iter , ( imgs , _ , info_imgs , ids ) in enumerate ( progress_bar ( self . dataloader ) ) : is_time_record = cur_iter < len ( self . dataloader ) - 1 if is_time_record : start = time . time ( ) imgs = mge . tensor ( imgs . cpu ( ) . numpy ( ) ) outputs = model ( imgs ) if is_time_record : infer_end = time_synchronized ( ) inference_time += infer_end - start outputs = postprocess ( outputs , self . num_classes , self . confthre , self . nmsthre ) if is_time_record : nms_end = time_synchronized ( ) nms_time += nms_end - infer_end data_list . extend ( self . convert_to_coco_format ( outputs , info_imgs , ids ) ) statistics = mge . tensor ( [ inference_time , nms_time , n_samples ] ) if distributed : statistics = F . distributed . all_reduce_sum ( statistics ) statistics /= dist . get_world_size ( ) results = gather_pyobj ( data_list , obj_name = "data_list" , target_rank_id = 0 ) for x in results [ 1 : ] : data_list . extend ( x ) eval_results = self . evaluate_prediction ( data_list , statistics ) dist . group_barrier ( ) return eval_results
COCO average precision (AP) Evaluation.
COCO average precision ( AP ) Evaluation .
"""
        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.

        Returns:
            ap50_95 (float) : COCO AP of IoU=50:95
            ap50 (float) : COCO AP of IoU=50
            summary (sr): summary info of evaluation.
        """ # skip the the last iters since batchsize might be not enough for batch inference
ap50_95 (float) : COCO AP of IoU=50:95
ap50 (float) : COCO AP of IoU=50
summary (sr): summary info of evaluation.
ap50_95 ( float ) : COCO AP of IoU = 50 : 95 ap50 ( float ) : COCO AP of IoU = 50 summary ( sr ) : summary info of evaluation .
self
model
distributed
half
test_size
model 
model to evaluate.
model to evaluate .