ayooshkathuria / YOLO_v3_tutorial_from_scratch

Accompanying code for Paperspace tutorial series "How to Implement YOLO v3 Object Detector from Scratch"
https://blog.paperspace.com/how-to-implement-a-yolo-object-detector-in-pytorch/
2.32k stars 724 forks source link

CFG file input dimension [advice] #44

Open juanmed opened 5 years ago

juanmed commented 5 years ago

Hello everyone, First thanks to @ayooshkathuria for such a nice tutorial. Second I would like to point out that the input dimensions in the current version of the yolov3.cfg file from yolo repository (the one recommended to download in the tutorial part 2) contains a height = 608, width = 608. So you might encounter an error like this at some point:

RuntimeError: shape '[1, 255, 3025]' is invalid for input of size 689520

My suggestion is to change the yolov3.cfg to height=416, width = 416 as those are the dimensions used in the tutorial, particularly in line 14. Another solution is to resize the image to height = 608 and width = 608 when reading it, in the same line. A more general solution would be to read whatever dimensions are in the yolov3.cfg file and resize the image with those dimensions.

Cheers!

kHarshit commented 5 years ago

Thanks @juanmed You saved the day!

SambhaviPD commented 5 years ago

Many thanks to @ayooshkathuria for such a detailed and brilliantly explained tutorial.

@juanmed, Really nice of you to point out the config change. Was useful to me and to many others too I guess!

aimxu commented 4 years ago

Thank to the great and selfless tutorial by @ayooshkathuria and @juanmed, you save many people like us

sisrfeng commented 4 years ago

https://github.com/ayooshkathuria/pytorch-yolo-v3/blob/fbb4ef98d5a598f4c8eded6d618a599b7d289e2f/cfg/yolov3.cfg#L8 with=320

https://github.com/ayooshkathuria/YOLO_v3_tutorial_from_scratch/blob/8264dfba39a866998b8936a24133f41f12bfbdb7/cfg/yolov3.cfg#L8 width=416

should width for training imgs be 320, 416 or 608? Thanks!