Kleyson Rios
Kleyson Rios

Reputation: 2877

Is image resizing needed to training a new Yolo model?

I would like to train a new model using my own dataset. I will be using Darkflow/Tensorflow for it.

Regarding my doubts:

(1) Should we resize our training images for a specific size?

(2) I think smaller images might save time, but can smaller images harm the accuracy?

(3) And what about the images to be predicted, should we resize them as well or is it not necessary?

Upvotes: 7

Views: 8217

Answers (3)

dasmehdix
dasmehdix

Reputation: 329

(1) It already resize it with random=1 in .cfg file.The answer is "yes".The input resolution of images are same.You can resize it by yourself or Yolo can do it.

(2)If your hardware is good enough,I suggest you to use big sized images.Also as a suggest,If you will use webcam,use images as the same resolutions as your webcam uses.

(3)Yes, same as training.

Upvotes: 4

mrk
mrk

Reputation: 10406

(1) Yes, neural networks have fixed input dimensions. These can be adjusted to fit your purpose, but at last you need to commit to a defined input dimension, and thus you need to input your images fitting these dimensions. For YOLO I found the following:

    layer      filters     size           input                  output
    0 conv     32          3 x 3 / 1      416 x 416 x   3   ->   416 x 416 x  32  

It could be that the framework you are using already does that step for you. Maybe somebody could comment on that.

(3) The images / samples you feed during inference, for prediction should be as similar to the training images / samples as possible. So whatever preprocessing you re doing with your training data, you should definitely do the same on your inference data.

(2) Smaller images make sense if your hardware is not able to hold larger images in memory, or if you train with large batch sizes so that your hardware needs to hold multiple images in memory at ones. In the end, the computational time is rather proportional to the amount of operations of your architecture, not necessarily to the images size.

Upvotes: 1

paul.ruelle
paul.ruelle

Reputation: 132

(1) No, it is not necessary. But if your dataset contains random resolutions, you can put

random = 1

in your .cfg file for better results.

(2) Smaller images don't reduce the time to converge, but if your dataset contains only small images, Yolo will probably fail to converge (Yolov3 is not a good detector for a lot of tiny objects)

(3) It is not necessary

Upvotes: 0

Related Questions