umaradnaan commited on
Commit
007b98e
Β·
verified Β·
1 Parent(s): ed5a0c2

Upload YOLOv8.ipynb

Browse files
Files changed (1) hide show
  1. YOLOv8.ipynb +533 -0
YOLOv8.ipynb ADDED
@@ -0,0 +1,533 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "nbformat": 4,
3
+ "nbformat_minor": 0,
4
+ "metadata": {
5
+ "colab": {
6
+ "provenance": []
7
+ },
8
+ "kernelspec": {
9
+ "name": "python3",
10
+ "display_name": "Python 3"
11
+ },
12
+ "language_info": {
13
+ "name": "python"
14
+ }
15
+ },
16
+ "cells": [
17
+ {
18
+ "cell_type": "code",
19
+ "execution_count": 1,
20
+ "metadata": {
21
+ "colab": {
22
+ "base_uri": "https://localhost:8080/",
23
+ "height": 1000
24
+ },
25
+ "id": "nEdvYjRHmN9f",
26
+ "outputId": "08b5c0e8-5771-459c-caf0-103d1ce4d946"
27
+ },
28
+ "outputs": [
29
+ {
30
+ "output_type": "stream",
31
+ "name": "stdout",
32
+ "text": [
33
+ "Collecting roboflow\n",
34
+ " Downloading roboflow-1.1.29-py3-none-any.whl (74 kB)\n",
35
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m74.9/74.9 kB\u001b[0m \u001b[31m805.4 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
36
+ "\u001b[?25hCollecting certifi==2023.7.22 (from roboflow)\n",
37
+ " Downloading certifi-2023.7.22-py3-none-any.whl (158 kB)\n",
38
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m158.3/158.3 kB\u001b[0m \u001b[31m3.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
39
+ "\u001b[?25hCollecting chardet==4.0.0 (from roboflow)\n",
40
+ " Downloading chardet-4.0.0-py2.py3-none-any.whl (178 kB)\n",
41
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m178.7/178.7 kB\u001b[0m \u001b[31m14.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
42
+ "\u001b[?25hCollecting cycler==0.10.0 (from roboflow)\n",
43
+ " Downloading cycler-0.10.0-py2.py3-none-any.whl (6.5 kB)\n",
44
+ "Collecting idna==2.10 (from roboflow)\n",
45
+ " Downloading idna-2.10-py2.py3-none-any.whl (58 kB)\n",
46
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m58.8/58.8 kB\u001b[0m \u001b[31m3.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
47
+ "\u001b[?25hRequirement already satisfied: kiwisolver>=1.3.1 in /usr/local/lib/python3.10/dist-packages (from roboflow) (1.4.5)\n",
48
+ "Requirement already satisfied: matplotlib in /usr/local/lib/python3.10/dist-packages (from roboflow) (3.7.1)\n",
49
+ "Requirement already satisfied: numpy>=1.18.5 in /usr/local/lib/python3.10/dist-packages (from roboflow) (1.25.2)\n",
50
+ "Collecting opencv-python-headless==4.8.0.74 (from roboflow)\n",
51
+ " Downloading opencv_python_headless-4.8.0.74-cp37-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (49.1 MB)\n",
52
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m49.1/49.1 MB\u001b[0m \u001b[31m13.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
53
+ "\u001b[?25hRequirement already satisfied: Pillow>=7.1.2 in /usr/local/lib/python3.10/dist-packages (from roboflow) (9.4.0)\n",
54
+ "Requirement already satisfied: python-dateutil in /usr/local/lib/python3.10/dist-packages (from roboflow) (2.8.2)\n",
55
+ "Collecting python-dotenv (from roboflow)\n",
56
+ " Downloading python_dotenv-1.0.1-py3-none-any.whl (19 kB)\n",
57
+ "Requirement already satisfied: requests in /usr/local/lib/python3.10/dist-packages (from roboflow) (2.31.0)\n",
58
+ "Requirement already satisfied: six in /usr/local/lib/python3.10/dist-packages (from roboflow) (1.16.0)\n",
59
+ "Requirement already satisfied: urllib3>=1.26.6 in /usr/local/lib/python3.10/dist-packages (from roboflow) (2.0.7)\n",
60
+ "Requirement already satisfied: tqdm>=4.41.0 in /usr/local/lib/python3.10/dist-packages (from roboflow) (4.66.4)\n",
61
+ "Requirement already satisfied: PyYAML>=5.3.1 in /usr/local/lib/python3.10/dist-packages (from roboflow) (6.0.1)\n",
62
+ "Collecting requests-toolbelt (from roboflow)\n",
63
+ " Downloading requests_toolbelt-1.0.0-py2.py3-none-any.whl (54 kB)\n",
64
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m54.5/54.5 kB\u001b[0m \u001b[31m5.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
65
+ "\u001b[?25hCollecting python-magic (from roboflow)\n",
66
+ " Downloading python_magic-0.4.27-py2.py3-none-any.whl (13 kB)\n",
67
+ "Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->roboflow) (1.2.1)\n",
68
+ "Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib->roboflow) (4.51.0)\n",
69
+ "Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib->roboflow) (24.0)\n",
70
+ "Requirement already satisfied: pyparsing>=2.3.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib->roboflow) (3.1.2)\n",
71
+ "Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests->roboflow) (3.3.2)\n",
72
+ "Installing collected packages: python-magic, python-dotenv, opencv-python-headless, idna, cycler, chardet, certifi, requests-toolbelt, roboflow\n",
73
+ " Attempting uninstall: opencv-python-headless\n",
74
+ " Found existing installation: opencv-python-headless 4.9.0.80\n",
75
+ " Uninstalling opencv-python-headless-4.9.0.80:\n",
76
+ " Successfully uninstalled opencv-python-headless-4.9.0.80\n",
77
+ " Attempting uninstall: idna\n",
78
+ " Found existing installation: idna 3.7\n",
79
+ " Uninstalling idna-3.7:\n",
80
+ " Successfully uninstalled idna-3.7\n",
81
+ " Attempting uninstall: cycler\n",
82
+ " Found existing installation: cycler 0.12.1\n",
83
+ " Uninstalling cycler-0.12.1:\n",
84
+ " Successfully uninstalled cycler-0.12.1\n",
85
+ " Attempting uninstall: chardet\n",
86
+ " Found existing installation: chardet 5.2.0\n",
87
+ " Uninstalling chardet-5.2.0:\n",
88
+ " Successfully uninstalled chardet-5.2.0\n",
89
+ " Attempting uninstall: certifi\n",
90
+ " Found existing installation: certifi 2024.2.2\n",
91
+ " Uninstalling certifi-2024.2.2:\n",
92
+ " Successfully uninstalled certifi-2024.2.2\n",
93
+ "Successfully installed certifi-2023.7.22 chardet-4.0.0 cycler-0.10.0 idna-2.10 opencv-python-headless-4.8.0.74 python-dotenv-1.0.1 python-magic-0.4.27 requests-toolbelt-1.0.0 roboflow-1.1.29\n"
94
+ ]
95
+ },
96
+ {
97
+ "output_type": "display_data",
98
+ "data": {
99
+ "application/vnd.colab-display-data+json": {
100
+ "pip_warning": {
101
+ "packages": [
102
+ "certifi",
103
+ "cycler"
104
+ ]
105
+ },
106
+ "id": "189b4ab8ab254301b30a812bcd22210b"
107
+ }
108
+ },
109
+ "metadata": {}
110
+ },
111
+ {
112
+ "output_type": "stream",
113
+ "name": "stdout",
114
+ "text": [
115
+ "loading Roboflow workspace...\n",
116
+ "loading Roboflow project...\n",
117
+ "[WARNING] we noticed you are downloading a `yolov8` datasets but you don't have `ultralytics` installed. Roboflow `.deploy` supports only models trained with `ultralytics==8.0.196`, to intall it `pip install ultralytics==8.0.196`.\n"
118
+ ]
119
+ },
120
+ {
121
+ "output_type": "stream",
122
+ "name": "stderr",
123
+ "text": [
124
+ "Downloading Dataset Version Zip in Rock-Paper-Scissors-SXSW-14 to yolov8:: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 232554/232554 [00:05<00:00, 42589.34it/s]"
125
+ ]
126
+ },
127
+ {
128
+ "output_type": "stream",
129
+ "name": "stdout",
130
+ "text": [
131
+ "\n"
132
+ ]
133
+ },
134
+ {
135
+ "output_type": "stream",
136
+ "name": "stderr",
137
+ "text": [
138
+ "\n",
139
+ "Extracting Dataset Version Zip to Rock-Paper-Scissors-SXSW-14 in yolov8:: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 14682/14682 [00:02<00:00, 5891.90it/s]\n"
140
+ ]
141
+ }
142
+ ],
143
+ "source": [
144
+ "!pip install roboflow\n",
145
+ "from roboflow import Roboflow\n",
146
+ "rf = Roboflow(api_key=\"DAsT6me1vloOn4s8a8s5\")\n",
147
+ "project = rf.workspace(\"roboflow-58fyf\").project(\"rock-paper-scissors-sxsw\")\n",
148
+ "version = project.version(14)\n",
149
+ "dataset = version.download(\"yolov8\")"
150
+ ]
151
+ },
152
+ {
153
+ "cell_type": "code",
154
+ "source": [
155
+ "pip install ultralytics"
156
+ ],
157
+ "metadata": {
158
+ "colab": {
159
+ "base_uri": "https://localhost:8080/"
160
+ },
161
+ "id": "yE100PMrmqnF",
162
+ "outputId": "03dfc64d-582f-4865-a536-38dcc2e3dd0e"
163
+ },
164
+ "execution_count": 1,
165
+ "outputs": [
166
+ {
167
+ "output_type": "stream",
168
+ "name": "stdout",
169
+ "text": [
170
+ "Collecting ultralytics\n",
171
+ " Downloading ultralytics-8.2.16-py3-none-any.whl (756 kB)\n",
172
+ "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m756.9/756.9 kB\u001b[0m \u001b[31m7.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
173
+ "\u001b[?25hRequirement already satisfied: matplotlib>=3.3.0 in /usr/local/lib/python3.10/dist-packages (from ultralytics) (3.7.1)\n",
174
+ "Requirement already satisfied: opencv-python>=4.6.0 in /usr/local/lib/python3.10/dist-packages (from ultralytics) (4.8.0.76)\n",
175
+ "Requirement already satisfied: pillow>=7.1.2 in /usr/local/lib/python3.10/dist-packages (from ultralytics) (9.4.0)\n",
176
+ "Requirement already satisfied: pyyaml>=5.3.1 in /usr/local/lib/python3.10/dist-packages (from ultralytics) (6.0.1)\n",
177
+ "Requirement already satisfied: requests>=2.23.0 in /usr/local/lib/python3.10/dist-packages (from ultralytics) (2.31.0)\n",
178
+ "Requirement already satisfied: scipy>=1.4.1 in /usr/local/lib/python3.10/dist-packages (from ultralytics) (1.11.4)\n",
179
+ "Requirement already satisfied: torch>=1.8.0 in /usr/local/lib/python3.10/dist-packages (from ultralytics) (2.2.1+cu121)\n",
180
+ "Requirement already satisfied: torchvision>=0.9.0 in /usr/local/lib/python3.10/dist-packages (from ultralytics) (0.17.1+cu121)\n",
181
+ "Requirement already satisfied: tqdm>=4.64.0 in /usr/local/lib/python3.10/dist-packages (from ultralytics) (4.66.4)\n",
182
+ "Requirement already satisfied: psutil in /usr/local/lib/python3.10/dist-packages (from ultralytics) (5.9.5)\n",
183
+ "Requirement already satisfied: py-cpuinfo in /usr/local/lib/python3.10/dist-packages (from ultralytics) (9.0.0)\n",
184
+ "Collecting thop>=0.1.1 (from ultralytics)\n",
185
+ " Downloading thop-0.1.1.post2209072238-py3-none-any.whl (15 kB)\n",
186
+ "Requirement already satisfied: pandas>=1.1.4 in /usr/local/lib/python3.10/dist-packages (from ultralytics) (2.0.3)\n",
187
+ "Requirement already satisfied: seaborn>=0.11.0 in /usr/local/lib/python3.10/dist-packages (from ultralytics) (0.13.1)\n",
188
+ "Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=3.3.0->ultralytics) (1.2.1)\n",
189
+ "Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=3.3.0->ultralytics) (0.10.0)\n",
190
+ "Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=3.3.0->ultralytics) (4.51.0)\n",
191
+ "Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=3.3.0->ultralytics) (1.4.5)\n",
192
+ "Requirement already satisfied: numpy>=1.20 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=3.3.0->ultralytics) (1.25.2)\n",
193
+ "Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=3.3.0->ultralytics) (24.0)\n",
194
+ "Requirement already satisfied: pyparsing>=2.3.1 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=3.3.0->ultralytics) (3.1.2)\n",
195
+ "Requirement already satisfied: python-dateutil>=2.7 in /usr/local/lib/python3.10/dist-packages (from matplotlib>=3.3.0->ultralytics) (2.8.2)\n",
196
+ "Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.10/dist-packages (from pandas>=1.1.4->ultralytics) (2023.4)\n",
197
+ "Requirement already satisfied: tzdata>=2022.1 in /usr/local/lib/python3.10/dist-packages (from pandas>=1.1.4->ultralytics) (2024.1)\n",
198
+ "Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests>=2.23.0->ultralytics) (3.3.2)\n",
199
+ "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests>=2.23.0->ultralytics) (2.10)\n",
200
+ "Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests>=2.23.0->ultralytics) (2.0.7)\n",
201
+ "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests>=2.23.0->ultralytics) (2023.7.22)\n",
202
+ "Requirement already satisfied: filelock in /usr/local/lib/python3.10/dist-packages (from torch>=1.8.0->ultralytics) (3.14.0)\n",
203
+ "Requirement already satisfied: typing-extensions>=4.8.0 in /usr/local/lib/python3.10/dist-packages (from torch>=1.8.0->ultralytics) (4.11.0)\n",
204
+ "Requirement already satisfied: sympy in /usr/local/lib/python3.10/dist-packages (from torch>=1.8.0->ultralytics) (1.12)\n",
205
+ "Requirement already satisfied: networkx in /usr/local/lib/python3.10/dist-packages (from torch>=1.8.0->ultralytics) (3.3)\n",
206
+ "Requirement already satisfied: jinja2 in /usr/local/lib/python3.10/dist-packages (from torch>=1.8.0->ultralytics) (3.1.4)\n",
207
+ "Requirement already satisfied: fsspec in /usr/local/lib/python3.10/dist-packages (from torch>=1.8.0->ultralytics) (2023.6.0)\n",
208
+ "Collecting nvidia-cuda-nvrtc-cu12==12.1.105 (from torch>=1.8.0->ultralytics)\n",
209
+ " Using cached nvidia_cuda_nvrtc_cu12-12.1.105-py3-none-manylinux1_x86_64.whl (23.7 MB)\n",
210
+ "Collecting nvidia-cuda-runtime-cu12==12.1.105 (from torch>=1.8.0->ultralytics)\n",
211
+ " Using cached nvidia_cuda_runtime_cu12-12.1.105-py3-none-manylinux1_x86_64.whl (823 kB)\n",
212
+ "Collecting nvidia-cuda-cupti-cu12==12.1.105 (from torch>=1.8.0->ultralytics)\n",
213
+ " Using cached nvidia_cuda_cupti_cu12-12.1.105-py3-none-manylinux1_x86_64.whl (14.1 MB)\n",
214
+ "Collecting nvidia-cudnn-cu12==8.9.2.26 (from torch>=1.8.0->ultralytics)\n",
215
+ " Using cached nvidia_cudnn_cu12-8.9.2.26-py3-none-manylinux1_x86_64.whl (731.7 MB)\n",
216
+ "Collecting nvidia-cublas-cu12==12.1.3.1 (from torch>=1.8.0->ultralytics)\n",
217
+ " Using cached nvidia_cublas_cu12-12.1.3.1-py3-none-manylinux1_x86_64.whl (410.6 MB)\n",
218
+ "Collecting nvidia-cufft-cu12==11.0.2.54 (from torch>=1.8.0->ultralytics)\n",
219
+ " Using cached nvidia_cufft_cu12-11.0.2.54-py3-none-manylinux1_x86_64.whl (121.6 MB)\n",
220
+ "Collecting nvidia-curand-cu12==10.3.2.106 (from torch>=1.8.0->ultralytics)\n",
221
+ " Using cached nvidia_curand_cu12-10.3.2.106-py3-none-manylinux1_x86_64.whl (56.5 MB)\n",
222
+ "Collecting nvidia-cusolver-cu12==11.4.5.107 (from torch>=1.8.0->ultralytics)\n",
223
+ " Using cached nvidia_cusolver_cu12-11.4.5.107-py3-none-manylinux1_x86_64.whl (124.2 MB)\n",
224
+ "Collecting nvidia-cusparse-cu12==12.1.0.106 (from torch>=1.8.0->ultralytics)\n",
225
+ " Using cached nvidia_cusparse_cu12-12.1.0.106-py3-none-manylinux1_x86_64.whl (196.0 MB)\n",
226
+ "Collecting nvidia-nccl-cu12==2.19.3 (from torch>=1.8.0->ultralytics)\n",
227
+ " Using cached nvidia_nccl_cu12-2.19.3-py3-none-manylinux1_x86_64.whl (166.0 MB)\n",
228
+ "Collecting nvidia-nvtx-cu12==12.1.105 (from torch>=1.8.0->ultralytics)\n",
229
+ " Using cached nvidia_nvtx_cu12-12.1.105-py3-none-manylinux1_x86_64.whl (99 kB)\n",
230
+ "Requirement already satisfied: triton==2.2.0 in /usr/local/lib/python3.10/dist-packages (from torch>=1.8.0->ultralytics) (2.2.0)\n",
231
+ "Collecting nvidia-nvjitlink-cu12 (from nvidia-cusolver-cu12==11.4.5.107->torch>=1.8.0->ultralytics)\n",
232
+ " Using cached nvidia_nvjitlink_cu12-12.4.127-py3-none-manylinux2014_x86_64.whl (21.1 MB)\n",
233
+ "Requirement already satisfied: six in /usr/local/lib/python3.10/dist-packages (from cycler>=0.10->matplotlib>=3.3.0->ultralytics) (1.16.0)\n",
234
+ "Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.10/dist-packages (from jinja2->torch>=1.8.0->ultralytics) (2.1.5)\n",
235
+ "Requirement already satisfied: mpmath>=0.19 in /usr/local/lib/python3.10/dist-packages (from sympy->torch>=1.8.0->ultralytics) (1.3.0)\n",
236
+ "Installing collected packages: nvidia-nvtx-cu12, nvidia-nvjitlink-cu12, nvidia-nccl-cu12, nvidia-curand-cu12, nvidia-cufft-cu12, nvidia-cuda-runtime-cu12, nvidia-cuda-nvrtc-cu12, nvidia-cuda-cupti-cu12, nvidia-cublas-cu12, nvidia-cusparse-cu12, nvidia-cudnn-cu12, nvidia-cusolver-cu12, thop, ultralytics\n",
237
+ "Successfully installed nvidia-cublas-cu12-12.1.3.1 nvidia-cuda-cupti-cu12-12.1.105 nvidia-cuda-nvrtc-cu12-12.1.105 nvidia-cuda-runtime-cu12-12.1.105 nvidia-cudnn-cu12-8.9.2.26 nvidia-cufft-cu12-11.0.2.54 nvidia-curand-cu12-10.3.2.106 nvidia-cusolver-cu12-11.4.5.107 nvidia-cusparse-cu12-12.1.0.106 nvidia-nccl-cu12-2.19.3 nvidia-nvjitlink-cu12-12.4.127 nvidia-nvtx-cu12-12.1.105 thop-0.1.1.post2209072238 ultralytics-8.2.16\n"
238
+ ]
239
+ }
240
+ ]
241
+ },
242
+ {
243
+ "cell_type": "code",
244
+ "source": [
245
+ "from ultralytics import YOLO\n",
246
+ "\n",
247
+ "# Load a model\n",
248
+ "model = YOLO(\"yolov8n.yaml\") # build a new model from scratch\n",
249
+ "model = YOLO(\"yolov8n.pt\") # load a pretrained model (recommended for training)\n",
250
+ "\n",
251
+ "# Use the model\n",
252
+ "model.train(data=\"coco8.yaml\", epochs=3) # train the model\n",
253
+ "metrics = model.val() # evaluate model performance on the validation set\n",
254
+ "path = model.export(format=\"onnx\") # export the model to ONNX format"
255
+ ],
256
+ "metadata": {
257
+ "colab": {
258
+ "base_uri": "https://localhost:8080/"
259
+ },
260
+ "id": "j233xPDqmrjz",
261
+ "outputId": "ae961308-b66f-448c-f3f8-8a6bea7c0e1a"
262
+ },
263
+ "execution_count": 7,
264
+ "outputs": [
265
+ {
266
+ "output_type": "stream",
267
+ "name": "stdout",
268
+ "text": [
269
+ "Ultralytics YOLOv8.2.16 πŸš€ Python-3.10.12 torch-2.2.1+cu121 CPU (Intel Xeon 2.20GHz)\n",
270
+ "\u001b[34m\u001b[1mengine/trainer: \u001b[0mtask=detect, mode=train, model=yolov8n.pt, data=coco8.yaml, epochs=3, time=None, patience=100, batch=16, imgsz=640, save=True, save_period=-1, cache=False, device=None, workers=8, project=None, name=train3, exist_ok=False, pretrained=True, optimizer=auto, verbose=True, seed=0, deterministic=True, single_cls=False, rect=False, cos_lr=False, close_mosaic=10, resume=False, amp=True, fraction=1.0, profile=False, freeze=None, multi_scale=False, overlap_mask=True, mask_ratio=4, dropout=0.0, val=True, split=val, save_json=False, save_hybrid=False, conf=None, iou=0.7, max_det=300, half=False, dnn=False, plots=True, source=None, vid_stride=1, stream_buffer=False, visualize=False, augment=False, agnostic_nms=False, classes=None, retina_masks=False, embed=None, show=False, save_frames=False, save_txt=False, save_conf=False, save_crop=False, show_labels=True, show_conf=True, show_boxes=True, line_width=None, format=torchscript, keras=False, optimize=False, int8=False, dynamic=False, simplify=False, opset=None, workspace=4, nms=False, lr0=0.01, lrf=0.01, momentum=0.937, weight_decay=0.0005, warmup_epochs=3.0, warmup_momentum=0.8, warmup_bias_lr=0.1, box=7.5, cls=0.5, dfl=1.5, pose=12.0, kobj=1.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, bgr=0.0, mosaic=1.0, mixup=0.0, copy_paste=0.0, auto_augment=randaugment, erasing=0.4, crop_fraction=1.0, cfg=None, tracker=botsort.yaml, save_dir=runs/detect/train3\n",
271
+ "\n",
272
+ " from n params module arguments \n",
273
+ " 0 -1 1 464 ultralytics.nn.modules.conv.Conv [3, 16, 3, 2] \n",
274
+ " 1 -1 1 4672 ultralytics.nn.modules.conv.Conv [16, 32, 3, 2] \n",
275
+ " 2 -1 1 7360 ultralytics.nn.modules.block.C2f [32, 32, 1, True] \n",
276
+ " 3 -1 1 18560 ultralytics.nn.modules.conv.Conv [32, 64, 3, 2] \n",
277
+ " 4 -1 2 49664 ultralytics.nn.modules.block.C2f [64, 64, 2, True] \n",
278
+ " 5 -1 1 73984 ultralytics.nn.modules.conv.Conv [64, 128, 3, 2] \n",
279
+ " 6 -1 2 197632 ultralytics.nn.modules.block.C2f [128, 128, 2, True] \n",
280
+ " 7 -1 1 295424 ultralytics.nn.modules.conv.Conv [128, 256, 3, 2] \n",
281
+ " 8 -1 1 460288 ultralytics.nn.modules.block.C2f [256, 256, 1, True] \n",
282
+ " 9 -1 1 164608 ultralytics.nn.modules.block.SPPF [256, 256, 5] \n",
283
+ " 10 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest'] \n",
284
+ " 11 [-1, 6] 1 0 ultralytics.nn.modules.conv.Concat [1] \n",
285
+ " 12 -1 1 148224 ultralytics.nn.modules.block.C2f [384, 128, 1] \n",
286
+ " 13 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest'] \n",
287
+ " 14 [-1, 4] 1 0 ultralytics.nn.modules.conv.Concat [1] \n",
288
+ " 15 -1 1 37248 ultralytics.nn.modules.block.C2f [192, 64, 1] \n",
289
+ " 16 -1 1 36992 ultralytics.nn.modules.conv.Conv [64, 64, 3, 2] \n",
290
+ " 17 [-1, 12] 1 0 ultralytics.nn.modules.conv.Concat [1] \n",
291
+ " 18 -1 1 123648 ultralytics.nn.modules.block.C2f [192, 128, 1] \n",
292
+ " 19 -1 1 147712 ultralytics.nn.modules.conv.Conv [128, 128, 3, 2] \n",
293
+ " 20 [-1, 9] 1 0 ultralytics.nn.modules.conv.Concat [1] \n",
294
+ " 21 -1 1 493056 ultralytics.nn.modules.block.C2f [384, 256, 1] \n",
295
+ " 22 [15, 18, 21] 1 897664 ultralytics.nn.modules.head.Detect [80, [64, 128, 256]] \n",
296
+ "Model summary: 225 layers, 3157200 parameters, 3157184 gradients, 8.9 GFLOPs\n",
297
+ "\n",
298
+ "Transferred 355/355 items from pretrained weights\n",
299
+ "\u001b[34m\u001b[1mTensorBoard: \u001b[0mStart with 'tensorboard --logdir runs/detect/train3', view at http://localhost:6006/\n",
300
+ "Freezing layer 'model.22.dfl.conv.weight'\n"
301
+ ]
302
+ },
303
+ {
304
+ "output_type": "stream",
305
+ "name": "stderr",
306
+ "text": [
307
+ "\u001b[34m\u001b[1mtrain: \u001b[0mScanning /content/datasets/coco8/labels/train.cache... 4 images, 0 backgrounds, 0 corrupt: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 4/4 [00:00<?, ?it/s]"
308
+ ]
309
+ },
310
+ {
311
+ "output_type": "stream",
312
+ "name": "stdout",
313
+ "text": [
314
+ "\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"
315
+ ]
316
+ },
317
+ {
318
+ "output_type": "stream",
319
+ "name": "stderr",
320
+ "text": [
321
+ "\n",
322
+ "\u001b[34m\u001b[1mval: \u001b[0mScanning /content/datasets/coco8/labels/val.cache... 4 images, 0 backgrounds, 0 corrupt: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 4/4 [00:00<?, ?it/s]"
323
+ ]
324
+ },
325
+ {
326
+ "output_type": "stream",
327
+ "name": "stdout",
328
+ "text": [
329
+ "Plotting labels to runs/detect/train3/labels.jpg... \n"
330
+ ]
331
+ },
332
+ {
333
+ "output_type": "stream",
334
+ "name": "stderr",
335
+ "text": [
336
+ "\n"
337
+ ]
338
+ },
339
+ {
340
+ "output_type": "stream",
341
+ "name": "stdout",
342
+ "text": [
343
+ "\u001b[34m\u001b[1moptimizer:\u001b[0m 'optimizer=auto' found, ignoring 'lr0=0.01' and 'momentum=0.937' and determining best 'optimizer', 'lr0' and 'momentum' automatically... \n",
344
+ "\u001b[34m\u001b[1moptimizer:\u001b[0m AdamW(lr=0.000119, momentum=0.9) with parameter groups 57 weight(decay=0.0), 64 weight(decay=0.0005), 63 bias(decay=0.0)\n",
345
+ "\u001b[34m\u001b[1mTensorBoard: \u001b[0mmodel graph visualization added βœ…\n",
346
+ "Image sizes 640 train, 640 val\n",
347
+ "Using 0 dataloader workers\n",
348
+ "Logging results to \u001b[1mruns/detect/train3\u001b[0m\n",
349
+ "Starting training for 3 epochs...\n",
350
+ "\n",
351
+ " Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n"
352
+ ]
353
+ },
354
+ {
355
+ "output_type": "stream",
356
+ "name": "stderr",
357
+ "text": [
358
+ " 1/3 0G 1.52 4.076 1.811 24 640: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1/1 [00:04<00:00, 4.72s/it]\n",
359
+ " Class Images Instances Box(P R mAP50 mAP50-95): 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1/1 [00:01<00:00, 1.33s/it]"
360
+ ]
361
+ },
362
+ {
363
+ "output_type": "stream",
364
+ "name": "stdout",
365
+ "text": [
366
+ " all 4 17 0.605 0.87 0.888 0.618\n"
367
+ ]
368
+ },
369
+ {
370
+ "output_type": "stream",
371
+ "name": "stderr",
372
+ "text": [
373
+ "\n"
374
+ ]
375
+ },
376
+ {
377
+ "output_type": "stream",
378
+ "name": "stdout",
379
+ "text": [
380
+ "\n",
381
+ " Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n"
382
+ ]
383
+ },
384
+ {
385
+ "output_type": "stream",
386
+ "name": "stderr",
387
+ "text": [
388
+ " 2/3 0G 0.8071 3.833 1.239 11 640: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1/1 [00:04<00:00, 4.70s/it]\n",
389
+ " Class Images Instances Box(P R mAP50 mAP50-95): 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1/1 [00:01<00:00, 1.28s/it]"
390
+ ]
391
+ },
392
+ {
393
+ "output_type": "stream",
394
+ "name": "stdout",
395
+ "text": [
396
+ " all 4 17 0.557 0.833 0.874 0.611\n"
397
+ ]
398
+ },
399
+ {
400
+ "output_type": "stream",
401
+ "name": "stderr",
402
+ "text": [
403
+ "\n"
404
+ ]
405
+ },
406
+ {
407
+ "output_type": "stream",
408
+ "name": "stdout",
409
+ "text": [
410
+ "\n",
411
+ " Epoch GPU_mem box_loss cls_loss dfl_loss Instances Size\n"
412
+ ]
413
+ },
414
+ {
415
+ "output_type": "stream",
416
+ "name": "stderr",
417
+ "text": [
418
+ " 3/3 0G 0.9564 2.497 1.297 24 640: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1/1 [00:03<00:00, 3.18s/it]\n",
419
+ " Class Images Instances Box(P R mAP50 mAP50-95): 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1/1 [00:01<00:00, 1.37s/it]"
420
+ ]
421
+ },
422
+ {
423
+ "output_type": "stream",
424
+ "name": "stdout",
425
+ "text": [
426
+ " all 4 17 0.54 0.833 0.872 0.621\n"
427
+ ]
428
+ },
429
+ {
430
+ "output_type": "stream",
431
+ "name": "stderr",
432
+ "text": [
433
+ "\n"
434
+ ]
435
+ },
436
+ {
437
+ "output_type": "stream",
438
+ "name": "stdout",
439
+ "text": [
440
+ "\n",
441
+ "3 epochs completed in 0.007 hours.\n",
442
+ "Optimizer stripped from runs/detect/train3/weights/last.pt, 6.5MB\n",
443
+ "Optimizer stripped from runs/detect/train3/weights/best.pt, 6.5MB\n",
444
+ "\n",
445
+ "Validating runs/detect/train3/weights/best.pt...\n",
446
+ "Ultralytics YOLOv8.2.16 πŸš€ Python-3.10.12 torch-2.2.1+cu121 CPU (Intel Xeon 2.20GHz)\n",
447
+ "Model summary (fused): 168 layers, 3151904 parameters, 0 gradients, 8.7 GFLOPs\n"
448
+ ]
449
+ },
450
+ {
451
+ "output_type": "stream",
452
+ "name": "stderr",
453
+ "text": [
454
+ " Class Images Instances Box(P R mAP50 mAP50-95): 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1/1 [00:00<00:00, 1.03it/s]\n"
455
+ ]
456
+ },
457
+ {
458
+ "output_type": "stream",
459
+ "name": "stdout",
460
+ "text": [
461
+ " all 4 17 0.541 0.86 0.872 0.621\n",
462
+ " person 4 10 0.639 0.5 0.51 0.285\n",
463
+ " dog 4 1 0.316 1 0.995 0.597\n",
464
+ " horse 4 2 0.628 1 0.995 0.648\n",
465
+ " elephant 4 2 0.386 0.658 0.745 0.303\n",
466
+ " umbrella 4 1 0.536 1 0.995 0.995\n",
467
+ " potted plant 4 1 0.742 1 0.995 0.895\n",
468
+ "Speed: 2.3ms preprocess, 227.4ms inference, 0.0ms loss, 2.1ms postprocess per image\n",
469
+ "Results saved to \u001b[1mruns/detect/train3\u001b[0m\n",
470
+ "Ultralytics YOLOv8.2.16 πŸš€ Python-3.10.12 torch-2.2.1+cu121 CPU (Intel Xeon 2.20GHz)\n",
471
+ "Model summary (fused): 168 layers, 3151904 parameters, 0 gradients, 8.7 GFLOPs\n"
472
+ ]
473
+ },
474
+ {
475
+ "output_type": "stream",
476
+ "name": "stderr",
477
+ "text": [
478
+ "\u001b[34m\u001b[1mval: \u001b[0mScanning /content/datasets/coco8/labels/val.cache... 4 images, 0 backgrounds, 0 corrupt: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 4/4 [00:00<?, ?it/s]\n",
479
+ " Class Images Instances Box(P R mAP50 mAP50-95): 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 1/1 [00:00<00:00, 1.04it/s]\n"
480
+ ]
481
+ },
482
+ {
483
+ "output_type": "stream",
484
+ "name": "stdout",
485
+ "text": [
486
+ " all 4 17 0.541 0.86 0.872 0.621\n",
487
+ " person 4 10 0.639 0.5 0.51 0.285\n",
488
+ " dog 4 1 0.316 1 0.995 0.597\n",
489
+ " horse 4 2 0.628 1 0.995 0.648\n",
490
+ " elephant 4 2 0.386 0.658 0.745 0.303\n",
491
+ " umbrella 4 1 0.536 1 0.995 0.995\n",
492
+ " potted plant 4 1 0.742 1 0.995 0.895\n",
493
+ "Speed: 2.3ms preprocess, 226.0ms inference, 0.0ms loss, 2.1ms postprocess per image\n",
494
+ "Results saved to \u001b[1mruns/detect/train32\u001b[0m\n",
495
+ "Ultralytics YOLOv8.2.16 πŸš€ Python-3.10.12 torch-2.2.1+cu121 CPU (Intel Xeon 2.20GHz)\n",
496
+ "\n",
497
+ "\u001b[34m\u001b[1mPyTorch:\u001b[0m starting from 'runs/detect/train3/weights/best.pt' with input shape (1, 3, 640, 640) BCHW and output shape(s) (1, 84, 8400) (6.2 MB)\n",
498
+ "\u001b[31m\u001b[1mrequirements:\u001b[0m Ultralytics requirement ['onnx>=1.12.0'] not found, attempting AutoUpdate...\n",
499
+ "Collecting onnx>=1.12.0\n",
500
+ " Downloading onnx-1.16.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (15.9 MB)\n",
501
+ " ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 15.9/15.9 MB 141.5 MB/s eta 0:00:00\n",
502
+ "Requirement already satisfied: numpy>=1.20 in /usr/local/lib/python3.10/dist-packages (from onnx>=1.12.0) (1.25.2)\n",
503
+ "Requirement already satisfied: protobuf>=3.20.2 in /usr/local/lib/python3.10/dist-packages (from onnx>=1.12.0) (3.20.3)\n",
504
+ "Installing collected packages: onnx\n",
505
+ "Successfully installed onnx-1.16.0\n",
506
+ "\n",
507
+ "\u001b[31m\u001b[1mrequirements:\u001b[0m AutoUpdate success βœ… 13.7s, installed 1 package: ['onnx>=1.12.0']\n",
508
+ "\u001b[31m\u001b[1mrequirements:\u001b[0m ⚠️ \u001b[1mRestart runtime or rerun command for updates to take effect\u001b[0m\n",
509
+ "\n",
510
+ "\n",
511
+ "\u001b[34m\u001b[1mONNX:\u001b[0m starting export with onnx 1.16.0 opset 17...\n",
512
+ "\u001b[34m\u001b[1mONNX:\u001b[0m export success βœ… 14.7s, saved as 'runs/detect/train3/weights/best.onnx' (12.2 MB)\n",
513
+ "\n",
514
+ "Export complete (16.4s)\n",
515
+ "Results saved to \u001b[1m/content/runs/detect/train3/weights\u001b[0m\n",
516
+ "Predict: yolo predict task=detect model=runs/detect/train3/weights/best.onnx imgsz=640 \n",
517
+ "Validate: yolo val task=detect model=runs/detect/train3/weights/best.onnx imgsz=640 data=/usr/local/lib/python3.10/dist-packages/ultralytics/cfg/datasets/coco8.yaml \n",
518
+ "Visualize: https://netron.app\n"
519
+ ]
520
+ }
521
+ ]
522
+ },
523
+ {
524
+ "cell_type": "code",
525
+ "source": [],
526
+ "metadata": {
527
+ "id": "HbYQuEnAnDd7"
528
+ },
529
+ "execution_count": null,
530
+ "outputs": []
531
+ }
532
+ ]
533
+ }