yjh0410 / PyTorch_YOLO-Family

Apache License 2.0
161 stars 48 forks source link

target tensor with 0's #12

Closed kulkarnikeerti closed 1 year ago

kulkarnikeerti commented 2 years ago

I am trying to use mapillary with yolo-nano model. And I get the target tensor after applying this gt_creator with 0's in it. In if condition which is present in the gt_creator function (where gt_tensor is assigned with values) is not assigning the values to gt_tensor, hence it just returns the tensor wit 0's which is initialized in the beginning.

https://github.com/yjh0410/PyTorch_YOLO-Family/blob/24b92e3989a7506ba7e047c284fef69d7250a3b9/train.py#L302

Okay, so I tried to run the original script instead with mapillary data, even with coco dataset its the same. I get a tensor with 0's. This isn't the expected behavior right? We should have values in the gt_tensor?

Thanks in advance, Keerti

yjh0410 commented 1 year ago

@kulkarnikeerti I don't think it is a problem. In this project, gt_tensor contains a total of three predicted labels: objectness, category label, and bounding box label. Among them, the objectness label is very important, which determines the positive and negative samples in the training process. Usually, each target will be assigned with at least one positive sample, that is, gt_tensot[x, y, 0]=1.0. If a certain gt_tensot[x, y, 0]=0.0, it indicates that the corresponding prediction is a negative sample, and only the objectness loss is calculated, and the classification loss and regression loss are not calculated.