WongKinYiu / yolov7

Implementation of paper - YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors
GNU General Public License v3.0
13.4k stars 4.23k forks source link

What exactly does image size do in test.py and detect.py? #2059

Open seungdae251 opened 4 months ago

seungdae251 commented 4 months ago

I just wonder the role of image size and what it does in test.py, and detect.py. I understand that input size affects the model's performance in terms of both speed and accuracy so I see it's important when we train a model. But what about in test and detect situation? Also, I added (print("img.shape: ", img.shape) in line 110 of test.py to check the height and width of the images while running the test.py script and they weren't 640 640 even though the input size parameter was 640. Where can I check if the size of the input images are actually 640 640?

for batch_i, (img, targets, paths, shapes) in enumerate(tqdm(dataloader, desc=s)):
        img = img.to(device, non_blocking=True)
        img = img.half() if half else img.float()  # uint8 to fp16/32
        img /= 255.0  # 0 - 255 to 0.0 - 1.0
        targets = targets.to(device)
        nb, _, height, width = img.shape  # batch size, channels, height, width
        print("img.shape: ", img.shape)