mirror of
https://github.com/THU-MIG/yolov10.git
synced 2025-05-23 13:34:23 +08:00
Separate GPU CI job in actions (#4584)
This commit is contained in:
parent
f755ba88c3
commit
c635418a27
47
.github/workflows/ci.yaml
vendored
47
.github/workflows/ci.yaml
vendored
@ -24,6 +24,10 @@ on:
|
|||||||
description: 'Run Benchmarks'
|
description: 'Run Benchmarks'
|
||||||
default: false
|
default: false
|
||||||
type: boolean
|
type: boolean
|
||||||
|
gpu:
|
||||||
|
description: 'Run GPU'
|
||||||
|
default: false
|
||||||
|
type: boolean
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
HUB:
|
HUB:
|
||||||
@ -47,6 +51,7 @@ jobs:
|
|||||||
pip install -e . --extra-index-url https://download.pytorch.org/whl/cpu
|
pip install -e . --extra-index-url https://download.pytorch.org/whl/cpu
|
||||||
- name: Check environment
|
- name: Check environment
|
||||||
run: |
|
run: |
|
||||||
|
yolo checks
|
||||||
echo "RUNNER_OS is ${{ runner.os }}"
|
echo "RUNNER_OS is ${{ runner.os }}"
|
||||||
echo "GITHUB_EVENT_NAME is ${{ github.event_name }}"
|
echo "GITHUB_EVENT_NAME is ${{ github.event_name }}"
|
||||||
echo "GITHUB_WORKFLOW is ${{ github.workflow }}"
|
echo "GITHUB_WORKFLOW is ${{ github.workflow }}"
|
||||||
@ -110,6 +115,7 @@ jobs:
|
|||||||
yolo export format=tflite imgsz=32 || true
|
yolo export format=tflite imgsz=32 || true
|
||||||
- name: Check environment
|
- name: Check environment
|
||||||
run: |
|
run: |
|
||||||
|
yolo checks
|
||||||
echo "RUNNER_OS is ${{ runner.os }}"
|
echo "RUNNER_OS is ${{ runner.os }}"
|
||||||
echo "GITHUB_EVENT_NAME is ${{ github.event_name }}"
|
echo "GITHUB_EVENT_NAME is ${{ github.event_name }}"
|
||||||
echo "GITHUB_WORKFLOW is ${{ github.workflow }}"
|
echo "GITHUB_WORKFLOW is ${{ github.workflow }}"
|
||||||
@ -159,7 +165,6 @@ jobs:
|
|||||||
- os: ubuntu-latest
|
- os: ubuntu-latest
|
||||||
python-version: '3.8' # torch 1.8.0 requires python >=3.6, <=3.8
|
python-version: '3.8' # torch 1.8.0 requires python >=3.6, <=3.8
|
||||||
torch: '1.8.0' # min torch version CI https://pypi.org/project/torchvision/
|
torch: '1.8.0' # min torch version CI https://pypi.org/project/torchvision/
|
||||||
- os: gpu-latest # do not pass python-version
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-python@v4
|
- uses: actions/setup-python@v4
|
||||||
@ -189,12 +194,7 @@ jobs:
|
|||||||
pip list
|
pip list
|
||||||
- name: Pytest tests
|
- name: Pytest tests
|
||||||
shell: bash # for Windows compatibility
|
shell: bash # for Windows compatibility
|
||||||
run: |
|
run: pytest --cov=ultralytics/ --cov-report xml tests/
|
||||||
if [ "${{ matrix.os }}" == "gpu-latest" ]; then
|
|
||||||
pytest --cov=ultralytics/ --cov-report xml tests/test_cuda.py
|
|
||||||
else
|
|
||||||
pytest --cov=ultralytics/ --cov-report xml tests/
|
|
||||||
fi
|
|
||||||
- name: Upload Coverage Reports to CodeCov
|
- name: Upload Coverage Reports to CodeCov
|
||||||
if: github.repository == 'ultralytics/ultralytics' # && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
|
if: github.repository == 'ultralytics/ultralytics' # && matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
|
||||||
uses: codecov/codecov-action@v3
|
uses: codecov/codecov-action@v3
|
||||||
@ -203,13 +203,42 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
|
||||||
|
GPU:
|
||||||
|
if: github.repository == 'ultralytics/ultralytics' && (github.event_name != 'workflow_dispatch' || github.event.inputs.gpu == 'true')
|
||||||
|
timeout-minutes: 60
|
||||||
|
runs-on: gpu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Install requirements
|
||||||
|
run: pip install -e .
|
||||||
|
- name: Check environment
|
||||||
|
run: |
|
||||||
|
yolo checks
|
||||||
|
echo "RUNNER_OS is ${{ runner.os }}"
|
||||||
|
echo "GITHUB_EVENT_NAME is ${{ github.event_name }}"
|
||||||
|
echo "GITHUB_WORKFLOW is ${{ github.workflow }}"
|
||||||
|
echo "GITHUB_ACTOR is ${{ github.actor }}"
|
||||||
|
echo "GITHUB_REPOSITORY is ${{ github.repository }}"
|
||||||
|
echo "GITHUB_REPOSITORY_OWNER is ${{ github.repository_owner }}"
|
||||||
|
python --version
|
||||||
|
pip --version
|
||||||
|
pip list
|
||||||
|
- name: Pytest tests
|
||||||
|
run: pytest --cov=ultralytics/ --cov-report xml tests/test_cuda.py
|
||||||
|
- name: Upload Coverage Reports to CodeCov
|
||||||
|
uses: codecov/codecov-action@v3
|
||||||
|
with:
|
||||||
|
flags: GPU
|
||||||
|
env:
|
||||||
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
|
||||||
Summary:
|
Summary:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [HUB, Benchmarks, Tests] # Add job names that you want to check for failure
|
needs: [HUB, Benchmarks, Tests, GPU] # Add job names that you want to check for failure
|
||||||
if: always() # This ensures the job runs even if previous jobs fail
|
if: always() # This ensures the job runs even if previous jobs fail
|
||||||
steps:
|
steps:
|
||||||
- name: Check for failure and notify
|
- name: Check for failure and notify
|
||||||
if: (needs.HUB.result == 'failure' || needs.Benchmarks.result == 'failure' || needs.Tests.result == 'failure') && github.repository == 'ultralytics/ultralytics' && (github.event_name == 'schedule' || github.event_name == 'push')
|
if: (needs.HUB.result == 'failure' || needs.Benchmarks.result == 'failure' || needs.Tests.result == 'failure' || needs.GPU.result == 'failure') && github.repository == 'ultralytics/ultralytics' && (github.event_name == 'schedule' || github.event_name == 'push')
|
||||||
uses: slackapi/slack-github-action@v1.24.0
|
uses: slackapi/slack-github-action@v1.24.0
|
||||||
with:
|
with:
|
||||||
payload: |
|
payload: |
|
||||||
|
@ -29,7 +29,7 @@ ADD https://github.com/ultralytics/assets/releases/download/v0.0.0/yolov8n.pt /u
|
|||||||
|
|
||||||
# Install pip packages
|
# Install pip packages
|
||||||
RUN python3 -m pip install --upgrade pip wheel
|
RUN python3 -m pip install --upgrade pip wheel
|
||||||
RUN pip install --no-cache -e ".[export]" thop albumentations comet pycocotools
|
RUN pip install --no-cache -e ".[export]" thop albumentations comet pycocotools pytest-cov
|
||||||
|
|
||||||
# Run exports to AutoInstall packages
|
# Run exports to AutoInstall packages
|
||||||
RUN yolo export model=tmp/yolov8n.pt format=edgetpu imgsz=32
|
RUN yolo export model=tmp/yolov8n.pt format=edgetpu imgsz=32
|
||||||
|
@ -133,13 +133,15 @@ To auto-annotate your dataset using the Ultralytics framework, you can use the `
|
|||||||
auto_annotate(data="path/to/images", det_model="yolov8x.pt", sam_model='sam_b.pt')
|
auto_annotate(data="path/to/images", det_model="yolov8x.pt", sam_model='sam_b.pt')
|
||||||
```
|
```
|
||||||
|
|
||||||
| Argument | Type | Description | Default |
|
Certainly, here is the table updated with code snippets:
|
||||||
|------------|---------------------|---------------------------------------------------------------------------------------------------------|--------------|
|
|
||||||
| data | str | Path to a folder containing images to be annotated. | |
|
| Argument | Type | Description | Default |
|
||||||
| det_model | str, optional | Pre-trained YOLO detection model. Defaults to 'yolov8x.pt'. | 'yolov8x.pt' |
|
|--------------|-------------------------|-------------------------------------------------------------------------------------------------------------|----------------|
|
||||||
| sam_model | str, optional | Pre-trained SAM segmentation model. Defaults to 'sam_b.pt'. | 'sam_b.pt' |
|
| `data` | `str` | Path to a folder containing images to be annotated. | `None` |
|
||||||
| device | str, optional | Device to run the models on. Defaults to an empty string (CPU or GPU, if available). | |
|
| `det_model` | `str, optional` | Pre-trained YOLO detection model. Defaults to `'yolov8x.pt'`. | `'yolov8x.pt'` |
|
||||||
| output_dir | str, None, optional | Directory to save the annotated results. Defaults to a 'labels' folder in the same directory as 'data'. | None |
|
| `sam_model` | `str, optional` | Pre-trained SAM segmentation model. Defaults to `'sam_b.pt'`. | `'sam_b.pt'` |
|
||||||
|
| `device` | `str, optional` | Device to run the models on. Defaults to an empty string (CPU or GPU, if available). | `''` |
|
||||||
|
| `output_dir` | `str or None, optional` | Directory to save the annotated results. Defaults to a `'labels'` folder in the same directory as `'data'`. | `None` |
|
||||||
|
|
||||||
The `auto_annotate` function takes the path to your images, along with optional arguments for specifying the pre-trained detection and [SAM segmentation models](https://docs.ultralytics.com/models/sam), the device to run the models on, and the output directory for saving the annotated results.
|
The `auto_annotate` function takes the path to your images, along with optional arguments for specifying the pre-trained detection and [SAM segmentation models](https://docs.ultralytics.com/models/sam), the device to run the models on, and the output directory for saving the annotated results.
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@ from PIL import Image
|
|||||||
from torchvision.transforms import ToTensor
|
from torchvision.transforms import ToTensor
|
||||||
|
|
||||||
from ultralytics import RTDETR, YOLO
|
from ultralytics import RTDETR, YOLO
|
||||||
|
from ultralytics.cfg import TASK2DATA
|
||||||
from ultralytics.data.build import load_inference_source
|
from ultralytics.data.build import load_inference_source
|
||||||
from ultralytics.utils import ASSETS, DEFAULT_CFG, LINUX, ONLINE, ROOT, SETTINGS, WINDOWS
|
from ultralytics.utils import ASSETS, DEFAULT_CFG, LINUX, ONLINE, ROOT, SETTINGS, WINDOWS
|
||||||
from ultralytics.utils.downloads import download
|
from ultralytics.utils.downloads import download
|
||||||
@ -275,11 +276,13 @@ def test_data_utils():
|
|||||||
# from ultralytics.utils.files import WorkingDirectory
|
# from ultralytics.utils.files import WorkingDirectory
|
||||||
# with WorkingDirectory(ROOT.parent / 'tests'):
|
# with WorkingDirectory(ROOT.parent / 'tests'):
|
||||||
|
|
||||||
download('https://github.com/ultralytics/hub/raw/main/example_datasets/coco8.zip', unzip=False)
|
for task in 'detect', 'segment', 'pose':
|
||||||
shutil.move('coco8.zip', TMP)
|
file = Path(TASK2DATA[task]).with_suffix('.zip') # i.e. coco8.zip
|
||||||
stats = HUBDatasetStats(TMP / 'coco8.zip', task='detect')
|
download(f'https://github.com/ultralytics/hub/raw/main/example_datasets/{file}', unzip=False)
|
||||||
stats.get_json(save=True)
|
shutil.move(str(file), TMP) # Python 3.8 requires string input to shutil.move()
|
||||||
stats.process_images()
|
stats = HUBDatasetStats(TMP / file, task=task)
|
||||||
|
stats.get_json(save=True)
|
||||||
|
stats.process_images()
|
||||||
|
|
||||||
autosplit(TMP / 'coco8')
|
autosplit(TMP / 'coco8')
|
||||||
zip_directory(TMP / 'coco8/images/val') # zip
|
zip_directory(TMP / 'coco8/images/val') # zip
|
||||||
|
Loading…
x
Reference in New Issue
Block a user