Verify dataset >= batch size on INT8 export calibration (#18611)

Signed-off-by: Mohammed Yasin <32206511+Y-T-G@users.noreply.github.com>
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
Mohammed Yasin 2025-01-09 17:29:17 +08:00 committed by GitHub
parent b04f6ae28f
commit 02e4e984a1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -452,7 +452,11 @@ class Exporter:
batch_size=batch,
)
n = len(dataset)
if n < 300:
if n < self.args.batch:
raise ValueError(
f"The calibration dataset ({n} images) must have at least as many images as the batch size ('batch={self.args.batch}')."
)
elif n < 300:
LOGGER.warning(f"{prefix} WARNING ⚠️ >300 images recommended for INT8 calibration, found {n} images.")
return build_dataloader(dataset, batch=batch, workers=0) # required for batch loading