HikariTJU / LD

Localization Distillation for Object Detection (CVPR 2022, TPAMI 2023)
Apache License 2.0
355 stars 51 forks source link

I reimplement your model (Teacher: R101, Student: R50, Detection head: Foveabox) and got RuntimeError: shape '[-1, 68]' is invalid for input of size 115200 #61

Open letruongngochai opened 1 year ago

letruongngochai commented 1 year ago

Hello, here I try to replace the detection head used with Foveabox. I use R50 as a student and R101 as a teacher to distill. But I can't manage to train it due to the above error. Is there any advices in changing the detection head of your model that you can give me? Thanks

HikariTJU commented 1 year ago

Have you modified the head to use general distribution? Like what I did in atss_gfl_head.py

letruongngochai commented 1 year ago

Can you tell me where to view the .py file you mentioned?

HikariTJU commented 1 year ago

https://github.com/HikariTJU/LD/blob/main/mmdet/models/dense_heads/atss_gfl_head.py

  1. you need to change network from 4-d ltrb to 4x17 distribution (refer to GFocal) https://github.com/HikariTJU/LD/blob/bc60bbcd48e9305e61e32a0d2c981621e2ae0d05/mmdet/models/dense_heads/atss_gfl_head.py#L120
  2. when calculate bbox loss use integral to transform 4x17 distribution back to 4-d ltrb https://github.com/HikariTJU/LD/blob/bc60bbcd48e9305e61e32a0d2c981621e2ae0d05/mmdet/models/dense_heads/atss_gfl_head.py#L252
letruongngochai commented 1 year ago

Sorry but I just don't get the "4-d ltrb" point, what is it actually?

HikariTJU commented 1 year ago

ltrb is introduced in FCOS to replace xywh, I know a little about FoveaBox, maybe you should change xywh to ltrb at first image