I am really new in this topic and I wanted to ask how I can generate the file instances_default.json for the confusion matrix described in the answer here:
Build confusion matrix for instance segmantation (mask r-cnn from detectron2)
If I am using the output of COCOEval I just get a file with the labels and not with the annotations.
Thanks!
which part of the detectron2 bib to use to generate the file
I have a trained model and want to evaluate it:
print('INFO: Evaluating model...')
try:
evaluator = COCOEvaluator("det_objects_test", cfg, False, output_dir='/home/output')
val_loader = build_detection_test_loader(cfg, "det_objects_test")
results = inference_on_dataset(trainer.model, val_loader, evaluator)
except Exception as e:
print(f"ERROR: Evaluation failed: {e}")
sys.exit()
print(f"INFO: AP50 for bboxes: {results['bbox']['AP50']}")
The files i saved from the COCOEvaluator are the ones described at the top of this question. If I try to build the confusion matrix as described in the link above I get this error:
Traceback (most recent call last): File "/home/Training.py", line 80, in run_ObjectDetectionTraining(args) File "/home/Training.py", line 236, in run_ObjectDetectionTraining confusion_matrix += conf_matrix_calc(np.array(labels), np.array(detections), n_classes, conf_thresh=0.5, iou_thresh=0.5) File "/home/Training.py", line 212, in conf_matrix_calc detections_matched[d_idx] = 1 IndexError: index 4 is out of bounds for axis 0 with size 0
I tried to extract predictions scores and the ids of the images but it did not work