From 69b307cc07763713119efae5d2204037d5cc3456 Mon Sep 17 00:00:00 2001 From: Hamza Zakaria Date: Sun, 3 May 2026 15:10:09 +0100 Subject: [PATCH] Notebook --- shelf-products-detection-train-yolov8n.ipynb | 1 + 1 file changed, 1 insertion(+) create mode 100644 shelf-products-detection-train-yolov8n.ipynb 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