0
$\begingroup$

I training maskrcnn on a custom dataset with two classes (1 and 2). After testing, I get some files segm.json, predictions.pth, coco_results.pth and bbox.json in the inference folder. I have successfully extracted y_pred from predictions.pth inference file using the code below.

import torch
import numpy as np
predictions = torch.load("predictions.pth")
y_preds = []
for box in predictions:
   scores = box.get_field("scores")
   labels = box.get_field("labels")
   mask = box.get_field("mask")
   mask_scores = box.get_field("mask_scores")
   y_preds = np.concatenate((y_preds, labels.numpy()), axis=None)
y_preds = np.array(y_preds, dtype=np.int32)
print(y_pred.shape)
print(y_preds)

I get an output for shape and y_pred similar to one below.

(17)
[1 1 1 2 1 2 1 1 1 1 2 1 1 1 1 2 1 2]

However, this does not add up to y_true (which is 25 objects in total), Meaning some detections (about 8) were missed. How do I extract the 8 object labels that weren't detected and know thier classes ? How do I know the class(es) that were not detected?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.