Skip to content

Update torch_utils.py #332

Update torch_utils.py

Update torch_utils.py #332

Workflow file for this run

# name of the workflow, what it is doing (optional)
name: CI CPU testing
# events that trigger the workflow (required)
on:
push:
branches: [master, CIdebug]
pull_request:
# pull request where master is target
branches: [master]
env:
# Directory of PyPi package to be tested
PACKAGE_DIR: boxmot
# Minimum acceptable test coverage
# Increase as you add more tests to increase coverage
COVERAGE_FAIL_UNDER: 31
# the workflow that gets triggerd
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest] # skip windows-latest for
python-version: ['3.8', '3.9', '3.10']
#model: ['yolov8n', 'yolo_nas_s', yolox_n] # yolo models to test
#tracking-methods: ['deepocsort', 'ocsort', 'botsort', 'strongsort', 'bytetrack'] # tracking methods to test
# Timeout: https://stackoverflow.com/a/59076067/4521646
timeout-minutes: 50
steps:
- uses: actions/checkout@v3 # Check out the repository
- uses: actions/setup-python@v4 # Prepare environment with python 3.9
with:
python-version: ${{ matrix.python-version }}
cache: 'pip' # caching pip dependencies
- name: Install requirements
shell: bash # for Windows compatibility
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -e . pytest pytest-cov --extra-index-url https://download.pytorch.org/whl/cpu
python --version
pip --version
pip list
- name: Pytest tests
shell: bash # for Windows compatibility
run: |
pytest --cov=$PACKAGE_DIR --cov-report=html -v tests
coverage report --fail-under=$COVERAGE_FAIL_UNDER
- name: Tests all tracking options
shell: bash # for Windows compatibility
env:
IMG: ./assets/MOT17-mini/train/MOT17-05-FRCNN/img1/000001.jpg
run: |
# deepocsort fro all supported yolo models
python examples/track.py --tracking-method deepocsort --source $IMG --imgsz 320
python examples/track.py --yolo-model yolo_nas_s --tracking-method deepocsort --source $IMG --imgsz 320
python examples/track.py --yolo-model yolox_n --tracking-method deepocsort --source $IMG --imgsz 320
# botsort
python examples/track.py --tracking-method botsort --source $IMG --imgsz 320
# strongsort
python examples/track.py --tracking-method strongsort --source $IMG --imgsz 320
# ocsort
python examples/track.py --tracking-method ocsort --source $IMG --imgsz 320
# bytetrack
python examples/track.py --tracking-method bytetrack --source $IMG --imgsz 320
- name: Tests tracker with exported reid model
env:
IMG: ./assets/MOT17-mini/train/MOT17-05-FRCNN/img1/000001.jpg
shell: bash # for Windows compatibility
run: |
# export
python boxmot/appearance/reid_export.py # defaults to torchscript
# strongsort w. exported reid model
python examples/track.py --reid-model examples/weights/mobilenetv2_x1_4_dukemtmcreid.torchscript --source $IMG --imgsz 320
- name: Test tracking with seg models
env:
IMG: ./assets/MOT17-mini/train/MOT17-05-FRCNN/img1/000001.jpg
shell: bash # for Windows compatibility
run: |
# tracking with SEG models
python examples/track.py --tracking-method deepocsort --yolo-model yolov8n-seg.pt --source $IMG
- name: Test tracking with pose models
env:
IMG: ./assets/MOT17-mini/train/MOT17-05-FRCNN/img1/000001.jpg
shell: bash # for Windows compatibility
run: |
# tracking with POSE models
python3 examples/track.py --yolo-model weights/yolov8n.pt --source $IMG --imgsz 320
- name: Test validation on MOT17 subset
shell: bash # for Windows compatibility
run: |
# validation on a few MOT17 imges
python examples/val.py --tracking-method deepocsort --yolo-model yolov8n.pt --benchmark MOT17-mini --imgsz 320 --conf 0.2
- name: Test evolution on MOT17 subset
shell: bash # for Windows compatibility
run: |
# evolve a for a single set of parameters
python examples/evolve.py --objectives HOTA,MOTA,IDF1 --benchmark MOT17-mini --n-trials 1 --imgsz 320 --conf 0.2