+
+
Admin tools
+
🎟️ Lotto ticket counter + Collect and label display photos, export training data, upload predictions. +
Suspicious Logs for {{ date }} diff --git a/tests/test_lotto.py b/tests/test_lotto.py index a389a69..2eec710 100644 --- a/tests/test_lotto.py +++ b/tests/test_lotto.py @@ -57,8 +57,8 @@ def _make_photo( # noqa: PLR0913 @pytest.fixture def user_client(notesync_app, notesync_client): - _make_user("u1", "alice") - _login(notesync_app, notesync_client, "u1") + _make_user("admin", "alice") + _login(notesync_app, notesync_client, "admin") return notesync_client @@ -237,7 +237,7 @@ def test_clean_model_boxes(): def test_apply_predictions_prefills_unlabeled_photo(notesync_app): - photo = db.session.get(LottoPhoto, _make_photo("u1", boxes=[{**BOX, "label": ""}])) + photo = db.session.get(LottoPhoto, _make_photo("admin", boxes=[{**BOX, "label": ""}])) assert lotto.apply_predictions(photo, PRED) assert json.loads(photo.boxes_json) == [ {"x": 0.3, "y": 0.3, "w": 0.05, "h": 0.04, "label": "", "pred": "20", "conf": 0.8}, @@ -248,8 +248,8 @@ def test_apply_predictions_prefills_unlabeled_photo(notesync_app): def test_apply_predictions_never_overwrites_labels(notesync_app): - labeled = db.session.get(LottoPhoto, _make_photo("u1", boxes=[BOX], labeled=True)) - draft = db.session.get(LottoPhoto, _make_photo("u1", boxes=[BOX, {**BOX, "label": ""}], data=b"d")) + labeled = db.session.get(LottoPhoto, _make_photo("admin", boxes=[BOX], labeled=True)) + draft = db.session.get(LottoPhoto, _make_photo("admin", boxes=[BOX, {**BOX, "label": ""}], data=b"d")) for photo in (labeled, draft): before = photo.boxes_json assert lotto.apply_predictions(photo, PRED) @@ -267,9 +267,9 @@ def test_lotto_requires_login(notesync_client): def test_lotto_home_renders_progress_and_filters(user_client): - _make_photo("u1", boxes=[BOX], labeled=True) - _make_photo("u1", data=b"other", created=datetime(2026, 11, 2)) - _make_photo("u1", data=b"skipped", skipped=True) + _make_photo("admin", boxes=[BOX], labeled=True) + _make_photo("admin", data=b"other", created=datetime(2026, 11, 2)) + _make_photo("admin", data=b"skipped", skipped=True) _make_photo("u2", boxes=[{**BOX, "label": "424242"}], labeled=True, data=b"x") page = user_client.get("/lotto").get_data(as_text=True) @@ -288,7 +288,7 @@ def test_lotto_home_renders_progress_and_filters(user_client): def test_upload_stores_photos_and_dedupes(user_client): - _make_photo("u1", boxes=[BOX], labeled=True, data=b"old") + _make_photo("admin", boxes=[BOX], labeled=True, data=b"old") response = user_client.post( "/lotto/upload", data={ @@ -313,13 +313,13 @@ def test_upload_stores_photos_and_dedupes(user_client): def test_home_cards_show_model_comparison(user_client): _make_photo( - "u1", + "admin", boxes=[{**BOX, "label": "5"}, {**BOX, "label": "10"}], labeled=True, model=[{**BOX, "text": "5"}, {**BOX, "text": "10"}], ) - _make_photo("u1", boxes=[{**BOX, "label": "5"}], labeled=True, data=b"2", model=[]) - _make_photo("u1", boxes=[{**BOX, "label": ""}], data=b"3") + _make_photo("admin", boxes=[{**BOX, "label": "5"}], labeled=True, data=b"2", model=[]) + _make_photo("admin", boxes=[{**BOX, "label": ""}], data=b"3") page = user_client.get("/lotto?status=all").get_data(as_text=True) assert "Model: 2 · $5×1 · $10×1" in page # noqa: RUF001 assert "✓" in page @@ -331,7 +331,7 @@ def test_home_cards_show_model_comparison(user_client): def test_upload_without_files_or_only_duplicates(user_client): response = user_client.post("/lotto/upload", data={}, content_type="multipart/form-data") assert response.headers["Location"].endswith("/lotto") - _make_photo("u1", data=JPEG) + _make_photo("admin", data=JPEG) LottoPhoto.query.update({"checksum": "sha256:" + __import__("hashlib").sha256(JPEG).hexdigest()}) db.session.commit() response = user_client.post( @@ -344,9 +344,9 @@ def test_upload_without_files_or_only_duplicates(user_client): def test_label_page_and_ownership(user_client): - own = _make_photo("u1", boxes=[BOX]) + own = _make_photo("admin", boxes=[BOX]) other = _make_photo("u2", data=b"x") - next_id = _make_photo("u1", data=b"y", created=datetime(2026, 11, 3)) + next_id = _make_photo("admin", data=b"y", created=datetime(2026, 11, 3)) page = user_client.get(f"/lotto/{own}").get_data(as_text=True) assert "Value for new boxes" in page assert all(f'data-value="{v}"' in page for v in lotto.TICKET_VALUES) @@ -360,8 +360,8 @@ def test_label_page_and_ownership(user_client): def test_save_complete_labels_and_go_next(user_client): - first = _make_photo("u1") - second = _make_photo("u1", data=b"2", created=datetime(2026, 11, 2)) + first = _make_photo("admin") + second = _make_photo("admin", data=b"2", created=datetime(2026, 11, 2)) response = user_client.post( f"/lotto/{first}", data={"rotation": "90", "boxes": json.dumps([BOX]), "split": "test", "action": "save_next"}, @@ -375,7 +375,7 @@ def test_save_complete_labels_and_go_next(user_client): def test_save_last_photo_returns_home(user_client): - only = _make_photo("u1") + only = _make_photo("admin") response = user_client.post( f"/lotto/{only}", data={"rotation": "0", "boxes": json.dumps([BOX]), "split": "bogus", "action": "save_next"}, @@ -385,7 +385,7 @@ def test_save_last_photo_returns_home(user_client): def test_save_incomplete_is_a_draft(user_client): - photo_id = _make_photo("u1", boxes=[BOX], labeled=True) + photo_id = _make_photo("admin", boxes=[BOX], labeled=True) response = user_client.post( f"/lotto/{photo_id}", data={"rotation": "0", "boxes": json.dumps([{**BOX, "label": ""}]), "action": "save_next"}, @@ -402,14 +402,14 @@ def test_save_incomplete_is_a_draft(user_client): ], ) def test_save_rejects_bad_input(user_client, form): - photo_id = _make_photo("u1", boxes=[BOX]) + photo_id = _make_photo("admin", boxes=[BOX]) response = user_client.post(f"/lotto/{photo_id}", data={**form, "action": "save"}) assert response.headers["Location"].endswith(f"/lotto/{photo_id}") assert json.loads(db.session.get(LottoPhoto, photo_id).boxes_json) == [BOX] def test_skip_and_unskip(user_client): - photo_id = _make_photo("u1") + photo_id = _make_photo("admin") response = user_client.post(f"/lotto/{photo_id}", data={"action": "skip"}) assert response.headers["Location"].endswith("/lotto") assert db.session.get(LottoPhoto, photo_id).skipped @@ -419,7 +419,7 @@ def test_skip_and_unskip(user_client): def test_delete(user_client): - photo_id = _make_photo("u1") + photo_id = _make_photo("admin") other = _make_photo("u2", data=b"x") assert user_client.post(f"/lotto/{other}/delete").status_code == 404 response = user_client.post(f"/lotto/{photo_id}/delete") @@ -428,9 +428,9 @@ def test_delete(user_client): def test_export_labeled_and_all(user_client): - done = _make_photo("u1", boxes=[BOX], labeled=True, split="test") - todo = _make_photo("u1", data=b"todo") - _make_photo("u1", data=b"skip", skipped=True, labeled=True) + done = _make_photo("admin", boxes=[BOX], labeled=True, split="test") + todo = _make_photo("admin", data=b"todo") + _make_photo("admin", data=b"skip", skipped=True, labeled=True) _make_photo("u2", data=b"other", labeled=True) response = user_client.get("/lotto/export.zip") @@ -464,7 +464,7 @@ def test_image_ext(): def test_predictions_upload(user_client): - photo_id = _make_photo("u1", boxes=[]) + photo_id = _make_photo("admin", boxes=[]) other = _make_photo("u2", boxes=[], data=b"x") payload = {photo_id: PRED, other: PRED, "missing": PRED} response = user_client.post( @@ -484,8 +484,29 @@ def test_predictions_upload_rejects_bad_files(user_client, body): assert response.headers["Location"].endswith("/lotto") +def test_normal_user_cannot_open_lotto(notesync_app, notesync_client): + _make_user("u2", "bob") + _login(notesync_app, notesync_client, "u2") + photo_id = _make_photo("u2") + for method, url in [ + ("get", "/lotto"), + ("post", "/lotto/upload"), + ("get", f"/lotto/{photo_id}"), + ("get", f"/lotto/{photo_id}/image"), + ("get", "/lotto/export.zip"), + ("post", "/lotto/predictions"), + ]: + response = getattr(notesync_client, method)(url) + assert response.status_code == 302, url + assert "/auth/login-ui" in response.headers["Location"] + # No Lotto entry in the top navigation for anyone. + page = notesync_client.get("/lotto/" + photo_id, follow_redirects=True).get_data(as_text=True) + assert ">Lotto" not in page + + def test_routes_redirect_when_user_missing(notesync_app, notesync_client): - _login(notesync_app, notesync_client, "ghost") + # Admin token, but no user row: still sent to the login page. + _login(notesync_app, notesync_client, "admin") for method, url in [ ("get", "/lotto"), ("post", "/lotto/upload"), From c44bde105e0c5c62a5cc6b14e1d02fe49decef11 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 6 Nov 2026 21:14:01 +0000 Subject: [PATCH 7/8] Convert HEIC photos to JPEG before upload, reject what can't be HEIC uploads passed the image/* check, but the Mac scripts open photos with plain Pillow, so prepare_dataset.py would abort on the first HEIC photo. The upload page now converts HEIC/HEIF to full-quality JPEG in the browser (capped at 16 MP for the iOS canvas limit) and drops, with a message, any HEIC the browser can't decode. The server no longer trusts the declared type: it sniffs the bytes, stores only JPEG/PNG/WebP with the sniffed type, and refuses HEIC with instructions (Safari, or iPhone "Most Compatible"). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012k19dCKBK4J2UdDMJd5gLv --- docs/lotto-training.md | 6 ++ src/safe_family/lotto/lotto.py | 61 +++++++++++++++++---- src/safe_family/templates/lotto/lotto.html | 64 +++++++++++++++++++++- tests/test_lotto.py | 52 ++++++++++++++++++ 4 files changed, 170 insertions(+), 13 deletions(-) diff --git a/docs/lotto-training.md b/docs/lotto-training.md index 411d86c..5837b67 100644 --- a/docs/lotto-training.md +++ b/docs/lotto-training.md @@ -101,6 +101,12 @@ Open `/lotto` on your phone, tap **Choose / take photos**, then **Upload**. * The ceiling lights make round white reflections on the glass. Tilt the phone a little so they don't sit on a row of price corners. A little glare is OK: real photos have it, so the model must learn it. +* **HEIC (iPhone's default format) is converted to JPEG in the browser** + before upload, because the training scripts can't read HEIC. iPhone Safari + usually sends JPEG anyway. A browser that can't decode HEIC (e.g. Chrome on + Windows) drops those photos with a message. The server also checks the file + bytes and stores only JPEG, PNG or WebP. If a HEIC is refused, upload from + Safari, or set iPhone Settings → Camera → Formats → Most Compatible. * The website holds up to 400 boxes per photo (tested with 300: the page stays fast on a phone), so a whole-case photo also *works*. It's just slower to label and less accurate. diff --git a/src/safe_family/lotto/lotto.py b/src/safe_family/lotto/lotto.py index 622386c..259318e 100644 --- a/src/safe_family/lotto/lotto.py +++ b/src/safe_family/lotto/lotto.py @@ -95,6 +95,31 @@ ) +# HEIF/HEIC brands in the ISO-BMFF "ftyp" box (bytes 8-12 of the file). +_HEIF_BRANDS = {b"heic", b"heix", b"heim", b"heis", b"hevc", b"hevx", b"mif1", b"msf1", b"avif"} + + +def sniff_image_type(data: bytes) -> str | None: + """Return the real MIME type of a photo we can train on, from its bytes. + + Only formats plain Pillow opens are accepted (JPEG, PNG, WebP): the Mac + scripts must read every stored photo. The browser's declared type is not + trusted. Returns None for anything else, including HEIC/HEIF. + """ + if data.startswith(b"\xff\xd8\xff"): + return "image/jpeg" + if data.startswith(b"\x89PNG\r\n\x1a\n"): + return "image/png" + if data[:4] == b"RIFF" and data[8:12] == b"WEBP": + return "image/webp" + return None + + +def is_heif(data: bytes) -> bool: + """Return True for HEIC/HEIF/AVIF photos (iPhone's default format).""" + return data[4:8] == b"ftyp" and data[8:12] in _HEIF_BRANDS + + def _now() -> datetime: return datetime.now(UTC).replace(tzinfo=None) @@ -415,6 +440,21 @@ def lotto_home(): ) +def upload_message(added: int, duplicates: int, heif: int, rejected: int) -> str: + """Summarize an upload, explaining why any file was refused.""" + parts = [f"Uploaded {added} photo(s)."] + if duplicates: + parts.append(f"{duplicates} duplicate(s) ignored.") + if heif: + parts.append( + f"{heif} HEIC/HEIF photo(s) rejected: this browser couldn't convert them to JPEG. " + "Upload from Safari, or set iPhone Settings > Camera > Formats > Most Compatible.", + ) + if rejected: + parts.append(f"{rejected} file(s) rejected (not a JPEG, PNG or WebP photo, or over 20 MB).") + return " ".join(parts) + + @lotto_bp.post("/lotto/upload") @admin_required def lotto_upload(): @@ -427,14 +467,20 @@ def lotto_upload(): flash("Choose at least one photo.", "warning") return redirect(url_for("lotto.lotto_home")) - added, duplicates, rejected = [], 0, 0 + added, duplicates, rejected, heif = [], 0, 0, 0 now = _now() split = assign_split(datetime.now(local_tz).date()) for upload in files: - content_type = upload.content_type or "" data = upload.read() - if not content_type.startswith("image/") or not data or len(data) > MAX_UPLOAD_BYTES: - rejected += 1 + content_type = sniff_image_type(data) + if content_type is None or len(data) > MAX_UPLOAD_BYTES: + # The upload page converts HEIC to JPEG in the browser; one that + # still arrives here (old page, browser without HEIC support) is + # refused rather than stored in a format training can't read. + if is_heif(data): + heif += 1 + else: + rejected += 1 continue checksum = f"sha256:{hashlib.sha256(data).hexdigest()}" if LottoPhoto.query.filter_by(user_id=user.id, checksum=checksum).first(): @@ -458,12 +504,7 @@ def lotto_upload(): added.append(photo) db.session.commit() - parts = [f"Uploaded {len(added)} photo(s)."] - if duplicates: - parts.append(f"{duplicates} duplicate(s) ignored.") - if rejected: - parts.append(f"{rejected} file(s) rejected (not an image, or over 20 MB).") - flash(" ".join(parts), "success" if added else "warning") + flash(upload_message(len(added), duplicates, heif, rejected), "success" if added else "warning") if added: return redirect(url_for("lotto.lotto_label", photo_id=added[0].id)) return redirect(url_for("lotto.lotto_home")) diff --git a/src/safe_family/templates/lotto/lotto.html b/src/safe_family/templates/lotto/lotto.html index 2281d81..2635d93 100644 --- a/src/safe_family/templates/lotto/lotto.html +++ b/src/safe_family/templates/lotto/lotto.html @@ -17,11 +17,12 @@ reflects on the glass. You can pick several photos at once. Upload whenever you like: photos wait in To label until you have time, even for weeks.

- + No photos chosen - +
+ @@ -146,8 +147,65 @@ chosen.textContent = n === 1 ? input.files[0].name : (n ? `${n} files chosen` : empty); }); }; - show('lotto-photos', 'lotto-chosen', 'No photos chosen'); show('lotto-preds', 'lotto-preds-chosen', 'No file chosen'); + + // HEIC/HEIF (iPhone's default) can't be read by the training scripts. + // Convert to full-quality JPEG in the browser before upload; drop the + // file with a message when this browser can't decode HEIC. + const photos = document.getElementById('lotto-photos'); + const chosen = document.getElementById('lotto-chosen'); + const uploadBtn = document.getElementById('lotto-upload-btn'); + const msg = document.getElementById('lotto-convert-msg'); + const MAX_PIXELS = 16000000; // iOS canvas limit is ~16.7 MP + const isHeif = f => /^image\/hei[cf](-sequence)?$/i.test(f.type) || /\.(heic|heif)$/i.test(f.name); + + async function toJpeg(file) { + const url = URL.createObjectURL(file); + try { + const img = new Image(); + img.src = url; + await img.decode(); + let w = img.naturalWidth, h = img.naturalHeight; + const scale = Math.min(1, Math.sqrt(MAX_PIXELS / (w * h))); + w = Math.round(w * scale); h = Math.round(h * scale); + const canvas = document.createElement('canvas'); + canvas.width = w; canvas.height = h; + canvas.getContext('2d').drawImage(img, 0, 0, w, h); + const blob = await new Promise(resolve => canvas.toBlob(resolve, 'image/jpeg', 0.92)); + if (!blob || blob.size < 1000) throw new Error('encode failed'); + const name = file.name.replace(/\.(heic|heif)$/i, '') + '.jpg'; + return new File([blob], name, { type: 'image/jpeg', lastModified: file.lastModified }); + } finally { + URL.revokeObjectURL(url); + } + } + + photos.addEventListener('change', async () => { + const files = [...photos.files]; + const heif = files.filter(isHeif); + msg.hidden = true; + if (!heif.length) { + chosen.textContent = files.length === 1 ? files[0].name : (files.length ? `${files.length} files chosen` : 'No photos chosen'); + return; + } + uploadBtn.disabled = true; + chosen.textContent = `Converting ${heif.length} HEIC photo(s) to JPEG…`; + const kept = new DataTransfer(); + const failed = []; + for (const f of files) { + if (!isHeif(f)) { kept.items.add(f); continue; } + try { kept.items.add(await toJpeg(f)); } catch (e) { failed.push(f.name); } + } + photos.files = kept.files; + const n = kept.files.length; + chosen.textContent = n ? `${n} photo(s) ready` : 'No photos chosen'; + if (failed.length) { + msg.hidden = false; + msg.textContent = `Removed ${failed.length} HEIC photo(s) this browser can't convert (${failed.join(', ')}). ` + + 'Upload them from Safari, or set iPhone Settings > Camera > Formats > Most Compatible.'; + } + uploadBtn.disabled = n === 0; + }); })(); {% endblock %} diff --git a/tests/test_lotto.py b/tests/test_lotto.py index 2eec710..46e9cb8 100644 --- a/tests/test_lotto.py +++ b/tests/test_lotto.py @@ -328,6 +328,58 @@ def test_home_cards_show_model_comparison(user_client): assert "the count was exactly" in page +HEIC = b"\x00\x00\x00\x18ftypheic\x00\x00\x00\x00mif1heic" + b"\x00" * 64 +PNG = b"\x89PNG\r\n\x1a\n" + b"\x00" * 32 +WEBP = b"RIFF\x10\x00\x00\x00WEBPVP8 " + b"\x00" * 32 + + +@pytest.mark.parametrize( + ("data", "expected"), + [(JPEG, "image/jpeg"), (PNG, "image/png"), (WEBP, "image/webp"), (HEIC, None), (b"GIF89a", None), (b"", None)], +) +def test_sniff_image_type(data, expected): + assert lotto.sniff_image_type(data) == expected + + +def test_is_heif(): + assert lotto.is_heif(HEIC) + assert lotto.is_heif(b"\x00\x00\x00\x1cftypmif1") + assert not lotto.is_heif(JPEG) + assert not lotto.is_heif(b"\x00\x00\x00\x18ftypisom") # an MP4 video + + +def test_upload_rejects_heic_and_trusts_bytes_not_declared_type(user_client): + response = user_client.post( + "/lotto/upload", + data={ + "photos": [ + (io.BytesIO(HEIC), "IMG_0001.HEIC", "image/heic"), + # Declared HEIC but really a PNG (already converted): accepted as PNG. + (io.BytesIO(PNG), "IMG_0002.HEIC", "image/heic"), + # Declared JPEG but really HEIC: still refused. + (io.BytesIO(HEIC + b"x"), "IMG_0003.jpg", "image/jpeg"), + (io.BytesIO(b"GIF89a-not-allowed"), "a.gif", "image/gif"), + ], + }, + content_type="multipart/form-data", + follow_redirects=True, + ) + page = response.get_data(as_text=True) + assert "Uploaded 1 photo(s)." in page + assert "2 HEIC/HEIF photo(s) rejected" in page + assert "1 file(s) rejected (not a JPEG, PNG or WebP photo" in page + photo = LottoPhoto.query.one() + assert photo.content_type == "image/png" + assert photo.data == PNG + + +def test_upload_message(): + assert lotto.upload_message(2, 0, 0, 0) == "Uploaded 2 photo(s)." + message = lotto.upload_message(0, 1, 1, 1) + assert "1 duplicate(s) ignored." in message + assert "Most Compatible" in message + + def test_upload_without_files_or_only_duplicates(user_client): response = user_client.post("/lotto/upload", data={}, content_type="multipart/form-data") assert response.headers["Location"].endswith("/lotto") From 4425ec3eba78e25f58f7e9582efff9e76c443be4 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 6 Nov 2026 21:16:37 +0000 Subject: [PATCH 8/8] Fix CI lint: make extra script parameters keyword-only CI pins ruff 0.15.20, where PLR0917 isn't enabled, so the "noqa: PLR0913, PLR0917" comments failed with RUF100 (unused noqa). Newer ruff does enable PLR0917. Making the trailing parameters of write_yolo_image() and count_check() keyword-only satisfies PLR0917 on both versions, so the noqa only needs PLR0913. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_012k19dCKBK4J2UdDMJd5gLv --- scripts/lotto/prepare_dataset.py | 6 ++++-- scripts/lotto/train_detector.py | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/scripts/lotto/prepare_dataset.py b/scripts/lotto/prepare_dataset.py index db3cc8d..0618f28 100644 --- a/scripts/lotto/prepare_dataset.py +++ b/scripts/lotto/prepare_dataset.py @@ -30,7 +30,9 @@ SPLITS = ("train", "val", "test") -def write_yolo_image(image: Image.Image, boxes: list[dict], stem: str, root: Path, split: str, max_side: int) -> None: # noqa: PLR0913, PLR0917 +def write_yolo_image( # noqa: PLR0913 + image: Image.Image, boxes: list[dict], stem: str, root: Path, *, split: str, max_side: int, +) -> None: """Save an upright photo and its YOLO label file (one class: price corner).""" images_dir = root / "images" / split labels_dir = root / "labels" / split @@ -83,7 +85,7 @@ def main() -> None: split = entry.split if entry.split in SPLITS else "train" boxes = [b for b in entry.boxes if b.get("label")] image = load_upright(archive.read(entry.file), entry.rotation) - write_yolo_image(image, boxes, entry.id, yolo_dir, split, args.max_side) + write_yolo_image(image, boxes, entry.id, yolo_dir, split=split, max_side=args.max_side) photos[split] += 1 out_dir = crops_dir / split out_dir.mkdir(parents=True, exist_ok=True) diff --git a/scripts/lotto/train_detector.py b/scripts/lotto/train_detector.py index 3f61c1a..a9528e5 100644 --- a/scripts/lotto/train_detector.py +++ b/scripts/lotto/train_detector.py @@ -37,7 +37,9 @@ def pick_device() -> str: return "cpu" -def count_check(model: YOLO, data: Path, split: str, imgsz: int, conf: float, device: str) -> None: # noqa: PLR0913, PLR0917 +def count_check( # noqa: PLR0913 + model: YOLO, data: Path, split: str, *, imgsz: int, conf: float, device: str, +) -> None: """Compare found vs. boxed corners per photo of ``split``.""" images = sorted((data / "yolo" / "images" / split).glob("*.jpg")) if not images: @@ -98,7 +100,7 @@ def main() -> None: shutil.copy(best, out) print(f"Saved best detector to {out}") - count_check(YOLO(str(out)), args.data, "test", args.imgsz, args.conf, device) + count_check(YOLO(str(out)), args.data, "test", imgsz=args.imgsz, conf=args.conf, device=device) if __name__ == "__main__":