lyuwenyu / RT-DETR

[CVPR 2024] Official RT-DETR (RTDETR paddle pytorch), Real-Time DEtection TRansformer, DETRs Beat YOLOs on Real-time Object Detection. 🔥 🔥 🔥
Apache License 2.0
1.64k stars 178 forks source link

No normalization for validation data during model evaluation #312

Open Geo99pro opened 1 month ago

Geo99pro commented 1 month ago

Star RTDETR 请先在RTDETR主页点击star以支持本项目 Star RTDETR to help more people discover this project.


Describe the bug Hello everyone,

First of all, I'd like to congratulate you on the work you've done on this project.

I'm in the process of adding early stop to the code. To do this, I need to calculate the validation error first. I've managed to calculate the validation error in the evaluate function available in rtdetr_pytorch/src/solver/det_engine.py using criterion(outputs, targets) and summing the result.

However, I noticed that the validation data used by the model during the evaluation are not normalized as in the training mode. This leads to very high validation error values.

I wonder if this lack of normalization is intentional and if there's any particular reason for it on your part?

NB: the bbox values for the train function are indeed normalized, whereas the validation values are not, as shown in the images below.``

Thanks in advance for your help. And I apologize if my question is low level, I'm learning.

8392e721-c2f3-4b9f-b4ef-9019ce225211

b587d38a-9e75-4acc-9b10-3de2f88666b5

To Reproduce 4e2e483b-4f2d-480b-82c6-c50603cf09a2 80072f9a-eac9-49b1-bb19-b76ed253f486

lyuwenyu commented 1 month ago

Yes, You are right. We did not normalize bbox in val_dataloader. You can do it by adding L20 after L35

https://github.com/lyuwenyu/RT-DETR/blob/main/rtdetr_pytorch/configs/rtdetr/include/dataloader.yml#L20 https://github.com/lyuwenyu/RT-DETR/blob/main/rtdetr_pytorch/configs/rtdetr/include/dataloader.yml#L35

Geo99pro commented 1 month ago

Oh yes ! Of course then it can perform L131 of the function _transform in https://github.com/lyuwenyu/RT-DETR/blob/64878acad2f58ed34579e5a5ec45da1044587e09/rtdetr_pytorch/src/data/transforms.py.

I appreciate your answer @lyuwenyu, thanks you.