datasets.py self.batch_shapes fix
This commit is contained in:
1 parent
7a00a5eff2
commit
ee8988b8a2
3 files changed
+3
-4
No files matched your search
@@ -20,7 +20,6 @@ class Detect(nn.Module):
|
|||||||
self.export = False # onnx export
|
self.export = False # onnx export
|
||||||
|
|
||||||
def forward(self, x):
|
def forward(self, x):
|
||||||
x = x.copy()
|
|
||||||
z = [] # inference output
|
z = [] # inference output
|
||||||
self.training |= self.export
|
self.training |= self.export
|
||||||
for i in range(self.nl):
|
for i in range(self.nl):
|
||||||
|
|||||||
@@ -244,7 +244,7 @@ if __name__ == '__main__':
|
|||||||
print(opt)
|
print(opt)
|
||||||
|
|
||||||
# task = 'val', 'test', 'study'
|
# task = 'val', 'test', 'study'
|
||||||
if opt.task == 'val': # (default) run normally
|
if opt.task in ['val', 'test']: # (default) run normally
|
||||||
test(opt.data,
|
test(opt.data,
|
||||||
opt.weights,
|
opt.weights,
|
||||||
opt.batch_size,
|
opt.batch_size,
|
||||||
@@ -258,7 +258,7 @@ if __name__ == '__main__':
|
|||||||
elif opt.task == 'study': # run over a range of settings and save/plot
|
elif opt.task == 'study': # run over a range of settings and save/plot
|
||||||
for weights in ['yolov5s.pt', 'yolov5m.pt', 'yolov5l.pt', 'yolov5x.pt', 'yolov3-spp.pt']:
|
for weights in ['yolov5s.pt', 'yolov5m.pt', 'yolov5l.pt', 'yolov5x.pt', 'yolov3-spp.pt']:
|
||||||
f = 'study_%s_%s.txt' % (Path(opt.data).stem, Path(weights).stem) # filename to save to
|
f = 'study_%s_%s.txt' % (Path(opt.data).stem, Path(weights).stem) # filename to save to
|
||||||
x = list(range(256, 1024, 32)) # x axis
|
x = list(range(256, 1024, 64)) # x axis
|
||||||
y = [] # y axis
|
y = [] # y axis
|
||||||
for i in x: # img-size
|
for i in x: # img-size
|
||||||
print('\nRunning %s point %s...' % (f, i))
|
print('\nRunning %s point %s...' % (f, i))
|
||||||
|
|||||||
+1
-1
@@ -322,7 +322,7 @@ class LoadImagesAndLabels(Dataset): # for training/testing
|
|||||||
elif mini > 1:
|
elif mini > 1:
|
||||||
shapes[i] = [1, 1 / mini]
|
shapes[i] = [1, 1 / mini]
|
||||||
|
|
||||||
self.batch_shapes = np.ceil(np.array(shapes) * img_size / 64.).astype(np.int) * 64
|
self.batch_shapes = np.round(np.array(shapes) * img_size / 32. + 1.).astype(np.int) * 32
|
||||||
|
|
||||||
# Cache labels
|
# Cache labels
|
||||||
self.imgs = [None] * n
|
self.imgs = [None] * n
|
||||||
|
|||||||
Reference in new issue
Block a user