Skip to content

Commit

Permalink
datasets.py self.batch_shapes fix
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher committed Jun 2, 2020
1 parent 7a00a5e commit ee8988b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion models/yolo.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ def __init__(self, nc=80, anchors=()): # detection layer
self.export = False # onnx export

def forward(self, x):
x = x.copy()
z = [] # inference output
self.training |= self.export
for i in range(self.nl):
Expand Down
4 changes: 2 additions & 2 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ def test(data,
print(opt)

# task = 'val', 'test', 'study'
if opt.task == 'val': # (default) run normally
if opt.task in ['val', 'test']: # (default) run normally
test(opt.data,
opt.weights,
opt.batch_size,
Expand All @@ -258,7 +258,7 @@ def test(data,
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']:
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
for i in x: # img-size
print('\nRunning %s point %s...' % (f, i))
Expand Down
2 changes: 1 addition & 1 deletion utils/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def __init__(self, path, img_size=416, batch_size=16, augment=False, hyp=None, r
elif mini > 1:
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
self.imgs = [None] * n
Expand Down

0 comments on commit ee8988b

Please sign in to comment.