YOLOX icon indicating copy to clipboard operation
YOLOX copied to clipboard

Understand label conversion

Open sedatester opened this issue 2 years ago • 0 comments

Hi @FateScript and others, thanks for this great contribution! I'm writing a dataloader for a custom dataset and I've having a bit of trouble with the format of labels at different steps and how the conversions happen. It could be that some comments in the code are correct, would be great if we could confirm a few things.

For coco dataset, it looks like the pull_item should be returning labels in the xyxy format resulting from: https://github.com/Megvii-BaseDetection/YOLOX/blob/d78fe47802d3987a915645179d87f5c1a96e646f/yolox/data/datasets/coco.py#L149

Now in MosaicDetection:

  • for the case when mosaic is disabled, we can see that the prepoc (I'm using TrainTransform for that) leads to conversion from xyxy to cxcywh here: https://github.com/Megvii-BaseDetection/YOLOX/blob/d78fe47802d3987a915645179d87f5c1a96e646f/yolox/data/datasets/mosaicdetection.py#L159
  • for the case when mosaic is enabled, this line does a pull_item: https://github.com/Megvii-BaseDetection/YOLOX/blob/d78fe47802d3987a915645179d87f5c1a96e646f/yolox/data/datasets/mosaicdetection.py#L93 and this _labels should be in xyxy format. But that contradicts the comment here: https://github.com/Megvii-BaseDetection/YOLOX/blob/d78fe47802d3987a915645179d87f5c1a96e646f/yolox/data/datasets/mosaicdetection.py#L113 which says that we are going from normalized xywh to xyxy. Could you confirm that this is indeed incorrect?

Is it safe to assume that pull_item for my custom dataset should be returning xyxy format for everything else to work correctly?

sedatester avatar Aug 01 '22 18:08 sedatester