Evaluation loop per class, and transformation

Hi,

Urgent help!

I would appreciate it if someone could help me. I’m trying to implement mask rcnn on Pascal VOC 2012. My main concerned are the transformations and AP. I resized the boxes, images and mask in the dataset class and used transforms separately. After 15 epochs I got AP Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.65 for the boxes and 0.53 for the mask. However, the AP for small objects is not higher than 0.15. I am not really sure if I am applying the transformation correctly if I need to rotate and them scale. I run another version of the code with transforms built in the class for the mask and image and separately rescale the box. I did not use the horizontal flip and I got the results below in one epoch.

Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.756
Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.659 ,

The issue with small objects remained.

Also, I am using the coco metrics . Does anyone know if it is possible to get the AP per class using COCO Average Precision (AP) @[ IoU=0.50?
I 've been stuck on this, any piece of advice will be greatly appreciated.

def resize_img(self, imag, img_max_size):
“”“Resizes images and masks from PIL Images”""

    h_, w_ = self.img_max_size[0], self.img_max_size[1]
    
    
    img_resized= imag.resize((h_,w_))
    # returns resized image
    return img_resized

def resize_box(self, box, img_max_size):
    """resizes bounding boxes"""
    h_ratio =  img_max_size[0]/h
    w_ratio =  img_max_size[1]/w

    box[0] = round(box[0] * w_ratio)
    box[2] = round(box[2] * w_ratio)
    box[1] = round(box[1] * h_ratio)
    box[3] = round(box[3] * h_ratio)
  
    return box   

def get_transform(train):
transforms = []
transforms.append(T.ToTensor())
if train:
transforms.append(T.RandomHorizontalFlip(0.5))
return T.Compose(transforms)