YuHengsss / YOLOV

This repo is an implementation of PyTorch version YOLOV Series
Apache License 2.0
283 stars 39 forks source link

How to make sure the output features_cls meet the required size [b*50, 5, 128]? #9

Closed ray-lee-94 closed 1 year ago

ray-lee-94 commented 1 year ago

Hi, I have the problem that if the post function finds nothing. Maybe the input is a background image https://github.com/YuHengsss/YOLOV/blob/9f3a5b79c7c23051a021daa3d8a4db3e17da4ec9/yolox/models/yolov_msa_online.py#L255-L256

How to make sure the output feature meets the required shape? https://github.com/YuHengsss/YOLOV/blob/9f3a5b79c7c23051a021daa3d8a4db3e17da4ec9/yolox/models/yolovp_msa.py#L272-L274

YuHengsss commented 1 year ago

Hi, I have the problem that if the post function finds nothing. Maybe the input is a background image

https://github.com/YuHengsss/YOLOV/blob/9f3a5b79c7c23051a021daa3d8a4db3e17da4ec9/yolox/models/yolov_msa_online.py#L255-L256

How to make sure the output feature meets the required shape?

https://github.com/YuHengsss/YOLOV/blob/9f3a5b79c7c23051a021daa3d8a4db3e17da4ec9/yolox/models/yolovp_msa.py#L272-L274

Sorry for my poor annotations. The size of feature_cls should be [batch_size*defualt_p,feature_dim]. As the first function finds top defulat_p proposals, the output should be the same no matter what kind of inputs. Could you please try to print the shape of pred_result or features_cls?

ray-lee-94 commented 1 year ago

Thank you for your reply. I train on my own dataset. Since the pred_idx may be small than the topK, the reshape below will complain. https://github.com/YuHengsss/YOLOV/blob/246b55bc3c3214e48dc7766d885f1271921fd221/yolox/models/yolovp_msa.py#L285 Finaly I change this line as below to fix the problem. Thank you for your help!

        fc_output = torch.reshape(
            fc_output, [-1, self.num_classes+1])[:, :-1]