pyproject.toml, pre-commit, ruff, uv and typing issues, fixes #1119 #2081
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI with uv | |
on: | |
push: | |
branches: [main] | |
paths-ignore: | |
- "**.md" | |
- "**.ipynb" | |
- "**.cff" | |
pull_request: | |
branches: [main] | |
paths-ignore: | |
- "**.md" | |
- "**.ipynb" | |
- "**.cff" | |
workflow_dispatch: # allow running sync via github ui button | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
# python-version: ["3.10"] | |
steps: | |
- uses: actions/checkout@v4 | |
# opencv is needed, because otherwise the following error occurs | |
# Docs for the uv github action: https://github.com/astral-sh/setup-uv | |
- name: Install the latest version of uv and set the python version | |
uses: astral-sh/setup-uv@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
enable-cache: true | |
# - name: Restore Ubuntu cache | |
# uses: actions/cache@v4 | |
# with: | |
# path: .venv | |
# key: ${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml')}} | |
- name: Test with python ${{ matrix.python-version }} | |
run: | | |
uv sync --extra ci -U | |
# uv run --extra ci pytest | |
# uv run --extra ci --frozen python --version | |
uv run python -c 'from mmdet.apis.det_inferencer import DetInferencer' | |
- name: Cache apt packages | |
uses: actions/cache@v4 | |
with: | |
path: /var/cache/apt | |
key: apt-cache | |
# https://itsmycode.com/importerror-libgl-so-1-cannot-open-shared-object-file-no-such-file-or-directory/ | |
- name: Install libgl | |
# run: apt-get update && apt-get install -y python3-opencv | |
run: apt-get update && apt-get install -y libgl1 | |
- name: Test SAHI CLI | |
run: | | |
source .venv/bin/activate | |
# help | |
sahi --help | |
# predict mmdet | |
sahi predict --source tests/data/ --novisual --model_path tests/data/models/mmdet/yolox/yolox_tiny_8x8_300e_coco_20211124_171234-b4047906.pth --model_config_path tests/data/models/mmdet/yolox/yolox_tiny_8xb8-300e_coco.py --image_size 320 | |
sahi predict --source tests/data/coco_utils/terrain1.jpg --export_pickle --export_crop --model_path tests/data/models/mmdet/yolox/yolox_tiny_8x8_300e_coco_20211124_171234-b4047906.pth --model_config_path tests/data/models/mmdet/yolox/yolox_tiny_8xb8-300e_coco.py --image_size 320 | |
sahi predict --source tests/data/coco_utils/ --novisual --dataset_json_path tests/data/coco_utils/combined_coco.json --model_path tests/data/models/mmdet/yolox/yolox_tiny_8x8_300e_coco_20211124_171234-b4047906.pth --model_config_path tests/data/models/mmdet/yolox/yolox_tiny_8xb8-300e_coco.py --image_size 320 | |
# predict yolov5 | |
sahi predict --no_sliced_prediction --model_type yolov5 --source tests/data/coco_utils/terrain1.jpg --novisual --model_path tests/data/models/yolov5/yolov5s6.pt --image_size 320 | |
sahi predict --model_type yolov5 --source tests/data/ --novisual --model_path tests/data/models/yolov5/yolov5s6.pt --image_size 320 | |
sahi predict --model_type yolov5 --source tests/data/coco_utils/terrain1.jpg --export_pickle --export_crop --model_path tests/data/models/yolov5/yolov5s6.pt --image_size 320 | |
sahi predict --model_type yolov5 --source tests/data/coco_utils/ --novisual --dataset_json_path tests/data/coco_utils/combined_coco.json --model_path tests/data/models/yolov5/yolov5s6.pt --image_size 320 | |
# coco yolov5 | |
sahi coco yolov5 --image_dir tests/data/coco_utils/ --dataset_json_path tests/data/coco_utils/combined_coco.json --train_split 0.9 | |
# coco evaluate | |
sahi coco evaluate --dataset_json_path tests/data/coco_evaluate/dataset.json --result_json_path tests/data/coco_evaluate/result.json | |
# coco analyse | |
sahi coco analyse --dataset_json_path tests/data/coco_evaluate/dataset.json --result_json_path tests/data/coco_evaluate/result.json --out_dir tests/data/coco_evaluate/ |