Skip to content

Commit

Permalink
Exported model batch size validation fix (ultralytics#14845)
Browse files Browse the repository at this point in the history
Co-authored-by: Glenn Jocher <[email protected]>
  • Loading branch information
ambitious-octopus and glenn-jocher authored Jul 31, 2024
1 parent 8648572 commit db4c43b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ultralytics/engine/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ def __call__(self, trainer=None, model=None):
if engine:
self.args.batch = model.batch_size
elif not pt and not jit:
self.args.batch = 1 # export.py models default to batch-size 1
LOGGER.info(f"Forcing batch=1 square inference (1,3,{imgsz},{imgsz}) for non-PyTorch models")
self.args.batch = model.metadata.get("batch", 1) # export.py models default to batch-size 1
LOGGER.info(f"Setting batch={self.args.batch} input of shape ({self.args.batch}, 3, {imgsz}, {imgsz})")

if str(self.args.data).split(".")[-1] in {"yaml", "yml"}:
self.data = check_det_dataset(self.args.data)
Expand Down

0 comments on commit db4c43b

Please sign in to comment.