{ "cells": [ { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Sat Mar 4 21:14:41 2023 \n", "+---------------------------------------------------------------------------------------+\n", "| NVIDIA-SMI 531.18 Driver Version: 531.18 CUDA Version: 12.1 |\n", "|-----------------------------------------+----------------------+----------------------+\n", "| GPU Name TCC/WDDM | Bus-Id Disp.A | Volatile Uncorr. ECC |\n", "| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |\n", "| | | MIG M. |\n", "|=========================================+======================+======================|\n", "| 0 NVIDIA GeForce GTX 1080 Ti WDDM | 00000000:B3:00.0 On | N/A |\n", "|100% 42C P0 68W / 127W| 1980MiB / 11264MiB | 3% Default |\n", "| | | N/A |\n", "+-----------------------------------------+----------------------+----------------------+\n", " \n", "+---------------------------------------------------------------------------------------+\n", "| Processes: |\n", "| GPU GI CI PID Type Process name GPU Memory |\n", "| ID ID Usage |\n", "|=======================================================================================|\n", "| 0 N/A N/A 1148 C+G ... (x86)\\Audeze\\AudezeHQ\\AudezeHQ.exe N/A |\n", "| 0 N/A N/A 2232 C+G ...GeForce Experience\\NVIDIA Share.exe N/A |\n", "| 0 N/A N/A 6208 C+G ..._x64__rz1tebttyb220\\DolbyAccess.exe N/A |\n", "| 0 N/A N/A 9096 C+G ...CBS_cw5n1h2txyewy\\TextInputHost.exe N/A |\n", "| 0 N/A N/A 9832 C+G ...63.0_x86__zpdnekdrzrea0\\Spotify.exe N/A |\n", "| 0 N/A N/A 10856 C+G ....0_x64__8wekyb3d8bbwe\\HxOutlook.exe N/A |\n", "| 0 N/A N/A 11512 C+G ...2txyewy\\StartMenuExperienceHost.exe N/A |\n", "| 0 N/A N/A 11596 C+G ...GeForce Experience\\NVIDIA Share.exe N/A |\n", "| 0 N/A N/A 12780 C+G ...rPicker\\PowerToys.ColorPickerUI.exe N/A |\n", "| 0 N/A N/A 14676 C+G ...on\\110.0.1587.57\\msedgewebview2.exe N/A |\n", "| 0 N/A N/A 14900 C+G C:\\Windows\\explorer.exe N/A |\n", "| 0 N/A N/A 16116 C+G ...FancyZones\\PowerToys.FancyZones.exe N/A |\n", "| 0 N/A N/A 17548 C+G ...5n1h2txyewy\\ShellExperienceHost.exe N/A |\n", "| 0 N/A N/A 17848 C ...al\\Discord\\app-1.0.9011\\Discord.exe N/A |\n", "| 0 N/A N/A 18064 C+G ...\\cef\\cef.win7x64\\steamwebhelper.exe N/A |\n", "| 0 N/A N/A 20132 C+G ...crosoft\\Edge\\Application\\msedge.exe N/A |\n", "| 0 N/A N/A 20864 C+G ...t.LockApp_cw5n1h2txyewy\\LockApp.exe N/A |\n", "| 0 N/A N/A 20928 C+G ...B\\system_tray\\lghub_system_tray.exe N/A |\n", "| 0 N/A N/A 22896 C+G ...Cloudflare WARP\\Cloudflare WARP.exe N/A |\n", "| 0 N/A N/A 23784 C+G ...__8wekyb3d8bbwe\\WindowsTerminal.exe N/A |\n", "| 0 N/A N/A 24416 C+G ...cal\\Microsoft\\OneDrive\\OneDrive.exe N/A |\n", "| 0 N/A N/A 27532 C+G ...auncher\\PowerToys.PowerLauncher.exe N/A |\n", "| 0 N/A N/A 28696 C+G ...siveControlPanel\\SystemSettings.exe N/A |\n", "| 0 N/A N/A 29184 C+G ...ekyb3d8bbwe\\PhoneExperienceHost.exe N/A |\n", "| 0 N/A N/A 32684 C+G ...nt.CBS_cw5n1h2txyewy\\SearchHost.exe N/A |\n", "| 0 N/A N/A 34624 C+G C:\\Program Files\\LGHUB\\lghub.exe N/A |\n", "| 0 N/A N/A 34692 C+G ...pdnekdrzrea0\\XboxGameBarSpotify.exe N/A |\n", "| 0 N/A N/A 37692 C+G ...4.0_x64__cv1g1gvanyjgm\\WhatsApp.exe N/A |\n", "+---------------------------------------------------------------------------------------+\n" ] } ], "source": [ "!nvidia-smi" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import os\n", "HOME = os.getcwd()\n", "print(HOME)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "C:\\Users\\Gyana\\AppData\\Local\\Programs\\Python\\Python310\\lib\\site-packages\\tqdm\\auto.py:22: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", " from .autonotebook import tqdm as notebook_tqdm\n" ] } ], "source": [ "\n", "from IPython import display\n", "display.clear_output()\n", "\n", "from ultralytics import YOLOV8\n", "ultralytics.checks()" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "!pip install roboflow\n", "\n" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "ename": "ModuleNotFoundError", "evalue": "No module named 'roboflow'", "output_type": "error", "traceback": [ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[1;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)", "Cell \u001b[1;32mIn[2], line 1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mroboflow\u001b[39;00m \u001b[39mimport\u001b[39;00m Roboflow\n\u001b[0;32m 2\u001b[0m rf \u001b[39m=\u001b[39m Roboflow(api_key\u001b[39m=\u001b[39m\u001b[39m\"\u001b[39m\u001b[39m2NdQm1ivtFCAYiOLVTwn\u001b[39m\u001b[39m\"\u001b[39m)\n\u001b[0;32m 3\u001b[0m project \u001b[39m=\u001b[39m rf\u001b[39m.\u001b[39mworkspace(\u001b[39m\"\u001b[39m\u001b[39mhackthethong\u001b[39m\u001b[39m\"\u001b[39m)\u001b[39m.\u001b[39mproject(\u001b[39m\"\u001b[39m\u001b[39mpothole-detection-gmnid\u001b[39m\u001b[39m\"\u001b[39m)\n", "\u001b[1;31mModuleNotFoundError\u001b[0m: No module named 'roboflow'" ] } ], "source": [ "from roboflow import Roboflow\n", "rf = Roboflow(api_key=\"2NdQm1ivtFCAYiOLVTwn\")\n", "project = rf.workspace(\"hackthethong\").project(\"pothole-detection-gmnid\")\n", "dataset = project.version(3).download(\"yolov8\")" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "_cell_guid": "b1076dfc-b9ad-4769-8c92-a6c4dae69d19", "_uuid": "8f2839f25d086af736a60e9eeb907d3b93b6e0e5", "execution": { "iopub.execute_input": "2023-03-04T11:06:34.982368Z", "iopub.status.busy": "2023-03-04T11:06:34.982065Z", "iopub.status.idle": "2023-03-04T11:06:36.155978Z", "shell.execute_reply": "2023-03-04T11:06:36.154454Z", "shell.execute_reply.started": "2023-03-04T11:06:34.982341Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Sat Mar 4 11:06:35 2023 \n", "+-----------------------------------------------------------------------------+\n", "| NVIDIA-SMI 470.82.01 Driver Version: 470.82.01 CUDA Version: 11.4 |\n", "|-------------------------------+----------------------+----------------------+\n", "| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |\n", "| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |\n", "| | | MIG M. |\n", "|===============================+======================+======================|\n", "| 0 Tesla T4 Off | 00000000:00:04.0 Off | 0 |\n", "| N/A 36C P8 9W / 70W | 0MiB / 15109MiB | 0% Default |\n", "| | | N/A |\n", "+-------------------------------+----------------------+----------------------+\n", "| 1 Tesla T4 Off | 00000000:00:05.0 Off | 0 |\n", "| N/A 47C P8 10W / 70W | 0MiB / 15109MiB | 0% Default |\n", "| | | N/A |\n", "+-------------------------------+----------------------+----------------------+\n", " \n", "+-----------------------------------------------------------------------------+\n", "| Processes: |\n", "| GPU GI CI PID Type Process name GPU Memory |\n", "| ID ID Usage |\n", "|=============================================================================|\n", "| No running processes found |\n", "+-----------------------------------------------------------------------------+\n" ] } ], "source": [ "!nvidia-smi" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "execution": { "iopub.execute_input": "2023-03-04T11:06:36.165528Z", "iopub.status.busy": "2023-03-04T11:06:36.162799Z", "iopub.status.idle": "2023-03-04T11:06:36.175759Z", "shell.execute_reply": "2023-03-04T11:06:36.174308Z", "shell.execute_reply.started": "2023-03-04T11:06:36.165476Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "/kaggle/working\n" ] } ], "source": [ "import os\n", "HOME = os.getcwd()\n", "print(HOME)" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "execution": { "iopub.execute_input": "2023-03-04T11:06:36.180607Z", "iopub.status.busy": "2023-03-04T11:06:36.179797Z", "iopub.status.idle": "2023-03-04T11:06:55.605740Z", "shell.execute_reply": "2023-03-04T11:06:55.604691Z", "shell.execute_reply.started": "2023-03-04T11:06:36.180564Z" } }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "Ultralytics YOLOv8.0.20 🚀 Python-3.7.12 torch-1.13.0 CUDA:0 (Tesla T4, 15110MiB)\n", "Setup complete ✅ (2 CPUs, 15.6 GB RAM, 4437.1/8062.4 GB disk)\n" ] } ], "source": [ "# Pip install method (recommended)\n", "\n", "!pip install ultralytics==8.0.20\n", "\n", "from IPython import display\n", "display.clear_output()\n", "\n", "import ultralytics\n", "ultralytics.checks()" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "execution": { "iopub.execute_input": "2023-03-04T11:06:55.608863Z", "iopub.status.busy": "2023-03-04T11:06:55.608358Z", "iopub.status.idle": "2023-03-04T11:06:55.615639Z", "shell.execute_reply": "2023-03-04T11:06:55.613293Z", "shell.execute_reply.started": "2023-03-04T11:06:55.608820Z" } }, "outputs": [], "source": [ "from ultralytics import YOLO\n", "\n", "from IPython.display import display, Image" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.execute_input": "2023-03-04T11:06:55.618151Z", "iopub.status.busy": "2023-03-04T11:06:55.617309Z", "iopub.status.idle": "2023-03-04T11:07:53.787811Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "/kaggle/working/datasets\n", "Collecting roboflow\n", " Downloading roboflow-0.2.32-py3-none-any.whl (50 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m50.2/50.2 kB\u001b[0m \u001b[31m2.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hRequirement already satisfied: opencv-python>=4.1.2 in /opt/conda/lib/python3.7/site-packages (from roboflow) (4.7.0.72)\n", "Collecting wget\n", " Downloading wget-3.2.zip (10 kB)\n", " Preparing metadata (setup.py) ... \u001b[?25ldone\n", "\u001b[?25hRequirement already satisfied: urllib3>=1.26.6 in /opt/conda/lib/python3.7/site-packages (from roboflow) (1.26.14)\n", "Requirement already satisfied: python-dotenv in /opt/conda/lib/python3.7/site-packages (from roboflow) (0.21.1)\n", "Requirement already satisfied: Pillow>=7.1.2 in /opt/conda/lib/python3.7/site-packages (from roboflow) (9.4.0)\n", "Collecting chardet==4.0.0\n", " Downloading chardet-4.0.0-py2.py3-none-any.whl (178 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m178.7/178.7 kB\u001b[0m \u001b[31m8.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hRequirement already satisfied: tqdm>=4.41.0 in /opt/conda/lib/python3.7/site-packages (from roboflow) (4.64.1)\n", "Collecting idna==2.10\n", " Downloading idna-2.10-py2.py3-none-any.whl (58 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m58.8/58.8 kB\u001b[0m \u001b[31m6.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hRequirement already satisfied: matplotlib in /opt/conda/lib/python3.7/site-packages (from roboflow) (3.5.3)\n", "Collecting cycler==0.10.0\n", " Downloading cycler-0.10.0-py2.py3-none-any.whl (6.5 kB)\n", "Collecting requests-toolbelt\n", " Downloading requests_toolbelt-0.10.1-py2.py3-none-any.whl (54 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m54.5/54.5 kB\u001b[0m \u001b[31m6.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hRequirement already satisfied: python-dateutil in /opt/conda/lib/python3.7/site-packages (from roboflow) (2.8.2)\n", "Requirement already satisfied: certifi==2022.12.7 in /opt/conda/lib/python3.7/site-packages (from roboflow) (2022.12.7)\n", "Requirement already satisfied: numpy>=1.18.5 in /opt/conda/lib/python3.7/site-packages (from roboflow) (1.21.6)\n", "Requirement already satisfied: PyYAML>=5.3.1 in /opt/conda/lib/python3.7/site-packages (from roboflow) (6.0)\n", "Requirement already satisfied: requests in /opt/conda/lib/python3.7/site-packages (from roboflow) (2.28.2)\n", "Requirement already satisfied: six in /opt/conda/lib/python3.7/site-packages (from roboflow) (1.16.0)\n", "Collecting pyparsing==2.4.7\n", " Downloading pyparsing-2.4.7-py2.py3-none-any.whl (67 kB)\n", "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m67.8/67.8 kB\u001b[0m \u001b[31m8.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", "\u001b[?25hRequirement already satisfied: kiwisolver>=1.3.1 in /opt/conda/lib/python3.7/site-packages (from roboflow) (1.4.4)\n", "Requirement already satisfied: typing-extensions in /opt/conda/lib/python3.7/site-packages (from kiwisolver>=1.3.1->roboflow) (4.4.0)\n", "Requirement already satisfied: fonttools>=4.22.0 in /opt/conda/lib/python3.7/site-packages (from matplotlib->roboflow) (4.38.0)\n", "Requirement already satisfied: packaging>=20.0 in /opt/conda/lib/python3.7/site-packages (from matplotlib->roboflow) (23.0)\n", "Requirement already satisfied: charset-normalizer<4,>=2 in /opt/conda/lib/python3.7/site-packages (from requests->roboflow) (2.1.1)\n", "Building wheels for collected packages: wget\n", " Building wheel for wget (setup.py) ... \u001b[?25ldone\n", "\u001b[?25h Created wheel for wget: filename=wget-3.2-py3-none-any.whl size=9674 sha256=c21353920025ab2a7acd6c41f94a830e3de43131a8eb128b751e9613559978c7\n", " Stored in directory: /root/.cache/pip/wheels/e1/e8/db/ebe4dcd7d7d11208c1e4e4ef246cea4fcc8d463c93405a6555\n", "Successfully built wget\n", "Installing collected packages: wget, pyparsing, idna, cycler, chardet, requests-toolbelt, roboflow\n", " Attempting uninstall: pyparsing\n", " Found existing installation: pyparsing 3.0.9\n", " Uninstalling pyparsing-3.0.9:\n", " Successfully uninstalled pyparsing-3.0.9\n", " Attempting uninstall: idna\n", " Found existing installation: idna 3.4\n", " Uninstalling idna-3.4:\n", " Successfully uninstalled idna-3.4\n", " Attempting uninstall: cycler\n", " Found existing installation: cycler 0.11.0\n", " Uninstalling cycler-0.11.0:\n", " Successfully uninstalled cycler-0.11.0\n", "\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n", "librosa 0.10.0 requires soundfile>=0.12.1, but you have soundfile 0.11.0 which is incompatible.\n", "cloud-tpu-client 0.10 requires google-api-python-client==1.8.0, but you have google-api-python-client 2.79.0 which is incompatible.\n", "apache-beam 2.44.0 requires dill<0.3.2,>=0.3.1.1, but you have dill 0.3.6 which is incompatible.\u001b[0m\u001b[31m\n", "\u001b[0mSuccessfully installed chardet-4.0.0 cycler-0.10.0 idna-2.10 pyparsing-2.4.7 requests-toolbelt-0.10.1 roboflow-0.2.32 wget-3.2\n", "\u001b[33mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv\u001b[0m\u001b[33m\n", "loading Roboflow workspace...\n", "loading Roboflow project...\n", "Downloading Dataset Version Zip in Pothole-detection-1 to yolov8: 97% [254164992 / 260273386] bytes" ] }, { "name": "stderr", "output_type": "stream", "text": [ "IOPub message rate exceeded.\n", "The notebook server will temporarily stop sending output\n", "to the client in order to avoid crashing it.\n", "To change this limit, set the config variable\n", "`--NotebookApp.iopub_msg_rate_limit`.\n", "\n", "Current values:\n", "NotebookApp.iopub_msg_rate_limit=1000.0 (msgs/sec)\n", "NotebookApp.rate_limit_window=3.0 (secs)\n", "\n" ] } ], "source": [ "!mkdir {HOME}/datasets\n", "%cd {HOME}/datasets\n", "\n", "!pip install roboflow\n", "\n", "from roboflow import Roboflow\n", "rf = Roboflow(api_key=\"2NdQm1ivtFCAYiOLVTwn\")\n", "project = rf.workspace(\"hackthethong\").project(\"pothole-detection-gmnid\")\n", "dataset = project.version(1).download(\"yolov8\")" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "execution": { "iopub.execute_input": "2023-03-04T11:16:50.287812Z", "iopub.status.busy": "2023-03-04T11:16:50.287079Z", "iopub.status.idle": "2023-03-04T12:12:27.477858Z", "shell.execute_reply": "2023-03-04T12:12:27.476221Z", "shell.execute_reply.started": "2023-03-04T11:16:50.287774Z" } }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "/kaggle/working\n", "Ultralytics YOLOv8.0.20 🚀 Python-3.7.12 torch-1.13.0 CUDA:0 (Tesla T4, 15110MiB)\n", " CUDA:1 (Tesla T4, 15110MiB)\n", "\u001b[34m\u001b[1myolo/engine/trainer: \u001b[0mtask=detect, mode=train, model=yolov8s.yaml, data=/kaggle/working/datasets/Pothole-detection-1/data.yaml, epochs=215, patience=50, batch=24, imgsz=800, save=True, cache=False, device=(0, 1), workers=8, project=None, name=None, exist_ok=False, pretrained=False, optimizer=SGD, verbose=True, seed=0, deterministic=True, single_cls=False, image_weights=False, rect=False, cos_lr=False, close_mosaic=10, resume=False, overlap_mask=True, mask_ratio=4, dropout=False, val=True, save_json=False, save_hybrid=False, conf=0.001, iou=0.7, max_det=300, half=False, dnn=False, plots=True, source=ultralytics/assets/, show=False, save_txt=False, save_conf=False, save_crop=False, hide_labels=False, hide_conf=False, vid_stride=1, line_thickness=3, visualize=False, augment=False, agnostic_nms=False, classes=None, retina_masks=False, boxes=True, format=torchscript, keras=False, optimize=False, int8=False, dynamic=False, simplify=False, opset=17, workspace=4, nms=False, lr0=0.01, lrf=0.01, momentum=0.937, weight_decay=0.001, warmup_epochs=3.0, warmup_momentum=0.8, warmup_bias_lr=0.1, box=7.5, cls=0.5, dfl=1.5, fl_gamma=0.0, label_smoothing=0.0, nbs=64, hsv_h=0.015, hsv_s=0.7, hsv_v=0.4, degrees=0.0, translate=0.1, scale=0.5, shear=0.0, perspective=0.0, flipud=0.0, fliplr=0.5, mosaic=1.0, mixup=0.0, copy_paste=0.0, cfg=None, v5loader=False, save_dir=runs/detect/train3\n", "Overriding model.yaml nc=80 with nc=1\n", "\n", " from n params module arguments \n", " 0 -1 1 928 ultralytics.nn.modules.Conv [3, 32, 3, 2] \n", " 1 -1 1 18560 ultralytics.nn.modules.Conv [32, 64, 3, 2] \n", " 2 -1 1 29056 ultralytics.nn.modules.C2f [64, 64, 1, True] \n", " 3 -1 1 73984 ultralytics.nn.modules.Conv [64, 128, 3, 2] \n", " 4 -1 2 197632 ultralytics.nn.modules.C2f [128, 128, 2, True] \n", " 5 -1 1 295424 ultralytics.nn.modules.Conv [128, 256, 3, 2] \n", " 6 -1 2 788480 ultralytics.nn.modules.C2f [256, 256, 2, True] \n", " 7 -1 1 1180672 ultralytics.nn.modules.Conv [256, 512, 3, 2] \n", " 8 -1 1 1838080 ultralytics.nn.modules.C2f [512, 512, 1, True] \n", " 9 -1 1 656896 ultralytics.nn.modules.SPPF [512, 512, 5] \n", " 10 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest'] \n", " 11 [-1, 6] 1 0 ultralytics.nn.modules.Concat [1] \n", " 12 -1 1 591360 ultralytics.nn.modules.C2f [768, 256, 1] \n", " 13 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest'] \n", " 14 [-1, 4] 1 0 ultralytics.nn.modules.Concat [1] \n", " 15 -1 1 148224 ultralytics.nn.modules.C2f [384, 128, 1] \n", " 16 -1 1 147712 ultralytics.nn.modules.Conv [128, 128, 3, 2] \n", " 17 [-1, 12] 1 0 ultralytics.nn.modules.Concat [1] \n", " 18 -1 1 493056 ultralytics.nn.modules.C2f [384, 256, 1] \n", " 19 -1 1 590336 ultralytics.nn.modules.Conv [256, 256, 3, 2] \n", " 20 [-1, 9] 1 0 ultralytics.nn.modules.Concat [1] \n", " 21 -1 1 1969152 ultralytics.nn.modules.C2f [768, 512, 1] \n", " 22 [15, 18, 21] 1 2116435 ultralytics.nn.modules.Detect [1, [128, 256, 512]] \n", "Model summary: 225 layers, 11135987 parameters, 11135971 gradients, 28.6 GFLOPs\n", "\n", "Transferred 349/355 items from pretrained weights\n", "DDP settings: RANK 0, WORLD_SIZE 2, DEVICE cuda:0\n", "Overriding model.yaml nc=80 with nc=1\n", "\n", " from n params module arguments \n", " 0 -1 1 928 ultralytics.nn.modules.Conv [3, 32, 3, 2] \n", " 1 -1 1 18560 ultralytics.nn.modules.Conv [32, 64, 3, 2] \n", " 2 -1 1 29056 ultralytics.nn.modules.C2f [64, 64, 1, True] \n", " 3 -1 1 73984 ultralytics.nn.modules.Conv [64, 128, 3, 2] \n", " 4 -1 2 197632 ultralytics.nn.modules.C2f [128, 128, 2, True] \n", " 5 -1 1 295424 ultralytics.nn.modules.Conv [128, 256, 3, 2] \n", " 6 -1 2 788480 ultralytics.nn.modules.C2f [256, 256, 2, True] \n", " 7 -1 1 1180672 ultralytics.nn.modules.Conv [256, 512, 3, 2] \n", " 8 -1 1 1838080 ultralytics.nn.modules.C2f [512, 512, 1, True] \n", " 9 -1 1 656896 ultralytics.nn.modules.SPPF [512, 512, 5] \n", " 10 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest'] \n", " 11 [-1, 6] 1 0 ultralytics.nn.modules.Concat [1] \n", " 12 -1 1 591360 ultralytics.nn.modules.C2f [768, 256, 1] \n", " 13 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest'] \n", " 14 [-1, 4] 1 0 ultralytics.nn.modules.Concat [1] \n", " 15 -1 1 148224 ultralytics.nn.modules.C2f [384, 128, 1] \n", " 16 -1 1 147712 ultralytics.nn.modules.Conv [128, 128, 3, 2] \n", " 17 [-1, 12] 1 0 ultralytics.nn.modules.Concat [1] \n", " 18 -1 1 493056 ultralytics.nn.modules.C2f [384, 256, 1] \n", " 19 -1 1 590336 ultralytics.nn.modules.Conv [256, 256, 3, 2] \n", " 20 [-1, 9] 1 0 ultralytics.nn.modules.Concat [1] \n", " 21 -1 1 1969152 ultralytics.nn.modules.C2f [768, 512, 1] \n", " 22 [15, 18, 21] 1 2116435 ultralytics.nn.modules.Detect [1, [128, 256, 512]] \n", "YOLOv8s summary: 225 layers, 11135987 parameters, 11135971 gradients, 28.6 GFLOPs\n", "\n", "\u001b[34m\u001b[1moptimizer:\u001b[0m SGD(lr=0.01) with parameter groups 57 weight(decay=0.0), 64 weight(decay=0.0011250000000000001), 63 bias\n", "\u001b[34m\u001b[1mtrain: \u001b[0mScanning /kaggle/working/datasets/Pothole-detection-1/train/labels.cache.\u001b[0m\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), CLAHE(p=0.01, clip_limit=(1, 4.0), tile_grid_size=(8, 8))\n", "\u001b[34m\u001b[1mval: \u001b[0mScanning /kaggle/working/datasets/Pothole-detection-1/valid/labels.cache...\u001b[0m\n", "Image sizes 800 train, 800 val\n", "Using 2 dataloader workers\n", "Logging results to \u001b[1mruns/detect/train3\u001b[0m\n", "Starting training for 215 epochs...\n", "\n", " Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n", " 1/215 5.86G 3.481 4.528 4.09 7 800: 1\n", " Class Images Instances Box(P R mAP50 m\n", " all 357 941 0.000902 0.0967 0.000495 0.000148\n", "\n", " Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n", " 2/215 6.96G 3.266 3.481 3.476 2 800: 1\n", " Class Images Instances Box(P R mAP50 m\n", " all 357 941 0.000937 0.0786 0.000536 0.000168\n", "\n", " Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n", " 3/215 6.96G 2.43 2.349 2.433 7 800: 1\n", " Class Images Instances Box(P R mAP50 m\n", " all 357 941 0.00105 0.00213 0.00035 0.000101\n", "\n", " Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n", " 4/215 6.96G 1.867 1.71 1.77 8 800: 1\n", " Class Images Instances Box(P R mAP50 m\n", " all 357 941 0.00488 0.0117 0.0025 0.00104\n", "\n", " Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n", " 5/215 6.96G 1.549 1.331 1.48 3 800: 1\n", " Class Images Instances Box(P R mAP50 m\n", " all 357 941 0.023 0.0266 0.00589 0.0015\n", "\n", " Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n", " 6/215 6.96G 1.341 1.113 1.34 17 800: 1\n", " Class Images Instances Box(P R mAP50 m\n", " all 357 941 0.00154 0.00531 0.000551 0.000166\n", "\n", " Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n", " 7/215 6.96G 1.187 0.9461 1.234 14 800: 1\n", " Class Images Instances Box(P R mAP50 m\n", " all 357 941 0.00854 0.0298 0.00488 0.00147\n", "\n", " Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n", " 8/215 6.96G 1.08 0.8943 1.175 8 800: 1\n", " Class Images Instances Box(P R mAP50 m\n", " all 357 941 0.0174 0.0765 0.0116 0.00329\n", "\n", " Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n", " 9/215 6.96G 1.012 0.8116 1.133 5 800: 1\n", " Class Images Instances Box(P R mAP50 m\n", " all 357 941 0.0058 0.0085 0.00295 0.00103\n", "\n", " Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n", " 10/215 6.96G 0.9529 0.756 1.114 6 800: 1\n", " Class Images Instances Box(P R mAP50 m\n", " all 357 941 0.0551 0.0351 0.0156 0.00493\n", "\n", " Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n", " 11/215 6.96G 0.8946 0.7085 1.069 3 800: 1\n", " Class Images Instances Box(P R mAP50 m\n", " all 357 941 0.00808 0.051 0.00986 0.00449\n", "\n", " Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n", " 12/215 6.96G 0.8897 0.7045 1.057 4 800: 1\n", " Class Images Instances Box(P R mAP50 m\n", " all 357 941 0.0929 0.0244 0.0159 0.00461\n", "\n", " Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n", " 13/215 6.96G 0.8399 0.6641 1.048 5 800: 1\n", " Class Images Instances Box(P R mAP50 m\n", " all 357 941 0.0321 0.0893 0.0204 0.00543\n", "\n", " Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n", " 14/215 6.96G 0.8033 0.6374 1.02 10 800: 1\n", " Class Images Instances Box(P R mAP50 m\n", " all 357 941 0.0161 0.0298 0.00856 0.003\n", "\n", " Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n", " 15/215 6.96G 0.7915 0.6248 1.019 19 800: 1\n", " Class Images Instances Box(P R mAP50 m\n", " all 357 941 0.0149 0.117 0.01 0.00296\n", "\n", " Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n", " 16/215 6.96G 0.7849 0.6106 1.012 2 800: 1\n", " Class Images Instances Box(P R mAP50 m\n", " all 357 941 0.0118 0.0298 0.0039 0.00128\n", "\n", " Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n", " 17/215 6.96G 0.7422 0.5916 0.9887 44 800: ^C\n", " 17/215 6.96G 0.7432 0.5909 0.9886 49 800: Traceback (most recent call last):\n", " File \"/root/.config/Ultralytics/DDP/_temp_f6tt1q5n139889764186704.py\", line 6, in \n", " trainer.train()\n", " File \"/opt/conda/lib/python3.7/site-packages/ultralytics/yolo/engine/trainer.py\", line 183, in train\n", " self._do_train(int(os.getenv(\"RANK\", -1)), world_size)\n", " File \"/opt/conda/lib/python3.7/site-packages/ultralytics/yolo/engine/trainer.py\", line 284, in _do_train\n", " for i, batch in pbar:\n", " File \"/opt/conda/lib/python3.7/site-packages/torch/utils/data/dataloader.py\", line 628, in __next__\n", " data = self._next_data()\n", " File \"/opt/conda/lib/python3.7/site-packages/torch/utils/data/dataloader.py\", line 1316, in _next_data\n", " idx, data = self._get_data()\n", " File \"/opt/conda/lib/python3.7/site-packages/torch/utils/data/dataloader.py\", line 1272, in _get_data\n", " success, data = self._try_get_data()\n", " File \"/opt/conda/lib/python3.7/site-packages/torch/utils/data/dataloader.py\", line 1120, in _try_get_data\n", "Traceback (most recent call last):\n", " File \"/opt/conda/lib/python3.7/site-packages/tqdm/std.py\", line 1195, in __iter__\n", " data = self._data_queue.get(timeout=timeout)\n", " File \"/opt/conda/lib/python3.7/queue.py\", line 179, in get\n", " self.not_empty.wait(remaining)\n", " File \"/opt/conda/lib/python3.7/threading.py\", line 300, in wait\n", " gotit = waiter.acquire(True, timeout)\n", "KeyboardInterrupt\n", " for obj in iterable:\n", " File \"/opt/conda/lib/python3.7/site-packages/torch/utils/data/dataloader.py\", line 628, in __next__\n", " data = self._next_data()\n", " File \"/opt/conda/lib/python3.7/site-packages/torch/utils/data/dataloader.py\", line 1316, in _next_data\n", " idx, data = self._get_data()\n", " File \"/opt/conda/lib/python3.7/site-packages/torch/utils/data/dataloader.py\", line 1272, in _get_data\n", " success, data = self._try_get_data()\n", " File \"/opt/conda/lib/python3.7/site-packages/torch/utils/data/dataloader.py\", line 1120, in _try_get_data\n", " data = self._data_queue.get(timeout=timeout)\n", " File \"/opt/conda/lib/python3.7/queue.py\", line 179, in get\n", " self.not_empty.wait(remaining)\n", " File \"/opt/conda/lib/python3.7/threading.py\", line 300, in wait\n", " gotit = waiter.acquire(True, timeout)\n", "KeyboardInterrupt\n", "\n", "During handling of the above exception, another exception occurred:\n", "\n", "Traceback (most recent call last):\n", " File \"/root/.config/Ultralytics/DDP/_temp_f6tt1q5n139889764186704.py\", line 6, in \n", " trainer.train()\n", " File \"/opt/conda/lib/python3.7/site-packages/ultralytics/yolo/engine/trainer.py\", line 183, in train\n", " self._do_train(int(os.getenv(\"RANK\", -1)), world_size)\n", " File \"/opt/conda/lib/python3.7/site-packages/ultralytics/yolo/engine/trainer.py\", line 284, in _do_train\n", " for i, batch in pbar:\n", " File \"/opt/conda/lib/python3.7/site-packages/tqdm/std.py\", line 1210, in __iter__\n", " self.close()\n", " File \"/opt/conda/lib/python3.7/site-packages/tqdm/std.py\", line 1316, in close\n", " self.display(pos=0)\n", " File \"/opt/conda/lib/python3.7/site-packages/tqdm/std.py\", line 1509, in display\n", " self.sp(self.__str__() if msg is None else msg)\n", " File \"/opt/conda/lib/python3.7/site-packages/tqdm/std.py\", line 350, in print_status\n", " fp_write('\\r' + s + (' ' * max(last_len[0] - len_s, 0)))\n", " File \"/opt/conda/lib/python3.7/site-packages/tqdm/std.py\", line 343, in fp_write\n", " fp.write(_unicode(s))\n", " File \"/opt/conda/lib/python3.7/site-packages/tqdm/utils.py\", line 145, in inner\n", " return func(*args, **kwargs)\n", "KeyboardInterrupt\n" ] } ], "source": [ "%cd {HOME}\n", "\n", "!yolo task=detect mode=train model=yolov8s.pt data={dataset.location}/data.yaml device = '0,1' epochs=215 imgsz=800 plots=True device=0,1 batch = 24\n" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.status.busy": "2023-03-04T12:12:29.081618Z", "iopub.status.idle": "2023-03-04T12:12:29.082487Z", "shell.execute_reply": "2023-03-04T12:12:29.082244Z", "shell.execute_reply.started": "2023-03-04T12:12:29.082201Z" } }, "outputs": [], "source": [ "!ls {HOME}/runs/detect/train/ " ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.status.busy": "2023-03-04T12:12:29.083867Z", "iopub.status.idle": "2023-03-04T12:12:29.084678Z", "shell.execute_reply": "2023-03-04T12:12:29.084440Z", "shell.execute_reply.started": "2023-03-04T12:12:29.084414Z" } }, "outputs": [], "source": [ "%cd {HOME}\n", "Image(filename=f'{HOME}/runs/detect/train/confusion_matrix.png', width=600)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.status.busy": "2023-03-04T12:12:29.086107Z", "iopub.status.idle": "2023-03-04T12:12:29.086926Z", "shell.execute_reply": "2023-03-04T12:12:29.086690Z", "shell.execute_reply.started": "2023-03-04T12:12:29.086663Z" } }, "outputs": [], "source": [ "%cd {HOME}\n", "Image(filename=f'{HOME}/runs/detect/train/results.png', width=600)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.status.busy": "2023-03-04T12:12:29.088406Z", "iopub.status.idle": "2023-03-04T12:12:29.089394Z", "shell.execute_reply": "2023-03-04T12:12:29.089118Z", "shell.execute_reply.started": "2023-03-04T12:12:29.089088Z" } }, "outputs": [], "source": [ "%cd {HOME}\n", "Image(filename=f'{HOME}/runs/detect/train/val_batch0_pred.jpg', width=600)" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.status.busy": "2023-03-04T12:12:29.090791Z", "iopub.status.idle": "2023-03-04T12:12:29.091614Z", "shell.execute_reply": "2023-03-04T12:12:29.091379Z", "shell.execute_reply.started": "2023-03-04T12:12:29.091353Z" } }, "outputs": [], "source": [ "%cd {HOME}\n", "\n", "!yolo task=detect mode=val model={HOME}/runs/detect/train/weights/best.pt data={dataset.location}/data.yaml" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.status.busy": "2023-03-04T12:12:29.093044Z", "iopub.status.idle": "2023-03-04T12:12:29.093872Z", "shell.execute_reply": "2023-03-04T12:12:29.093627Z", "shell.execute_reply.started": "2023-03-04T12:12:29.093602Z" } }, "outputs": [], "source": [ "%cd {HOME}\n", "!yolo task=detect mode=predict model={HOME}/runs/detect/train/weights/best.pt conf=0.25 source={dataset.location}/test/images save=True" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.status.busy": "2023-03-04T12:12:29.095308Z", "iopub.status.idle": "2023-03-04T12:12:29.096145Z", "shell.execute_reply": "2023-03-04T12:12:29.095908Z", "shell.execute_reply.started": "2023-03-04T12:12:29.095881Z" } }, "outputs": [], "source": [ "import glob\n", "from IPython.display import Image, display\n", "\n", "for image_path in glob.glob(f'{HOME}/runs/detect/predict3/*.jpg')[:3]:\n", " display(Image(filename=image_path, width=600))\n", " print(\"\\n\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.status.busy": "2023-03-04T12:12:29.097602Z", "iopub.status.idle": "2023-03-04T12:12:29.098464Z", "shell.execute_reply": "2023-03-04T12:12:29.098204Z", "shell.execute_reply.started": "2023-03-04T12:12:29.098177Z" } }, "outputs": [], "source": [ "project.version(dataset.version).deploy(model_type=\"yolov8\", model_path=f\"{HOME}/runs/detect/train/\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "execution": { "iopub.status.busy": "2023-03-04T12:12:29.099771Z", "iopub.status.idle": "2023-03-04T12:12:29.100632Z", "shell.execute_reply": "2023-03-04T12:12:29.100401Z", "shell.execute_reply.started": "2023-03-04T12:12:29.100374Z" } }, "outputs": [], "source": [ "#Run inference on your model on a persistant, auto-scaling, cloud API\n", "\n", "#load model\n", "model = project.version(dataset.version).model\n", "\n", "#choose random test set image\n", "import os, random\n", "test_set_loc = dataset.location + \"/test/images/\"\n", "random_test_image = random.choice(os.listdir(test_set_loc))\n", "print(\"running inference on \" + random_test_image)\n", "\n", "pred = model.predict(test_set_loc + random_test_image, confidence=40, overlap=30).json()\n", "pred" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.6" }, "vscode": { "interpreter": { "hash": "909e94fa6c232d7c724ea0272d1d960c187d26acecb731545632ac2dfd18735f" } } }, "nbformat": 4, "nbformat_minor": 4 }