Skip to content

Commit 1cb92d7

Browse files
AyushExelglenn-jocherpre-commit-ci[bot]validatedevLaughing-q
authored
ultralytics 8.0.65 YOLOv8 Pose models (ultralytics#1347)
Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Glenn Jocher <[email protected]> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Mert Can Demir <[email protected]> Co-authored-by: Laughing <[email protected]> Co-authored-by: Fabian Greavu <[email protected]> Co-authored-by: Yonghye Kwon <[email protected]> Co-authored-by: Eric Pedley <[email protected]> Co-authored-by: JustasBart <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Aarni Koskela <[email protected]> Co-authored-by: Sergio Sanchez <[email protected]> Co-authored-by: Bogdan Gheorghe <[email protected]> Co-authored-by: Jaap van de Loosdrecht <[email protected]> Co-authored-by: Noobtoss <[email protected]> Co-authored-by: nerdyespresso <[email protected]> Co-authored-by: Farid Inawan <[email protected]> Co-authored-by: Laughing-q <[email protected]> Co-authored-by: Alexander Duda <[email protected]> Co-authored-by: Mehran Ghandehari <[email protected]> Co-authored-by: Snyk bot <[email protected]> Co-authored-by: majid nasiri <[email protected]>
1 parent 9af3e69 commit 1cb92d7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+1578
-489
lines changed

.github/workflows/ci.yaml

Lines changed: 32 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,7 @@ jobs:
4343
python --version
4444
pip --version
4545
pip list
46-
- name: Test HUB training (Python Usage 1)
47-
shell: python
48-
env:
49-
APIKEY: ${{ secrets.ULTRALYTICS_HUB_APIKEY }}
50-
run: |
51-
import os
52-
from pathlib import Path
53-
from ultralytics import YOLO, hub
54-
from ultralytics.yolo.utils import USER_CONFIG_DIR
55-
Path(USER_CONFIG_DIR / 'settings.yaml').unlink()
56-
key = os.environ['APIKEY']
57-
hub.reset_model(key)
58-
model = YOLO('https://hub.ultralytics.com/models/' + key)
59-
model.train()
60-
- name: Test HUB training (Python Usage 2)
46+
- name: Test HUB training
6147
shell: python
6248
env:
6349
APIKEY: ${{ secrets.ULTRALYTICS_HUB_APIKEY }}
@@ -73,36 +59,6 @@ jobs:
7359
hub.login(key)
7460
model = YOLO('https://hub.ultralytics.com/models/' + model_id)
7561
model.train()
76-
- name: Test HUB training (Python Usage 3)
77-
shell: python
78-
env:
79-
APIKEY: ${{ secrets.ULTRALYTICS_HUB_APIKEY }}
80-
run: |
81-
import os
82-
from pathlib import Path
83-
from ultralytics import YOLO, hub
84-
from ultralytics.yolo.utils import USER_CONFIG_DIR
85-
Path(USER_CONFIG_DIR / 'settings.yaml').unlink()
86-
key = os.environ['APIKEY']
87-
hub.reset_model(key)
88-
model = YOLO(key)
89-
model.train()
90-
- name: Test HUB training (Python Usage 4)
91-
shell: python
92-
env:
93-
APIKEY: ${{ secrets.ULTRALYTICS_HUB_APIKEY }}
94-
run: |
95-
import os
96-
from pathlib import Path
97-
from ultralytics import YOLO, hub
98-
from ultralytics.yolo.utils import USER_CONFIG_DIR
99-
Path(USER_CONFIG_DIR / 'settings.yaml').unlink()
100-
key = os.environ['APIKEY']
101-
hub.reset_model(key)
102-
key, model_id = key.split('_')
103-
hub.login(key)
104-
model = YOLO(model_id)
105-
model.train()
10662
10763
Benchmarks:
10864
runs-on: ${{ matrix.os }}
@@ -154,6 +110,11 @@ jobs:
154110
run: |
155111
from ultralytics.yolo.utils.benchmarks import benchmark
156112
benchmark(model='${{ matrix.model }}-cls.pt', imgsz=160, half=False, hard_fail=0.61)
113+
- name: Benchmark PoseModel
114+
shell: python
115+
run: |
116+
from ultralytics.yolo.utils.benchmarks import benchmark
117+
benchmark(model='${{ matrix.model }}-pose.pt', imgsz=160, half=False, hard_fail=0.0)
157118
- name: Benchmark Summary
158119
run: |
159120
cat benchmarks.log
@@ -200,30 +161,38 @@ jobs:
200161
python --version
201162
pip --version
202163
pip list
203-
- name: Test detection
164+
- name: Test Detect
165+
shell: bash # for Windows compatibility
166+
run: |
167+
yolo detect train data=coco8.yaml model=yolov8n.yaml epochs=1 imgsz=32
168+
yolo detect train data=coco8.yaml model=yolov8n.pt epochs=1 imgsz=32
169+
yolo detect val data=coco8.yaml model=runs/detect/train/weights/last.pt imgsz=32
170+
yolo detect predict model=runs/detect/train/weights/last.pt imgsz=32 source=ultralytics/assets/bus.jpg
171+
yolo export model=runs/detect/train/weights/last.pt imgsz=32 format=torchscript
172+
- name: Test Segment
204173
shell: bash # for Windows compatibility
205174
run: |
206-
yolo task=detect mode=train data=coco8.yaml model=yolov8n.yaml epochs=1 imgsz=32
207-
yolo task=detect mode=train data=coco8.yaml model=yolov8n.pt epochs=1 imgsz=32
208-
yolo task=detect mode=val data=coco8.yaml model=runs/detect/train/weights/last.pt imgsz=32
209-
yolo task=detect mode=predict model=runs/detect/train/weights/last.pt imgsz=32 source=ultralytics/assets/bus.jpg
210-
yolo mode=export model=runs/detect/train/weights/last.pt imgsz=32 format=torchscript
211-
- name: Test segmentation
175+
yolo segment train data=coco8-seg.yaml model=yolov8n-seg.yaml epochs=1 imgsz=32
176+
yolo segment train data=coco8-seg.yaml model=yolov8n-seg.pt epochs=1 imgsz=32
177+
yolo segment val data=coco8-seg.yaml model=runs/segment/train/weights/last.pt imgsz=32
178+
yolo segment predict model=runs/segment/train/weights/last.pt imgsz=32 source=ultralytics/assets/bus.jpg
179+
yolo export model=runs/segment/train/weights/last.pt imgsz=32 format=torchscript
180+
- name: Test Classify
212181
shell: bash # for Windows compatibility
213182
run: |
214-
yolo task=segment mode=train data=coco8-seg.yaml model=yolov8n-seg.yaml epochs=1 imgsz=32
215-
yolo task=segment mode=train data=coco8-seg.yaml model=yolov8n-seg.pt epochs=1 imgsz=32
216-
yolo task=segment mode=val data=coco8-seg.yaml model=runs/segment/train/weights/last.pt imgsz=32
217-
yolo task=segment mode=predict model=runs/segment/train/weights/last.pt imgsz=32 source=ultralytics/assets/bus.jpg
218-
yolo mode=export model=runs/segment/train/weights/last.pt imgsz=32 format=torchscript
219-
- name: Test classification
183+
yolo classify train data=imagenet10 model=yolov8n-cls.yaml epochs=1 imgsz=32
184+
yolo classify train data=imagenet10 model=yolov8n-cls.pt epochs=1 imgsz=32
185+
yolo classify val data=imagenet10 model=runs/classify/train/weights/last.pt imgsz=32
186+
yolo classify predict model=runs/classify/train/weights/last.pt imgsz=32 source=ultralytics/assets/bus.jpg
187+
yolo export model=runs/classify/train/weights/last.pt imgsz=32 format=torchscript
188+
- name: Test Pose
220189
shell: bash # for Windows compatibility
221190
run: |
222-
yolo task=classify mode=train data=imagenet10 model=yolov8n-cls.yaml epochs=1 imgsz=32
223-
yolo task=classify mode=train data=imagenet10 model=yolov8n-cls.pt epochs=1 imgsz=32
224-
yolo task=classify mode=val data=imagenet10 model=runs/classify/train/weights/last.pt imgsz=32
225-
yolo task=classify mode=predict model=runs/classify/train/weights/last.pt imgsz=32 source=ultralytics/assets/bus.jpg
226-
yolo mode=export model=runs/classify/train/weights/last.pt imgsz=32 format=torchscript
191+
yolo pose train data=coco8-pose.yaml model=yolov8n-pose.yaml epochs=1 imgsz=32
192+
yolo pose train data=coco8-pose.yaml model=yolov8n-pose.pt epochs=1 imgsz=32
193+
yolo pose val data=coco8-pose.yaml model=runs/pose/train/weights/last.pt imgsz=32
194+
yolo pose predict model=runs/pose/train/weights/last.pt imgsz=32 source=ultralytics/assets/bus.jpg
195+
yolo export model=runs/pose/train/weights/last.pt imgsz=32 format=torchscript
227196
- name: Pytest tests
228197
shell: bash # for Windows compatibility
229198
run: pytest tests

README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,10 @@ YOLOv8 [Python Docs](https://docs.ultralytics.com/usage/python) for more example
109109

110110
## <div align="center">Models</div>
111111

112-
All YOLOv8 pretrained models are available here. Detect, Segment and Pose models are pretrained on the [COCO](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/datasets/coco.yaml) dataset, while Classify models are pretrained on the [ImageNet](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/datasets/ImageNet.yaml) dataset.
112+
All YOLOv8 pretrained models are available here. Detect, Segment and Pose models are pretrained on
113+
the [COCO](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/datasets/coco.yaml) dataset, while Classify
114+
models are pretrained on
115+
the [ImageNet](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/datasets/ImageNet.yaml) dataset.
113116

114117
[Models](https://github.com/ultralytics/ultralytics/tree/main/ultralytics/models) download automatically from the latest
115118
Ultralytics [release](https://github.com/ultralytics/assets/releases) on first use.
@@ -174,6 +177,28 @@ See [Classification Docs](https://docs.ultralytics.com/tasks/classify/) for usag
174177

175178
</details>
176179

180+
<details><summary>Pose</summary>
181+
182+
See [Pose Docs](https://docs.ultralytics.com/tasks/) for usage examples with these models.
183+
184+
| Model | size<br><sup>(pixels) | mAP<sup>box<br>50-95 | mAP<sup>pose<br>50-95 | Speed<br><sup>CPU ONNX<br>(ms) | Speed<br><sup>A100 TensorRT<br>(ms) | params<br><sup>(M) | FLOPs<br><sup>(B) |
185+
| ---------------------------------------------------------------------------------------------------- | --------------------- | -------------------- | --------------------- | ------------------------------ | ----------------------------------- | ------------------ | ----------------- |
186+
| [YOLOv8n-pose](https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n-pose.pt) | 640 | - | 49.7 | - | - | 3.3 | 9.2 |
187+
| [YOLOv8s-pose](https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8s-pose.pt) | 640 | - | 59.2 | - | - | 11.6 | 30.2 |
188+
| [YOLOv8m-pose](https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8m-pose.pt) | 640 | - | 63.6 | - | - | 26.4 | 81.0 |
189+
| [YOLOv8l-pose](https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8l-pose.pt) | 640 | - | 67.0 | - | - | 44.4 | 168.6 |
190+
| [YOLOv8x-pose](https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8x-pose.pt) | 640 | - | 68.9 | - | - | 69.4 | 263.2 |
191+
| [YOLOv8x-pose-p6](https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8x-pose-p6.pt) | 1280 | - | 71.5 | - | - | 99.1 | 1066.4 |
192+
193+
- **mAP<sup>val</sup>** values are for single-model single-scale on [COCO Keypoints val2017](http://cocodataset.org)
194+
dataset.
195+
<br>Reproduce by `yolo val pose data=coco-pose.yaml device=0`
196+
- **Speed** averaged over COCO val images using an [Amazon EC2 P4d](https://aws.amazon.com/ec2/instance-types/p4/)
197+
instance.
198+
<br>Reproduce by `yolo val pose data=coco8-pose.yaml batch=1 device=0|cpu`
199+
200+
</details>
201+
177202
## <div align="center">Integrations</div>
178203

179204
<br>

README.zh-CN.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,28 @@ Ultralytics [发布页](https://github.com/ultralytics/ultralytics/releases) 自
163163

164164
</details>
165165

166+
<details><summary>Pose</summary>
167+
168+
See [Pose Docs](https://docs.ultralytics.com/tasks/) for usage examples with these models.
169+
170+
| Model | size<br><sup>(pixels) | mAP<sup>box<br>50-95 | mAP<sup>pose<br>50-95 | Speed<br><sup>CPU ONNX<br>(ms) | Speed<br><sup>A100 TensorRT<br>(ms) | params<br><sup>(M) | FLOPs<br><sup>(B) |
171+
| ---------------------------------------------------------------------------------------------------- | --------------------- | -------------------- | --------------------- | ------------------------------ | ----------------------------------- | ------------------ | ----------------- |
172+
| [YOLOv8n-pose](https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n-pose.pt) | 640 | - | 49.7 | - | - | 3.3 | 9.2 |
173+
| [YOLOv8s-pose](https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8s-pose.pt) | 640 | - | 59.2 | - | - | 11.6 | 30.2 |
174+
| [YOLOv8m-pose](https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8m-pose.pt) | 640 | - | 63.6 | - | - | 26.4 | 81.0 |
175+
| [YOLOv8l-pose](https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8l-pose.pt) | 640 | - | 67.0 | - | - | 44.4 | 168.6 |
176+
| [YOLOv8x-pose](https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8x-pose.pt) | 640 | - | 68.9 | - | - | 69.4 | 263.2 |
177+
| [YOLOv8x-pose-p6](https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8x-pose-p6.pt) | 1280 | - | 71.5 | - | - | 99.1 | 1066.4 |
178+
179+
- **mAP<sup>val</sup>** values are for single-model single-scale on [COCO Keypoints val2017](http://cocodataset.org)
180+
dataset.
181+
<br>Reproduce by `yolo val pose data=coco-pose.yaml device=0`
182+
- **Speed** averaged over COCO val images using an [Amazon EC2 P4d](https://aws.amazon.com/ec2/instance-types/p4/)
183+
instance.
184+
<br>Reproduce by `yolo val pose data=coco8-pose.yaml batch=1 device=0|cpu`
185+
186+
</details>
187+
166188
## <div align="center">模块集成</div>
167189

168190
<br>

docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Builds ultralytics/ultralytics:latest image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
33
# Image is CUDA-optimized for YOLOv8 single/multi-GPU training and inference
44

5-
# Start FROM PyTorch image https://hub.docker.com/r/pytorch/pytorch
5+
# Start FROM PyTorch image https://hub.docker.com/r/pytorch/pytorch or nvcr.io/nvidia/pytorch:23.03-py3
66
FROM pytorch/pytorch:2.0.0-cuda11.7-cudnn8-runtime
77

88
# Downloads to user config dir

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ Since its launch YOLO has been employed in various applications, including auton
4242

4343
YOLOv8 is designed with a strong focus on speed, size, and accuracy, making it a compelling choice for various vision AI tasks. It outperforms previous versions by incorporating innovations like a new backbone network, a new anchor-free split head, and new loss functions. These improvements enable YOLOv8 to deliver superior results, while maintaining a compact size and exceptional speed.
4444

45-
Additionally, YOLOv8 supports a full range of vision AI tasks, including [detection](tasks/detect.md), [segmentation](tasks/segment.md), [pose estimation](tasks/keypoints.md), [tracking](modes/track.md), and [classification](tasks/classify.md). This versatility allows users to leverage YOLOv8's capabilities across diverse applications and domains.
45+
Additionally, YOLOv8 supports a full range of vision AI tasks, including [detection](tasks/detect.md), [segmentation](tasks/segment.md), [pose estimation](tasks/pose.md), [tracking](modes/track.md), and [classification](tasks/classify.md). This versatility allows users to leverage YOLOv8's capabilities across diverse applications and domains.

docs/modes/benchmark.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<img width="1024" src="https://github.com/ultralytics/assets/raw/main/yolov8/banner-integrations.png">
22

33
**Benchmark mode** is used to profile the speed and accuracy of various export formats for YOLOv8. The benchmarks
4-
provide information on the size of the exported format, its `mAP50-95` metrics (for object detection and segmentation)
4+
provide information on the size of the exported format, its `mAP50-95` metrics (for object detection, segmentation and pose)
55
or `accuracy_top5` metrics (for classification), and the inference time in milliseconds per image across various export
66
formats like ONNX, OpenVINO, TensorRT and others. This information can help users choose the optimal export format for
77
their specific use case based on their requirements for speed and accuracy.

docs/modes/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ for applications such as surveillance systems or self-driving cars.
5454
## [Benchmark](benchmark.md)
5555

5656
Benchmark mode is used to profile the speed and accuracy of various export formats for YOLOv8. The benchmarks provide
57-
information on the size of the exported format, its `mAP50-95` metrics (for object detection and segmentation)
57+
information on the size of the exported format, its `mAP50-95` metrics (for object detection, segmentation and pose)
5858
or `accuracy_top5` metrics (for classification), and the inference time in milliseconds per image across various export
5959
formats like ONNX, OpenVINO, TensorRT and others. This information can help users choose the optimal export format for
6060
their specific use case based on their requirements for speed and accuracy.

docs/modes/train.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ task.
8888
| `box` | `7.5` | box loss gain |
8989
| `cls` | `0.5` | cls loss gain (scale with pixels) |
9090
| `dfl` | `1.5` | dfl loss gain |
91+
| `pose` | `12.0` | pose loss gain (pose-only) |
92+
| `kobj` | `2.0` | keypoint obj loss gain (pose-only) |
9193
| `fl_gamma` | `0.0` | focal loss gamma (efficientDet default gamma=1.5) |
9294
| `label_smoothing` | `0.0` | label smoothing (fraction) |
9395
| `nbs` | `64` | nominal batch size |

docs/reference/ops.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,9 +175,9 @@ show_source: false
175175
show_root_toc_entry: false
176176
---
177177

178-
## scale_segments
178+
## scale_coords
179179

180-
:::ultralytics.yolo.utils.ops.scale_segments
180+
:::ultralytics.yolo.utils.ops.scale_coords
181181
handler: python
182182
options:
183183
show_source: false
@@ -193,9 +193,9 @@ show_source: false
193193
show_root_toc_entry: false
194194
---
195195

196-
## clip_segments
196+
## clip_coords
197197

198-
:::ultralytics.yolo.utils.ops.clip_segments
198+
:::ultralytics.yolo.utils.ops.clip_coords
199199
handler: python
200200
options:
201201
show_source: false

docs/tasks/classify.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ Use a trained YOLOv8n-cls model to run predictions on images.
122122
yolo classify predict model=path/to/best.pt source='https://ultralytics.com/images/bus.jpg' # predict with custom model
123123
```
124124

125-
Read more details of `predict` in our [Predict](https://docs.ultralytics.com/modes/predict/) page.
125+
See full `predict` mode details in the [Predict](https://docs.ultralytics.com/modes/predict/) page.
126126

127127
## Export
128128

@@ -150,7 +150,7 @@ Export a YOLOv8n-cls model to a different format like ONNX, CoreML, etc.
150150
```
151151

152152
Available YOLOv8-cls export formats are in the table below. You can predict or validate directly on exported models,
153-
i.e. `yolo predict model=yolov8n-cls.onnx`.
153+
i.e. `yolo predict model=yolov8n-cls.onnx`. Usage examples are shown for your model after export completes.
154154

155155
| Format | `format` Argument | Model | Metadata |
156156
|--------------------------------------------------------------------|-------------------|-------------------------------|----------|
@@ -167,3 +167,4 @@ i.e. `yolo predict model=yolov8n-cls.onnx`.
167167
| [TF.js](https://www.tensorflow.org/js) | `tfjs` | `yolov8n-cls_web_model/` ||
168168
| [PaddlePaddle](https://github.com/PaddlePaddle) | `paddle` | `yolov8n-cls_paddle_model/` ||
169169

170+
See full `export` details in the [Export](https://docs.ultralytics.com/modes/export/) page.

0 commit comments

Comments
 (0)