├── .gitignore ├── 1.jpg ├── 2.jpg ├── best-2.pt ├── requirements.txt ├── app.py ├── README.md ├── licence └── Lung_cancer_classification_using_Yolov8.ipynb /.gitignore: -------------------------------------------------------------------------------- 1 | yolov8 2 | gradio_cached_examples 3 | flagged 4 | -------------------------------------------------------------------------------- /1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bedead/lung-cancer-classification-yoloV8---gradio/HEAD/1.jpg -------------------------------------------------------------------------------- /2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bedead/lung-cancer-classification-yoloV8---gradio/HEAD/2.jpg -------------------------------------------------------------------------------- /best-2.pt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bedead/lung-cancer-classification-yoloV8---gradio/HEAD/best-2.pt -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bedead/lung-cancer-classification-yoloV8---gradio/HEAD/requirements.txt -------------------------------------------------------------------------------- /app.py: -------------------------------------------------------------------------------- 1 | import gradio as gr 2 | from ultralytics import YOLO 3 | import os 4 | 5 | # catgories 6 | format = { 0: 'Adenocarcinoma case', 7 | 1: 'Bengin case', 8 | 2: 'Large cell Carcinoma case', 9 | 3: 'Malignant case', 10 | 4: 'Normal case', 11 | 5: 'Squamous cell Carcinoma case'} 12 | 13 | # returning classifiers output 14 | def image_classifier(inp): 15 | model = YOLO("best-2.pt") 16 | 17 | result = model.predict(source=inp) 18 | probs = result[0].probs 19 | max_tensor = max(probs) 20 | tensor_pos = ((probs == max_tensor).nonzero(as_tuple=True)[0]) 21 | 22 | return format.get(int(tensor_pos)) 23 | 24 | # gradio code block for input and output 25 | with gr.Blocks() as app: 26 | gr.Markdown("## Lung Cancer classification using Yolov8") 27 | with gr.Row(): 28 | inp_img = gr.Image() 29 | out_txt = gr.Textbox() 30 | btn = gr.Button(value="Submit") 31 | btn.click(image_classifier, inputs=inp_img, outputs=out_txt) 32 | 33 | gr.Markdown("## Image Examples") 34 | gr.Examples( 35 | examples=[os.path.join(os.path.dirname(__file__), "1.jpg"), os.path.join(os.path.dirname(__file__), "2.jpg")], 36 | inputs=inp_img, 37 | outputs=out_txt, 38 | fn=image_classifier, 39 | cache_examples=True, 40 | ) 41 | 42 | app.launch(share=True) 43 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

🫁 Lung Cancer Classification (YOLOv8)

2 | 3 |

4 | project-banner 5 |

