Created
February 7, 2025 12:50
-
-
Save asus4/34af2fd5d5eaf56428e95da21de27d59 to your computer and use it in GitHub Desktop.
Export yolo11 Seg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"nbformat": 4, | |
"nbformat_minor": 0, | |
"metadata": { | |
"colab": { | |
"provenance": [] | |
}, | |
"kernelspec": { | |
"name": "python3", | |
"display_name": "Python 3" | |
}, | |
"language_info": { | |
"name": "python" | |
} | |
}, | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"id": "xcpJWi_vzK2u", | |
"outputId": "243b2610-ba3b-40da-9ff8-a66dd281e432" | |
}, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": [ | |
"Collecting ultralytics\n", | |
" Downloading ultralytics-8.3.70-py3-none-any.whl.metadata (35 kB)\n", | |
"Requirement already satisfied: numpy<=2.1.1,>=1.23.0 in /usr/local/lib/python3.11/dist-packages (from ultralytics) (1.26.4)\n", | |
"Requirement already satisfied: matplotlib>=3.3.0 in /usr/local/lib/python3.11/dist-packages (from ultralytics) (3.10.0)\n", | |
"Requirement already satisfied: opencv-python>=4.6.0 in /usr/local/lib/python3.11/dist-packages (from ultralytics) (4.10.0.84)\n", | |
"Requirement already satisfied: pillow>=7.1.2 in /usr/local/lib/python3.11/dist-packages (from ultralytics) (11.1.0)\n", | |
"Requirement already satisfied: pyyaml>=5.3.1 in /usr/local/lib/python3.11/dist-packages (from ultralytics) (6.0.2)\n", | |
"Requirement already satisfied: requests>=2.23.0 in /usr/local/lib/python3.11/dist-packages (from ultralytics) (2.32.3)\n", | |
"Requirement already satisfied: scipy>=1.4.1 in /usr/local/lib/python3.11/dist-packages (from ultralytics) (1.13.1)\n", | |
"Requirement already satisfied: torch>=1.8.0 in /usr/local/lib/python3.11/dist-packages (from ultralytics) (2.5.1+cu124)\n", | |
"Requirement already satisfied: torchvision>=0.9.0 in /usr/local/lib/python3.11/dist-packages (from ultralytics) (0.20.1+cu124)\n", | |
"Requirement already satisfied: tqdm>=4.64.0 in /usr/local/lib/python3.11/dist-packages (from ultralytics) (4.67.1)\n", | |
"Requirement already satisfied: psutil in /usr/local/lib/python3.11/dist-packages (from ultralytics) (5.9.5)\n", | |
"Requirement already satisfied: py-cpuinfo in /usr/local/lib/python3.11/dist-packages (from ultralytics) (9.0.0)\n", | |
"Requirement already satisfied: pandas>=1.1.4 in /usr/local/lib/python3.11/dist-packages (from ultralytics) (2.2.2)\n", | |
"Requirement already satisfied: seaborn>=0.11.0 in /usr/local/lib/python3.11/dist-packages (from ultralytics) (0.13.2)\n", | |
"Collecting ultralytics-thop>=2.0.0 (from ultralytics)\n", | |
" Downloading ultralytics_thop-2.0.14-py3-none-any.whl.metadata (9.4 kB)\n", | |
"Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.11/dist-packages (from matplotlib>=3.3.0->ultralytics) (1.3.1)\n", | |
"Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.11/dist-packages (from matplotlib>=3.3.0->ultralytics) (0.12.1)\n", | |
"Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.11/dist-packages (from matplotlib>=3.3.0->ultralytics) (4.55.7)\n", | |
"Requirement already satisfied: kiwisolver>=1.3.1 in /usr/local/lib/python3.11/dist-packages (from matplotlib>=3.3.0->ultralytics) (1.4.8)\n", | |
"Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.11/dist-packages (from matplotlib>=3.3.0->ultralytics) (24.2)\n", | |
"Requirement already satisfied: pyparsing>=2.3.1 in /usr/local/lib/python3.11/dist-packages (from matplotlib>=3.3.0->ultralytics) (3.2.1)\n", | |
"Requirement already satisfied: python-dateutil>=2.7 in /usr/local/lib/python3.11/dist-packages (from matplotlib>=3.3.0->ultralytics) (2.8.2)\n", | |
"Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.11/dist-packages (from pandas>=1.1.4->ultralytics) (2024.2)\n", | |
"Requirement already satisfied: tzdata>=2022.7 in /usr/local/lib/python3.11/dist-packages (from pandas>=1.1.4->ultralytics) (2025.1)\n", | |
"Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.11/dist-packages (from requests>=2.23.0->ultralytics) (3.4.1)\n", | |
"Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.11/dist-packages (from requests>=2.23.0->ultralytics) (3.10)\n", | |
"Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.11/dist-packages (from requests>=2.23.0->ultralytics) (2.3.0)\n", | |
"Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.11/dist-packages (from requests>=2.23.0->ultralytics) (2024.12.14)\n", | |
"Requirement already satisfied: filelock in /usr/local/lib/python3.11/dist-packages (from torch>=1.8.0->ultralytics) (3.17.0)\n", | |
"Requirement already satisfied: typing-extensions>=4.8.0 in /usr/local/lib/python3.11/dist-packages (from torch>=1.8.0->ultralytics) (4.12.2)\n", | |
"Requirement already satisfied: networkx in /usr/local/lib/python3.11/dist-packages (from torch>=1.8.0->ultralytics) (3.4.2)\n", | |
"Requirement already satisfied: jinja2 in /usr/local/lib/python3.11/dist-packages (from torch>=1.8.0->ultralytics) (3.1.5)\n", | |
"Requirement already satisfied: fsspec in /usr/local/lib/python3.11/dist-packages (from torch>=1.8.0->ultralytics) (2024.10.0)\n", | |
"Collecting nvidia-cuda-nvrtc-cu12==12.4.127 (from torch>=1.8.0->ultralytics)\n", | |
" Downloading nvidia_cuda_nvrtc_cu12-12.4.127-py3-none-manylinux2014_x86_64.whl.metadata (1.5 kB)\n", | |
"Collecting nvidia-cuda-runtime-cu12==12.4.127 (from torch>=1.8.0->ultralytics)\n", | |
" Downloading nvidia_cuda_runtime_cu12-12.4.127-py3-none-manylinux2014_x86_64.whl.metadata (1.5 kB)\n", | |
"Collecting nvidia-cuda-cupti-cu12==12.4.127 (from torch>=1.8.0->ultralytics)\n", | |
" Downloading nvidia_cuda_cupti_cu12-12.4.127-py3-none-manylinux2014_x86_64.whl.metadata (1.6 kB)\n", | |
"Collecting nvidia-cudnn-cu12==9.1.0.70 (from torch>=1.8.0->ultralytics)\n", | |
" Downloading nvidia_cudnn_cu12-9.1.0.70-py3-none-manylinux2014_x86_64.whl.metadata (1.6 kB)\n", | |
"Collecting nvidia-cublas-cu12==12.4.5.8 (from torch>=1.8.0->ultralytics)\n", | |
" Downloading nvidia_cublas_cu12-12.4.5.8-py3-none-manylinux2014_x86_64.whl.metadata (1.5 kB)\n", | |
"Collecting nvidia-cufft-cu12==11.2.1.3 (from torch>=1.8.0->ultralytics)\n", | |
" Downloading nvidia_cufft_cu12-11.2.1.3-py3-none-manylinux2014_x86_64.whl.metadata (1.5 kB)\n", | |
"Collecting nvidia-curand-cu12==10.3.5.147 (from torch>=1.8.0->ultralytics)\n", | |
" Downloading nvidia_curand_cu12-10.3.5.147-py3-none-manylinux2014_x86_64.whl.metadata (1.5 kB)\n", | |
"Collecting nvidia-cusolver-cu12==11.6.1.9 (from torch>=1.8.0->ultralytics)\n", | |
" Downloading nvidia_cusolver_cu12-11.6.1.9-py3-none-manylinux2014_x86_64.whl.metadata (1.6 kB)\n", | |
"Collecting nvidia-cusparse-cu12==12.3.1.170 (from torch>=1.8.0->ultralytics)\n", | |
" Downloading nvidia_cusparse_cu12-12.3.1.170-py3-none-manylinux2014_x86_64.whl.metadata (1.6 kB)\n", | |
"Requirement already satisfied: nvidia-nccl-cu12==2.21.5 in /usr/local/lib/python3.11/dist-packages (from torch>=1.8.0->ultralytics) (2.21.5)\n", | |
"Requirement already satisfied: nvidia-nvtx-cu12==12.4.127 in /usr/local/lib/python3.11/dist-packages (from torch>=1.8.0->ultralytics) (12.4.127)\n", | |
"Collecting nvidia-nvjitlink-cu12==12.4.127 (from torch>=1.8.0->ultralytics)\n", | |
" Downloading nvidia_nvjitlink_cu12-12.4.127-py3-none-manylinux2014_x86_64.whl.metadata (1.5 kB)\n", | |
"Requirement already satisfied: triton==3.1.0 in /usr/local/lib/python3.11/dist-packages (from torch>=1.8.0->ultralytics) (3.1.0)\n", | |
"Requirement already satisfied: sympy==1.13.1 in /usr/local/lib/python3.11/dist-packages (from torch>=1.8.0->ultralytics) (1.13.1)\n", | |
"Requirement already satisfied: mpmath<1.4,>=1.1.0 in /usr/local/lib/python3.11/dist-packages (from sympy==1.13.1->torch>=1.8.0->ultralytics) (1.3.0)\n", | |
"Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.11/dist-packages (from python-dateutil>=2.7->matplotlib>=3.3.0->ultralytics) (1.17.0)\n", | |
"Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.11/dist-packages (from jinja2->torch>=1.8.0->ultralytics) (3.0.2)\n", | |
"Downloading ultralytics-8.3.70-py3-none-any.whl (914 kB)\n", | |
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m914.9/914.9 kB\u001b[0m \u001b[31m15.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", | |
"\u001b[?25hDownloading nvidia_cublas_cu12-12.4.5.8-py3-none-manylinux2014_x86_64.whl (363.4 MB)\n", | |
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m363.4/363.4 MB\u001b[0m \u001b[31m3.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", | |
"\u001b[?25hDownloading nvidia_cuda_cupti_cu12-12.4.127-py3-none-manylinux2014_x86_64.whl (13.8 MB)\n", | |
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m13.8/13.8 MB\u001b[0m \u001b[31m67.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", | |
"\u001b[?25hDownloading nvidia_cuda_nvrtc_cu12-12.4.127-py3-none-manylinux2014_x86_64.whl (24.6 MB)\n", | |
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m24.6/24.6 MB\u001b[0m \u001b[31m48.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", | |
"\u001b[?25hDownloading nvidia_cuda_runtime_cu12-12.4.127-py3-none-manylinux2014_x86_64.whl (883 kB)\n", | |
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m883.7/883.7 kB\u001b[0m \u001b[31m35.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", | |
"\u001b[?25hDownloading nvidia_cudnn_cu12-9.1.0.70-py3-none-manylinux2014_x86_64.whl (664.8 MB)\n", | |
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m664.8/664.8 MB\u001b[0m \u001b[31m1.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", | |
"\u001b[?25hDownloading nvidia_cufft_cu12-11.2.1.3-py3-none-manylinux2014_x86_64.whl (211.5 MB)\n", | |
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m211.5/211.5 MB\u001b[0m \u001b[31m5.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", | |
"\u001b[?25hDownloading nvidia_curand_cu12-10.3.5.147-py3-none-manylinux2014_x86_64.whl (56.3 MB)\n", | |
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m56.3/56.3 MB\u001b[0m \u001b[31m10.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", | |
"\u001b[?25hDownloading nvidia_cusolver_cu12-11.6.1.9-py3-none-manylinux2014_x86_64.whl (127.9 MB)\n", | |
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m127.9/127.9 MB\u001b[0m \u001b[31m8.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", | |
"\u001b[?25hDownloading nvidia_cusparse_cu12-12.3.1.170-py3-none-manylinux2014_x86_64.whl (207.5 MB)\n", | |
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m207.5/207.5 MB\u001b[0m \u001b[31m5.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", | |
"\u001b[?25hDownloading nvidia_nvjitlink_cu12-12.4.127-py3-none-manylinux2014_x86_64.whl (21.1 MB)\n", | |
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m21.1/21.1 MB\u001b[0m \u001b[31m47.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", | |
"\u001b[?25hDownloading ultralytics_thop-2.0.14-py3-none-any.whl (26 kB)\n", | |
"Installing collected packages: nvidia-nvjitlink-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, ultralytics-thop, ultralytics\n", | |
" Attempting uninstall: nvidia-nvjitlink-cu12\n", | |
" Found existing installation: nvidia-nvjitlink-cu12 12.5.82\n", | |
" Uninstalling nvidia-nvjitlink-cu12-12.5.82:\n", | |
" Successfully uninstalled nvidia-nvjitlink-cu12-12.5.82\n", | |
" Attempting uninstall: nvidia-curand-cu12\n", | |
" Found existing installation: nvidia-curand-cu12 10.3.6.82\n", | |
" Uninstalling nvidia-curand-cu12-10.3.6.82:\n", | |
" Successfully uninstalled nvidia-curand-cu12-10.3.6.82\n", | |
" Attempting uninstall: nvidia-cufft-cu12\n", | |
" Found existing installation: nvidia-cufft-cu12 11.2.3.61\n", | |
" Uninstalling nvidia-cufft-cu12-11.2.3.61:\n", | |
" Successfully uninstalled nvidia-cufft-cu12-11.2.3.61\n", | |
" Attempting uninstall: nvidia-cuda-runtime-cu12\n", | |
" Found existing installation: nvidia-cuda-runtime-cu12 12.5.82\n", | |
" Uninstalling nvidia-cuda-runtime-cu12-12.5.82:\n", | |
" Successfully uninstalled nvidia-cuda-runtime-cu12-12.5.82\n", | |
" Attempting uninstall: nvidia-cuda-nvrtc-cu12\n", | |
" Found existing installation: nvidia-cuda-nvrtc-cu12 12.5.82\n", | |
" Uninstalling nvidia-cuda-nvrtc-cu12-12.5.82:\n", | |
" Successfully uninstalled nvidia-cuda-nvrtc-cu12-12.5.82\n", | |
" Attempting uninstall: nvidia-cuda-cupti-cu12\n", | |
" Found existing installation: nvidia-cuda-cupti-cu12 12.5.82\n", | |
" Uninstalling nvidia-cuda-cupti-cu12-12.5.82:\n", | |
" Successfully uninstalled nvidia-cuda-cupti-cu12-12.5.82\n", | |
" Attempting uninstall: nvidia-cublas-cu12\n", | |
" Found existing installation: nvidia-cublas-cu12 12.5.3.2\n", | |
" Uninstalling nvidia-cublas-cu12-12.5.3.2:\n", | |
" Successfully uninstalled nvidia-cublas-cu12-12.5.3.2\n", | |
" Attempting uninstall: nvidia-cusparse-cu12\n", | |
" Found existing installation: nvidia-cusparse-cu12 12.5.1.3\n", | |
" Uninstalling nvidia-cusparse-cu12-12.5.1.3:\n", | |
" Successfully uninstalled nvidia-cusparse-cu12-12.5.1.3\n", | |
" Attempting uninstall: nvidia-cudnn-cu12\n", | |
" Found existing installation: nvidia-cudnn-cu12 9.3.0.75\n", | |
" Uninstalling nvidia-cudnn-cu12-9.3.0.75:\n", | |
" Successfully uninstalled nvidia-cudnn-cu12-9.3.0.75\n", | |
" Attempting uninstall: nvidia-cusolver-cu12\n", | |
" Found existing installation: nvidia-cusolver-cu12 11.6.3.83\n", | |
" Uninstalling nvidia-cusolver-cu12-11.6.3.83:\n", | |
" Successfully uninstalled nvidia-cusolver-cu12-11.6.3.83\n", | |
"Successfully installed nvidia-cublas-cu12-12.4.5.8 nvidia-cuda-cupti-cu12-12.4.127 nvidia-cuda-nvrtc-cu12-12.4.127 nvidia-cuda-runtime-cu12-12.4.127 nvidia-cudnn-cu12-9.1.0.70 nvidia-cufft-cu12-11.2.1.3 nvidia-curand-cu12-10.3.5.147 nvidia-cusolver-cu12-11.6.1.9 nvidia-cusparse-cu12-12.3.1.170 nvidia-nvjitlink-cu12-12.4.127 ultralytics-8.3.70 ultralytics-thop-2.0.14\n", | |
"\n", | |
"Usage: \n", | |
" pip3 <command> [options]\n", | |
"\n", | |
"Commands:\n", | |
" install Install packages.\n", | |
" download Download packages.\n", | |
" uninstall Uninstall packages.\n", | |
" freeze Output installed packages in requirements format.\n", | |
" inspect Inspect the python environment.\n", | |
" list List installed packages.\n", | |
" show Show information about installed packages.\n", | |
" check Verify installed packages have compatible dependencies.\n", | |
" config Manage local and global configuration.\n", | |
" search Search PyPI for packages.\n", | |
" cache Inspect and manage pip's wheel cache.\n", | |
" index Inspect information available from package indexes.\n", | |
" wheel Build wheels from your requirements.\n", | |
" hash Compute hashes of package archives.\n", | |
" completion A helper command used for command completion.\n", | |
" debug Show information useful for debugging.\n", | |
" help Show help for commands.\n", | |
"\n", | |
"General Options:\n", | |
" -h, --help Show help.\n", | |
" --debug Let unhandled exceptions propagate outside the main subroutine,\n", | |
" instead of logging them to stderr.\n", | |
" --isolated Run pip in an isolated mode, ignoring environment variables and user\n", | |
" configuration.\n", | |
" --require-virtualenv Allow pip to only run in a virtual environment; exit with an error\n", | |
" otherwise.\n", | |
" --python <python> Run pip with the specified Python interpreter.\n", | |
" -v, --verbose Give more output. Option is additive, and can be used up to 3 times.\n", | |
" -V, --version Show version and exit.\n", | |
" -q, --quiet Give less output. Option is additive, and can be used up to 3 times\n", | |
" (corresponding to WARNING, ERROR, and CRITICAL logging levels).\n", | |
" --log <path> Path to a verbose appending log.\n", | |
" --no-input Disable prompting for input.\n", | |
" --keyring-provider <keyring_provider>\n", | |
" Enable the credential lookup via the keyring library if user input\n", | |
" is allowed. Specify which mechanism to use [disabled, import,\n", | |
" subprocess]. (default: disabled)\n", | |
" --proxy <proxy> Specify a proxy in the form\n", | |
" scheme://[user:passwd@]proxy.server:port.\n", | |
" --retries <retries> Maximum number of retries each connection should attempt (default 5\n", | |
" times).\n", | |
" --timeout <sec> Set the socket timeout (default 15 seconds).\n", | |
" --exists-action <action> Default action when a path already exists: (s)witch, (i)gnore,\n", | |
" (w)ipe, (b)ackup, (a)bort.\n", | |
" --trusted-host <hostname> Mark this host or host:port pair as trusted, even though it does not\n", | |
" have valid or any HTTPS.\n", | |
" --cert <path> Path to PEM-encoded CA certificate bundle. If provided, overrides\n", | |
" the default. See 'SSL Certificate Verification' in pip documentation\n", | |
" for more information.\n", | |
" --client-cert <path> Path to SSL client certificate, a single file containing the private\n", | |
" key and the certificate in PEM format.\n", | |
" --cache-dir <dir> Store the cache data in <dir>.\n", | |
" --no-cache-dir Disable the cache.\n", | |
" --disable-pip-version-check\n", | |
" Don't periodically check PyPI to determine whether a new version of\n", | |
" pip is available for download. Implied with --no-index.\n", | |
" --no-color Suppress colored output.\n", | |
" --no-python-version-warning\n", | |
" Silence deprecation warnings for upcoming unsupported Pythons.\n", | |
" --use-feature <feature> Enable new functionality, that may be backward incompatible.\n", | |
" --use-deprecated <feature> Enable deprecated functionality, that will be removed in the future.\n" | |
] | |
} | |
], | |
"source": [ | |
"# Install devendent libraries\n", | |
"\n", | |
"!pip install ultralytics\n", | |
"!pip\n" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"from ultralytics import YOLO\n", | |
"\n", | |
"# Load a model\n", | |
"model = YOLO(\"yolo11n-seg.pt\")\n", | |
"\n", | |
"# Export the model\n", | |
"# model.export(format=\"onnx\", dynamic=True)\n", | |
"model.export(format=\"onnx\", dynamic=False)\n", | |
"\n", | |
"\n" | |
], | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 938 | |
}, | |
"id": "S_fMK45Xz5rt", | |
"outputId": "c9e6a870-3f6e-40e7-8506-3e9c70b5130b" | |
}, | |
"execution_count": null, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": [ | |
"Creating new Ultralytics Settings v0.0.6 file ✅ \n", | |
"View Ultralytics Settings with 'yolo settings' or at '/root/.config/Ultralytics/settings.json'\n", | |
"Update Settings with 'yolo settings key=value', i.e. 'yolo settings runs_dir=path/to/dir'. For help see https://docs.ultralytics.com/quickstart/#ultralytics-settings.\n", | |
"Downloading https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11n-seg.pt to 'yolo11n-seg.pt'...\n" | |
] | |
}, | |
{ | |
"output_type": "stream", | |
"name": "stderr", | |
"text": [ | |
"100%|██████████| 5.90M/5.90M [00:00<00:00, 67.1MB/s]\n" | |
] | |
}, | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": [ | |
"Ultralytics 8.3.70 🚀 Python-3.11.11 torch-2.5.1+cu124 CPU (Intel Xeon 2.20GHz)\n", | |
"YOLO11n-seg summary (fused): 265 layers, 2,868,664 parameters, 0 gradients, 10.4 GFLOPs\n", | |
"\n", | |
"\u001b[34m\u001b[1mPyTorch:\u001b[0m starting from 'yolo11n-seg.pt' with input shape (1, 3, 640, 640) BCHW and output shape(s) ((1, 116, 8400), (1, 32, 160, 160)) (5.9 MB)\n", | |
"\u001b[31m\u001b[1mrequirements:\u001b[0m Ultralytics requirements ['onnx>=1.12.0', 'onnxslim', 'onnxruntime'] not found, attempting AutoUpdate...\n", | |
"Collecting onnx>=1.12.0\n", | |
" Downloading onnx-1.17.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (16 kB)\n", | |
"Collecting onnxslim\n", | |
" Downloading onnxslim-0.1.48-py3-none-any.whl.metadata (4.6 kB)\n", | |
"Collecting onnxruntime\n", | |
" Downloading onnxruntime-1.20.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.metadata (4.5 kB)\n", | |
"Requirement already satisfied: numpy>=1.20 in /usr/local/lib/python3.11/dist-packages (from onnx>=1.12.0) (1.26.4)\n", | |
"Requirement already satisfied: protobuf>=3.20.2 in /usr/local/lib/python3.11/dist-packages (from onnx>=1.12.0) (4.25.6)\n", | |
"Requirement already satisfied: sympy in /usr/local/lib/python3.11/dist-packages (from onnxslim) (1.13.1)\n", | |
"Requirement already satisfied: packaging in /usr/local/lib/python3.11/dist-packages (from onnxslim) (24.2)\n", | |
"Collecting coloredlogs (from onnxruntime)\n", | |
" Downloading coloredlogs-15.0.1-py2.py3-none-any.whl.metadata (12 kB)\n", | |
"Requirement already satisfied: flatbuffers in /usr/local/lib/python3.11/dist-packages (from onnxruntime) (25.1.24)\n", | |
"Collecting humanfriendly>=9.1 (from coloredlogs->onnxruntime)\n", | |
" Downloading humanfriendly-10.0-py2.py3-none-any.whl.metadata (9.2 kB)\n", | |
"Requirement already satisfied: mpmath<1.4,>=1.1.0 in /usr/local/lib/python3.11/dist-packages (from sympy->onnxslim) (1.3.0)\n", | |
"Downloading onnx-1.17.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (16.0 MB)\n", | |
" ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 16.0/16.0 MB 194.5 MB/s eta 0:00:00\n", | |
"Downloading onnxslim-0.1.48-py3-none-any.whl (142 kB)\n", | |
" ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 142.9/142.9 kB 255.1 MB/s eta 0:00:00\n", | |
"Downloading onnxruntime-1.20.1-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (13.3 MB)\n", | |
" ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 13.3/13.3 MB 202.7 MB/s eta 0:00:00\n", | |
"Downloading coloredlogs-15.0.1-py2.py3-none-any.whl (46 kB)\n", | |
" ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 46.0/46.0 kB 135.4 MB/s eta 0:00:00\n", | |
"Downloading humanfriendly-10.0-py2.py3-none-any.whl (86 kB)\n", | |
" ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 86.8/86.8 kB 225.4 MB/s eta 0:00:00\n", | |
"Installing collected packages: onnx, humanfriendly, onnxslim, coloredlogs, onnxruntime\n", | |
"Successfully installed coloredlogs-15.0.1 humanfriendly-10.0 onnx-1.17.0 onnxruntime-1.20.1 onnxslim-0.1.48\n", | |
"\n", | |
"\u001b[31m\u001b[1mrequirements:\u001b[0m AutoUpdate success ✅ 10.4s, installed 3 packages: ['onnx>=1.12.0', 'onnxslim', 'onnxruntime']\n", | |
"\u001b[31m\u001b[1mrequirements:\u001b[0m ⚠️ \u001b[1mRestart runtime or rerun command for updates to take effect\u001b[0m\n", | |
"\n", | |
"\n", | |
"\u001b[34m\u001b[1mONNX:\u001b[0m starting export with onnx 1.17.0 opset 19...\n", | |
"\u001b[34m\u001b[1mONNX:\u001b[0m slimming with onnxslim 0.1.48...\n", | |
"\u001b[34m\u001b[1mONNX:\u001b[0m export success ✅ 61.8s, saved as 'yolo11n-seg.onnx' (11.1 MB)\n", | |
"\n", | |
"Export complete (64.5s)\n", | |
"Results saved to \u001b[1m/content\u001b[0m\n", | |
"Predict: yolo predict task=segment model=yolo11n-seg.onnx imgsz=640 \n", | |
"Validate: yolo val task=segment model=yolo11n-seg.onnx imgsz=640 data=/ultralytics/ultralytics/cfg/datasets/coco.yaml \n", | |
"Visualize: https://netron.app\n" | |
] | |
}, | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": [ | |
"'yolo11n-seg.onnx'" | |
], | |
"application/vnd.google.colaboratory.intrinsic+json": { | |
"type": "string" | |
} | |
}, | |
"metadata": {}, | |
"execution_count": 2 | |
} | |
] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment