Skip to content

Commit

Permalink
Update autobatch.py (#5536)
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher authored Nov 6, 2021
1 parent 3364379 commit 60e42e1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion utils/autobatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,5 @@ def autobatch(model, imgsz=640, fraction=0.9, batch_size=16):
batch_sizes = batch_sizes[:len(y)]
p = np.polyfit(batch_sizes, y, deg=1) # first degree polynomial fit
b = int((f * fraction - p[1]) / p[0]) # y intercept (optimal batch size)
print(f'{prefix}Using colorstr(batch-size {b}) for {d} {t * fraction:.3g}G/{t:.3g}G ({fraction * 100:.0f}%)')
print(f'{prefix}Using batch-size {b} for {d} {t * fraction:.3g}G/{t:.3g}G ({fraction * 100:.0f}%)')
return b

0 comments on commit 60e42e1

Please sign in to comment.