ayooshkathuria / pytorch-yolo-v3

A PyTorch implementation of the YOLO v3 object detection algorithm
3.3k stars 1.06k forks source link

grid calculation for the 3rd prediction layer in #142

Open Shashank-Holla opened 4 years ago

Shashank-Holla commented 4 years ago

https://github.com/ayooshkathuria/pytorch-yolo-v3/blob/fbb4ef98d5a598f4c8eded6d618a599b7d289e2f/util.py#L27

grid_size calculation in the predict_transform function. For the stride and grid_size for 3rd prediction layer, the inp_dim is 608 and prediction.size(2) is 52. With floor division, stride is calculated as 11 (608 // 52) and grid_size is calculated as 55 (608 // 11). But the desired grid_size for the 3rd prediction layer is 52. With grid_size as 55, prediction reshape is failing with below error- RuntimeError: shape '[1, 255, 3025]' is invalid for input of size 689520

arunm8489 commented 4 years ago

Same issue for me.

ashishgupta2598 commented 4 years ago

I have got the same error. Have you guys solved it?? @ayooshkathuria @Shashank-Holla @arunm8489

MaxwellHogan commented 4 years ago

is this an issue with using latest version of pytorch?

MaxwellHogan commented 4 years ago

is this an issue with using latest version of pytorch?

it is not as I have ran with pytorch 4.0

nickblock commented 4 years ago

I found the 608 number that doesn't divide by 52 comes from the first block in the yolo.cfg; "net". If you change the width and height values there to 624 it all works.