sugar.darre
sugar.darre

Reputation: 33

Should YOLOv3 annotations be done before the resize?

I am about to start annotating my images to train a YOLOv3 model. Before starting I want to make sure that it is okay to create the annotations on the original image. Would the annotations change respectively after I resize my images before training? Or should I resize all of my images first then start annotating?

Upvotes: 3

Views: 2102

Answers (1)

iv67
iv67

Reputation: 4151

It is okay! You don't have to worry about image size. You can annotate your dataset with any sizes, when you start training Yolo will resize the training image according to network size e.g. 416x416, 608x608.

Also note that in original repo, during the network sized is changed every 10 iterations if you set random = 1 in your cfg file. random = 1 means Yolo changes the network size for every 10 iterations, it is useful to increase precision by training the network on different resolution.

According to Yolo paper :

However, since our model only uses convolutional and pooling layers it can be resized on the fly. We want YOLOv2 to be robust to running on images of different sizes so we train this into the model. Instead of fixing the input image size we change the network every few iterations. Every 10 batches our network randomly chooses a new image dimension size. Since our model downsamples by a factor of 32, we pull from the following multiples of 32: {320, 352, ..., 608}. Thus the smallest option is 320 × 320 and the largest is 608 × 608. We resize the network to that dimension and continue training.

However, if you are using AlexeyAB's repo the resize process won't keep aspect ratio https://github.com/AlexeyAB/darknet/issues/232#issuecomment-336955485

Upvotes: 3

Related Questions