diff --git a/prepare_dataset.py b/1_prepare_dataset.py similarity index 98% rename from prepare_dataset.py rename to 1_prepare_dataset.py index 8d9b1d1..b95f8b7 100644 --- a/prepare_dataset.py +++ b/1_prepare_dataset.py @@ -1,5 +1,5 @@ """ -STEP 1 ─ prepare_dataset.py +STEP 1 ─ 1_prepare_dataset.py =========================== Run this FIRST. It creates the required folder structure and a dataset.yaml that YOLOv8 expects. diff --git a/augment.py b/2_augment.py similarity index 99% rename from augment.py rename to 2_augment.py index e5b419d..556d32c 100644 --- a/augment.py +++ b/2_augment.py @@ -1,5 +1,5 @@ """ -STEP 2 — augment.py +STEP 2 — 2_augment.py ==================== Expands your small labeled dataset using augmentations tuned specifically for retail shelf / packaged-goods detection. diff --git a/train.py b/3_train.py similarity index 100% rename from train.py rename to 3_train.py diff --git a/train_from_checkpoint.py b/3_train_from_checkpoint.py similarity index 100% rename from train_from_checkpoint.py rename to 3_train_from_checkpoint.py diff --git a/4_detect.py b/4_detect.py new file mode 100644 index 0000000..79e824d --- /dev/null +++ b/4_detect.py @@ -0,0 +1,224 @@ +""" +SETP 4 - detect.py +==================== +Run detection on a single image, a folder, or a webcam stream. +Draw bounding boxes, prints a per-class count summary, and +saves an annotated result image. + +Usage: + python detect.py --source scene.jpg + python detect.py --source images/ + python detect.py --source 0 + python detect.py --source scene.jpg --conf 0.5 --wieghts best.pt +""" + +import argparse +import sys +import os +import cv2 +import numpy as np + +from pathlib import Path +from collections import defaultdict +from ultralytics import YOLO + +# ── Defaults ────────────────────────────────────────────────────────────────── +DEFAULT_WEIGHTS = "runs/detect/coffee_v1/weights/best.pt" +DEFAULT_CONF = .35 # lower = more detections and more false positives. +DEFAULT_IOU = .45 # NMS IoU threshold. +DEFAULT_IMGSZ = 640 +OUTPUT_DIR = Path("detections") + + +# ── Colour palette (one BGR colour per class index) ────────────────────────── +PALETTE = [ + ( 0, 200, 0), # green + ( 0, 120, 255), # orange + (255, 50, 50), # blue + (200, 0, 200), # magenta + ( 0, 200, 200), # yellow + ( 80, 200, 80), + (200, 100, 0), + ( 0, 80, 200), + (150, 0, 150), + (100, 200, 0), + ( 0, 150, 150), + (200, 50, 100), + ( 50, 50, 200), +] + +def get_color(class_id: int): + return PALETTE[class_id % len(PALETTE)] + +# ── Drawing ────────────────────────── +def draw_box(img, box, class_name, conf, class_id): + x1, y1, x2, y2 = map(int, box) + color = get_color(class_id) + + cv2.rectangle(img, (x1, y1), (x2, y2), color, 2) + + label = f"{class_name} {conf: .0%}" + (tw, th), baseline = cv2.getTextSize(label, cv2.FONT_HERSHEY_SIMPLEX, 0.55, 1) + cv2.rectangle( + img, + (x1, y1 - th - baseline - 6), + (x1 + tw + 4, y1), + color, cv2.FILLED + ) + + cv2.putText( + img, + label, + (x1 + 2, y1 - baseline -2), + cv2.FONT_HERSHEY_SIMPLEX, + 0.55, + (0, 0, 0), 1, cv2.LINE_AA + ) + +def draw_summary(img, counts: dict): + """ Overlay a product count table in the top-right corner.""" + if not counts: + return + + lines = ["── Count ──"] + [f"{n:>2}x {name}" for name, n in sorted(counts.items())] + + x = img.shape[1] - 200 + y = 16 + for line in lines: + (tw, th), _ = cv2.getTextSize(line, cv2.FONT_HERSHEY_SIMPLEX, 0.5, 1) + cv2.rectangle(img, (x - 4, y - th - 2), (x + tw + 4, y + 4), (30, 30, 30), cv2.FILLED) + cv2.putText(img, line, (x, y), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (240, 240, 240), 1, cv2.LINE_AA) + y += th + 8 + + +# ── Single image inference ──────────────────────────────────────────────────── +def detect_image(model, img_path: Path, conf: float, iou: float, imgsz: int): + img = cv2.imread(str(img_path)) + if img is None: + print(f"[WARN] Cannot read {img_path}") + return + results = model.predict( + source=str(img_path), + conf=conf, + iou=iou, + imgsz=imgsz, + verbose=False, + )[0] + + counts = defaultdict(int) + + for box in results.boxes: + cid = int(box.cls) + name = model.names[cid] + score = float(box.conf) + draw_box(img, box.xyxy[0].tolist(), name, score, cid) + counts[name] += 1 + + draw_summary(img, counts) + + OUTPUT_DIR.mkdir(exist_ok=True) + out_path = OUTPUT_DIR / img_path.name + cv2.imwrite(str(out_path), img) + + # Console Summary + print(f"\n{img_path.name}") + if counts: + for name, n in sorted(counts.items()): + print(f" {n:>2}x {name}") + else: + print(" (no detections)") + print(f" -> saved: {out_path}") + + return img, counts + +# ── Webcam / video stream ───────────────────────────────────────────────────── +def detect_stream(model, source, conf: float, iou: float, imgsz: int): + cap = cv2.VideoCapture(int(source) if source.isdigit() else source) + if not cap.isOpened(): + print(f"[ERROR] Cannot open source: {source}") + return + + print("Streaming - press Q to quit") + while True: + ret, frame = cap.read() + if not ret: + break + + results = model.predict( + source = frame, + conf = conf, + iou = iou, + imgsz = imgsz, + verbose = False + )[0] + + counts = defaultdict(int) + for box in results.boxes: + cid = int(box.cls) + name = model.names[cid] + draw_box(frame, box.xyxy[0].tolist(), name, float(box.conf), cid) + counts[name] += 1 + + draw_summary(frame, counts) + cv2.imshow("Coffee Detector", frame) + if cv2.waitKey(1) & 0xFF == ord("q"): + break + + cap.release() + cv2.destroyAllWindows() + + +# ── Entry point ───────────────────────────────────────────────────── +def main(): + parser = argparse.ArgumentParser(description="Coffee Product Detector") + parser.add_argument("--source" , default="scene.jpg" , help="Image path, folder, or 0 for webcam") + parser.add_argument("--weights", default=DEFAULT_WEIGHTS, help="Path to *.pt") + parser.add_argument("--conf" , default=DEFAULT_CONF , type=float, help="Confidence threshold (0-1)") + parser.add_argument("--iou" , default=DEFAULT_IOU , type=float, help="NMS IoU threshold (0-1)") + parser.add_argument("--imgsz" , default=DEFAULT_IMGSZ , type=int , help="Inference image size") + + args = parser.parse_args() + + if not Path(args.weights).exists(): + print(f"[ERROR] Weights not found: {args.weights}") + print(" Run train.py first.") + sys.exit(1) + + print(f"Loading model: {args.weights}") + model = YOLO(args.weights) + print(f"Classes: {list(model.names.values())}\n") + + source = Path(args.source) + + # Webcam / video + if args.source.isdigit() or str(source).endswith((".mp4", ".avi", ".mov")): + detect_stream(model, args.source, args.conf, args.iou, args.imgsz) + return + + # Folder + if source.is_dir(): + exts = {".jpg", ".jpeg", ".png", ".bmp", ".webp"} + images = sorted([p for p in source.iterdir() if p.suffix.lower() in exts]) + print(f"Processing {len(images)} images from {source}...") + total_counts = defaultdict(int) + for img_path in images: + _, counts = detect_image(model, img_path, args.conf, args.iou, args.imgsz) + if counts: + for k, v in counts.items(): + total_counts[k] += v + + print("\n── Total across all images ──") + for name, n in sorted(total_counts.items()): + print(f" {n:>3}x {name}") + return + + # Single image + if source.exists(): + detect_image(model, source, args.conf, args.iou, args.imgsz) + return + + print(f"[ERROR] Source not found: {source}") + sys.exit(1) + +if __name__ == "__main__": + main() diff --git a/best.pt b/best.pt new file mode 100644 index 0000000..a2148b6 Binary files /dev/null and b/best.pt differ diff --git a/detections/01.jpeg b/detections/01.jpeg new file mode 100644 index 0000000..8012a14 Binary files /dev/null and b/detections/01.jpeg differ diff --git a/detections/02.jpeg b/detections/02.jpeg new file mode 100644 index 0000000..70a5f02 Binary files /dev/null and b/detections/02.jpeg differ diff --git a/detections/03.jpeg b/detections/03.jpeg new file mode 100644 index 0000000..644753a Binary files /dev/null and b/detections/03.jpeg differ diff --git a/detections/04.jpeg b/detections/04.jpeg new file mode 100644 index 0000000..e32e19a Binary files /dev/null and b/detections/04.jpeg differ diff --git a/detections/05.jpeg b/detections/05.jpeg new file mode 100644 index 0000000..fb19814 Binary files /dev/null and b/detections/05.jpeg differ diff --git a/detections/06.jpeg b/detections/06.jpeg new file mode 100644 index 0000000..6e86ef7 Binary files /dev/null and b/detections/06.jpeg differ diff --git a/detections/07.jpeg b/detections/07.jpeg new file mode 100644 index 0000000..83875af Binary files /dev/null and b/detections/07.jpeg differ diff --git a/detections/08.jpeg b/detections/08.jpeg new file mode 100644 index 0000000..57bbbfd Binary files /dev/null and b/detections/08.jpeg differ diff --git a/detections/09.jpeg b/detections/09.jpeg new file mode 100644 index 0000000..89a2d8d Binary files /dev/null and b/detections/09.jpeg differ diff --git a/detections/10.jpeg b/detections/10.jpeg new file mode 100644 index 0000000..47b2dc4 Binary files /dev/null and b/detections/10.jpeg differ diff --git a/detections/11.jpeg b/detections/11.jpeg new file mode 100644 index 0000000..9945f0a Binary files /dev/null and b/detections/11.jpeg differ diff --git a/detections/12.jpeg b/detections/12.jpeg new file mode 100644 index 0000000..a95af81 Binary files /dev/null and b/detections/12.jpeg differ diff --git a/detections/13.jpeg b/detections/13.jpeg new file mode 100644 index 0000000..143db88 Binary files /dev/null and b/detections/13.jpeg differ diff --git a/detections/14.jpeg b/detections/14.jpeg new file mode 100644 index 0000000..f8744d1 Binary files /dev/null and b/detections/14.jpeg differ diff --git a/detections/15.jpeg b/detections/15.jpeg new file mode 100644 index 0000000..93e6a93 Binary files /dev/null and b/detections/15.jpeg differ diff --git a/detections/16.jpeg b/detections/16.jpeg new file mode 100644 index 0000000..a9eb924 Binary files /dev/null and b/detections/16.jpeg differ diff --git a/detections/17.jpeg b/detections/17.jpeg new file mode 100644 index 0000000..83875af Binary files /dev/null and b/detections/17.jpeg differ diff --git a/detections/18.jpeg b/detections/18.jpeg new file mode 100644 index 0000000..e32e19a Binary files /dev/null and b/detections/18.jpeg differ diff --git a/detections/19.jpeg b/detections/19.jpeg new file mode 100644 index 0000000..5e16d3d Binary files /dev/null and b/detections/19.jpeg differ diff --git a/detections/20.jpeg b/detections/20.jpeg new file mode 100644 index 0000000..70a5f02 Binary files /dev/null and b/detections/20.jpeg differ diff --git a/detections/21.jpeg b/detections/21.jpeg new file mode 100644 index 0000000..8012a14 Binary files /dev/null and b/detections/21.jpeg differ diff --git a/detections/22.jpeg b/detections/22.jpeg new file mode 100644 index 0000000..6e86ef7 Binary files /dev/null and b/detections/22.jpeg differ diff --git a/detections/23.jpeg b/detections/23.jpeg new file mode 100644 index 0000000..fb19814 Binary files /dev/null and b/detections/23.jpeg differ diff --git a/detections/24.jpeg b/detections/24.jpeg new file mode 100644 index 0000000..57bbbfd Binary files /dev/null and b/detections/24.jpeg differ diff --git a/detections/25.jpeg b/detections/25.jpeg new file mode 100644 index 0000000..644753a Binary files /dev/null and b/detections/25.jpeg differ diff --git a/detections/26.jpeg b/detections/26.jpeg new file mode 100644 index 0000000..4651a2a Binary files /dev/null and b/detections/26.jpeg differ diff --git a/detections/27.jpeg b/detections/27.jpeg new file mode 100644 index 0000000..987a1ef Binary files /dev/null and b/detections/27.jpeg differ diff --git a/detections/28.jpeg b/detections/28.jpeg new file mode 100644 index 0000000..93ca531 Binary files /dev/null and b/detections/28.jpeg differ diff --git a/detections/29.jpeg b/detections/29.jpeg new file mode 100644 index 0000000..f5b76a8 Binary files /dev/null and b/detections/29.jpeg differ diff --git a/detections/30.jpeg b/detections/30.jpeg new file mode 100644 index 0000000..c964e9c Binary files /dev/null and b/detections/30.jpeg differ diff --git a/detections/31.jpeg b/detections/31.jpeg new file mode 100644 index 0000000..e6f8779 Binary files /dev/null and b/detections/31.jpeg differ diff --git a/detections/32.jpeg b/detections/32.jpeg new file mode 100644 index 0000000..9aa4285 Binary files /dev/null and b/detections/32.jpeg differ diff --git a/detections/33.jpeg b/detections/33.jpeg new file mode 100644 index 0000000..9249d00 Binary files /dev/null and b/detections/33.jpeg differ diff --git a/detections/34.jpeg b/detections/34.jpeg new file mode 100644 index 0000000..2883642 Binary files /dev/null and b/detections/34.jpeg differ diff --git a/detections/35.jpeg b/detections/35.jpeg new file mode 100644 index 0000000..5cdaed1 Binary files /dev/null and b/detections/35.jpeg differ diff --git a/detections/36.jpeg b/detections/36.jpeg new file mode 100644 index 0000000..7e21022 Binary files /dev/null and b/detections/36.jpeg differ diff --git a/detections/37.jpeg b/detections/37.jpeg new file mode 100644 index 0000000..b464322 Binary files /dev/null and b/detections/37.jpeg differ diff --git a/detections/38.jpeg b/detections/38.jpeg new file mode 100644 index 0000000..ba349e5 Binary files /dev/null and b/detections/38.jpeg differ diff --git a/detections/39.jpeg b/detections/39.jpeg new file mode 100644 index 0000000..5cfe6ce Binary files /dev/null and b/detections/39.jpeg differ diff --git a/detections/40.jpeg b/detections/40.jpeg new file mode 100644 index 0000000..12c0d6f Binary files /dev/null and b/detections/40.jpeg differ diff --git a/detections/41.jpeg b/detections/41.jpeg new file mode 100644 index 0000000..1b770b9 Binary files /dev/null and b/detections/41.jpeg differ diff --git a/detections/42.jpeg b/detections/42.jpeg new file mode 100644 index 0000000..67496f5 Binary files /dev/null and b/detections/42.jpeg differ diff --git a/detections/43.jpeg b/detections/43.jpeg new file mode 100644 index 0000000..191dc49 Binary files /dev/null and b/detections/43.jpeg differ diff --git a/detections/44.jpeg b/detections/44.jpeg new file mode 100644 index 0000000..ade1bc6 Binary files /dev/null and b/detections/44.jpeg differ diff --git a/detections/45.jpeg b/detections/45.jpeg new file mode 100644 index 0000000..61e53ff Binary files /dev/null and b/detections/45.jpeg differ diff --git a/detections/46.jpeg b/detections/46.jpeg new file mode 100644 index 0000000..754561a Binary files /dev/null and b/detections/46.jpeg differ diff --git a/detections/47.jpeg b/detections/47.jpeg new file mode 100644 index 0000000..0408cc4 Binary files /dev/null and b/detections/47.jpeg differ diff --git a/detections/48.jpeg b/detections/48.jpeg new file mode 100644 index 0000000..24ec004 Binary files /dev/null and b/detections/48.jpeg differ diff --git a/detections/49.jpeg b/detections/49.jpeg new file mode 100644 index 0000000..df8574a Binary files /dev/null and b/detections/49.jpeg differ diff --git a/detections/50.jpeg b/detections/50.jpeg new file mode 100644 index 0000000..d2f4dc5 Binary files /dev/null and b/detections/50.jpeg differ diff --git a/detections/51.jpeg b/detections/51.jpeg new file mode 100644 index 0000000..5753d7c Binary files /dev/null and b/detections/51.jpeg differ diff --git a/detections/52.jpeg b/detections/52.jpeg new file mode 100644 index 0000000..fd5fafc Binary files /dev/null and b/detections/52.jpeg differ diff --git a/detections/53.jpeg b/detections/53.jpeg new file mode 100644 index 0000000..aef7fe5 Binary files /dev/null and b/detections/53.jpeg differ diff --git a/detections/54.jpeg b/detections/54.jpeg new file mode 100644 index 0000000..d50a7c3 Binary files /dev/null and b/detections/54.jpeg differ diff --git a/detections/55.jpeg b/detections/55.jpeg new file mode 100644 index 0000000..0f318db Binary files /dev/null and b/detections/55.jpeg differ diff --git a/detections/56.jpeg b/detections/56.jpeg new file mode 100644 index 0000000..73e8b9d Binary files /dev/null and b/detections/56.jpeg differ diff --git a/detections/57.jpeg b/detections/57.jpeg new file mode 100644 index 0000000..cda2eb1 Binary files /dev/null and b/detections/57.jpeg differ diff --git a/detections/58.jpeg b/detections/58.jpeg new file mode 100644 index 0000000..375a116 Binary files /dev/null and b/detections/58.jpeg differ diff --git a/detections/59.jpeg b/detections/59.jpeg new file mode 100644 index 0000000..c2ddc9b Binary files /dev/null and b/detections/59.jpeg differ diff --git a/detections/60.jpeg b/detections/60.jpeg new file mode 100644 index 0000000..f6b3b40 Binary files /dev/null and b/detections/60.jpeg differ diff --git a/detections/61.jpeg b/detections/61.jpeg new file mode 100644 index 0000000..1695e73 Binary files /dev/null and b/detections/61.jpeg differ diff --git a/detections/62.jpeg b/detections/62.jpeg new file mode 100644 index 0000000..049bdb2 Binary files /dev/null and b/detections/62.jpeg differ diff --git a/detections/63.jpeg b/detections/63.jpeg new file mode 100644 index 0000000..9adccf4 Binary files /dev/null and b/detections/63.jpeg differ diff --git a/detections/64.jpeg b/detections/64.jpeg new file mode 100644 index 0000000..9575a9e Binary files /dev/null and b/detections/64.jpeg differ diff --git a/shelf-products-detection-train-yolov8n.ipynb b/shelf-products-detection-train-yolov8n.ipynb new file mode 100644 index 0000000..4a91991 --- /dev/null +++ b/shelf-products-detection-train-yolov8n.ipynb @@ -0,0 +1 @@ +{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.12.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"nvidiaTeslaT4","dataSources":[{"sourceType":"datasetVersion","sourceId":3771150,"datasetId":2004518,"databundleVersionId":3825728}],"dockerImageVersionId":31329,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":true}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"!pip install -q ultralytics","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true,"execution":{"iopub.status.busy":"2026-05-03T10:28:09.186553Z","iopub.execute_input":"2026-05-03T10:28:09.186784Z","iopub.status.idle":"2026-05-03T10:28:15.175437Z","shell.execute_reply.started":"2026-05-03T10:28:09.186760Z","shell.execute_reply":"2026-05-03T10:28:15.174587Z"}},"outputs":[{"name":"stdout","text":"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.2/1.2 MB\u001b[0m \u001b[31m20.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n\u001b[?25h","output_type":"stream"}],"execution_count":1},{"cell_type":"markdown","source":"# Dataset - SKU110K *(most popular)*\n- 11,762 shelf images with ~1.2million annotated products.\n- Dense shelf scenarios\n- [on Github](http://github.com/eg4000/SKU110K_CVPR19) | [on Kaggle](https://www.kaggle.com/datasets/thedatasith/sku110k-annotations)\n\nOther datasets to check:\n- Grocery Store Dataset (Grozi-120)\n- WebMarket\n- RPC (Retail Product Checkout)","metadata":{}},{"cell_type":"code","source":"import os\n\nBASE_PATH = \"/kaggle/input/datasets/thedatasith/sku110k-annotations\"\nDATASET_FOLDER = None\n\n# find SKU110K_fixed folder\nfor item in os.listdir(BASE_PATH):\n if \"SKU110K\" in item:\n DATASET_FOLDER = os.path.join(BASE_PATH, item)\n break\n\nprint(\"📁 Dataset folder:\", DATASET_FOLDER)\n\nfor root, dirs, files in os.walk(DATASET_FOLDER):\n level = root.replace(DATASET_FOLDER, '').count(os.sep)\n indent = ' ' * 2 * level\n print(f\"{indent}📁 {os.path.basename(root)}/\")\n for f in files[:5]:\n print(f\"{indent} 📄 {f}\")\n if level >= 2:\n break","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-05-03T10:28:15.180147Z","iopub.execute_input":"2026-05-03T10:28:15.180435Z","iopub.status.idle":"2026-05-03T10:28:18.766862Z","shell.execute_reply.started":"2026-05-03T10:28:15.180387Z","shell.execute_reply":"2026-05-03T10:28:18.766011Z"}},"outputs":[{"name":"stdout","text":"📁 Dataset folder: /kaggle/input/datasets/thedatasith/sku110k-annotations/SKU110K_fixed\n📁 SKU110K_fixed/\n 📁 labels/\n 📁 val/\n 📄 val_30.txt\n 📄 val_216.txt\n 📄 val_16.txt\n 📄 val_499.txt\n 📄 val_180.txt\n","output_type":"stream"}],"execution_count":2},{"cell_type":"code","source":"import yaml\n\nYAML_PATH = BASE_PATH + \"/data_kaggle.yaml\"\n\nwith open(YAML_PATH, \"r\") as f:\n data = yaml.safe_load(f)\n\nprint(\"Classes:\", data.get(\"names\"))\nprint(\"Number of classes:\", len(data.get(\"names\", [])))\nprint(\"Train path:\", data.get(\"train\"))\nprint(\"Val path:\", data.get(\"val\"))","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-05-03T10:28:18.768355Z","iopub.execute_input":"2026-05-03T10:28:18.768863Z","iopub.status.idle":"2026-05-03T10:28:18.803040Z","shell.execute_reply.started":"2026-05-03T10:28:18.768833Z","shell.execute_reply":"2026-05-03T10:28:18.802326Z"}},"outputs":[{"name":"stdout","text":"Classes: ['object']\nNumber of classes: 1\nTrain path: train\nVal path: val\n","output_type":"stream"}],"execution_count":3},{"cell_type":"code","source":"import yaml\n\nYAML_PATH = BASE_PATH + \"/data_kaggle.yaml\"\n\nwith open(YAML_PATH, \"r\") as f:\n data = yaml.safe_load(f)\n\n# 🔧 FIX PATHS\ndata[\"train\"] = DATASET_FOLDER + \"/images/train\"\ndata[\"val\"] = DATASET_FOLDER + \"/images/val\"\n\n# save fixed yaml\nFIXED_YAML_PATH = \"/kaggle/working/fixed_data.yaml\"\n\nwith open(FIXED_YAML_PATH, \"w\") as f:\n yaml.dump(data, f)\n\nprint(\"✅ Fixed YAML saved at:\", FIXED_YAML_PATH)\nprint(data)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-05-03T10:28:20.692186Z","iopub.execute_input":"2026-05-03T10:28:20.692762Z","iopub.status.idle":"2026-05-03T10:28:20.701198Z","shell.execute_reply.started":"2026-05-03T10:28:20.692697Z","shell.execute_reply":"2026-05-03T10:28:20.700594Z"}},"outputs":[{"name":"stdout","text":"✅ Fixed YAML saved at: /kaggle/working/fixed_data.yaml\n{'path': '/kaggle/input/sku110k-annotations/SKU110K_fixed/images', 'train': '/kaggle/input/datasets/thedatasith/sku110k-annotations/SKU110K_fixed/images/train', 'val': '/kaggle/input/datasets/thedatasith/sku110k-annotations/SKU110K_fixed/images/val', 'test': 'test', 'nc': 1, 'names': ['object']}\n","output_type":"stream"}],"execution_count":4},{"cell_type":"markdown","source":"# Model Training YOLOv8n","metadata":{}},{"cell_type":"code","source":"import torch\nimport numpy\nfrom ultralytics import YOLO\n\nprint(torch.cuda.get_device_name(0))\nprint(\"GPU:\", torch.cuda.get_device_name(0) if torch.cuda.is_available() else \"None\")\nprint(torch.cuda.get_device_capability(0))\n\nmodel = YOLO('yolov8n.pt')\nmodel.train(\n device='0',\n data=FIXED_YAML_PATH,\n epochs=30,\n imgsz=800,\n batch=-1, # Automatically finas largest batch that fits in memory.\n workers=4,\n optimizer=\"AdamW\",\n lr0=0.002,\n patience=10,\n save_period=5,\n project=\"kaggle/working/runs\",\n name=\"exp\",\n save=True\n)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-05-03T10:50:33.507952Z","iopub.execute_input":"2026-05-03T10:50:33.508838Z","iopub.status.idle":"2026-05-03T13:30:14.432940Z","shell.execute_reply.started":"2026-05-03T10:50:33.508804Z","shell.execute_reply":"2026-05-03T13:30:14.428192Z"}},"outputs":[{"name":"stdout","text":"Tesla T4\nGPU: Tesla T4\n(7, 5)\nUltralytics 8.4.46 🚀 Python-3.12.12 torch-2.10.0+cu128 CUDA:0 (Tesla T4, 14913MiB)\n\u001b[34m\u001b[1mengine/trainer: \u001b[0magnostic_nms=False, amp=True, angle=1.0, augment=False, auto_augment=randaugment, batch=-1, bgr=0.0, box=7.5, cache=False, cfg=None, classes=None, close_mosaic=10, cls=0.5, cls_pw=0.0, compile=False, conf=None, copy_paste=0.0, copy_paste_mode=flip, cos_lr=False, cutmix=0.0, data=/kaggle/working/fixed_data.yaml, degrees=0.0, deterministic=True, device=0, dfl=1.5, dnn=False, dropout=0.0, dynamic=False, embed=None, end2end=None, epochs=50, erasing=0.4, exist_ok=False, fliplr=0.5, flipud=0.0, format=torchscript, fraction=1.0, freeze=None, half=False, hsv_h=0.015, hsv_s=0.7, hsv_v=0.4, imgsz=800, int8=False, iou=0.7, keras=False, kobj=1.0, line_width=None, lr0=0.002, lrf=0.01, mask_ratio=4, max_det=300, mixup=0.0, mode=train, model=yolov8n.pt, momentum=0.937, mosaic=1.0, multi_scale=0.0, name=exp-6, nbs=64, nms=False, opset=None, optimize=False, optimizer=AdamW, overlap_mask=True, patience=10, perspective=0.0, plots=True, pose=12.0, pretrained=True, profile=False, project=kaggle/working/runs, rect=False, resume=False, retina_masks=False, rle=1.0, save=True, save_conf=False, save_crop=False, save_dir=/kaggle/working/runs/detect/kaggle/working/runs/exp-6, save_frames=False, save_json=False, save_period=5, save_txt=False, scale=0.5, seed=0, shear=0.0, show=False, show_boxes=True, show_conf=True, show_labels=True, simplify=True, single_cls=False, source=None, split=val, stream_buffer=False, task=detect, time=None, tracker=botsort.yaml, translate=0.1, val=True, verbose=True, vid_stride=1, visualize=False, warmup_bias_lr=0.1, warmup_epochs=3.0, warmup_momentum=0.8, weight_decay=0.0005, workers=4, workspace=None\nOverriding model.yaml nc=80 with nc=1\n\n from n params module arguments \n 0 -1 1 464 ultralytics.nn.modules.conv.Conv [3, 16, 3, 2] \n 1 -1 1 4672 ultralytics.nn.modules.conv.Conv [16, 32, 3, 2] \n 2 -1 1 7360 ultralytics.nn.modules.block.C2f [32, 32, 1, True] \n 3 -1 1 18560 ultralytics.nn.modules.conv.Conv [32, 64, 3, 2] \n 4 -1 2 49664 ultralytics.nn.modules.block.C2f [64, 64, 2, True] \n 5 -1 1 73984 ultralytics.nn.modules.conv.Conv [64, 128, 3, 2] \n 6 -1 2 197632 ultralytics.nn.modules.block.C2f [128, 128, 2, True] \n 7 -1 1 295424 ultralytics.nn.modules.conv.Conv [128, 256, 3, 2] \n 8 -1 1 460288 ultralytics.nn.modules.block.C2f [256, 256, 1, True] \n 9 -1 1 164608 ultralytics.nn.modules.block.SPPF [256, 256, 5] \n 10 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest'] \n 11 [-1, 6] 1 0 ultralytics.nn.modules.conv.Concat [1] \n 12 -1 1 148224 ultralytics.nn.modules.block.C2f [384, 128, 1] \n 13 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest'] \n 14 [-1, 4] 1 0 ultralytics.nn.modules.conv.Concat [1] \n 15 -1 1 37248 ultralytics.nn.modules.block.C2f [192, 64, 1] \n 16 -1 1 36992 ultralytics.nn.modules.conv.Conv [64, 64, 3, 2] \n 17 [-1, 12] 1 0 ultralytics.nn.modules.conv.Concat [1] \n 18 -1 1 123648 ultralytics.nn.modules.block.C2f [192, 128, 1] \n 19 -1 1 147712 ultralytics.nn.modules.conv.Conv [128, 128, 3, 2] \n 20 [-1, 9] 1 0 ultralytics.nn.modules.conv.Concat [1] \n 21 -1 1 493056 ultralytics.nn.modules.block.C2f [384, 256, 1] \n 22 [15, 18, 21] 1 751507 ultralytics.nn.modules.head.Detect [1, 16, None, [64, 128, 256]] \nModel summary: 130 layers, 3,011,043 parameters, 3,011,027 gradients, 8.2 GFLOPs\n\nTransferred 319/355 items from pretrained weights\nFreezing layer 'model.22.dfl.conv.weight'\n\u001b[34m\u001b[1mAMP: \u001b[0mrunning Automatic Mixed Precision (AMP) checks...\n\u001b[34m\u001b[1mAMP: \u001b[0mchecks passed ✅\n\u001b[34m\u001b[1mtrain: \u001b[0mFast image access ✅ (ping: 0.0±0.0 ms, read: 1622.5±338.4 MB/s, size: 1055.7 KB)\n\u001b[K\u001b[34m\u001b[1mtrain: \u001b[0mScanning /kaggle/input/datasets/thedatasith/sku110k-annotations/SKU110K_fixed/labels/train... 8185 images, 0 backgrounds, 0 corrupt: 100% ━━━━━━━━━━━━ 8185/8185 530.6it/s 15.4s<0.0s\n\u001b[34m\u001b[1mtrain: \u001b[0m/kaggle/input/datasets/thedatasith/sku110k-annotations/SKU110K_fixed/images/train/train_1797.jpg: 3 duplicate labels removed\nWARNING ⚠️ \u001b[34m\u001b[1mtrain: \u001b[0mCache directory /kaggle/input/datasets/thedatasith/sku110k-annotations/SKU110K_fixed/labels is not writable, cache not saved.\n\u001b[34m\u001b[1malbumentations: \u001b[0mBlur(p=0.01, blur_limit=(3, 7)), MedianBlur(p=0.01, blur_limit=(3, 7)), ToGray(p=0.01, method='weighted_average', num_output_channels=3), CLAHE(p=0.01, clip_limit=(1.0, 4.0), tile_grid_size=(8, 8))\n\u001b[34m\u001b[1mAutoBatch: \u001b[0mComputing optimal batch size for imgsz=800 at 60.0% CUDA memory utilization.\n\u001b[34m\u001b[1mAutoBatch: \u001b[0mCUDA:0 (Tesla T4) 14.56G total, 14.06G reserved, 4.27G allocated, -3.77G free\n Params GFLOPs GPU_mem (GB) forward (ms) backward (ms) input output\n 3011043 12.8 0.742 25.48 nan (1, 3, 800, 800) list\n 3011043 25.61 1.407 22.69 nan (2, 3, 800, 800) list\n 3011043 51.21 2.533 20.66 nan (4, 3, 800, 800) list\n 3011043 102.4 4.647 31.35 nan (8, 3, 800, 800) list\n 3011043 204.9 8.993 67.12 nan (16, 3, 800, 800) list\nWARNING ⚠️ \u001b[34m\u001b[1mAutoBatch: \u001b[0mbatch=-4 outside safe range, using default batch-size 16.\n\u001b[34m\u001b[1mAutoBatch: \u001b[0mUsing batch-size 16 for CUDA:0 27.35G/14.56G (188%) ✅\n\u001b[34m\u001b[1mtrain: \u001b[0mFast image access ✅ (ping: 0.0±0.0 ms, read: 1226.3±337.2 MB/s, size: 909.7 KB)\n\u001b[K\u001b[34m\u001b[1mtrain: \u001b[0mScanning /kaggle/input/datasets/thedatasith/sku110k-annotations/SKU110K_fixed/labels/train... 8185 images, 0 backgrounds, 0 corrupt: 100% ━━━━━━━━━━━━ 8185/8185 690.8it/s 11.8s<0.0s\n\u001b[34m\u001b[1mtrain: \u001b[0m/kaggle/input/datasets/thedatasith/sku110k-annotations/SKU110K_fixed/images/train/train_1797.jpg: 3 duplicate labels removed\nWARNING ⚠️ \u001b[34m\u001b[1mtrain: \u001b[0mCache directory /kaggle/input/datasets/thedatasith/sku110k-annotations/SKU110K_fixed/labels is not writable, cache not saved.\n\u001b[34m\u001b[1malbumentations: \u001b[0mBlur(p=0.01, blur_limit=(3, 7)), MedianBlur(p=0.01, blur_limit=(3, 7)), ToGray(p=0.01, method='weighted_average', num_output_channels=3), CLAHE(p=0.01, clip_limit=(1.0, 4.0), tile_grid_size=(8, 8))\n\u001b[34m\u001b[1mval: \u001b[0mFast image access ✅ (ping: 0.0±0.0 ms, read: 645.9±321.3 MB/s, size: 1108.0 KB)\n\u001b[K\u001b[34m\u001b[1mval: \u001b[0mScanning /kaggle/input/datasets/thedatasith/sku110k-annotations/SKU110K_fixed/labels/val... 584 images, 0 backgrounds, 0 corrupt: 100% ━━━━━━━━━━━━ 584/584 471.5it/s 1.2s0.0s\nWARNING ⚠️ \u001b[34m\u001b[1mval: \u001b[0mCache directory /kaggle/input/datasets/thedatasith/sku110k-annotations/SKU110K_fixed/labels is not writable, cache not saved.\n\u001b[34m\u001b[1moptimizer:\u001b[0m AdamW(lr=0.002, momentum=0.937) with parameter groups 57 weight(decay=0.0), 64 weight(decay=0.0005), 63 bias(decay=0.0)\nPlotting labels to /kaggle/working/runs/detect/kaggle/working/runs/exp-6/labels.jpg... \nImage sizes 800 train, 800 val\nUsing 2 dataloader workers\nLogging results to \u001b[1m/kaggle/working/runs/detect/kaggle/working/runs/exp-6\u001b[0m\nStarting training for 50 epochs...\n\n Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n\u001b[K 1/50 9.3G 1.622 1.023 1.113 2446 800: 100% ━━━━━━━━━━━━ 512/512 1.8it/s 4:46<0.4s\n\u001b[K Class Images Instances Box(P R mAP50 mAP50-95): 100% ━━━━━━━━━━━━ 19/19 1.6it/s 12.2s0.7s\n all 584 90456 0.822 0.693 0.758 0.425\n\n Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n\u001b[K 2/50 14G 1.515 0.817 1.063 2277 800: 100% ━━━━━━━━━━━━ 512/512 1.8it/s 4:42<0.4s\n\u001b[K Class Images Instances Box(P R mAP50 mAP50-95): 100% ━━━━━━━━━━━━ 19/19 1.6it/s 11.8s0.7s\n all 584 90456 0.851 0.77 0.82 0.476\n\n Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n\u001b[K 3/50 12.3G 1.479 0.7712 1.048 2172 800: 100% ━━━━━━━━━━━━ 512/512 1.8it/s 4:40<0.4s\n\u001b[K Class Images Instances Box(P R mAP50 mAP50-95): 100% ━━━━━━━━━━━━ 19/19 1.7it/s 11.1s0.6s\n all 584 90456 0.853 0.757 0.81 0.475\n\n Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n\u001b[K 4/50 9.78G 1.459 0.748 1.042 1688 800: 100% ━━━━━━━━━━━━ 512/512 1.8it/s 4:47<0.4s\n\u001b[K Class Images Instances Box(P R mAP50 mAP50-95): 100% ━━━━━━━━━━━━ 19/19 1.6it/s 11.6s0.7s\n all 584 90456 0.849 0.775 0.827 0.484\n\n Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n\u001b[K 5/50 9.12G 1.451 0.7335 1.036 3278 800: 100% ━━━━━━━━━━━━ 512/512 1.8it/s 4:45<0.4s\n\u001b[K Class Images Instances Box(P R mAP50 mAP50-95): 100% ━━━━━━━━━━━━ 19/19 1.7it/s 11.1s0.6s\n all 584 90456 0.872 0.788 0.842 0.497\n\n Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n\u001b[K 6/50 12.6G 1.433 0.7175 1.031 1835 800: 100% ━━━━━━━━━━━━ 512/512 1.8it/s 4:52<0.4s\n\u001b[K Class Images Instances Box(P R mAP50 mAP50-95): 100% ━━━━━━━━━━━━ 19/19 1.6it/s 11.6s0.6s\n all 584 90456 0.881 0.802 0.853 0.511\n\n Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n\u001b[K 7/50 12.5G 1.422 0.7049 1.025 1625 800: 100% ━━━━━━━━━━━━ 512/512 1.7it/s 4:58<0.4s\n\u001b[K Class Images Instances Box(P R mAP50 mAP50-95): 100% ━━━━━━━━━━━━ 19/19 1.6it/s 11.6s0.7s\n all 584 90456 0.879 0.81 0.859 0.511\n\n Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n\u001b[K 8/50 13.5G 1.415 0.699 1.023 2169 800: 100% ━━━━━━━━━━━━ 512/512 1.8it/s 4:52<0.4s\n\u001b[K Class Images Instances Box(P R mAP50 mAP50-95): 100% ━━━━━━━━━━━━ 19/19 1.5it/s 12.5s0.7s\n all 584 90456 0.883 0.792 0.849 0.511\n\n Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n\u001b[K 9/50 10.9G 1.409 0.6911 1.019 2703 800: 100% ━━━━━━━━━━━━ 512/512 1.8it/s 4:50<0.4s\n\u001b[K Class Images Instances Box(P R mAP50 mAP50-95): 100% ━━━━━━━━━━━━ 19/19 1.5it/s 12.5s0.7s\n all 584 90456 0.89 0.816 0.865 0.525\n\n Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n\u001b[K 10/50 10.1G 1.404 0.6845 1.018 2094 800: 100% ━━━━━━━━━━━━ 512/512 1.8it/s 4:49<0.4s\n\u001b[K Class Images Instances Box(P R mAP50 mAP50-95): 100% ━━━━━━━━━━━━ 19/19 1.7it/s 11.5s0.6s\n all 584 90456 0.885 0.817 0.867 0.524\n\n Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n\u001b[K 11/50 11.5G 1.394 0.6736 1.015 2164 800: 100% ━━━━━━━━━━━━ 512/512 1.8it/s 4:48<0.4s\n\u001b[K Class Images Instances Box(P R mAP50 mAP50-95): 100% ━━━━━━━━━━━━ 19/19 1.6it/s 11.9s0.6s\n all 584 90456 0.89 0.814 0.866 0.526\n\n Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n\u001b[K 12/50 10G 1.395 0.6753 1.016 2302 800: 100% ━━━━━━━━━━━━ 512/512 1.8it/s 4:46<0.4s\n\u001b[K Class Images Instances Box(P R mAP50 mAP50-95): 100% ━━━━━━━━━━━━ 19/19 1.7it/s 11.1s0.6s\n all 584 90456 0.89 0.819 0.874 0.529\n\n Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n\u001b[K 13/50 11.4G 1.389 0.6684 1.011 1912 800: 100% ━━━━━━━━━━━━ 512/512 1.8it/s 4:47<0.4s\n\u001b[K Class Images Instances Box(P R mAP50 mAP50-95): 100% ━━━━━━━━━━━━ 19/19 1.6it/s 12.0s0.7s\n all 584 90456 0.893 0.823 0.875 0.531\n\n Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n\u001b[K 14/50 11.5G 1.386 0.6636 1.011 1621 800: 100% ━━━━━━━━━━━━ 512/512 1.8it/s 4:45<0.3s\n\u001b[K Class Images Instances Box(P R mAP50 mAP50-95): 100% ━━━━━━━━━━━━ 19/19 1.7it/s 11.1s0.6s\n all 584 90456 0.895 0.825 0.875 0.533\n\n Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n\u001b[K 15/50 10.3G 1.385 0.6615 1.012 1877 800: 100% ━━━━━━━━━━━━ 512/512 1.8it/s 4:45<0.4s\n\u001b[K Class Images Instances Box(P R mAP50 mAP50-95): 100% ━━━━━━━━━━━━ 19/19 1.6it/s 12.0s0.7s\n all 584 90456 0.895 0.826 0.878 0.534\n\n Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n\u001b[K 16/50 10.2G 1.379 0.6564 1.009 1694 800: 100% ━━━━━━━━━━━━ 512/512 1.8it/s 4:46<0.4s\n\u001b[K Class Images Instances Box(P R mAP50 mAP50-95): 100% ━━━━━━━━━━━━ 19/19 1.6it/s 11.5s0.6s\n all 584 90456 0.895 0.821 0.876 0.534\n\n Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n\u001b[K 17/50 13.7G 1.372 0.6501 1.008 1779 800: 100% ━━━━━━━━━━━━ 512/512 1.8it/s 4:43<0.4s\n\u001b[K Class Images Instances Box(P R mAP50 mAP50-95): 100% ━━━━━━━━━━━━ 19/19 1.7it/s 11.1s0.6s\n all 584 90456 0.902 0.825 0.879 0.539\n\n Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n\u001b[K 18/50 8.65G 1.371 0.6494 1.004 1915 800: 100% ━━━━━━━━━━━━ 512/512 1.8it/s 4:41<0.4s\n\u001b[K Class Images Instances Box(P R mAP50 mAP50-95): 100% ━━━━━━━━━━━━ 19/19 1.6it/s 11.5s0.6s\n all 584 90456 0.896 0.826 0.878 0.539\n\n Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n\u001b[K 19/50 12.3G 1.372 0.6459 1.005 1668 800: 100% ━━━━━━━━━━━━ 512/512 1.8it/s 4:44<0.4s\n\u001b[K Class Images Instances Box(P R mAP50 mAP50-95): 100% ━━━━━━━━━━━━ 19/19 1.6it/s 11.6s0.7s\n all 584 90456 0.898 0.826 0.879 0.541\n\n Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n\u001b[K 20/50 12.9G 1.369 0.6451 1.006 2292 800: 100% ━━━━━━━━━━━━ 512/512 1.8it/s 4:42<0.4s\n\u001b[K Class Images Instances Box(P R mAP50 mAP50-95): 100% ━━━━━━━━━━━━ 19/19 1.7it/s 11.2s0.7s\n all 584 90456 0.896 0.831 0.88 0.54\n\n Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n\u001b[K 21/50 12G 1.369 0.644 1.003 1722 800: 100% ━━━━━━━━━━━━ 512/512 1.8it/s 4:41<0.3s\n\u001b[K Class Images Instances Box(P R mAP50 mAP50-95): 100% ━━━━━━━━━━━━ 19/19 1.6it/s 11.7s0.8s\n all 584 90456 0.903 0.827 0.881 0.541\n\n Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n\u001b[K 22/50 9.84G 1.363 0.6361 0.9997 2757 800: 100% ━━━━━━━━━━━━ 512/512 1.8it/s 4:43<0.4s\n\u001b[K Class Images Instances Box(P R mAP50 mAP50-95): 100% ━━━━━━━━━━━━ 19/19 1.6it/s 11.7s0.6s\n all 584 90456 0.902 0.833 0.886 0.545\n\n Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n\u001b[K 23/50 13.7G 1.362 0.6348 0.9999 2388 800: 100% ━━━━━━━━━━━━ 512/512 1.8it/s 4:41<0.4s\n\u001b[K Class Images Instances Box(P R mAP50 mAP50-95): 100% ━━━━━━━━━━━━ 19/19 1.6it/s 11.6s0.6s\n all 584 90456 0.901 0.83 0.882 0.545\n\n Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n\u001b[K 24/50 11.1G 1.362 0.6353 1 2284 800: 100% ━━━━━━━━━━━━ 512/512 1.8it/s 4:39<0.4s\n\u001b[K Class Images Instances Box(P R mAP50 mAP50-95): 100% ━━━━━━━━━━━━ 19/19 1.6it/s 11.8s0.7s\n all 584 90456 0.901 0.838 0.882 0.545\n\n Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n\u001b[K 25/50 9.52G 1.36 0.6314 0.9987 1620 800: 100% ━━━━━━━━━━━━ 512/512 1.8it/s 4:39<0.4s\n\u001b[K Class Images Instances Box(P R mAP50 mAP50-95): 100% ━━━━━━━━━━━━ 19/19 1.7it/s 11.1s0.7s\n all 584 90456 0.903 0.837 0.882 0.546\n\n Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n\u001b[K 26/50 11.4G 1.356 0.6293 0.9977 2145 800: 100% ━━━━━━━━━━━━ 512/512 1.8it/s 4:45<0.4s\n\u001b[K Class Images Instances Box(P R mAP50 mAP50-95): 100% ━━━━━━━━━━━━ 19/19 1.6it/s 11.9s0.6s\n all 584 90456 0.902 0.835 0.884 0.547\n\n Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n\u001b[K 27/50 11.8G 1.353 0.6294 0.9982 2334 800: 100% ━━━━━━━━━━━━ 512/512 1.8it/s 4:40<0.4s\n\u001b[K Class Images Instances Box(P R mAP50 mAP50-95): 100% ━━━━━━━━━━━━ 19/19 1.7it/s 11.5s0.6s\n all 584 90456 0.902 0.838 0.89 0.55\n\n Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n\u001b[K 28/50 14.3G 1.35 0.6254 0.9954 2831 800: 100% ━━━━━━━━━━━━ 512/512 1.8it/s 4:42<0.4s\n\u001b[K Class Images Instances Box(P R mAP50 mAP50-95): 100% ━━━━━━━━━━━━ 19/19 1.6it/s 12.0s0.7s\n all 584 90456 0.902 0.839 0.89 0.548\n\n Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n\u001b[K 29/50 11.6G 1.348 0.6233 0.9973 2048 800: 100% ━━━━━━━━━━━━ 512/512 1.8it/s 4:43<0.4s\n\u001b[K Class Images Instances Box(P R mAP50 mAP50-95): 100% ━━━━━━━━━━━━ 19/19 1.7it/s 11.5s0.6s\n all 584 90456 0.903 0.839 0.889 0.55\n\n Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n\u001b[K 30/50 13G 1.347 0.6208 0.9952 1730 800: 100% ━━━━━━━━━━━━ 512/512 1.8it/s 4:46<0.4s\n\u001b[K Class Images Instances Box(P R mAP50 mAP50-95): 100% ━━━━━━━━━━━━ 19/19 1.7it/s 11.5s0.7s\n all 584 90456 0.904 0.839 0.892 0.551\n\n Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n\u001b[K 31/50 13.9G 1.345 0.6187 0.9946 1832 800: 100% ━━━━━━━━━━━━ 512/512 1.8it/s 4:46<0.3s\n\u001b[K Class Images Instances Box(P R mAP50 mAP50-95): 100% ━━━━━━━━━━━━ 19/19 1.7it/s 11.2s0.7s\n all 584 90456 0.909 0.836 0.891 0.551\n\n Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n\u001b[K 32/50 12.3G 1.35 0.6191 0.9955 2375 800: 100% ━━━━━━━━━━━━ 512/512 1.8it/s 4:40<0.4s\n\u001b[K Class Images Instances Box(P R mAP50 mAP50-95): 100% ━━━━━━━━━━━━ 19/19 1.7it/s 11.3s0.6s\n all 584 90456 0.904 0.842 0.892 0.553\n\n Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n\u001b[K 33/50 8.47G 1.313 0.6057 0.9904 3858 800: 3% ──────────── 17/512 1.8it/s 8.8s<4:29\n","output_type":"stream"},{"name":"stderr","text":"Exception in thread Thread-37 (_pin_memory_loop):\nTraceback (most recent call last):\n File \"/usr/lib/python3.12/threading.py\", line 1075, in _bootstrap_inner\n","output_type":"stream"},{"traceback":["\u001b[0;31m---------------------------------------------------------------------------\u001b[0m","\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)","\u001b[0;32m/tmp/ipykernel_57/2567830867.py\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 9\u001b[0m \u001b[0mmodel\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mYOLO\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'yolov8n.pt'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 10\u001b[0;31m model.train(\n\u001b[0m\u001b[1;32m 11\u001b[0m \u001b[0mdevice\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'0'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 12\u001b[0m \u001b[0mdata\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mFIXED_YAML_PATH\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n","\u001b[0;32m/usr/local/lib/python3.12/dist-packages/ultralytics/engine/model.py\u001b[0m in \u001b[0;36mtrain\u001b[0;34m(self, trainer, **kwargs)\u001b[0m\n\u001b[1;32m 790\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmodel\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtrainer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmodel\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 791\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 792\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtrainer\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtrain\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 793\u001b[0m \u001b[0;31m# Update model and cfg after training\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 794\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mRANK\u001b[0m \u001b[0;32min\u001b[0m \u001b[0;34m{\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n","\u001b[0;32m/usr/local/lib/python3.12/dist-packages/ultralytics/engine/trainer.py\u001b[0m in \u001b[0;36mtrain\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 244\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 245\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 246\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_do_train\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 247\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 248\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m_setup_scheduler\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n","\u001b[0;32m/usr/local/lib/python3.12/dist-packages/ultralytics/engine/trainer.py\u001b[0m in \u001b[0;36m_do_train\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 437\u001b[0m \u001b[0mloss\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mloss_items\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0munwrap_model\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmodel\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mloss\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbatch\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mpreds\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 438\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 439\u001b[0;31m \u001b[0mloss\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mloss_items\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmodel\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbatch\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 440\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mloss\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mloss\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msum\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 441\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mRANK\u001b[0m \u001b[0;34m!=\u001b[0m \u001b[0;34m-\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n","\u001b[0;32m/usr/local/lib/python3.12/dist-packages/torch/nn/modules/module.py\u001b[0m in \u001b[0;36m_wrapped_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1774\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_compiled_call_impl\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;31m# type: ignore[misc]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1775\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1776\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_call_impl\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1777\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1778\u001b[0m \u001b[0;31m# torchrec tests the code consistency with the following code\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n","\u001b[0;32m/usr/local/lib/python3.12/dist-packages/torch/nn/modules/module.py\u001b[0m in \u001b[0;36m_call_impl\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 1785\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0m_global_backward_pre_hooks\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0m_global_backward_hooks\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1786\u001b[0m or _global_forward_hooks or _global_forward_pre_hooks):\n\u001b[0;32m-> 1787\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mforward_call\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 1788\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1789\u001b[0m \u001b[0mresult\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n","\u001b[0;32m/usr/local/lib/python3.12/dist-packages/ultralytics/nn/tasks.py\u001b[0m in \u001b[0;36mforward\u001b[0;34m(self, x, *args, **kwargs)\u001b[0m\n\u001b[1;32m 139\u001b[0m \"\"\"\n\u001b[1;32m 140\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0misinstance\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mdict\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0;31m# for cases of training and validating while training.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 141\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mloss\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 142\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpredict\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 143\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n","\u001b[0;32m/usr/local/lib/python3.12/dist-packages/ultralytics/nn/tasks.py\u001b[0m in \u001b[0;36mloss\u001b[0;34m(self, batch, preds)\u001b[0m\n\u001b[1;32m 333\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mpreds\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 334\u001b[0m \u001b[0mpreds\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mforward\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbatch\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"img\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 335\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcriterion\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mpreds\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbatch\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 336\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 337\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0minit_criterion\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n","\u001b[0;32m/usr/local/lib/python3.12/dist-packages/ultralytics/utils/loss.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, preds, batch)\u001b[0m\n\u001b[1;32m 469\u001b[0m ) -> tuple[torch.Tensor, torch.Tensor]:\n\u001b[1;32m 470\u001b[0m \u001b[0;34m\"\"\"Calculate the sum of the loss for box, cls and dfl multiplied by batch size.\"\"\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 471\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mloss\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mparse_output\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mpreds\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbatch\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 472\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 473\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0mloss\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mpreds\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mdict\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mstr\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtorch\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mTensor\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbatch\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mdict\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mstr\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtorch\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mTensor\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m->\u001b[0m \u001b[0mtuple\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mtorch\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mTensor\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtorch\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mTensor\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n","\u001b[0;32m/usr/local/lib/python3.12/dist-packages/ultralytics/utils/loss.py\u001b[0m in \u001b[0;36mloss\u001b[0;34m(self, preds, batch)\u001b[0m\n\u001b[1;32m 474\u001b[0m \u001b[0;34m\"\"\"Calculate detection loss using assigned targets.\"\"\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 475\u001b[0m \u001b[0mbatch_size\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mpreds\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m\"boxes\"\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mshape\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 476\u001b[0;31m \u001b[0mloss\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mloss_detach\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_assigned_targets_and_loss\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mpreds\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mbatch\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 477\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mloss\u001b[0m \u001b[0;34m*\u001b[0m \u001b[0mbatch_size\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mloss_detach\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 478\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n","\u001b[0;32m/usr/local/lib/python3.12/dist-packages/ultralytics/utils/loss.py\u001b[0m in \u001b[0;36mget_assigned_targets_and_loss\u001b[0;34m(self, preds, batch)\u001b[0m\n\u001b[1;32m 426\u001b[0m )\n\u001b[1;32m 427\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 428\u001b[0;31m \u001b[0mtarget_scores_sum\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mmax\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mtarget_scores\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0msum\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 429\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 430\u001b[0m \u001b[0;31m# Cls loss with optional class weighting\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n","\u001b[0;31mKeyboardInterrupt\u001b[0m: "],"ename":"KeyboardInterrupt","evalue":"","output_type":"error"},{"name":"stderr","text":" self.run()\n File \"/usr/lib/python3.12/threading.py\", line 1012, in run\n self._target(*self._args, **self._kwargs)\n File \"/usr/local/lib/python3.12/dist-packages/torch/utils/data/_utils/pin_memory.py\", line 52, in _pin_memory_loop\n do_one_step()\n File \"/usr/local/lib/python3.12/dist-packages/torch/utils/data/_utils/pin_memory.py\", line 28, in do_one_step\n r = in_queue.get(timeout=MP_STATUS_CHECK_INTERVAL)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/lib/python3.12/multiprocessing/queues.py\", line 122, in get\n return _ForkingPickler.loads(res)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/local/lib/python3.12/dist-packages/torch/multiprocessing/reductions.py\", line 540, in rebuild_storage_fd\n fd = df.detach()\n ^^^^^^^^^^^\n File \"/usr/lib/python3.12/multiprocessing/resource_sharer.py\", line 57, in detach\n with _resource_sharer.get_connection(self._id) as conn:\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/lib/python3.12/multiprocessing/resource_sharer.py\", line 86, in get_connection\n c = Client(address, authkey=process.current_process().authkey)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/lib/python3.12/multiprocessing/connection.py\", line 519, in Client\n c = SocketClient(address)\n ^^^^^^^^^^^^^^^^^^^^^\n File \"/usr/lib/python3.12/multiprocessing/connection.py\", line 647, in SocketClient\n s.connect(address)\nFileNotFoundError: [Errno 2] No such file or directory\n","output_type":"stream"}],"execution_count":10},{"cell_type":"markdown","source":"# Download Weights .zip","metadata":{}},{"cell_type":"code","source":"import shutil\n\nfolder_path = '/kaggle/working/runs/detect/kaggle/working/runs/exp-6'\nzip_path = '/kaggle/working/exp-6.zip'\n\nshutil.make_archive('/kaggle/working/exp-6', 'zip', folder_path)\nprint(\"Weights saved to !\", zip_path)\n\nfrom IPython.display import FileLink\nFileLink(zip_path)","metadata":{"trusted":true,"execution":{"iopub.status.busy":"2026-05-03T13:36:50.386531Z","iopub.execute_input":"2026-05-03T13:36:50.387428Z","iopub.status.idle":"2026-05-03T13:37:03.678219Z","shell.execute_reply.started":"2026-05-03T13:36:50.387392Z","shell.execute_reply":"2026-05-03T13:37:03.677577Z"}},"outputs":[{"name":"stdout","text":"Weights saved to ! /kaggle/working/exp-6.zip\n","output_type":"stream"},{"execution_count":11,"output_type":"execute_result","data":{"text/plain":"/kaggle/working/exp-6.zip","text/html":"/kaggle/working/exp-6.zip
"},"metadata":{}}],"execution_count":11},{"cell_type":"markdown","source":"# Resume Training","metadata":{}},{"cell_type":"code","source":"import ultralytics\n\nmodel = YOLO(\"/kaggle/input/weights/last.pt\")\nmodel.train(resume=True)","metadata":{"trusted":true,"execution":{"execution_failed":"2026-05-03T10:14:10.463Z"}},"outputs":[],"execution_count":null}]} \ No newline at end of file diff --git a/test/01.jpeg b/test/01.jpeg new file mode 100644 index 0000000..171cbd9 Binary files /dev/null and b/test/01.jpeg differ diff --git a/test/02.jpeg b/test/02.jpeg new file mode 100644 index 0000000..d16abb0 Binary files /dev/null and b/test/02.jpeg differ diff --git a/test/03.jpeg b/test/03.jpeg new file mode 100644 index 0000000..641390c Binary files /dev/null and b/test/03.jpeg differ diff --git a/test/04.jpeg b/test/04.jpeg new file mode 100644 index 0000000..c10d208 Binary files /dev/null and b/test/04.jpeg differ diff --git a/test/05.jpeg b/test/05.jpeg new file mode 100644 index 0000000..dacdc4e Binary files /dev/null and b/test/05.jpeg differ diff --git a/test/06.jpeg b/test/06.jpeg new file mode 100644 index 0000000..f7abde5 Binary files /dev/null and b/test/06.jpeg differ diff --git a/test/07.jpeg b/test/07.jpeg new file mode 100644 index 0000000..9f6cf1d Binary files /dev/null and b/test/07.jpeg differ diff --git a/test/08.jpeg b/test/08.jpeg new file mode 100644 index 0000000..9ec3335 Binary files /dev/null and b/test/08.jpeg differ diff --git a/test/09.jpeg b/test/09.jpeg new file mode 100644 index 0000000..5b0377e Binary files /dev/null and b/test/09.jpeg differ diff --git a/test/10.jpeg b/test/10.jpeg new file mode 100644 index 0000000..64dd3c2 Binary files /dev/null and b/test/10.jpeg differ diff --git a/test/11.jpeg b/test/11.jpeg new file mode 100644 index 0000000..5cd8540 Binary files /dev/null and b/test/11.jpeg differ diff --git a/test/12.jpeg b/test/12.jpeg new file mode 100644 index 0000000..49b5761 Binary files /dev/null and b/test/12.jpeg differ diff --git a/test/13.jpeg b/test/13.jpeg new file mode 100644 index 0000000..7882742 Binary files /dev/null and b/test/13.jpeg differ diff --git a/test/14.jpeg b/test/14.jpeg new file mode 100644 index 0000000..8f45d83 Binary files /dev/null and b/test/14.jpeg differ diff --git a/test/15.jpeg b/test/15.jpeg new file mode 100644 index 0000000..f5b8e16 Binary files /dev/null and b/test/15.jpeg differ diff --git a/test/16.jpeg b/test/16.jpeg new file mode 100644 index 0000000..abb3551 Binary files /dev/null and b/test/16.jpeg differ diff --git a/test/17.jpeg b/test/17.jpeg new file mode 100644 index 0000000..9f6cf1d Binary files /dev/null and b/test/17.jpeg differ diff --git a/test/18.jpeg b/test/18.jpeg new file mode 100644 index 0000000..c10d208 Binary files /dev/null and b/test/18.jpeg differ diff --git a/test/19.jpeg b/test/19.jpeg new file mode 100644 index 0000000..c56e8da Binary files /dev/null and b/test/19.jpeg differ diff --git a/test/20.jpeg b/test/20.jpeg new file mode 100644 index 0000000..d16abb0 Binary files /dev/null and b/test/20.jpeg differ diff --git a/test/21.jpeg b/test/21.jpeg new file mode 100644 index 0000000..171cbd9 Binary files /dev/null and b/test/21.jpeg differ diff --git a/test/22.jpeg b/test/22.jpeg new file mode 100644 index 0000000..f7abde5 Binary files /dev/null and b/test/22.jpeg differ diff --git a/test/23.jpeg b/test/23.jpeg new file mode 100644 index 0000000..dacdc4e Binary files /dev/null and b/test/23.jpeg differ diff --git a/test/24.jpeg b/test/24.jpeg new file mode 100644 index 0000000..9ec3335 Binary files /dev/null and b/test/24.jpeg differ diff --git a/test/25.jpeg b/test/25.jpeg new file mode 100644 index 0000000..641390c Binary files /dev/null and b/test/25.jpeg differ diff --git a/test/26.jpeg b/test/26.jpeg new file mode 100644 index 0000000..80eddd9 Binary files /dev/null and b/test/26.jpeg differ diff --git a/test/27.jpeg b/test/27.jpeg new file mode 100644 index 0000000..4d51e30 Binary files /dev/null and b/test/27.jpeg differ diff --git a/test/28.jpeg b/test/28.jpeg new file mode 100644 index 0000000..583559a Binary files /dev/null and b/test/28.jpeg differ diff --git a/test/29.jpeg b/test/29.jpeg new file mode 100644 index 0000000..df2a397 Binary files /dev/null and b/test/29.jpeg differ diff --git a/test/30.jpeg b/test/30.jpeg new file mode 100644 index 0000000..9d64621 Binary files /dev/null and b/test/30.jpeg differ diff --git a/test/31.jpeg b/test/31.jpeg new file mode 100644 index 0000000..05dc7e0 Binary files /dev/null and b/test/31.jpeg differ diff --git a/test/32.jpeg b/test/32.jpeg new file mode 100644 index 0000000..297cc5b Binary files /dev/null and b/test/32.jpeg differ diff --git a/test/33.jpeg b/test/33.jpeg new file mode 100644 index 0000000..8a72aa7 Binary files /dev/null and b/test/33.jpeg differ diff --git a/test/34.jpeg b/test/34.jpeg new file mode 100644 index 0000000..ba2a5c3 Binary files /dev/null and b/test/34.jpeg differ diff --git a/test/35.jpeg b/test/35.jpeg new file mode 100644 index 0000000..cff5366 Binary files /dev/null and b/test/35.jpeg differ diff --git a/test/36.jpeg b/test/36.jpeg new file mode 100644 index 0000000..df44208 Binary files /dev/null and b/test/36.jpeg differ diff --git a/test/37.jpeg b/test/37.jpeg new file mode 100644 index 0000000..3b7f679 Binary files /dev/null and b/test/37.jpeg differ diff --git a/test/38.jpeg b/test/38.jpeg new file mode 100644 index 0000000..e088325 Binary files /dev/null and b/test/38.jpeg differ diff --git a/test/39.jpeg b/test/39.jpeg new file mode 100644 index 0000000..ce568e4 Binary files /dev/null and b/test/39.jpeg differ diff --git a/test/40.jpeg b/test/40.jpeg new file mode 100644 index 0000000..edb3b58 Binary files /dev/null and b/test/40.jpeg differ diff --git a/test/41.jpeg b/test/41.jpeg new file mode 100644 index 0000000..360817e Binary files /dev/null and b/test/41.jpeg differ diff --git a/test/42.jpeg b/test/42.jpeg new file mode 100644 index 0000000..83bcf2f Binary files /dev/null and b/test/42.jpeg differ diff --git a/test/43.jpeg b/test/43.jpeg new file mode 100644 index 0000000..eb98d0f Binary files /dev/null and b/test/43.jpeg differ diff --git a/test/44.jpeg b/test/44.jpeg new file mode 100644 index 0000000..267881b Binary files /dev/null and b/test/44.jpeg differ diff --git a/test/45.jpeg b/test/45.jpeg new file mode 100644 index 0000000..5843000 Binary files /dev/null and b/test/45.jpeg differ diff --git a/test/46.jpeg b/test/46.jpeg new file mode 100644 index 0000000..34a81fc Binary files /dev/null and b/test/46.jpeg differ diff --git a/test/47.jpeg b/test/47.jpeg new file mode 100644 index 0000000..2ffedc9 Binary files /dev/null and b/test/47.jpeg differ diff --git a/test/48.jpeg b/test/48.jpeg new file mode 100644 index 0000000..ce5a656 Binary files /dev/null and b/test/48.jpeg differ diff --git a/test/49.jpeg b/test/49.jpeg new file mode 100644 index 0000000..df42d54 Binary files /dev/null and b/test/49.jpeg differ diff --git a/test/50.jpeg b/test/50.jpeg new file mode 100644 index 0000000..f9981c9 Binary files /dev/null and b/test/50.jpeg differ diff --git a/test/51.jpeg b/test/51.jpeg new file mode 100644 index 0000000..ff23c8e Binary files /dev/null and b/test/51.jpeg differ diff --git a/test/52.jpeg b/test/52.jpeg new file mode 100644 index 0000000..bc86359 Binary files /dev/null and b/test/52.jpeg differ diff --git a/test/53.jpeg b/test/53.jpeg new file mode 100644 index 0000000..f2f2356 Binary files /dev/null and b/test/53.jpeg differ diff --git a/test/54.jpeg b/test/54.jpeg new file mode 100644 index 0000000..159c29e Binary files /dev/null and b/test/54.jpeg differ diff --git a/test/55.jpeg b/test/55.jpeg new file mode 100644 index 0000000..32b4a8a Binary files /dev/null and b/test/55.jpeg differ diff --git a/test/56.jpeg b/test/56.jpeg new file mode 100644 index 0000000..08f82d7 Binary files /dev/null and b/test/56.jpeg differ diff --git a/test/57.jpeg b/test/57.jpeg new file mode 100644 index 0000000..4f1e729 Binary files /dev/null and b/test/57.jpeg differ diff --git a/test/58.jpeg b/test/58.jpeg new file mode 100644 index 0000000..a244261 Binary files /dev/null and b/test/58.jpeg differ diff --git a/test/59.jpeg b/test/59.jpeg new file mode 100644 index 0000000..6b11cd7 Binary files /dev/null and b/test/59.jpeg differ diff --git a/test/60.jpeg b/test/60.jpeg new file mode 100644 index 0000000..de3c3a1 Binary files /dev/null and b/test/60.jpeg differ diff --git a/test/61.jpeg b/test/61.jpeg new file mode 100644 index 0000000..f44c847 Binary files /dev/null and b/test/61.jpeg differ diff --git a/test/62.jpeg b/test/62.jpeg new file mode 100644 index 0000000..9522e5d Binary files /dev/null and b/test/62.jpeg differ diff --git a/test/63.jpeg b/test/63.jpeg new file mode 100644 index 0000000..a768c62 Binary files /dev/null and b/test/63.jpeg differ diff --git a/test/64.jpeg b/test/64.jpeg new file mode 100644 index 0000000..e6eb790 Binary files /dev/null and b/test/64.jpeg differ diff --git a/test/rename.ps1 b/test/rename.ps1 new file mode 100644 index 0000000..707d936 --- /dev/null +++ b/test/rename.ps1 @@ -0,0 +1,7 @@ +$i = 1 + +Get-ChildItem -File | Where-Object { $_.Extension -match "jpg|jpeg|png" } | Sort-Object Name | ForEach-Object { + $newName = "{0:D2}{1}" -f $i, $_.Extension + Rename-Item $_.FullName -NewName $newName + $i++ +}