mirror of
https://github.com/THU-MIG/yolov10.git
synced 2025-05-23 13:34:23 +08:00
ultralytics 8.0.203
DDP argparse and Tracker fixes (#6007)
This commit is contained in:
parent
ab0b47e386
commit
465df3024f
@ -2,14 +2,17 @@
|
|||||||
# Pre-commit hooks. For more information see https://github.com/pre-commit/pre-commit-hooks/blob/main/README.md
|
# Pre-commit hooks. For more information see https://github.com/pre-commit/pre-commit-hooks/blob/main/README.md
|
||||||
# Optionally remove from local hooks with 'rm .git/hooks/pre-commit'
|
# Optionally remove from local hooks with 'rm .git/hooks/pre-commit'
|
||||||
|
|
||||||
# exclude: 'docs/'
|
|
||||||
# Define bot property if installed via https://github.com/marketplace/pre-commit-ci
|
# Define bot property if installed via https://github.com/marketplace/pre-commit-ci
|
||||||
ci:
|
ci:
|
||||||
autofix_prs: true
|
autofix_prs: true
|
||||||
autoupdate_commit_msg: '[pre-commit.ci] pre-commit suggestions'
|
autoupdate_commit_msg: '[pre-commit.ci] pre-commit suggestions'
|
||||||
autoupdate_schedule: monthly
|
autoupdate_schedule: monthly
|
||||||
# submodules: true
|
submodules: true
|
||||||
|
|
||||||
|
# Exclude directories (optional)
|
||||||
|
# exclude: 'docs/'
|
||||||
|
|
||||||
|
# Define repos to run
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
rev: v4.5.0
|
rev: v4.5.0
|
||||||
|
@ -13,7 +13,6 @@ ADD https://ultralytics.com/assets/Arial.ttf https://ultralytics.com/assets/Aria
|
|||||||
# g++ required to build 'tflite_support' and 'lap' packages, libusb-1.0-0 required for 'tflite_support' package
|
# g++ required to build 'tflite_support' and 'lap' packages, libusb-1.0-0 required for 'tflite_support' package
|
||||||
RUN apt update \
|
RUN apt update \
|
||||||
&& apt install --no-install-recommends -y gcc git zip curl htop libgl1-mesa-glx libglib2.0-0 libpython3-dev gnupg g++ libusb-1.0-0
|
&& apt install --no-install-recommends -y gcc git zip curl htop libgl1-mesa-glx libglib2.0-0 libpython3-dev gnupg g++ libusb-1.0-0
|
||||||
# RUN alias python=python3
|
|
||||||
|
|
||||||
# Security updates
|
# Security updates
|
||||||
# https://security.snyk.io/vuln/SNYK-UBUNTU1804-OPENSSL-3314796
|
# https://security.snyk.io/vuln/SNYK-UBUNTU1804-OPENSSL-3314796
|
||||||
|
@ -12,7 +12,6 @@ ADD https://ultralytics.com/assets/Arial.ttf https://ultralytics.com/assets/Aria
|
|||||||
# g++ required to build 'tflite_support' and 'lap' packages, libusb-1.0-0 required for 'tflite_support' package
|
# g++ required to build 'tflite_support' and 'lap' packages, libusb-1.0-0 required for 'tflite_support' package
|
||||||
RUN apt update \
|
RUN apt update \
|
||||||
&& apt install --no-install-recommends -y python3-pip git zip curl htop gcc libgl1-mesa-glx libglib2.0-0 libpython3-dev gnupg g++ libusb-1.0-0
|
&& apt install --no-install-recommends -y python3-pip git zip curl htop gcc libgl1-mesa-glx libglib2.0-0 libpython3-dev gnupg g++ libusb-1.0-0
|
||||||
# RUN alias python=python3
|
|
||||||
|
|
||||||
# Create working directory
|
# Create working directory
|
||||||
WORKDIR /usr/src/ultralytics
|
WORKDIR /usr/src/ultralytics
|
||||||
|
@ -12,7 +12,6 @@ ADD https://ultralytics.com/assets/Arial.ttf https://ultralytics.com/assets/Aria
|
|||||||
# g++ required to build 'tflite_support' and 'lap' packages, libusb-1.0-0 required for 'tflite_support' package
|
# g++ required to build 'tflite_support' and 'lap' packages, libusb-1.0-0 required for 'tflite_support' package
|
||||||
RUN apt update \
|
RUN apt update \
|
||||||
&& apt install --no-install-recommends -y python3-pip git zip curl htop libgl1-mesa-glx libglib2.0-0 libpython3-dev gnupg g++ libusb-1.0-0
|
&& apt install --no-install-recommends -y python3-pip git zip curl htop libgl1-mesa-glx libglib2.0-0 libpython3-dev gnupg g++ libusb-1.0-0
|
||||||
# RUN alias python=python3
|
|
||||||
|
|
||||||
# Create working directory
|
# Create working directory
|
||||||
WORKDIR /usr/src/ultralytics
|
WORKDIR /usr/src/ultralytics
|
||||||
|
@ -12,7 +12,6 @@ ADD https://ultralytics.com/assets/Arial.ttf https://ultralytics.com/assets/Aria
|
|||||||
# g++ required to build 'tflite_support' and 'lap' packages, libusb-1.0-0 required for 'tflite_support' package
|
# g++ required to build 'tflite_support' and 'lap' packages, libusb-1.0-0 required for 'tflite_support' package
|
||||||
RUN apt update \
|
RUN apt update \
|
||||||
&& apt install --no-install-recommends -y gcc git zip curl htop libgl1-mesa-glx libglib2.0-0 libpython3-dev gnupg g++ libusb-1.0-0
|
&& apt install --no-install-recommends -y gcc git zip curl htop libgl1-mesa-glx libglib2.0-0 libpython3-dev gnupg g++ libusb-1.0-0
|
||||||
# RUN alias python=python3
|
|
||||||
|
|
||||||
# Create working directory
|
# Create working directory
|
||||||
WORKDIR /usr/src/ultralytics
|
WORKDIR /usr/src/ultralytics
|
||||||
|
@ -12,7 +12,6 @@ ADD https://ultralytics.com/assets/Arial.ttf https://ultralytics.com/assets/Aria
|
|||||||
# g++ required to build 'tflite_support' and 'lap' packages, libusb-1.0-0 required for 'tflite_support' package
|
# g++ required to build 'tflite_support' and 'lap' packages, libusb-1.0-0 required for 'tflite_support' package
|
||||||
RUN apt update \
|
RUN apt update \
|
||||||
&& apt install --no-install-recommends -y python3-pip git zip curl htop libgl1-mesa-glx libglib2.0-0 libpython3-dev gnupg g++ libusb-1.0-0
|
&& apt install --no-install-recommends -y python3-pip git zip curl htop libgl1-mesa-glx libglib2.0-0 libpython3-dev gnupg g++ libusb-1.0-0
|
||||||
# RUN alias python=python3
|
|
||||||
|
|
||||||
# Create working directory
|
# Create working directory
|
||||||
WORKDIR /usr/src/ultralytics
|
WORKDIR /usr/src/ultralytics
|
||||||
|
@ -15,6 +15,7 @@ Whether you're a beginner or an expert in deep learning, our tutorials offer val
|
|||||||
Here's a compilation of in-depth guides to help you master different aspects of Ultralytics YOLO.
|
Here's a compilation of in-depth guides to help you master different aspects of Ultralytics YOLO.
|
||||||
|
|
||||||
* [YOLO Common Issues](yolo-common-issues.md) ⭐ RECOMMENDED: Practical solutions and troubleshooting tips to the most frequently encountered issues when working with Ultralytics YOLO models.
|
* [YOLO Common Issues](yolo-common-issues.md) ⭐ RECOMMENDED: Practical solutions and troubleshooting tips to the most frequently encountered issues when working with Ultralytics YOLO models.
|
||||||
|
* [YOLO Performance Metrics](yolo-performance-metrics.md) ⭐ ESSENTIAL: Understand the key metrics like mAP, IoU, and F1 score used to evaluate the performance of your YOLO models. Includes practical examples and tips on how to improve detection accuracy and speed.
|
||||||
* [K-Fold Cross Validation](kfold-cross-validation.md) 🚀 NEW: Learn how to improve model generalization using K-Fold cross-validation technique.
|
* [K-Fold Cross Validation](kfold-cross-validation.md) 🚀 NEW: Learn how to improve model generalization using K-Fold cross-validation technique.
|
||||||
* [Hyperparameter Tuning](hyperparameter-tuning.md) 🚀 NEW: Discover how to optimize your YOLO models by fine-tuning hyperparameters using the Tuner class and genetic evolution algorithms.
|
* [Hyperparameter Tuning](hyperparameter-tuning.md) 🚀 NEW: Discover how to optimize your YOLO models by fine-tuning hyperparameters using the Tuner class and genetic evolution algorithms.
|
||||||
* [SAHI Tiled Inference](sahi-tiled-inference.md) 🚀 NEW: Comprehensive guide on leveraging SAHI's sliced inference capabilities with YOLOv8 for object detection in high-resolution images.
|
* [SAHI Tiled Inference](sahi-tiled-inference.md) 🚀 NEW: Comprehensive guide on leveraging SAHI's sliced inference capabilities with YOLOv8 for object detection in high-resolution images.
|
||||||
|
@ -46,13 +46,13 @@ One of the sections of the output is the class-wise breakdown of performance met
|
|||||||
|
|
||||||
- **Box(P, R, mAP50, mAP50-95)**: This metric provides insights into the model's performance in detecting objects:
|
- **Box(P, R, mAP50, mAP50-95)**: This metric provides insights into the model's performance in detecting objects:
|
||||||
|
|
||||||
- **P (Precision)**: The accuracy of the detected objects, indicating how many detections were correct.
|
- **P (Precision)**: The accuracy of the detected objects, indicating how many detections were correct.
|
||||||
|
|
||||||
- **R (Recall)**: The ability of the model to identify all instances of objects in the images.
|
- **R (Recall)**: The ability of the model to identify all instances of objects in the images.
|
||||||
|
|
||||||
- **mAP50**: Mean average precision calculated at an intersection over union (IoU) threshold of 0.50. It's a measure of the model's accuracy considering only the "easy" detections.
|
- **mAP50**: Mean average precision calculated at an intersection over union (IoU) threshold of 0.50. It's a measure of the model's accuracy considering only the "easy" detections.
|
||||||
|
|
||||||
- **mAP50-95**: The average of the mean average precision calculated at varying IoU thresholds, ranging from 0.50 to 0.95. It gives a comprehensive view of the model's performance across different levels of detection difficulty.
|
- **mAP50-95**: The average of the mean average precision calculated at varying IoU thresholds, ranging from 0.50 to 0.95. It gives a comprehensive view of the model's performance across different levels of detection difficulty.
|
||||||
|
|
||||||
#### Speed Metrics
|
#### Speed Metrics
|
||||||
|
|
@ -22,13 +22,13 @@ Here's a brief description of our CI actions:
|
|||||||
|
|
||||||
Below is the table showing the status of these CI tests for our main repositories:
|
Below is the table showing the status of these CI tests for our main repositories:
|
||||||
|
|
||||||
| Repository | CI | Docker Deployment | Broken Links | CodeQL | PyPi and Docs Publishing |
|
| Repository | CI | Docker Deployment | Broken Links | CodeQL | PyPi and Docs Publishing |
|
||||||
|-----------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|-----------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| [yolov3](https://github.com/ultralytics/yolov3) | [](https://github.com/ultralytics/yolov3/actions/workflows/ci-testing.yml) | [](https://github.com/ultralytics/yolov3/actions/workflows/docker.yml) | [](https://github.com/ultralytics/yolov3/actions/workflows/links.yml) | [](https://github.com/ultralytics/yolov3/actions/workflows/codeql-analysis.yml) | |
|
| [yolov3](https://github.com/ultralytics/yolov3) | [](https://github.com/ultralytics/yolov3/actions/workflows/ci-testing.yml) | [](https://github.com/ultralytics/yolov3/actions/workflows/docker.yml) | [](https://github.com/ultralytics/yolov3/actions/workflows/links.yml) | [](https://github.com/ultralytics/yolov3/actions/workflows/codeql-analysis.yml) | |
|
||||||
| [yolov5](https://github.com/ultralytics/yolov5) | [](https://github.com/ultralytics/yolov5/actions/workflows/ci-testing.yml) | [](https://github.com/ultralytics/yolov5/actions/workflows/docker.yml) | [](https://github.com/ultralytics/yolov5/actions/workflows/links.yml) | [](https://github.com/ultralytics/yolov5/actions/workflows/codeql-analysis.yml) | |
|
| [yolov5](https://github.com/ultralytics/yolov5) | [](https://github.com/ultralytics/yolov5/actions/workflows/ci-testing.yml) | [](https://github.com/ultralytics/yolov5/actions/workflows/docker.yml) | [](https://github.com/ultralytics/yolov5/actions/workflows/links.yml) | [](https://github.com/ultralytics/yolov5/actions/workflows/codeql-analysis.yml) | |
|
||||||
| [ultralytics](https://github.com/ultralytics/ultralytics) | [](https://github.com/ultralytics/ultralytics/actions/workflows/ci.yaml) | [](https://github.com/ultralytics/ultralytics/actions/workflows/docker.yaml) | [](https://github.com/ultralytics/ultralytics/actions/workflows/links.yml) | [](https://github.com/ultralytics/ultralytics/actions/workflows/codeql.yaml) | [](https://github.com/ultralytics/ultralytics/actions/workflows/publish.yml) |
|
| [ultralytics](https://github.com/ultralytics/ultralytics) | [](https://github.com/ultralytics/ultralytics/actions/workflows/ci.yaml) | [](https://github.com/ultralytics/ultralytics/actions/workflows/docker.yaml) | [](https://github.com/ultralytics/ultralytics/actions/workflows/links.yml) | [](https://github.com/ultralytics/ultralytics/actions/workflows/codeql.yaml) | [](https://github.com/ultralytics/ultralytics/actions/workflows/publish.yml) |
|
||||||
| [hub](https://github.com/ultralytics/hub) | [](https://github.com/ultralytics/hub/actions/workflows/ci.yaml) | | [](https://github.com/ultralytics/hub/actions/workflows/links.yml) | | |
|
| [hub](https://github.com/ultralytics/hub) | [](https://github.com/ultralytics/hub/actions/workflows/ci.yaml) | | [](https://github.com/ultralytics/hub/actions/workflows/links.yml) | | |
|
||||||
| [docs](https://github.com/ultralytics/docs) | | | | | [](https://github.com/ultralytics/docs/actions/workflows/pages/pages-build-deployment) [](https://github.com/ultralytics/docs/actions/workflows/links.yml) |
|
| [docs](https://github.com/ultralytics/docs) | | | [](https://github.com/ultralytics/docs/actions/workflows/links.yml) | | [](https://github.com/ultralytics/docs/actions/workflows/pages/pages-build-deployment) |
|
||||||
|
|
||||||
Each badge shows the status of the last run of the corresponding CI test on the `main` branch of the respective repository. If a test fails, the badge will display a "failing" status, and if it passes, it will display a "passing" status.
|
Each badge shows the status of the last run of the corresponding CI test on the `main` branch of the respective repository. If a test fails, the badge will display a "failing" status, and if it passes, it will display a "passing" status.
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ The following are some notable features of YOLOv8's Train mode:
|
|||||||
|
|
||||||
## Usage Examples
|
## Usage Examples
|
||||||
|
|
||||||
Train YOLOv8n on the COCO128 dataset for 100 epochs at image size 640. See Arguments section below for a full list of training arguments.
|
Train YOLOv8n on the COCO128 dataset for 100 epochs at image size 640. The training device can be specified using the `device` argument. If no argument is passed GPU `device=0` will be used if available, otherwise `device=cpu` will be used. See Arguments section below for a full list of training arguments.
|
||||||
|
|
||||||
!!! example "Single-GPU and CPU Training Example"
|
!!! example "Single-GPU and CPU Training Example"
|
||||||
|
|
||||||
@ -82,10 +82,12 @@ Train YOLOv8n on the COCO128 dataset for 100 epochs at image size 640. See Argum
|
|||||||
|
|
||||||
### Multi-GPU Training
|
### Multi-GPU Training
|
||||||
|
|
||||||
The training device can be specified using the `device` argument. If no argument is passed GPU `device=0` will be used if available, otherwise `device=cpu` will be used.
|
Multi-GPU training allows for more efficient utilization of available hardware resources by distributing the training load across multiple GPUs. This feature is available through both the Python API and the command-line interface. To enable multi-GPU training, specify the GPU device IDs you wish to use.
|
||||||
|
|
||||||
!!! example "Multi-GPU Training Example"
|
!!! example "Multi-GPU Training Example"
|
||||||
|
|
||||||
|
To train with 2 GPUs, CUDA devices 0 and 1 use the following commands. Expand to additional GPUs as required.
|
||||||
|
|
||||||
=== "Python"
|
=== "Python"
|
||||||
|
|
||||||
```python
|
```python
|
||||||
|
@ -215,6 +215,7 @@ nav:
|
|||||||
- Guides:
|
- Guides:
|
||||||
- guides/index.md
|
- guides/index.md
|
||||||
- YOLO Common Issues: guides/yolo-common-issues.md
|
- YOLO Common Issues: guides/yolo-common-issues.md
|
||||||
|
- Performance Metrics: guides/yolo-performance-metrics.md
|
||||||
- K-Fold Cross Validation: guides/kfold-cross-validation.md
|
- K-Fold Cross Validation: guides/kfold-cross-validation.md
|
||||||
- Hyperparameter Tuning: guides/hyperparameter-tuning.md
|
- Hyperparameter Tuning: guides/hyperparameter-tuning.md
|
||||||
- SAHI Tiled Inference: guides/sahi-tiled-inference.md
|
- SAHI Tiled Inference: guides/sahi-tiled-inference.md
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
||||||
|
|
||||||
__version__ = '8.0.202'
|
__version__ = '8.0.203'
|
||||||
|
|
||||||
from ultralytics.models import RTDETR, SAM, YOLO
|
from ultralytics.models import RTDETR, SAM, YOLO
|
||||||
from ultralytics.models.fastsam import FastSAM
|
from ultralytics.models.fastsam import FastSAM
|
||||||
|
@ -192,3 +192,8 @@ class BOTSORT(BYTETracker):
|
|||||||
def multi_predict(self, tracks):
|
def multi_predict(self, tracks):
|
||||||
"""Predict and track multiple objects with YOLOv8 model."""
|
"""Predict and track multiple objects with YOLOv8 model."""
|
||||||
BOTrack.multi_predict(tracks)
|
BOTrack.multi_predict(tracks)
|
||||||
|
|
||||||
|
def reset(self):
|
||||||
|
"""Reset tracker."""
|
||||||
|
super().reset()
|
||||||
|
self.gmc.reset_params()
|
||||||
|
@ -374,6 +374,15 @@ class BYTETracker:
|
|||||||
"""Resets the ID counter of STrack."""
|
"""Resets the ID counter of STrack."""
|
||||||
STrack.reset_id()
|
STrack.reset_id()
|
||||||
|
|
||||||
|
def reset(self):
|
||||||
|
"""Reset tracker."""
|
||||||
|
self.tracked_stracks = [] # type: list[STrack]
|
||||||
|
self.lost_stracks = [] # type: list[STrack]
|
||||||
|
self.removed_stracks = [] # type: list[STrack]
|
||||||
|
self.frame_id = 0
|
||||||
|
self.kalman_filter = self.get_kalmanfilter()
|
||||||
|
self.reset_id()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def joint_stracks(tlista, tlistb):
|
def joint_stracks(tlista, tlistb):
|
||||||
"""Combine two lists of stracks into a single one."""
|
"""Combine two lists of stracks into a single one."""
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
# Ultralytics YOLO 🚀, AGPL-3.0 license
|
||||||
|
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
import torch
|
import torch
|
||||||
|
|
||||||
@ -40,8 +41,12 @@ def on_predict_start(predictor, persist=False):
|
|||||||
def on_predict_postprocess_end(predictor):
|
def on_predict_postprocess_end(predictor):
|
||||||
"""Postprocess detected boxes and update with object tracking."""
|
"""Postprocess detected boxes and update with object tracking."""
|
||||||
bs = predictor.dataset.bs
|
bs = predictor.dataset.bs
|
||||||
im0s = predictor.batch[1]
|
path, im0s = predictor.batch[:2]
|
||||||
|
|
||||||
for i in range(bs):
|
for i in range(bs):
|
||||||
|
if predictor.vid_path[i] != str(predictor.save_dir / Path(path[i]).name): # new video
|
||||||
|
predictor.trackers[i].reset()
|
||||||
|
|
||||||
det = predictor.results[i].boxes.cpu().numpy()
|
det = predictor.results[i].boxes.cpu().numpy()
|
||||||
if len(det) == 0:
|
if len(det) == 0:
|
||||||
continue
|
continue
|
||||||
|
@ -300,3 +300,10 @@ class GMC:
|
|||||||
self.prevKeyPoints = copy.copy(keypoints)
|
self.prevKeyPoints = copy.copy(keypoints)
|
||||||
|
|
||||||
return H
|
return H
|
||||||
|
|
||||||
|
def reset_params(self):
|
||||||
|
"""Reset parameters."""
|
||||||
|
self.prevFrame = None
|
||||||
|
self.prevKeyPoints = None
|
||||||
|
self.prevDescriptors = None
|
||||||
|
self.initializedFirstFrame = False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user