Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
22_23-J 65
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
22_23-J 65
22_23-J 65
Commits
085ac664
Commit
085ac664
authored
Jan 30, 2023
by
Warnasooriya M.D.S.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Developed Yolo Model
parent
4759fe62
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
226 additions
and
0 deletions
+226
-0
Backend/SF_Dinuka_yolov6_implementationV01.ipynb
Backend/SF_Dinuka_yolov6_implementationV01.ipynb
+226
-0
No files found.
Backend/SF_Dinuka_yolov6_implementationV01.ipynb
0 → 100644
View file @
085ac664
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "84aae50f",
"metadata": {},
"outputs": [],
"source": [
"#Model"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d933964d",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "d933964d",
"outputId": "456275d6-eec8-4a30-e04f-e6a811f5ef9c"
},
"outputs": [],
"source": [
"!git clone https://github.com/meituan/YOLOv6\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "30f8fb79",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "30f8fb79",
"outputId": "78f5019e-e134-4614-dda0-7cbbdd98c37f"
},
"outputs": [],
"source": [
"cd YOLOv6"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "25mXhL4oVrBN",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "25mXhL4oVrBN",
"outputId": "e3f345c9-073c-474e-88e2-26e949cac072"
},
"outputs": [],
"source": [
"from google.colab import drive\n",
"drive.mount('/content/drive')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "NHwPYL-5V7Ig",
"metadata": {
"id": "NHwPYL-5V7Ig"
},
"outputs": [],
"source": [
"dataset_location = '/content/drive/MyDrive/RP_SmartFarmer/Dinuka Sandaruwan - Pest Management/DataSet/yolov6_image_dataset.zip'\n",
"destination_path = '/content/YOLOv6'"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "eGwD4Fq5VxdO",
"metadata": {
"id": "eGwD4Fq5VxdO"
},
"outputs": [],
"source": [
"#Load and Unzipping the dataset\n",
"import zipfile\n",
"#unzip our data\n",
"zip_ref = zipfile.ZipFile(dataset_location, \"r\")\n",
"zip_ref.extractall(destination_path)\n",
"zip_ref.close()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c4054bd8",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "c4054bd8",
"outputId": "f32cd6b6-92ad-4ec6-a3c7-9bb3dd80607d"
},
"outputs": [],
"source": [
"#!pip install -r requirements.txt\n",
"# AssertionError: Torch not compiled with CUDA enabled\n",
"\n",
"# This requirement file is not installing torch with cuda. So if you want to train your model using gpu then install torch with cuda\n",
"\n",
"# Below torch version works with rtx 3090 (cuda 11.1)\n",
"!pip install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d2aa6501",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/",
"height": 36
},
"id": "d2aa6501",
"outputId": "737d47f1-504f-4095-ee99-1ebfcaa755fd"
},
"outputs": [],
"source": [
"import torch\n",
"torch.cuda.is_available() \n",
"torch.cuda.get_device_name(0)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "HNdRVT92t7LN",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "HNdRVT92t7LN",
"outputId": "5432de7d-9395-4828-c378-04f77d0830c1"
},
"outputs": [],
"source": [
"!wget https://github.com/meituan/YOLOv6/releases/download/0.2.0/yolov6n.pt -O weights/yolov6n.pt"
]
},
{
"cell_type": "markdown",
"id": "b897b5c2",
"metadata": {
"id": "b897b5c2"
},
"source": [
"# Train"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "wuWD3XMas8Lz",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "wuWD3XMas8Lz",
"outputId": "71599ea4-ca89-422f-c4dd-b85711a7feb8"
},
"outputs": [],
"source": [
"!pip install addict\n",
"#!pip install thop"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "Ah5TLs4gq09W",
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "Ah5TLs4gq09W",
"outputId": "cc9ab647-8ae6-4e6b-8c69-fce5f830ac07"
},
"outputs": [],
"source": [
"!python tools/train.py --epochs 1000 --batch-size 32 \\\n",
"--conf configs/yolov6n_finetune.py \\\n",
"--data dataset.yaml \\\n",
"--write_trainbatch_tb \\\n",
"--device 0,1 \\\n",
"--eval-interval 1 \\\n",
"--img-size 640 \\\n",
"--name v6n_32b_640img_100e_reducedlabel"
]
}
],
"metadata": {
"accelerator": "GPU",
"colab": {
"provenance": []
},
"gpuClass": "standard",
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment