FateScript / CenterNet-better

An easy to understand and better performance version of CenterNet
Apache License 2.0
548 stars 104 forks source link

About padding operation(迷之操作) during inference! #36

Closed jiangzhengkai closed 3 years ago

jiangzhengkai commented 3 years ago

Feng wang:

I tried to understand padding operations during inference but failed. You should give an explanation.

Following the original CenterNet implementation, replacing the padding with CenterAffine, mAP drops to 28% compared with original 34.4% performance!

You are expected to give the reason!

FateScript commented 3 years ago

code here might be helpful. During inference, image padding is applied on four sides, and a new affine matrix is calculated. Did you forget such an operation?

jiangzhengkai commented 3 years ago

@FateScript code aims to generate affine matrix to map the regressed box results to image size. Because the regressed boxes downsample 4 according to code, thus we need to map regressed boxes to origin image size. I still can not figure out the reason why using image padding and why the performance drops when using cv2.warpAffine to resize the original image.

FateScript commented 3 years ago

Did you retrain your model since you are using a different augmentation?

PeizeSun commented 3 years ago

@FateScript @jiangzhengkai Hi~ I follow you guys for a very long time! It is very exciting to see you two battle~

However, I am a little confused about: Is there difference between image padding applied on four sides and only right bottom sides? Why does CenterNet apply image padding on four sides?

jiangzhengkai commented 3 years ago

@PeizeSun Amazing to talk here with feng wang.

jiangzhengkai commented 3 years ago

Did you retrain your model since you are using a different augmentation?

When training, CenterAffine is used to do augmentation, no padding. So, why do we need to retrain the model?

FateScript commented 3 years ago

Did you retrain your model since you are using a different augmentation?

When training, CenterAffine is used to do augmentation, no padding. So, why do we need to retrain the model?

Since you are using a different aug which might bring difference between training and infernce.

jiangzhengkai commented 3 years ago

got it!