pose2sim/.github/workflows/continuous-integration.yml

96 lines
3.7 KiB
YAML
Raw Normal View History

2022-06-13 22:04:45 +08:00
# This workflow will install Python dependencies, run tests and lint on several OS with a several versions of Python
2022-06-12 21:10:56 +08:00
# See: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
2022-06-10 23:29:01 +08:00
name: Build on Win-MacOS-Ubuntu with Python 3.9-3.11
2022-06-10 23:29:01 +08:00
on:
push:
branches: [ "main" ]
paths-ignore:
- 'README.md'
- 'Content/**'
2022-06-10 23:29:01 +08:00
pull_request:
branches: [ "main" ]
2022-06-12 21:10:56 +08:00
permissions:
contents: read
2022-06-10 23:29:01 +08:00
jobs:
build:
2022-06-12 21:10:56 +08:00
runs-on: ${{ matrix.os }}
2022-06-10 23:29:01 +08:00
strategy:
fail-fast: false
matrix:
2023-05-04 22:35:55 +08:00
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.9, "3.10", "3.11"]
2024-10-23 06:24:00 +08:00
# include:
# - os: ubuntu-latest
# path: ~/.cache/pip
# - os: macos-latest
# path: ~/Library/Caches/pip
# - os: windows-latest
# path: ~\AppData\Local\pip\Cache
2022-06-10 23:29:01 +08:00
steps:
2022-06-12 21:10:56 +08:00
- name: Checkout code
2024-01-27 06:43:29 +08:00
uses: actions/checkout@v4
2022-06-12 21:10:56 +08:00
2024-10-23 06:24:00 +08:00
- name: Cache conda environment
uses: actions/cache@v3
with:
path: ${{ matrix.os == 'windows-latest' && 'C:\\Users\\runneradmin\\.conda' || '~/.conda' }}
key: ${{ runner.os }}-conda-${{ matrix.python-version }}-${{ hashFiles('**/environment.yml') }}
restore-keys: ${{ runner.os }}-conda-${{ matrix.python-version }}-
# path: ~/conda_pkgs_dir # Adjust this for Windows or other paths as needed
# key: ${{ runner.os }}-conda-${{ matrix.python-version }}-${{ hashFiles('environment.yml') }}
# restore-keys: |
# ${{ runner.os }}-conda-${{ matrix.python-version }}
- name: Install Miniconda
2024-06-30 21:57:15 +08:00
uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}
activate-environment: pose2sim
2024-10-23 06:24:00 +08:00
cache-packages: true
2024-06-30 21:57:15 +08:00
2024-06-30 22:34:46 +08:00
- name: Install OpenSim with conda
run: |
conda install -n pose2sim -c conda-forge -c defaults pip
conda install -n pose2sim opensim-org::opensim -y
2024-10-23 06:24:00 +08:00
- name: Cache pip dependencies
uses: actions/cache@v3
with:
path: ${{ matrix.os == 'windows-latest' && 'C:\\Users\\runneradmin\\AppData\\Local\\pip\\Cache' || '~/.cache/pip' }}
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: ${{ runner.os }}-pip-${{ matrix.python-version }}-
# path: ${{ matrix.os == 'windows-latest' && '~\\AppData\\Local\\pip\\Cache' || 'pip_cache_directory' }}
# key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
# restore-keys: |
# ${{ runner.os }}-pip-${{ matrix.python-version }}
2024-06-30 22:17:23 +08:00
- name: Install pip dependencies
2022-06-12 21:10:56 +08:00
run: |
2024-06-30 21:57:15 +08:00
conda run -n pose2sim python -m pip install --upgrade pip
conda run -n pose2sim python -m pip install flake8 pytest
conda run -n pose2sim python -m pip install git+https://github.com/${{ github.repository }}.git@${{ github.sha }}
2022-06-12 21:10:56 +08:00
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
2024-06-30 21:57:15 +08:00
conda run -n pose2sim flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
2022-06-12 21:10:56 +08:00
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
2024-06-30 21:57:15 +08:00
conda run -n pose2sim flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
2022-06-12 21:10:56 +08:00
- name: Test with pytest
Pose estimation test (#116) Edits from @hunminkim98's awesome work at integrating pose estimation into Pose2Sim with RTMLib. Most of the changes in syntax are not necessarily better, it is mostly for the code to be more consistent with the rest of the library. Thank you again for your fantastic work! General: - Automatically detects whether a valid CUDA install is available. If so, use the GPU with the ONNXRuntime backend. Otherwise, use the CPU with the OpenVINO backend - The tensorflow version used for marker augmentation was incompatible with the cuda torch installation for pose estimation: edited code and models for it to work with the latest tf version. - Added logging information to pose estimation - Readme.md: provided an installation procedure for CUDA (took me a while to find something simple and robust) - Readme.md: added information about PoseEstimation with RTMLib - added poseEstimation to tests.py - created videos for the multi-person case (used to only have json, no video), and reorganized Demo folders. Had to recreate calibration file as well Json files: - the json files only saved one person, I made it save all the detected ones - tracking was not taken into account by rtmlib, which caused issues in synchronization: fixed, waiting for merge - took the save_to_openpose function out from the main function - minified the json files (they take less space when all spaces are removed) Detection results: - Compared the triangulated locations of RTMpose keypoints to the ones of OpenPose to potentially edit model marker locations on OpenSim. Did not seem to need it. Others in Config.toml: - removed the "to_openpose" option, which is not needed - added the flag: save_video = 'to_images' # 'to_video' or 'to_images' or ['to_video', 'to_images'] - changed the way frame_range was handled (made me change synchronization in depth, as well as personAssociation and triangulation) - added the flag: time_range_around_maxspeed in synchronization - automatically detect framerate from video, or set to 60 fps if we work from images (or give a value) - frame_range -> time_range - moved height and weight to project (only read for markerAugmentation, and in the future for automatic scaling) - removed reorder_trc from triangulation and Config -> call it for markerAugmentation instead Others: - Provided an installation procedure for OpenSim (for the future) and made continuous installation check its install (a bit harder since it cannot be installed via pip) - scaling from motion instead of static pose (will have to study whether it's as good or not) - added logging to synchronization - Struggled quite a bit with continuous integration * Starting point of integrating RTMPose into Pose2Sim. (#111) * RTM_to_Open Convert format from RTMPose to OpenPose * rtm_intergrated * rtm_integrated * rtm_integrated * rtm_integrated * rtm * Delete build/lib/Pose2Sim directory * rtm * Delete build/lib/Pose2Sim directory * Delete onnxruntime-gpu * device = cpu * add pose folder * Update tests.py * added annotation * fix typo * Should work be still lots of tests to run. Detailed commit coming soon * intermediary commit * last checks before v0.9.0 * Update continuous-integration.yml * Update tests.py * replaced tabs with spaces * unittest issue * unittest typo * deactivated display for CI test of pose detection * Try to make continuous integration work * a * b * c * d * e * f * g * h * i * j * k * l --------- Co-authored-by: HunMinKim <144449115+hunminkim98@users.noreply.github.com>
2024-07-09 22:39:33 +08:00
env:
PYTHONIOENCODING: utf-8
2024-07-30 23:17:42 +08:00
PYTHONUNBUFFERED: "1"
2024-07-31 03:50:38 +08:00
KMP_DUPLICATE_LIB_OK: TRUE
2022-06-12 21:10:56 +08:00
run: |
Pose estimation test (#116) Edits from @hunminkim98's awesome work at integrating pose estimation into Pose2Sim with RTMLib. Most of the changes in syntax are not necessarily better, it is mostly for the code to be more consistent with the rest of the library. Thank you again for your fantastic work! General: - Automatically detects whether a valid CUDA install is available. If so, use the GPU with the ONNXRuntime backend. Otherwise, use the CPU with the OpenVINO backend - The tensorflow version used for marker augmentation was incompatible with the cuda torch installation for pose estimation: edited code and models for it to work with the latest tf version. - Added logging information to pose estimation - Readme.md: provided an installation procedure for CUDA (took me a while to find something simple and robust) - Readme.md: added information about PoseEstimation with RTMLib - added poseEstimation to tests.py - created videos for the multi-person case (used to only have json, no video), and reorganized Demo folders. Had to recreate calibration file as well Json files: - the json files only saved one person, I made it save all the detected ones - tracking was not taken into account by rtmlib, which caused issues in synchronization: fixed, waiting for merge - took the save_to_openpose function out from the main function - minified the json files (they take less space when all spaces are removed) Detection results: - Compared the triangulated locations of RTMpose keypoints to the ones of OpenPose to potentially edit model marker locations on OpenSim. Did not seem to need it. Others in Config.toml: - removed the "to_openpose" option, which is not needed - added the flag: save_video = 'to_images' # 'to_video' or 'to_images' or ['to_video', 'to_images'] - changed the way frame_range was handled (made me change synchronization in depth, as well as personAssociation and triangulation) - added the flag: time_range_around_maxspeed in synchronization - automatically detect framerate from video, or set to 60 fps if we work from images (or give a value) - frame_range -> time_range - moved height and weight to project (only read for markerAugmentation, and in the future for automatic scaling) - removed reorder_trc from triangulation and Config -> call it for markerAugmentation instead Others: - Provided an installation procedure for OpenSim (for the future) and made continuous installation check its install (a bit harder since it cannot be installed via pip) - scaling from motion instead of static pose (will have to study whether it's as good or not) - added logging to synchronization - Struggled quite a bit with continuous integration * Starting point of integrating RTMPose into Pose2Sim. (#111) * RTM_to_Open Convert format from RTMPose to OpenPose * rtm_intergrated * rtm_integrated * rtm_integrated * rtm_integrated * rtm * Delete build/lib/Pose2Sim directory * rtm * Delete build/lib/Pose2Sim directory * Delete onnxruntime-gpu * device = cpu * add pose folder * Update tests.py * added annotation * fix typo * Should work be still lots of tests to run. Detailed commit coming soon * intermediary commit * last checks before v0.9.0 * Update continuous-integration.yml * Update tests.py * replaced tabs with spaces * unittest issue * unittest typo * deactivated display for CI test of pose detection * Try to make continuous integration work * a * b * c * d * e * f * g * h * i * j * k * l --------- Co-authored-by: HunMinKim <144449115+hunminkim98@users.noreply.github.com>
2024-07-09 22:39:33 +08:00
cd Pose2Sim/Utilities
2024-07-30 22:52:49 +08:00
conda run -n pose2sim pytest -v tests.py --capture=sys