6 | 7 | --- 8 | 9 | ## ✅ Project Overview 10 | 11 | **Lung Cancer Detection** is a deep-learning project that classifies lung CT scan images into three categories based on cancer risk. 12 | The model leverages **YOLOv8**, a powerful neural network architecture designed for image classification and object detection. 13 | 14 | The dataset contains **1,054 medical lung scan images**, curated and hosted on **Roboflow Universe**, and a trained model is already available for experimentation and inference. 15 | 16 | --- 17 | 18 | ## 🩺 Classification Categories 19 | 20 | | Class Type | Description | 21 | |------------------|-----------------------------------------------------------------------------| 22 | | **Normal** | Lungs showing no visible abnormalities or cancer-related nodules. | 23 | | **Benign** | Non-cancerous nodules or minor abnormalities detected. | 24 | | **Malignant** | Cancerous nodules or signs strongly indicating lung cancer. | 25 | 26 | --- 27 | 28 | ## 📊 Dataset & Model Details 29 | 30 | | Parameter | Value | 31 | |--------------------|----------------------------------------| 32 | | **Dataset Version** | v1 | 33 | | **Total Images** | 1,054 | 34 | | **Model Version** | YOLOv8 Classification Model (v1) | 35 | | **Dataset Host** | Roboflow Universe | 36 | 37 | > The dataset and current model release are stable. Future dataset updates and incremental versions are planned. 38 | 39 | --- 40 | 41 | ## 🌐 Demo & Resources 42 | 43 | 🔹 **Live Demo (Gradio App via Hugging Face Spaces):** 44 | 👉 45 | 46 | 🔹 **Dataset (Roboflow Universe):** 47 | 👉 48 | 49 | --- 50 | 51 | ## 🤝 Contribution & Labeling Guidelines 52 | 53 | To maintain dataset quality and medical reliability: 54 | 55 | - Use only **anonymized and ethically sourced** medical images. 56 | - Label using the following categories only: `Normal`, `Benign`, `Malignant`. 57 | - Ensure **image clarity** (CT/X-ray format recommended). 58 | - Add **metadata only if anonymized and ethically permissible**. 59 | - Expert cross-verification is recommended due to medical sensitivity. 60 | 61 | 📧 For contribution or dataset collaboration, contact: 62 | **Satyam Mishra —** `satyammishra9050@gmail.com` 63 | 64 | --- 65 | 66 | ## 🧾 Patent Information 67 | 68 | > **Patent Application Number:** `202341039647` 69 | > This project and methodology are protected under Indian patent application laws. 70 | 71 | --- 72 | 73 | ## 🚀 Tech Stack 74 | 75 | - **YOLOv8** (Ultralytics) 76 | - **Python** 77 | - **Roboflow** 78 | - **Gradio (Demo UI)** 79 | - **Hugging Face Spaces** 80 | 81 | --- 82 | 83 | ## ⭐ Support 84 | 85 | If you found this useful, don’t forget to ⭐ star the repository! 86 | 87 | --- 88 | -------------------------------------------------------------------------------- /licence: -------------------------------------------------------------------------------- 1 | Creative Commons Legal Code 2 | 3 | CC0 1.0 Universal 4 | 5 | CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE 6 | LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN 7 | ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS 8 | INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES 9 | REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS 10 | PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM 11 | THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED 12 | HEREUNDER. 13 | 14 | Statement of Purpose 15 | 16 | The laws of most jurisdictions throughout the world automatically confer 17 | exclusive Copyright and Related Rights (defined below) upon the creator 18 | and subsequent owner(s) (each and all, an "owner") of an original work of 19 | authorship and/or a database (each, a "Work"). 20 | 21 | Certain owners wish to permanently relinquish those rights to a Work for 22 | the purpose of contributing to a commons of creative, cultural and 23 | scientific works ("Commons") that the public can reliably and without fear 24 | of later claims of infringement build upon, modify, incorporate in other 25 | works, reuse and redistribute as freely as possible in any form whatsoever 26 | and for any purposes, including without limitation commercial purposes. 27 | These owners may contribute to the Commons to promote the ideal of a free 28 | culture and the further production of creative, cultural and scientific 29 | works, or to gain reputation or greater distribution for their Work in 30 | part through the use and efforts of others. 31 | 32 | For these and/or other purposes and motivations, and without any 33 | expectation of additional consideration or compensation, the person 34 | associating CC0 with a Work (the "Affirmer"), to the extent that he or she 35 | is an owner of Copyright and Related Rights in the Work, voluntarily 36 | elects to apply CC0 to the Work and publicly distribute the Work under its 37 | terms, with knowledge of his or her Copyright and Related Rights in the 38 | Work and the meaning and intended legal effect of CC0 on those rights. 39 | 40 | 1. Copyright and Related Rights. A Work made available under CC0 may be 41 | protected by copyright and related or neighboring rights ("Copyright and 42 | Related Rights"). Copyright and Related Rights include, but are not 43 | limited to, the following: 44 | 45 | i. the right to reproduce, adapt, distribute, perform, display, 46 | communicate, and translate a Work; 47 | ii. moral rights retained by the original author(s) and/or performer(s); 48 | iii. publicity and privacy rights pertaining to a person's image or 49 | likeness depicted in a Work; 50 | iv. rights protecting against unfair competition in regards to a Work, 51 | subject to the limitations in paragraph 4(a), below; 52 | v. rights protecting the extraction, dissemination, use and reuse of data 53 | in a Work; 54 | vi. database rights (such as those arising under Directive 96/9/EC of the 55 | European Parliament and of the Council of 11 March 1996 on the legal 56 | protection of databases, and under any national implementation 57 | thereof, including any amended or successor version of such 58 | directive); and 59 | vii. other similar, equivalent or corresponding rights throughout the 60 | world based on applicable law or treaty, and any national 61 | implementations thereof. 62 | 63 | 2. Waiver. To the greatest extent permitted by, but not in contravention 64 | of, applicable law, Affirmer hereby overtly, fully, permanently, 65 | irrevocably and unconditionally waives, abandons, and surrenders all of 66 | Affirmer's Copyright and Related Rights and associated claims and causes 67 | of action, whether now known or unknown (including existing as well as 68 | future claims and causes of action), in the Work (i) in all territories 69 | worldwide, (ii) for the maximum duration provided by applicable law or 70 | treaty (including future time extensions), (iii) in any current or future 71 | medium and for any number of copies, and (iv) for any purpose whatsoever, 72 | including without limitation commercial, advertising or promotional 73 | purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each 74 | member of the public at large and to the detriment of Affirmer's heirs and 75 | successors, fully intending that such Waiver shall not be subject to 76 | revocation, rescission, cancellation, termination, or any other legal or 77 | equitable action to disrupt the quiet enjoyment of the Work by the public 78 | as contemplated by Affirmer's express Statement of Purpose. 79 | 80 | 3. Public License Fallback. Should any part of the Waiver for any reason 81 | be judged legally invalid or ineffective under applicable law, then the 82 | Waiver shall be preserved to the maximum extent permitted taking into 83 | account Affirmer's express Statement of Purpose. In addition, to the 84 | extent the Waiver is so judged Affirmer hereby grants to each affected 85 | person a royalty-free, non transferable, non sublicensable, non exclusive, 86 | irrevocable and unconditional license to exercise Affirmer's Copyright and 87 | Related Rights in the Work (i) in all territories worldwide, (ii) for the 88 | maximum duration provided by applicable law or treaty (including future 89 | time extensions), (iii) in any current or future medium and for any number 90 | of copies, and (iv) for any purpose whatsoever, including without 91 | limitation commercial, advertising or promotional purposes (the 92 | "License"). The License shall be deemed effective as of the date CC0 was 93 | applied by Affirmer to the Work. Should any part of the License for any 94 | reason be judged legally invalid or ineffective under applicable law, such 95 | partial invalidity or ineffectiveness shall not invalidate the remainder 96 | of the License, and in such case Affirmer hereby affirms that he or she 97 | will not (i) exercise any of his or her remaining Copyright and Related 98 | Rights in the Work or (ii) assert any associated claims and causes of 99 | action with respect to the Work, in either case contrary to Affirmer's 100 | express Statement of Purpose. 101 | 102 | 4. Limitations and Disclaimers. 103 | 104 | a. No trademark or patent rights held by Affirmer are waived, abandoned, 105 | surrendered, licensed or otherwise affected by this document. 106 | b. Affirmer offers the Work as-is and makes no representations or 107 | warranties of any kind concerning the Work, express, implied, 108 | statutory or otherwise, including without limitation warranties of 109 | title, merchantability, fitness for a particular purpose, non 110 | infringement, or the absence of latent or other defects, accuracy, or 111 | the present or absence of errors, whether or not discoverable, all to 112 | the greatest extent permissible under applicable law. 113 | c. Affirmer disclaims responsibility for clearing rights of other persons 114 | that may apply to the Work or any use thereof, including without 115 | limitation any person's Copyright and Related Rights in the Work. 116 | Further, Affirmer disclaims responsibility for obtaining any necessary 117 | consents, permissions or other rights required for any use of the 118 | Work. 119 | d. Affirmer understands and acknowledges that Creative Commons is not a 120 | party to this document and has no duty or obligation with respect to 121 | this CC0 or use of the Work. 122 | -------------------------------------------------------------------------------- /Lung_cancer_classification_using_Yolov8.ipynb: -------------------------------------------------------------------------------- 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 | "accelerator": "GPU", 16 | "gpuClass": "standard" 17 | }, 18 | "cells": [ 19 | { 20 | "cell_type": "code", 21 | "execution_count": null, 22 | "metadata": { 23 | "id": "bAcKaPQVcw5R", 24 | "colab": { 25 | "base_uri": "https://localhost:8080/" 26 | }, 27 | "outputId": "5daac709-0d69-4496-87f2-53d66556d335" 28 | }, 29 | "outputs": [ 30 | { 31 | "output_type": "stream", 32 | "name": "stdout", 33 | "text": [ 34 | "Tue Mar 14 15:25:29 2023 \n", 35 | "+-----------------------------------------------------------------------------+\n", 36 | "| NVIDIA-SMI 525.85.12 Driver Version: 525.85.12 CUDA Version: 12.0 |\n", 37 | "|-------------------------------+----------------------+----------------------+\n", 38 | "| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |\n", 39 | "| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |\n", 40 | "| | | MIG M. |\n", 41 | "|===============================+======================+======================|\n", 42 | "| 0 Tesla T4 Off | 00000000:00:04.0 Off | 0 |\n", 43 | "| N/A 45C P0 27W / 70W | 0MiB / 15360MiB | 0% Default |\n", 44 | "| | | N/A |\n", 45 | "+-------------------------------+----------------------+----------------------+\n", 46 | " \n", 47 | "+-----------------------------------------------------------------------------+\n", 48 | "| Processes: |\n", 49 | "| GPU GI CI PID Type Process name GPU Memory |\n", 50 | "| ID ID Usage |\n", 51 | "|=============================================================================|\n", 52 | "| No running processes found |\n", 53 | "+-----------------------------------------------------------------------------+\n" 54 | ] 55 | } 56 | ], 57 | "source": [ 58 | "!nvidia-smi" 59 | ] 60 | }, 61 | { 62 | "cell_type": "code", 63 | "source": [ 64 | "!pip install ultralytics\n", 65 | "\n", 66 | "\n", 67 | "import ultralytics\n", 68 | "ultralytics.checks()" 69 | ], 70 | "metadata": { 71 | "colab": { 72 | "base_uri": "https://localhost:8080/" 73 | }, 74 | "id": "m0dx0mfRfzoM", 75 | "outputId": "5b65aacf-98c4-41de-a00e-9dbbeed0478e" 76 | }, 77 | "execution_count": 2, 78 | "outputs": [ 79 | { 80 | "output_type": "stream", 81 | "name": "stderr", 82 | "text": [ 83 | "Ultralytics YOLOv8.0.53 🚀 Python-3.9.16 torch-1.13.1+cu116 CUDA:0 (Tesla T4, 15102MiB)\n", 84 | "Setup complete ✅ (2 CPUs, 12.7 GB RAM, 25.5/78.2 GB disk)\n" 85 | ] 86 | } 87 | ] 88 | }, 89 | { 90 | "cell_type": "code", 91 | "source": [ 92 | "!pip install roboflow\n", 93 | "\n", 94 | "from roboflow import Roboflow\n", 95 | "rf = Roboflow(api_key=\"1hlOUh8DktTV4UeH0Wl8\")\n", 96 | "project = rf.workspace(\"satyam-mishra-gfl0c\").project(\"lung-cancer-detection-afeuf\")\n", 97 | "dataset = project.version(1).download(\"folder\")\n" 98 | ], 99 | "metadata": { 100 | "colab": { 101 | "base_uri": "https://localhost:8080/", 102 | "height": 1000 103 | }, 104 | "id": "igFiRpY9WBrI", 105 | "outputId": "0e5cc41b-923a-4504-bac7-31292451a2da" 106 | }, 107 | "execution_count": 1, 108 | "outputs": [ 109 | { 110 | "output_type": "stream", 111 | "name": "stdout", 112 | "text": [ 113 | "Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n", 114 | "Collecting roboflow\n", 115 | " Downloading roboflow-1.0.1-py3-none-any.whl (55 kB)\n", 116 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m55.7/55.7 KB\u001b[0m \u001b[31m2.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 117 | "\u001b[?25hCollecting python-dotenv\n", 118 | " Downloading python_dotenv-1.0.0-py3-none-any.whl (19 kB)\n", 119 | "Collecting cycler==0.10.0\n", 120 | " Downloading cycler-0.10.0-py2.py3-none-any.whl (6.5 kB)\n", 121 | "Requirement already satisfied: opencv-python>=4.1.2 in /usr/local/lib/python3.9/dist-packages (from roboflow) (4.6.0.66)\n", 122 | "Requirement already satisfied: urllib3>=1.26.6 in /usr/local/lib/python3.9/dist-packages (from roboflow) (1.26.15)\n", 123 | "Requirement already satisfied: PyYAML>=5.3.1 in /usr/local/lib/python3.9/dist-packages (from roboflow) (6.0)\n", 124 | "Requirement already satisfied: idna==2.10 in /usr/local/lib/python3.9/dist-packages (from roboflow) (2.10)\n", 125 | "Requirement already satisfied: python-dateutil in /usr/local/lib/python3.9/dist-packages (from roboflow) (2.8.2)\n", 126 | "Requirement already satisfied: Pillow>=7.1.2 in /usr/local/lib/python3.9/dist-packages (from roboflow) (8.4.0)\n", 127 | "Requirement already satisfied: certifi==2022.12.7 in /usr/local/lib/python3.9/dist-packages (from roboflow) (2022.12.7)\n", 128 | "Requirement already satisfied: chardet==4.0.0 in /usr/local/lib/python3.9/dist-packages (from roboflow) (4.0.0)\n", 129 | "Collecting requests-toolbelt\n", 130 | " Downloading requests_toolbelt-0.10.1-py2.py3-none-any.whl (54 kB)\n", 131 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m54.5/54.5 KB\u001b[0m \u001b[31m6.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 132 | "\u001b[?25hRequirement already satisfied: numpy>=1.18.5 in /usr/local/lib/python3.9/dist-packages (from roboflow) (1.22.4)\n", 133 | "Requirement already satisfied: requests in /usr/local/lib/python3.9/dist-packages (from roboflow) (2.25.1)\n", 134 | "Requirement already satisfied: tqdm>=4.41.0 in /usr/local/lib/python3.9/dist-packages (from roboflow) (4.65.0)\n", 135 | "Collecting pyparsing==2.4.7\n", 136 | " Downloading pyparsing-2.4.7-py2.py3-none-any.whl (67 kB)\n", 137 | "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m67.8/67.8 KB\u001b[0m \u001b[31m7.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", 138 | "\u001b[?25hRequirement already satisfied: matplotlib in /usr/local/lib/python3.9/dist-packages (from roboflow) (3.5.3)\n", 139 | "Requirement already satisfied: six in /usr/local/lib/python3.9/dist-packages (from roboflow) (1.15.0)\n", 140 | "Collecting wget\n", 141 | " Downloading wget-3.2.zip (10 kB)\n", 142 | " Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n", 143 | "Requirement already satisfied: kiwisolver>=1.3.1 in /usr/local/lib/python3.9/dist-packages (from roboflow) (1.4.4)\n", 144 | "Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.9/dist-packages (from matplotlib->roboflow) (4.39.0)\n", 145 | "Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.9/dist-packages (from matplotlib->roboflow) (23.0)\n", 146 | "Building wheels for collected packages: wget\n", 147 | " Building wheel for wget (setup.py) ... \u001b[?25l\u001b[?25hdone\n", 148 | " Created wheel for wget: filename=wget-3.2-py3-none-any.whl size=9673 sha256=f8e1224ac7815c5b36fa4a976dd5a39330c9bcd3b20e348cf1e79dcf6800a41d\n", 149 | " Stored in directory: /root/.cache/pip/wheels/04/5f/3e/46cc37c5d698415694d83f607f833f83f0149e49b3af9d0f38\n", 150 | "Successfully built wget\n", 151 | "Installing collected packages: wget, python-dotenv, pyparsing, cycler, requests-toolbelt, roboflow\n", 152 | " Attempting uninstall: pyparsing\n", 153 | " Found existing installation: pyparsing 3.0.9\n", 154 | " Uninstalling pyparsing-3.0.9:\n", 155 | " Successfully uninstalled pyparsing-3.0.9\n", 156 | " Attempting uninstall: cycler\n", 157 | " Found existing installation: cycler 0.11.0\n", 158 | " Uninstalling cycler-0.11.0:\n", 159 | " Successfully uninstalled cycler-0.11.0\n", 160 | "Successfully installed cycler-0.10.0 pyparsing-2.4.7 python-dotenv-1.0.0 requests-toolbelt-0.10.1 roboflow-1.0.1 wget-3.2\n" 161 | ] 162 | }, 163 | { 164 | "output_type": "display_data", 165 | "data": { 166 | "application/vnd.colab-display-data+json": { 167 | "pip_warning": { 168 | "packages": [ 169 | "cycler", 170 | "pyparsing" 171 | ] 172 | } 173 | } 174 | }, 175 | "metadata": {} 176 | }, 177 | { 178 | "output_type": "stream", 179 | "name": "stdout", 180 | "text": [ 181 | "loading Roboflow workspace...\n", 182 | "loading Roboflow project...\n", 183 | "Downloading Dataset Version Zip in Lung-cancer-detection-1 to folder: 100% [22327345 / 22327345] bytes\n" 184 | ] 185 | }, 186 | { 187 | "output_type": "stream", 188 | "name": "stderr", 189 | "text": [ 190 | "Extracting Dataset Version Zip to Lung-cancer-detection-1 in folder:: 100%|██████████| 2654/2654 [00:00<00:00, 3205.48it/s]\n" 191 | ] 192 | } 193 | ] 194 | }, 195 | { 196 | "cell_type": "code", 197 | "source": [ 198 | "!yolo task=classify mode=train model=yolov8n-cls.pt data={dataset.location} epochs=100 imgsz=224 single_cls=True" 199 | ], 200 | "metadata": { 201 | "colab": { 202 | "base_uri": "https://localhost:8080/" 203 | }, 204 | "id": "MH9cTx6KuqtG", 205 | "outputId": "f2a0e062-4088-4555-f903-158aeafd82e9" 206 | }, 207 | "execution_count": 3, 208 | "outputs": [ 209 | { 210 | "output_type": "stream", 211 | "name": "stdout", 212 | "text": [ 213 | "Downloading https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n-cls.pt to yolov8n-cls.pt...\n", 214 | "100% 5.28M/5.28M [00:00<00:00, 19.9MB/s]\n", 215 | "Ultralytics YOLOv8.0.53 🚀 Python-3.9.16 torch-1.13.1+cu116 CUDA:0 (Tesla T4, 15102MiB)\n", 216 | "\u001b[34m\u001b[1myolo/engine/trainer: \u001b[0mtask=classify, mode=train, model=yolov8n-cls.pt, data=/content/Lung-cancer-detection-1, epochs=100, patience=50, batch=16, imgsz=224, save=True, save_period=-1, cache=False, device=None, workers=8, project=None, name=None, exist_ok=False, pretrained=False, optimizer=SGD, verbose=True, seed=0, deterministic=True, single_cls=True, image_weights=False, rect=False, cos_lr=False, close_mosaic=10, resume=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, 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=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, 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, tracker=botsort.yaml, save_dir=runs/classify/train\n", 217 | "Overriding model.yaml nc=1000 with nc=5\n", 218 | "\n", 219 | " from n params module arguments \n", 220 | " 0 -1 1 464 ultralytics.nn.modules.Conv [3, 16, 3, 2] \n", 221 | " 1 -1 1 4672 ultralytics.nn.modules.Conv [16, 32, 3, 2] \n", 222 | " 2 -1 1 7360 ultralytics.nn.modules.C2f [32, 32, 1, True] \n", 223 | " 3 -1 1 18560 ultralytics.nn.modules.Conv [32, 64, 3, 2] \n", 224 | " 4 -1 2 49664 ultralytics.nn.modules.C2f [64, 64, 2, True] \n", 225 | " 5 -1 1 73984 ultralytics.nn.modules.Conv [64, 128, 3, 2] \n", 226 | " 6 -1 2 197632 ultralytics.nn.modules.C2f [128, 128, 2, True] \n", 227 | " 7 -1 1 295424 ultralytics.nn.modules.Conv [128, 256, 3, 2] \n", 228 | " 8 -1 1 460288 ultralytics.nn.modules.C2f [256, 256, 1, True] \n", 229 | " 9 -1 1 336645 ultralytics.nn.modules.Classify [256, 5] \n", 230 | "YOLOv8n-cls summary: 99 layers, 1444693 parameters, 1444693 gradients, 3.4 GFLOPs\n", 231 | "2023-03-15 03:43:11.863922: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 FMA\n", 232 | "To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.\n", 233 | "2023-03-15 03:43:12.922173: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/lib/python3.9/dist-packages/cv2/../../lib64:/usr/local/lib/python3.9/dist-packages/cv2/../../lib64:/usr/lib64-nvidia\n", 234 | "2023-03-15 03:43:12.922328: W tensorflow/compiler/xla/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/lib/python3.9/dist-packages/cv2/../../lib64:/usr/local/lib/python3.9/dist-packages/cv2/../../lib64:/usr/lib64-nvidia\n", 235 | "2023-03-15 03:43:12.922351: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.\n", 236 | "\u001b[34m\u001b[1mAMP: \u001b[0mrunning Automatic Mixed Precision (AMP) checks with YOLOv8n...\n", 237 | "Downloading https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n.pt to yolov8n.pt...\n", 238 | "100% 6.23M/6.23M [00:00<00:00, 16.9MB/s]\n", 239 | "\u001b[34m\u001b[1mAMP: \u001b[0mchecks passed ✅\n", 240 | "\u001b[34m\u001b[1moptimizer:\u001b[0m SGD(lr=0.01) with parameter groups 26 weight(decay=0.0), 27 weight(decay=0.0005), 27 bias\n", 241 | "\u001b[34m\u001b[1malbumentations: \u001b[0mRandomResizedCrop(p=1.0, height=224, width=224, scale=(0.08, 1.0), ratio=(0.75, 1.3333333333333333), interpolation=1), HorizontalFlip(p=0.5), ColorJitter(p=0.5, brightness=[0.6, 1.4], contrast=[0.6, 1.4], saturation=[0.6, 1.4], hue=[0, 0]), Normalize(p=1.0, mean=(0.0, 0.0, 0.0), std=(1.0, 1.0, 1.0), max_pixel_value=255.0), ToTensorV2(always_apply=True, p=1.0, transpose_mask=False)\n", 242 | "Image sizes 224 train, 224 val\n", 243 | "Using 2 dataloader workers\n", 244 | "Logging results to \u001b[1mruns/classify/train\u001b[0m\n", 245 | "Starting training for 100 epochs...\n", 246 | "\n", 247 | " Epoch GPU_mem loss Instances Size\n", 248 | " 1/100 0.172G 0.2959 2 224: 100% 149/149 [00:14<00:00, 10.53it/s]\n", 249 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 30.98it/s]\n", 250 | " all 0.537 1\n", 251 | "\n", 252 | " Epoch GPU_mem loss Instances Size\n", 253 | " 2/100 0.262G 0.2719 2 224: 100% 149/149 [00:12<00:00, 12.02it/s]\n", 254 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 27.22it/s]\n", 255 | " all 0.537 1\n", 256 | "\n", 257 | " Epoch GPU_mem loss Instances Size\n", 258 | " 3/100 0.264G 0.2707 2 224: 100% 149/149 [00:12<00:00, 12.20it/s]\n", 259 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 34.19it/s]\n", 260 | " all 0.648 1\n", 261 | "\n", 262 | " Epoch GPU_mem loss Instances Size\n", 263 | " 4/100 0.264G 0.269 2 224: 100% 149/149 [00:11<00:00, 13.02it/s]\n", 264 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 17.41it/s]\n", 265 | " all 0.556 1\n", 266 | "\n", 267 | " Epoch GPU_mem loss Instances Size\n", 268 | " 5/100 0.264G 0.2655 2 224: 100% 149/149 [00:10<00:00, 13.86it/s]\n", 269 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 26.26it/s]\n", 270 | " all 0.648 1\n", 271 | "\n", 272 | " Epoch GPU_mem loss Instances Size\n", 273 | " 6/100 0.264G 0.2616 2 224: 100% 149/149 [00:12<00:00, 12.41it/s]\n", 274 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 37.14it/s]\n", 275 | " all 0.389 1\n", 276 | "\n", 277 | " Epoch GPU_mem loss Instances Size\n", 278 | " 7/100 0.264G 0.2437 2 224: 100% 149/149 [00:12<00:00, 12.41it/s]\n", 279 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 51.76it/s]\n", 280 | " all 0.778 1\n", 281 | "\n", 282 | " Epoch GPU_mem loss Instances Size\n", 283 | " 8/100 0.264G 0.2328 2 224: 100% 149/149 [00:12<00:00, 12.36it/s]\n", 284 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 51.13it/s]\n", 285 | " all 0.389 1\n", 286 | "\n", 287 | " Epoch GPU_mem loss Instances Size\n", 288 | " 9/100 0.264G 0.2195 2 224: 100% 149/149 [00:11<00:00, 12.45it/s]\n", 289 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 29.97it/s]\n", 290 | " all 0.278 1\n", 291 | "\n", 292 | " Epoch GPU_mem loss Instances Size\n", 293 | " 10/100 0.264G 0.2053 2 224: 100% 149/149 [00:11<00:00, 12.43it/s]\n", 294 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 24.03it/s]\n", 295 | " all 0.778 1\n", 296 | "\n", 297 | " Epoch GPU_mem loss Instances Size\n", 298 | " 11/100 0.264G 0.2055 2 224: 100% 149/149 [00:11<00:00, 12.61it/s]\n", 299 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 32.91it/s]\n", 300 | " all 0.537 1\n", 301 | "\n", 302 | " Epoch GPU_mem loss Instances Size\n", 303 | " 12/100 0.264G 0.2024 2 224: 100% 149/149 [00:11<00:00, 12.50it/s]\n", 304 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 37.16it/s]\n", 305 | " all 0.704 1\n", 306 | "\n", 307 | " Epoch GPU_mem loss Instances Size\n", 308 | " 13/100 0.264G 0.1909 2 224: 100% 149/149 [00:11<00:00, 13.52it/s]\n", 309 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 55.27it/s]\n", 310 | " all 0.556 1\n", 311 | "\n", 312 | " Epoch GPU_mem loss Instances Size\n", 313 | " 14/100 0.264G 0.1858 2 224: 100% 149/149 [00:10<00:00, 13.55it/s]\n", 314 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 33.06it/s]\n", 315 | " all 0.722 1\n", 316 | "\n", 317 | " Epoch GPU_mem loss Instances Size\n", 318 | " 15/100 0.264G 0.184 2 224: 100% 149/149 [00:11<00:00, 13.25it/s]\n", 319 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 25.41it/s]\n", 320 | " all 0.778 1\n", 321 | "\n", 322 | " Epoch GPU_mem loss Instances Size\n", 323 | " 16/100 0.264G 0.1826 2 224: 100% 149/149 [00:10<00:00, 13.69it/s]\n", 324 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 33.67it/s]\n", 325 | " all 0.852 1\n", 326 | "\n", 327 | " Epoch GPU_mem loss Instances Size\n", 328 | " 17/100 0.264G 0.183 2 224: 100% 149/149 [00:10<00:00, 13.96it/s]\n", 329 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 54.68it/s]\n", 330 | " all 0.833 1\n", 331 | "\n", 332 | " Epoch GPU_mem loss Instances Size\n", 333 | " 18/100 0.264G 0.1746 2 224: 100% 149/149 [00:10<00:00, 14.06it/s]\n", 334 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 17.95it/s]\n", 335 | " all 0.815 1\n", 336 | "\n", 337 | " Epoch GPU_mem loss Instances Size\n", 338 | " 19/100 0.264G 0.1733 2 224: 100% 149/149 [00:09<00:00, 15.50it/s]\n", 339 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 29.10it/s]\n", 340 | " all 0.778 1\n", 341 | "\n", 342 | " Epoch GPU_mem loss Instances Size\n", 343 | " 20/100 0.264G 0.1708 2 224: 100% 149/149 [00:10<00:00, 13.59it/s]\n", 344 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 24.60it/s]\n", 345 | " all 0.815 1\n", 346 | "\n", 347 | " Epoch GPU_mem loss Instances Size\n", 348 | " 21/100 0.264G 0.1711 2 224: 100% 149/149 [00:11<00:00, 13.22it/s]\n", 349 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 31.04it/s]\n", 350 | " all 0.778 1\n", 351 | "\n", 352 | " Epoch GPU_mem loss Instances Size\n", 353 | " 22/100 0.264G 0.1681 2 224: 100% 149/149 [00:10<00:00, 13.89it/s]\n", 354 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 26.95it/s]\n", 355 | " all 0.741 1\n", 356 | "\n", 357 | " Epoch GPU_mem loss Instances Size\n", 358 | " 23/100 0.264G 0.1658 2 224: 100% 149/149 [00:11<00:00, 13.36it/s]\n", 359 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 35.86it/s]\n", 360 | " all 0.852 1\n", 361 | "\n", 362 | " Epoch GPU_mem loss Instances Size\n", 363 | " 24/100 0.264G 0.1642 2 224: 100% 149/149 [00:09<00:00, 14.96it/s]\n", 364 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 16.22it/s]\n", 365 | " all 0.833 1\n", 366 | "\n", 367 | " Epoch GPU_mem loss Instances Size\n", 368 | " 25/100 0.264G 0.1613 2 224: 100% 149/149 [00:10<00:00, 14.03it/s]\n", 369 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 59.90it/s]\n", 370 | " all 0.815 1\n", 371 | "\n", 372 | " Epoch GPU_mem loss Instances Size\n", 373 | " 26/100 0.264G 0.1599 2 224: 100% 149/149 [00:11<00:00, 13.45it/s]\n", 374 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 52.92it/s]\n", 375 | " all 0.87 1\n", 376 | "\n", 377 | " Epoch GPU_mem loss Instances Size\n", 378 | " 27/100 0.264G 0.152 2 224: 100% 149/149 [00:11<00:00, 12.94it/s]\n", 379 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 34.46it/s]\n", 380 | " all 0.741 1\n", 381 | "\n", 382 | " Epoch GPU_mem loss Instances Size\n", 383 | " 28/100 0.264G 0.1512 2 224: 100% 149/149 [00:11<00:00, 13.08it/s]\n", 384 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 23.40it/s]\n", 385 | " all 0.833 1\n", 386 | "\n", 387 | " Epoch GPU_mem loss Instances Size\n", 388 | " 29/100 0.264G 0.1558 2 224: 100% 149/149 [00:11<00:00, 13.48it/s]\n", 389 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 54.10it/s]\n", 390 | " all 0.796 1\n", 391 | "\n", 392 | " Epoch GPU_mem loss Instances Size\n", 393 | " 30/100 0.264G 0.1512 2 224: 100% 149/149 [00:09<00:00, 15.37it/s]\n", 394 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 24.78it/s]\n", 395 | " all 0.87 1\n", 396 | "\n", 397 | " Epoch GPU_mem loss Instances Size\n", 398 | " 31/100 0.264G 0.1486 2 224: 100% 149/149 [00:10<00:00, 13.93it/s]\n", 399 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 30.85it/s]\n", 400 | " all 0.889 1\n", 401 | "\n", 402 | " Epoch GPU_mem loss Instances Size\n", 403 | " 32/100 0.264G 0.1471 2 224: 100% 149/149 [00:11<00:00, 13.27it/s]\n", 404 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 57.83it/s]\n", 405 | " all 0.796 1\n", 406 | "\n", 407 | " Epoch GPU_mem loss Instances Size\n", 408 | " 33/100 0.264G 0.1387 2 224: 100% 149/149 [00:12<00:00, 12.37it/s]\n", 409 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 52.15it/s]\n", 410 | " all 0.852 1\n", 411 | "\n", 412 | " Epoch GPU_mem loss Instances Size\n", 413 | " 34/100 0.264G 0.1469 2 224: 100% 149/149 [00:11<00:00, 12.56it/s]\n", 414 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 26.54it/s]\n", 415 | " all 0.815 1\n", 416 | "\n", 417 | " Epoch GPU_mem loss Instances Size\n", 418 | " 35/100 0.264G 0.1452 2 224: 100% 149/149 [00:11<00:00, 12.53it/s]\n", 419 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 27.96it/s]\n", 420 | " all 0.815 1\n", 421 | "\n", 422 | " Epoch GPU_mem loss Instances Size\n", 423 | " 36/100 0.264G 0.1413 2 224: 100% 149/149 [00:10<00:00, 14.22it/s]\n", 424 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 26.08it/s]\n", 425 | " all 0.87 1\n", 426 | "\n", 427 | " Epoch GPU_mem loss Instances Size\n", 428 | " 37/100 0.264G 0.1382 2 224: 100% 149/149 [00:10<00:00, 14.46it/s]\n", 429 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 51.93it/s]\n", 430 | " all 0.87 1\n", 431 | "\n", 432 | " Epoch GPU_mem loss Instances Size\n", 433 | " 38/100 0.264G 0.1325 2 224: 100% 149/149 [00:11<00:00, 12.94it/s]\n", 434 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 25.35it/s]\n", 435 | " all 0.833 1\n", 436 | "\n", 437 | " Epoch GPU_mem loss Instances Size\n", 438 | " 39/100 0.264G 0.1323 2 224: 100% 149/149 [00:11<00:00, 13.21it/s]\n", 439 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 53.95it/s]\n", 440 | " all 0.889 1\n", 441 | "\n", 442 | " Epoch GPU_mem loss Instances Size\n", 443 | " 40/100 0.264G 0.1318 2 224: 100% 149/149 [00:11<00:00, 12.77it/s]\n", 444 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 44.68it/s]\n", 445 | " all 0.852 1\n", 446 | "\n", 447 | " Epoch GPU_mem loss Instances Size\n", 448 | " 41/100 0.264G 0.1327 2 224: 100% 149/149 [00:11<00:00, 12.70it/s]\n", 449 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 39.13it/s]\n", 450 | " all 0.907 1\n", 451 | "\n", 452 | " Epoch GPU_mem loss Instances Size\n", 453 | " 42/100 0.264G 0.1244 2 224: 100% 149/149 [00:11<00:00, 13.14it/s]\n", 454 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 53.56it/s]\n", 455 | " all 0.889 1\n", 456 | "\n", 457 | " Epoch GPU_mem loss Instances Size\n", 458 | " 43/100 0.264G 0.1282 2 224: 100% 149/149 [00:09<00:00, 15.03it/s]\n", 459 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 30.78it/s]\n", 460 | " all 0.889 1\n", 461 | "\n", 462 | " Epoch GPU_mem loss Instances Size\n", 463 | " 44/100 0.264G 0.125 2 224: 100% 149/149 [00:11<00:00, 13.47it/s]\n", 464 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 28.47it/s]\n", 465 | " all 0.889 1\n", 466 | "\n", 467 | " Epoch GPU_mem loss Instances Size\n", 468 | " 45/100 0.264G 0.1235 2 224: 100% 149/149 [00:11<00:00, 13.00it/s]\n", 469 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 54.66it/s]\n", 470 | " all 0.852 1\n", 471 | "\n", 472 | " Epoch GPU_mem loss Instances Size\n", 473 | " 46/100 0.264G 0.1087 2 224: 100% 149/149 [00:11<00:00, 13.20it/s]\n", 474 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 21.40it/s]\n", 475 | " all 0.87 1\n", 476 | "\n", 477 | " Epoch GPU_mem loss Instances Size\n", 478 | " 47/100 0.264G 0.1195 2 224: 100% 149/149 [00:11<00:00, 13.39it/s]\n", 479 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 47.25it/s]\n", 480 | " all 0.685 1\n", 481 | "\n", 482 | " Epoch GPU_mem loss Instances Size\n", 483 | " 48/100 0.264G 0.1208 2 224: 100% 149/149 [00:11<00:00, 13.16it/s]\n", 484 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 54.16it/s]\n", 485 | " all 0.815 1\n", 486 | "\n", 487 | " Epoch GPU_mem loss Instances Size\n", 488 | " 49/100 0.264G 0.1222 2 224: 100% 149/149 [00:09<00:00, 15.18it/s]\n", 489 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 23.65it/s]\n", 490 | " all 0.667 1\n", 491 | "\n", 492 | " Epoch GPU_mem loss Instances Size\n", 493 | " 50/100 0.264G 0.1138 2 224: 100% 149/149 [00:11<00:00, 13.33it/s]\n", 494 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 31.80it/s]\n", 495 | " all 0.889 1\n", 496 | "\n", 497 | " Epoch GPU_mem loss Instances Size\n", 498 | " 51/100 0.264G 0.1207 2 224: 100% 149/149 [00:11<00:00, 13.33it/s]\n", 499 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 55.68it/s]\n", 500 | " all 0.926 1\n", 501 | "\n", 502 | " Epoch GPU_mem loss Instances Size\n", 503 | " 52/100 0.264G 0.1133 2 224: 100% 149/149 [00:11<00:00, 13.33it/s]\n", 504 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 18.18it/s]\n", 505 | " all 0.759 1\n", 506 | "\n", 507 | " Epoch GPU_mem loss Instances Size\n", 508 | " 53/100 0.264G 0.1197 2 224: 100% 149/149 [00:11<00:00, 13.06it/s]\n", 509 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 52.78it/s]\n", 510 | " all 0.907 1\n", 511 | "\n", 512 | " Epoch GPU_mem loss Instances Size\n", 513 | " 54/100 0.264G 0.1046 2 224: 100% 149/149 [00:11<00:00, 13.54it/s]\n", 514 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 26.10it/s]\n", 515 | " all 0.926 1\n", 516 | "\n", 517 | " Epoch GPU_mem loss Instances Size\n", 518 | " 55/100 0.264G 0.1119 2 224: 100% 149/149 [00:09<00:00, 15.18it/s]\n", 519 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 25.62it/s]\n", 520 | " all 0.815 1\n", 521 | "\n", 522 | " Epoch GPU_mem loss Instances Size\n", 523 | " 56/100 0.264G 0.1071 2 224: 100% 149/149 [00:11<00:00, 13.30it/s]\n", 524 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 17.17it/s]\n", 525 | " all 0.926 1\n", 526 | "\n", 527 | " Epoch GPU_mem loss Instances Size\n", 528 | " 57/100 0.264G 0.107 2 224: 100% 149/149 [00:11<00:00, 13.21it/s]\n", 529 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 38.92it/s]\n", 530 | " all 0.833 1\n", 531 | "\n", 532 | " Epoch GPU_mem loss Instances Size\n", 533 | " 58/100 0.264G 0.1035 2 224: 100% 149/149 [00:11<00:00, 13.45it/s]\n", 534 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 24.59it/s]\n", 535 | " all 0.833 1\n", 536 | "\n", 537 | " Epoch GPU_mem loss Instances Size\n", 538 | " 59/100 0.264G 0.09939 2 224: 100% 149/149 [00:11<00:00, 13.09it/s]\n", 539 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 21.43it/s]\n", 540 | " all 0.889 1\n", 541 | "\n", 542 | " Epoch GPU_mem loss Instances Size\n", 543 | " 60/100 0.264G 0.09827 2 224: 100% 149/149 [00:10<00:00, 13.74it/s]\n", 544 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 17.17it/s]\n", 545 | " all 0.926 1\n", 546 | "\n", 547 | " Epoch GPU_mem loss Instances Size\n", 548 | " 61/100 0.264G 0.09715 2 224: 100% 149/149 [00:10<00:00, 14.89it/s]\n", 549 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 54.73it/s]\n", 550 | " all 0.87 1\n", 551 | "\n", 552 | " Epoch GPU_mem loss Instances Size\n", 553 | " 62/100 0.264G 0.09325 2 224: 100% 149/149 [00:11<00:00, 13.25it/s]\n", 554 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 53.29it/s]\n", 555 | " all 0.926 1\n", 556 | "\n", 557 | " Epoch GPU_mem loss Instances Size\n", 558 | " 63/100 0.264G 0.0967 2 224: 100% 149/149 [00:11<00:00, 13.32it/s]\n", 559 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 43.61it/s]\n", 560 | " all 0.833 1\n", 561 | "\n", 562 | " Epoch GPU_mem loss Instances Size\n", 563 | " 64/100 0.264G 0.09998 2 224: 100% 149/149 [00:11<00:00, 13.29it/s]\n", 564 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 40.23it/s]\n", 565 | " all 0.722 1\n", 566 | "\n", 567 | " Epoch GPU_mem loss Instances Size\n", 568 | " 65/100 0.264G 0.08892 2 224: 100% 149/149 [00:11<00:00, 12.75it/s]\n", 569 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 52.93it/s]\n", 570 | " all 0.852 1\n", 571 | "\n", 572 | " Epoch GPU_mem loss Instances Size\n", 573 | " 66/100 0.264G 0.09364 2 224: 100% 149/149 [00:11<00:00, 12.79it/s]\n", 574 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 18.99it/s]\n", 575 | " all 0.87 1\n", 576 | "\n", 577 | " Epoch GPU_mem loss Instances Size\n", 578 | " 67/100 0.264G 0.08667 2 224: 100% 149/149 [00:10<00:00, 13.92it/s]\n", 579 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 27.10it/s]\n", 580 | " all 0.907 1\n", 581 | "\n", 582 | " Epoch GPU_mem loss Instances Size\n", 583 | " 68/100 0.264G 0.09061 2 224: 100% 149/149 [00:11<00:00, 13.02it/s]\n", 584 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 35.86it/s]\n", 585 | " all 0.926 1\n", 586 | "\n", 587 | " Epoch GPU_mem loss Instances Size\n", 588 | " 69/100 0.264G 0.09277 2 224: 100% 149/149 [00:11<00:00, 12.47it/s]\n", 589 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 52.45it/s]\n", 590 | " all 0.87 1\n", 591 | "\n", 592 | " Epoch GPU_mem loss Instances Size\n", 593 | " 70/100 0.264G 0.08915 2 224: 100% 149/149 [00:12<00:00, 12.25it/s]\n", 594 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 47.63it/s]\n", 595 | " all 0.907 1\n", 596 | "\n", 597 | " Epoch GPU_mem loss Instances Size\n", 598 | " 71/100 0.264G 0.08995 2 224: 100% 149/149 [00:12<00:00, 12.28it/s]\n", 599 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 33.75it/s]\n", 600 | " all 0.926 1\n", 601 | "\n", 602 | " Epoch GPU_mem loss Instances Size\n", 603 | " 72/100 0.264G 0.08515 2 224: 100% 149/149 [00:12<00:00, 12.36it/s]\n", 604 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 52.94it/s]\n", 605 | " all 0.889 1\n", 606 | "\n", 607 | " Epoch GPU_mem loss Instances Size\n", 608 | " 73/100 0.264G 0.09154 2 224: 100% 149/149 [00:12<00:00, 12.28it/s]\n", 609 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 52.14it/s]\n", 610 | " all 0.907 1\n", 611 | "\n", 612 | " Epoch GPU_mem loss Instances Size\n", 613 | " 74/100 0.264G 0.07847 2 224: 100% 149/149 [00:12<00:00, 12.31it/s]\n", 614 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 27.10it/s]\n", 615 | " all 0.926 1\n", 616 | "\n", 617 | " Epoch GPU_mem loss Instances Size\n", 618 | " 75/100 0.264G 0.08391 2 224: 100% 149/149 [00:11<00:00, 12.77it/s]\n", 619 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 16.53it/s]\n", 620 | " all 0.907 1\n", 621 | "\n", 622 | " Epoch GPU_mem loss Instances Size\n", 623 | " 76/100 0.264G 0.08364 2 224: 100% 149/149 [00:10<00:00, 13.77it/s]\n", 624 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 23.21it/s]\n", 625 | " all 0.907 1\n", 626 | "\n", 627 | " Epoch GPU_mem loss Instances Size\n", 628 | " 77/100 0.264G 0.08722 2 224: 100% 149/149 [00:11<00:00, 12.63it/s]\n", 629 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 52.49it/s]\n", 630 | " all 0.87 1\n", 631 | "\n", 632 | " Epoch GPU_mem loss Instances Size\n", 633 | " 78/100 0.264G 0.08162 2 224: 100% 149/149 [00:12<00:00, 12.27it/s]\n", 634 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 18.14it/s]\n", 635 | " all 0.889 1\n", 636 | "\n", 637 | " Epoch GPU_mem loss Instances Size\n", 638 | " 79/100 0.264G 0.07975 2 224: 100% 149/149 [00:11<00:00, 12.56it/s]\n", 639 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 33.50it/s]\n", 640 | " all 0.796 1\n", 641 | "\n", 642 | " Epoch GPU_mem loss Instances Size\n", 643 | " 80/100 0.264G 0.0818 2 224: 100% 149/149 [00:11<00:00, 12.57it/s]\n", 644 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 36.67it/s]\n", 645 | " all 0.889 1\n", 646 | "\n", 647 | " Epoch GPU_mem loss Instances Size\n", 648 | " 81/100 0.264G 0.08163 2 224: 100% 149/149 [00:12<00:00, 12.21it/s]\n", 649 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 50.40it/s]\n", 650 | " all 0.907 1\n", 651 | "\n", 652 | " Epoch GPU_mem loss Instances Size\n", 653 | " 82/100 0.264G 0.08007 2 224: 100% 149/149 [00:12<00:00, 12.26it/s]\n", 654 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 51.51it/s]\n", 655 | " all 0.926 1\n", 656 | "\n", 657 | " Epoch GPU_mem loss Instances Size\n", 658 | " 83/100 0.264G 0.07943 2 224: 100% 149/149 [00:12<00:00, 12.37it/s]\n", 659 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 26.59it/s]\n", 660 | " all 0.926 1\n", 661 | "\n", 662 | " Epoch GPU_mem loss Instances Size\n", 663 | " 84/100 0.264G 0.07959 2 224: 100% 149/149 [00:12<00:00, 12.26it/s]\n", 664 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 19.49it/s]\n", 665 | " all 0.87 1\n", 666 | "\n", 667 | " Epoch GPU_mem loss Instances Size\n", 668 | " 85/100 0.264G 0.07833 2 224: 100% 149/149 [00:11<00:00, 13.36it/s]\n", 669 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 18.34it/s]\n", 670 | " all 0.907 1\n", 671 | "\n", 672 | " Epoch GPU_mem loss Instances Size\n", 673 | " 86/100 0.264G 0.07237 2 224: 100% 149/149 [00:11<00:00, 13.22it/s]\n", 674 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 23.94it/s]\n", 675 | " all 0.926 1\n", 676 | "\n", 677 | " Epoch GPU_mem loss Instances Size\n", 678 | " 87/100 0.264G 0.0703 2 224: 100% 149/149 [00:12<00:00, 12.28it/s]\n", 679 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 35.85it/s]\n", 680 | " all 0.926 1\n", 681 | "\n", 682 | " Epoch GPU_mem loss Instances Size\n", 683 | " 88/100 0.264G 0.06936 2 224: 100% 149/149 [00:12<00:00, 12.25it/s]\n", 684 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 52.90it/s]\n", 685 | " all 0.889 1\n", 686 | "\n", 687 | " Epoch GPU_mem loss Instances Size\n", 688 | " 89/100 0.264G 0.07047 2 224: 100% 149/149 [00:12<00:00, 12.31it/s]\n", 689 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 50.85it/s]\n", 690 | " all 0.926 1\n", 691 | "\n", 692 | " Epoch GPU_mem loss Instances Size\n", 693 | " 90/100 0.264G 0.06522 2 224: 100% 149/149 [00:11<00:00, 12.58it/s]\n", 694 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 51.15it/s]\n", 695 | " all 0.944 1\n", 696 | "Closing dataloader mosaic\n", 697 | "\n", 698 | " Epoch GPU_mem loss Instances Size\n", 699 | " 91/100 0.264G 0.06837 2 224: 100% 149/149 [00:12<00:00, 12.12it/s]\n", 700 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 35.57it/s]\n", 701 | " all 0.926 1\n", 702 | "\n", 703 | " Epoch GPU_mem loss Instances Size\n", 704 | " 92/100 0.264G 0.06572 2 224: 100% 149/149 [00:12<00:00, 12.37it/s]\n", 705 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 22.68it/s]\n", 706 | " all 0.926 1\n", 707 | "\n", 708 | " Epoch GPU_mem loss Instances Size\n", 709 | " 93/100 0.264G 0.06425 2 224: 100% 149/149 [00:12<00:00, 12.31it/s]\n", 710 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 16.11it/s]\n", 711 | " all 0.833 1\n", 712 | "\n", 713 | " Epoch GPU_mem loss Instances Size\n", 714 | " 94/100 0.264G 0.06726 2 224: 100% 149/149 [00:10<00:00, 14.89it/s]\n", 715 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 30.42it/s]\n", 716 | " all 0.926 1\n", 717 | "\n", 718 | " Epoch GPU_mem loss Instances Size\n", 719 | " 95/100 0.264G 0.0637 2 224: 100% 149/149 [00:10<00:00, 14.01it/s]\n", 720 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 18.66it/s]\n", 721 | " all 0.944 1\n", 722 | "\n", 723 | " Epoch GPU_mem loss Instances Size\n", 724 | " 96/100 0.264G 0.06349 2 224: 100% 149/149 [00:10<00:00, 13.61it/s]\n", 725 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 42.44it/s]\n", 726 | " all 0.889 1\n", 727 | "\n", 728 | " Epoch GPU_mem loss Instances Size\n", 729 | " 97/100 0.264G 0.05927 2 224: 100% 149/149 [00:11<00:00, 13.21it/s]\n", 730 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 53.77it/s]\n", 731 | " all 0.926 1\n", 732 | "\n", 733 | " Epoch GPU_mem loss Instances Size\n", 734 | " 98/100 0.264G 0.06427 2 224: 100% 149/149 [00:10<00:00, 13.71it/s]\n", 735 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 57.06it/s]\n", 736 | " all 0.907 1\n", 737 | "\n", 738 | " Epoch GPU_mem loss Instances Size\n", 739 | " 99/100 0.264G 0.06046 2 224: 100% 149/149 [00:09<00:00, 14.93it/s]\n", 740 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 18.89it/s]\n", 741 | " all 0.907 1\n", 742 | "\n", 743 | " Epoch GPU_mem loss Instances Size\n", 744 | " 100/100 0.264G 0.05704 2 224: 100% 149/149 [00:10<00:00, 13.87it/s]\n", 745 | " classes top1_acc top5_acc: 100% 1/1 [00:00<00:00, 40.50it/s]\n", 746 | " all 0.889 1\n", 747 | "\n", 748 | "100 epochs completed in 0.323 hours.\n", 749 | "Optimizer stripped from runs/classify/train/weights/last.pt, 3.0MB\n", 750 | "Optimizer stripped from runs/classify/train/weights/best.pt, 3.0MB\n", 751 | "Results saved to \u001b[1mruns/classify/train\u001b[0m\n" 752 | ] 753 | } 754 | ] 755 | }, 756 | { 757 | "cell_type": "code", 758 | "source": [ 759 | "!yolo task=classify mode=val model=runs/classify/train/weights/best.pt data={dataset.location}" 760 | ], 761 | "metadata": { 762 | "colab": { 763 | "base_uri": "https://localhost:8080/" 764 | }, 765 | "id": "gkzAqgk-zsDN", 766 | "outputId": "902f8f44-99ed-4208-937d-ad7299858cf0" 767 | }, 768 | "execution_count": 4, 769 | "outputs": [ 770 | { 771 | "output_type": "stream", 772 | "name": "stdout", 773 | "text": [ 774 | "Ultralytics YOLOv8.0.53 🚀 Python-3.9.16 torch-1.13.1+cu116 CUDA:0 (Tesla T4, 15102MiB)\n", 775 | "YOLOv8n-cls summary (fused): 73 layers, 1441285 parameters, 0 gradients, 3.3 GFLOPs\n", 776 | " classes top1_acc top5_acc: 100% 4/4 [00:00<00:00, 29.89it/s]\n", 777 | " all 0.889 1\n", 778 | "Speed: 0.1ms preprocess, 1.6ms inference, 0.0ms loss, 0.0ms postprocess per image\n", 779 | "Results saved to \u001b[1mruns/classify/val\u001b[0m\n" 780 | ] 781 | } 782 | ] 783 | }, 784 | { 785 | "cell_type": "code", 786 | "source": [ 787 | "!yolo task=classify mode=predict model=runs/classify/train/weights/best.pt conf=0.25 source={dataset.location}/test/Bengin save" 788 | ], 789 | "metadata": { 790 | "colab": { 791 | "base_uri": "https://localhost:8080/" 792 | }, 793 | "id": "FDGGW8YC0OL-", 794 | "outputId": "859760b6-dc68-4145-9787-8af849aeaee6" 795 | }, 796 | "execution_count": 7, 797 | "outputs": [ 798 | { 799 | "output_type": "stream", 800 | "name": "stdout", 801 | "text": [ 802 | "Ultralytics YOLOv8.0.53 🚀 Python-3.9.16 torch-1.13.1+cu116 CUDA:0 (Tesla T4, 15102MiB)\n", 803 | "YOLOv8n-cls summary (fused): 73 layers, 1441285 parameters, 0 gradients, 3.3 GFLOPs\n", 804 | "\n", 805 | "Downloading https://ultralytics.com/assets/Arial.ttf to /root/.config/Ultralytics/Arial.ttf...\n", 806 | "100% 755k/755k [00:00<00:00, 16.8MB/s]\n", 807 | "image 1/2 /content/Lung-cancer-detection-1/test/Bengin/Bengin-case-64-_jpg.rf.dba08dd56fbd50da40203e8b14d85f2b.jpg: 224x224 Bengin case 0.97, Normal case 0.03, Bengin case Malignant case 0.00, Malignant case Normal case 0.00, Malignant case 0.00, 5.4ms\n", 808 | "image 2/2 /content/Lung-cancer-detection-1/test/Bengin/Bengin-case-70-_jpg.rf.9c95114e1a847ce43afb476db08cdb60.jpg: 224x224 Malignant case 0.35, Bengin case 0.27, Bengin case Malignant case 0.21, Normal case 0.16, Malignant case Normal case 0.01, 4.8ms\n", 809 | "Speed: 0.3ms preprocess, 5.1ms inference, 0.1ms postprocess per image at shape (1, 3, 224, 224)\n", 810 | "Results saved to \u001b[1mruns/classify/predict\u001b[0m\n" 811 | ] 812 | } 813 | ] 814 | } 815 | ] 816 | } --------------------------------------------------------------------------------