Skip to content

Commit

Permalink
ultralytics 8.0.65 YOLOv8 Pose models (ultralytics#1347)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
1 parent 9af3e69 commit 1cb92d7
Show file tree
Hide file tree
Showing 57 changed files with 1,578 additions and 489 deletions.
95 changes: 32 additions & 63 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,7 @@ jobs:
python --version
pip --version
pip list
- name: Test HUB training (Python Usage 1)
shell: python
env:
APIKEY: ${{ secrets.ULTRALYTICS_HUB_APIKEY }}
run: |
import os
from pathlib import Path
from ultralytics import YOLO, hub
from ultralytics.yolo.utils import USER_CONFIG_DIR
Path(USER_CONFIG_DIR / 'settings.yaml').unlink()
key = os.environ['APIKEY']
hub.reset_model(key)
model = YOLO('https://hub.ultralytics.com/models/' + key)
model.train()
- name: Test HUB training (Python Usage 2)
- name: Test HUB training
shell: python
env:
APIKEY: ${{ secrets.ULTRALYTICS_HUB_APIKEY }}
Expand All @@ -73,36 +59,6 @@ jobs:
hub.login(key)
model = YOLO('https://hub.ultralytics.com/models/' + model_id)
model.train()
- name: Test HUB training (Python Usage 3)
shell: python
env:
APIKEY: ${{ secrets.ULTRALYTICS_HUB_APIKEY }}
run: |
import os
from pathlib import Path
from ultralytics import YOLO, hub
from ultralytics.yolo.utils import USER_CONFIG_DIR
Path(USER_CONFIG_DIR / 'settings.yaml').unlink()
key = os.environ['APIKEY']
hub.reset_model(key)
model = YOLO(key)
model.train()
- name: Test HUB training (Python Usage 4)
shell: python
env:
APIKEY: ${{ secrets.ULTRALYTICS_HUB_APIKEY }}
run: |
import os
from pathlib import Path
from ultralytics import YOLO, hub
from ultralytics.yolo.utils import USER_CONFIG_DIR
Path(USER_CONFIG_DIR / 'settings.yaml').unlink()
key = os.environ['APIKEY']
hub.reset_model(key)
key, model_id = key.split('_')
hub.login(key)
model = YOLO(model_id)
model.train()
Benchmarks:
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -154,6 +110,11 @@ jobs:
run: |
from ultralytics.yolo.utils.benchmarks import benchmark
benchmark(model='${{ matrix.model }}-cls.pt', imgsz=160, half=False, hard_fail=0.61)
- name: Benchmark PoseModel
shell: python
run: |
from ultralytics.yolo.utils.benchmarks import benchmark
benchmark(model='${{ matrix.model }}-pose.pt', imgsz=160, half=False, hard_fail=0.0)
- name: Benchmark Summary
run: |
cat benchmarks.log
Expand Down Expand Up @@ -200,30 +161,38 @@ jobs:
python --version
pip --version
pip list
- name: Test detection
- name: Test Detect
shell: bash # for Windows compatibility
run: |
yolo detect train data=coco8.yaml model=yolov8n.yaml epochs=1 imgsz=32
yolo detect train data=coco8.yaml model=yolov8n.pt epochs=1 imgsz=32
yolo detect val data=coco8.yaml model=runs/detect/train/weights/last.pt imgsz=32
yolo detect predict model=runs/detect/train/weights/last.pt imgsz=32 source=ultralytics/assets/bus.jpg
yolo export model=runs/detect/train/weights/last.pt imgsz=32 format=torchscript
- name: Test Segment
shell: bash # for Windows compatibility
run: |
yolo task=detect mode=train data=coco8.yaml model=yolov8n.yaml epochs=1 imgsz=32
yolo task=detect mode=train data=coco8.yaml model=yolov8n.pt epochs=1 imgsz=32
yolo task=detect mode=val data=coco8.yaml model=runs/detect/train/weights/last.pt imgsz=32
yolo task=detect mode=predict model=runs/detect/train/weights/last.pt imgsz=32 source=ultralytics/assets/bus.jpg
yolo mode=export model=runs/detect/train/weights/last.pt imgsz=32 format=torchscript
- name: Test segmentation
yolo segment train data=coco8-seg.yaml model=yolov8n-seg.yaml epochs=1 imgsz=32
yolo segment train data=coco8-seg.yaml model=yolov8n-seg.pt epochs=1 imgsz=32
yolo segment val data=coco8-seg.yaml model=runs/segment/train/weights/last.pt imgsz=32
yolo segment predict model=runs/segment/train/weights/last.pt imgsz=32 source=ultralytics/assets/bus.jpg
yolo export model=runs/segment/train/weights/last.pt imgsz=32 format=torchscript
- name: Test Classify
shell: bash # for Windows compatibility
run: |
yolo task=segment mode=train data=coco8-seg.yaml model=yolov8n-seg.yaml epochs=1 imgsz=32
yolo task=segment mode=train data=coco8-seg.yaml model=yolov8n-seg.pt epochs=1 imgsz=32
yolo task=segment mode=val data=coco8-seg.yaml model=runs/segment/train/weights/last.pt imgsz=32
yolo task=segment mode=predict model=runs/segment/train/weights/last.pt imgsz=32 source=ultralytics/assets/bus.jpg
yolo mode=export model=runs/segment/train/weights/last.pt imgsz=32 format=torchscript
- name: Test classification
yolo classify train data=imagenet10 model=yolov8n-cls.yaml epochs=1 imgsz=32
yolo classify train data=imagenet10 model=yolov8n-cls.pt epochs=1 imgsz=32
yolo classify val data=imagenet10 model=runs/classify/train/weights/last.pt imgsz=32
yolo classify predict model=runs/classify/train/weights/last.pt imgsz=32 source=ultralytics/assets/bus.jpg
yolo export model=runs/classify/train/weights/last.pt imgsz=32 format=torchscript
- name: Test Pose
shell: bash # for Windows compatibility
run: |
yolo task=classify mode=train data=imagenet10 model=yolov8n-cls.yaml epochs=1 imgsz=32
yolo task=classify mode=train data=imagenet10 model=yolov8n-cls.pt epochs=1 imgsz=32
yolo task=classify mode=val data=imagenet10 model=runs/classify/train/weights/last.pt imgsz=32
yolo task=classify mode=predict model=runs/classify/train/weights/last.pt imgsz=32 source=ultralytics/assets/bus.jpg
yolo mode=export model=runs/classify/train/weights/last.pt imgsz=32 format=torchscript
yolo pose train data=coco8-pose.yaml model=yolov8n-pose.yaml epochs=1 imgsz=32
yolo pose train data=coco8-pose.yaml model=yolov8n-pose.pt epochs=1 imgsz=32
yolo pose val data=coco8-pose.yaml model=runs/pose/train/weights/last.pt imgsz=32
yolo pose predict model=runs/pose/train/weights/last.pt imgsz=32 source=ultralytics/assets/bus.jpg
yolo export model=runs/pose/train/weights/last.pt imgsz=32 format=torchscript
- name: Pytest tests
shell: bash # for Windows compatibility
run: pytest tests
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ YOLOv8 [Python Docs](https://docs.ultralytics.com/usage/python) for more example

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

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.
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.

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

</details>

<details><summary>Pose</summary>

See [Pose Docs](https://docs.ultralytics.com/tasks/) for usage examples with these models.

| 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) |
| ---------------------------------------------------------------------------------------------------- | --------------------- | -------------------- | --------------------- | ------------------------------ | ----------------------------------- | ------------------ | ----------------- |
| [YOLOv8n-pose](https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n-pose.pt) | 640 | - | 49.7 | - | - | 3.3 | 9.2 |
| [YOLOv8s-pose](https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8s-pose.pt) | 640 | - | 59.2 | - | - | 11.6 | 30.2 |
| [YOLOv8m-pose](https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8m-pose.pt) | 640 | - | 63.6 | - | - | 26.4 | 81.0 |
| [YOLOv8l-pose](https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8l-pose.pt) | 640 | - | 67.0 | - | - | 44.4 | 168.6 |
| [YOLOv8x-pose](https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8x-pose.pt) | 640 | - | 68.9 | - | - | 69.4 | 263.2 |
| [YOLOv8x-pose-p6](https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8x-pose-p6.pt) | 1280 | - | 71.5 | - | - | 99.1 | 1066.4 |

- **mAP<sup>val</sup>** values are for single-model single-scale on [COCO Keypoints val2017](http://cocodataset.org)
dataset.
<br>Reproduce by `yolo val pose data=coco-pose.yaml device=0`
- **Speed** averaged over COCO val images using an [Amazon EC2 P4d](https://aws.amazon.com/ec2/instance-types/p4/)
instance.
<br>Reproduce by `yolo val pose data=coco8-pose.yaml batch=1 device=0|cpu`

</details>

## <div align="center">Integrations</div>

<br>
Expand Down
22 changes: 22 additions & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,28 @@ Ultralytics [发布页](https://github.com/ultralytics/ultralytics/releases) 自

</details>

<details><summary>Pose</summary>

See [Pose Docs](https://docs.ultralytics.com/tasks/) for usage examples with these models.

| 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) |
| ---------------------------------------------------------------------------------------------------- | --------------------- | -------------------- | --------------------- | ------------------------------ | ----------------------------------- | ------------------ | ----------------- |
| [YOLOv8n-pose](https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n-pose.pt) | 640 | - | 49.7 | - | - | 3.3 | 9.2 |
| [YOLOv8s-pose](https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8s-pose.pt) | 640 | - | 59.2 | - | - | 11.6 | 30.2 |
| [YOLOv8m-pose](https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8m-pose.pt) | 640 | - | 63.6 | - | - | 26.4 | 81.0 |
| [YOLOv8l-pose](https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8l-pose.pt) | 640 | - | 67.0 | - | - | 44.4 | 168.6 |
| [YOLOv8x-pose](https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8x-pose.pt) | 640 | - | 68.9 | - | - | 69.4 | 263.2 |
| [YOLOv8x-pose-p6](https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8x-pose-p6.pt) | 1280 | - | 71.5 | - | - | 99.1 | 1066.4 |

- **mAP<sup>val</sup>** values are for single-model single-scale on [COCO Keypoints val2017](http://cocodataset.org)
dataset.
<br>Reproduce by `yolo val pose data=coco-pose.yaml device=0`
- **Speed** averaged over COCO val images using an [Amazon EC2 P4d](https://aws.amazon.com/ec2/instance-types/p4/)
instance.
<br>Reproduce by `yolo val pose data=coco8-pose.yaml batch=1 device=0|cpu`

</details>

## <div align="center">模块集成</div>

<br>
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Builds ultralytics/ultralytics:latest image on DockerHub https://hub.docker.com/r/ultralytics/ultralytics
# Image is CUDA-optimized for YOLOv8 single/multi-GPU training and inference

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

# Downloads to user config dir
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,4 @@ Since its launch YOLO has been employed in various applications, including auton

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.

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.
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.
2 changes: 1 addition & 1 deletion docs/modes/benchmark.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<img width="1024" src="https://github.com/ultralytics/assets/raw/main/yolov8/banner-integrations.png">

**Benchmark mode** is used to profile the speed and accuracy of various export formats for YOLOv8. The benchmarks
provide information on the size of the exported format, its `mAP50-95` metrics (for object detection and segmentation)
provide information on the size of the exported format, its `mAP50-95` metrics (for object detection, segmentation and pose)
or `accuracy_top5` metrics (for classification), and the inference time in milliseconds per image across various export
formats like ONNX, OpenVINO, TensorRT and others. This information can help users choose the optimal export format for
their specific use case based on their requirements for speed and accuracy.
Expand Down
2 changes: 1 addition & 1 deletion docs/modes/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ for applications such as surveillance systems or self-driving cars.
## [Benchmark](benchmark.md)

Benchmark mode is used to profile the speed and accuracy of various export formats for YOLOv8. The benchmarks provide
information on the size of the exported format, its `mAP50-95` metrics (for object detection and segmentation)
information on the size of the exported format, its `mAP50-95` metrics (for object detection, segmentation and pose)
or `accuracy_top5` metrics (for classification), and the inference time in milliseconds per image across various export
formats like ONNX, OpenVINO, TensorRT and others. This information can help users choose the optimal export format for
their specific use case based on their requirements for speed and accuracy.
Expand Down
2 changes: 2 additions & 0 deletions docs/modes/train.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ task.
| `box` | `7.5` | box loss gain |
| `cls` | `0.5` | cls loss gain (scale with pixels) |
| `dfl` | `1.5` | dfl loss gain |
| `pose` | `12.0` | pose loss gain (pose-only) |
| `kobj` | `2.0` | keypoint obj loss gain (pose-only) |
| `fl_gamma` | `0.0` | focal loss gamma (efficientDet default gamma=1.5) |
| `label_smoothing` | `0.0` | label smoothing (fraction) |
| `nbs` | `64` | nominal batch size |
Expand Down
8 changes: 4 additions & 4 deletions docs/reference/ops.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@ show_source: false
show_root_toc_entry: false
---

## scale_segments
## scale_coords

:::ultralytics.yolo.utils.ops.scale_segments
:::ultralytics.yolo.utils.ops.scale_coords
handler: python
options:
show_source: false
Expand All @@ -193,9 +193,9 @@ show_source: false
show_root_toc_entry: false
---

## clip_segments
## clip_coords

:::ultralytics.yolo.utils.ops.clip_segments
:::ultralytics.yolo.utils.ops.clip_coords
handler: python
options:
show_source: false
Expand Down
5 changes: 3 additions & 2 deletions docs/tasks/classify.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ Use a trained YOLOv8n-cls model to run predictions on images.
yolo classify predict model=path/to/best.pt source='https://ultralytics.com/images/bus.jpg' # predict with custom model
```

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

## Export

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

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

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

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

0 comments on commit 1cb92d7

Please sign in to comment.