From b82d6aadad79830b68a92030e8c9e9f232501de7 Mon Sep 17 00:00:00 2001 From: "wenfeng.zhang" Date: Fri, 25 Apr 2025 05:55:59 +0000 Subject: [PATCH 1/2] add yolov11 model train --- cv/detection/yolov11/pytorch/README.md | 69 ++++++++++++++++++++++++++ cv/detection/yolov11/pytorch/train.py | 23 +++++++++ 2 files changed, 92 insertions(+) create mode 100644 cv/detection/yolov11/pytorch/README.md create mode 100644 cv/detection/yolov11/pytorch/train.py diff --git a/cv/detection/yolov11/pytorch/README.md b/cv/detection/yolov11/pytorch/README.md new file mode 100644 index 00000000..5052fa9a --- /dev/null +++ b/cv/detection/yolov11/pytorch/README.md @@ -0,0 +1,69 @@ +# YOLOv11 + +## Model Description + +Ultralytics YOLO11 is not just another object detection model; it's a versatile framework designed to cover the entire lifecycle of machine learning models—from data ingestion and model training to validation, deployment, and real-world tracking. Each mode serves a specific purpose and is engineered to offer you the flexibility and efficiency required for different tasks and use-cases. + +## Supported Environments + +| GPU | [IXUCA SDK](https://gitee.com/deep-spark/deepspark#%E5%A4%A9%E6%95%B0%E6%99%BA%E7%AE%97%E8%BD%AF%E4%BB%B6%E6%A0%88-ixuca) | Release | +|--------|-----------|---------| +| BI-V150 | 4.2.0 | 25.03 | +| BI-V100 | 3.0.0 | 23.06 | + +## Model Preparation + +### Prepare Resources + +Go to visit [COCO official website](https://cocodataset.org/#download), then select the COCO dataset you want to +download. + +Take coco2017 dataset as an example, specify `/path/to/coco2017` to your COCO path in later training process, the +unzipped dataset path structure sholud look like: + +```bash +coco2017 +├── annotations +│ ├── instances_train2017.json +│ ├── instances_val2017.json +│ └── ... +├── train2017 +│ ├── 000000000009.jpg +│ ├── 000000000025.jpg +│ └── ... +├── val2017 +│ ├── 000000000139.jpg +│ ├── 000000000285.jpg +│ └── ... +├── train2017.txt +├── val2017.txt +└── ... +``` + +```bash +mkdir -p /datasets/ +ln -s /path/to/coco2017 /datasets/ +``` + +### Install Dependencies + +```bash +# Install ultralytics +pip3 install ultralytics +``` + +## Model Training + +```bash +python3 train.py +``` + +## Model Results + +| Model | GPU | FP32 | +|--------|------------|----------| +| YOLOv11 | BI-V150 x8 | MAP=39.5 | + +## References + +- [ultralytics](https://github.com/ultralytics/ultralytics) diff --git a/cv/detection/yolov11/pytorch/train.py b/cv/detection/yolov11/pytorch/train.py new file mode 100644 index 00000000..074ce6c3 --- /dev/null +++ b/cv/detection/yolov11/pytorch/train.py @@ -0,0 +1,23 @@ +# Copyright (c) 2023, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. +# All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from ultralytics import YOLO + +# Load a model +model = YOLO("yolov11n.yaml") # build a new model from scratch +# model = YOLO("yolov11n.pt") # load a pretrained model (recommended for training) + +# Use the model +model.train(data="coco.yaml",epochs=100, imgsz=640,batch=128,device="0,1,2,3,4,5,6,7") # train the model -- Gitee From 657602f5bdf7c4a7ed70fe2e70953a6775dddf81 Mon Sep 17 00:00:00 2001 From: "hongliang.yuan" Date: Tue, 6 May 2025 14:41:58 +0800 Subject: [PATCH 2/2] update pr 484 --- cv/detection/yolov11/pytorch/README.md | 18 ++++++++++++++---- cv/detection/yolov11/pytorch/train.py | 4 ++-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/cv/detection/yolov11/pytorch/README.md b/cv/detection/yolov11/pytorch/README.md index 5052fa9a..cbe213d2 100644 --- a/cv/detection/yolov11/pytorch/README.md +++ b/cv/detection/yolov11/pytorch/README.md @@ -8,8 +8,7 @@ Ultralytics YOLO11 is not just another object detection model; it's a versatile | GPU | [IXUCA SDK](https://gitee.com/deep-spark/deepspark#%E5%A4%A9%E6%95%B0%E6%99%BA%E7%AE%97%E8%BD%AF%E4%BB%B6%E6%A0%88-ixuca) | Release | |--------|-----------|---------| -| BI-V150 | 4.2.0 | 25.03 | -| BI-V100 | 3.0.0 | 23.06 | +| BI-V150 | 4.2.0 | 25.06 | ## Model Preparation @@ -42,14 +41,25 @@ coco2017 ```bash mkdir -p /datasets/ -ln -s /path/to/coco2017 /datasets/ +ln -s /path/to/coco2017 /datasets/coco + +mkdir -p /root/.config/Ultralytics/ +# Download https://ultralytics.com/assets/Arial.ttf to '/root/.config/Ultralytics/'... + +# Download https://github.com/ultralytics/assets/releases/download/v8.3.0/yolo11n.pt to 'yolo11n.pt'... ``` ### Install Dependencies ```bash +# Install libGL +## CentOS +yum install -y mesa-libGL +## Ubuntu +apt install -y libgl1-mesa-glx + # Install ultralytics -pip3 install ultralytics +pip3 install ultralytics==8.3.127 ``` ## Model Training diff --git a/cv/detection/yolov11/pytorch/train.py b/cv/detection/yolov11/pytorch/train.py index 074ce6c3..2aec2ef0 100644 --- a/cv/detection/yolov11/pytorch/train.py +++ b/cv/detection/yolov11/pytorch/train.py @@ -1,4 +1,4 @@ -# Copyright (c) 2023, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. +# Copyright (c) 2025, Shanghai Iluvatar CoreX Semiconductor Co., Ltd. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may @@ -16,7 +16,7 @@ from ultralytics import YOLO # Load a model -model = YOLO("yolov11n.yaml") # build a new model from scratch +model = YOLO("yolo11n.yaml") # build a new model from scratch # model = YOLO("yolov11n.pt") # load a pretrained model (recommended for training) # Use the model -- Gitee