Closed abdelhak51 closed 2 years ago
input size should be 128x for p6 models.
thank you @WongKinYiu I solved the problem so I found that --img-size accepts 64 , 320 only
So, this problem is coming because of Resize of test and train images
These functions are responsible for changing the size, For TESTING please change the shape according to these lines of code..............
# Image sizes
gs = 64 #int(max(model.stride)) # grid size (max stride)
imgsz, imgsz_test = [check_img_size(x, gs) for x in opt.img_size]
def check_img_size(img_size, s=32):
# Verify img_size is a multiple of stride s
new_size = make_divisible(img_size, int(s)) # ceil gs-multiple
if new_size != img_size:
print('WARNING: --img-size %g must be multiple of max stride %g, updating to %g' % (img_size, s, new_size))
return new_size
def make_divisible(x, divisor):
# Returns x evenly divisible by divisor
return math.ceil(x / divisor) * divisor
hi, when I change --img-size from 1280 to 320 for example it is not working and throws me an error which is :
Traceback (most recent call last): File "detect.py", line 187, in
detect()
File "detect.py", line 86, in detect
pred = model(img, augment=opt.augment)[0]
File "C:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 1051, in _call_impl
return forward_call(*input, *kwargs)
File "C:\Users\ASUS\Desktop\yoloR\yolor\models\models.py", line 543, in forward
return self.forward_once(x)
File "C:\Users\ASUS\Desktop\yoloR\yolor\models\models.py", line 594, in forward_once
x = module(x, out) # WeightedFeatureFusion(), FeatureConcat()
File "C:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 1051, in _call_impl
return forward_call(input, **kwargs)
File "C:\Users\ASUS\Desktop\yoloR\yolor\utils\layers.py", line 69, in forward
return torch.cat([outputs[i] for i in self.layers], 1) if self.multiple else outputs[self.layers[0]]
RuntimeError: torch.cat(): Sizes of tensors must match except in dimension 1. Got 15 and 16 in dimension 2 (The offending index is 1)
any solution for this problem .