Bounding boxes in training data altered to [x1,y1,w,h] after running evaluation

Hi all,

I’ve been following the Torchvision object detection finetuning tutorial but with my own custom dataset and have been running into a strange issue. I’ve been using the tutorial code exactly as shown but with my own data. If I run it on the PennFudan dataset, everything works completely fine. If I run it on my dataset without evaluation, I don’t run into any problems either. But if I run it on my dataset with evaluation (on a test data loader that’s separate from my training data loader) it alters my training dataset so the bounding boxes in the labels are converted fro x1,y1,x2,y2 to x1,y1,width,height resulting in the error:
ValueError: All bounding boxes should have positive height and width.

So evaluation is completed without any problems but when I return to training I get that error.

Does anybody have any insight to why this could be happening? Is it some problem with my dataset or perhaps something unique to the way evaluation is being run?


I just fixed this actually. I was originally instantiating my dataset class only once and subsetting my train and test datasets from there. Instantiating my dataset class twice (one object for my training set and one for my test set) fixed my issue. I guess some part of evaluation was altering the dataset object therefore changing my training dataset.