yolov7
yolov7 copied to clipboard
How to set --img-size parameter for training set with diffrent input images size?
How to set --img-size
parameter for training set with diffrent input images size?
I have a training set with images 640x352
and 1024x768
and 960x708
in the same directory. How to train custom YOLOv7
with this images set?
I believe images are resized to what size you specify with --img-size. I don't believe the h/w ratio is changed however. Probably zero padding or trimming is used as needed.
But I'm not certain if the ordering is height width, or width height. See #315
So --img-size
parameter during training is input size of neural network or what?
Previous, when i've used darknet
repository for training, size of NN was defined in .cfg
file and there were no other img-size
definition. During training images where auto resized to input size of NN ( you could choose from resize, resize letterbox). @AlexeyAB @WongKinYiu
Unfortunately, the first number in '--img-size' parameter is train square size and the second is test square size. If anyone what to use rectangle in training, you should change some codes in train.py and datasets.py.
For example, from
imgsz, imgsz_test = [check_img_size(x, gs) for x in opt.img_size] # verify imgsz are gs-multiples
to
imgsz = [check_img_size(x, gs) for x in opt.img_size] # verify imgsz are gs-multiples
imgsz_test = imgsz
@Eliza-and-black If I understand correctly, not making that edit to the code means we would end up testing on a different input size (and perhaps aspect ratio as well, due to nearest gs
multiple). This could produce artificially low test metrics since the input is different from what the model sees during training. Is that a correct interpretation of your suggestion?
Unfortunately, the first number in '--img-size' parameter is train square size and the second is test square size. If anyone what to use rectangle in training, you should change some codes in train.py and datasets.py. For example, from
imgsz, imgsz_test = [check_img_size(x, gs) for x in opt.img_size] # verify imgsz are gs-multiples
toimgsz = [check_img_size(x, gs) for x in opt.img_size] # verify imgsz are gs-multiples imgsz_test = imgsz
What other code do I have to modify to make rect training work? I changed the lines you mentioned and solved the issues that came up, but i still don't get results from training.