File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 15
15
import copy
16
16
import json
17
17
import os
18
+ import warnings
18
19
19
20
from pycocotools .cocoeval import COCOeval
20
21
@@ -65,6 +66,17 @@ def results2json(self, results):
65
66
66
67
def evaluate (self , results , save_dir , rank = - 1 ):
67
68
results_json = self .results2json (results )
69
+ if len (results_json ) == 0 :
70
+ warnings .warn (
71
+ "Detection result is empty! Please check whether "
72
+ "training set is too small (need to increase val_interval "
73
+ "in config and train more epochs). Or check annotation "
74
+ "correctness."
75
+ )
76
+ empty_eval_results = {}
77
+ for key in self .metric_names :
78
+ empty_eval_results [key ] = 0
79
+ return empty_eval_results
68
80
json_path = os .path .join (save_dir , "results{}.json" .format (rank ))
69
81
json .dump (results_json , open (json_path , "w" ))
70
82
coco_dets = self .coco_api .loadRes (json_path )
You can’t perform that action at this time.
0 commit comments