Anipose
-
동물이나 손의 포즈를 마커 없이 3D 추적할 수 있는 오픈소스 툴킷
-
머신러닝 툴박스인 DeepLabCut을 활용하여 2D에서 키포인트를 추적한 다음, triangulation을 이용해 3D포즈를 추정
-
outliers의 영향을 최소화하도록 설계된 3D 캘리브레이션 모듈
-
여러 동영상을 효율적으로 처리하기 위한 파이프라인
환경 세팅
설치 환경
- OS: Windows 10 64bit
- GPU: RTX 3080 10GB
- CUDA: CUDA Toolkit 11.2, Cudnn 8.2
- Python: Anaconda 가상 환경
- Date: 2023.06.08
아나콘다 환경 생성 및 라이브러리 설치
# 가상환경 생성
conda create -n anipose python=3.7
conda activate anipose
문서에는 tensorflow-1.13.1 을 설치하라고 하지만, 실행 시 버전 이슈로 인해 1.15 버전 설치- tensorflow는 deeplabcut 을 위해 사용되며, GPU 버전으로 설치하기 위해 CUDA 설치 후 deeplabcut과 함께 설치
# CUDA Toolkit 및 cudnn 설치
conda install -c conda-forge cudnn
# deeplabcut 설치 (tensorflow와 함께)
# 23.06.09 기준 tensorflow 2.10.0 버전 설치됨
pip install deeplabcut[tf]
# wxPython 설치
pip install attrdict3
pip install requests
pip install -U wxPython
# wxPython 설치 확인
>> python >> import wx
# anipose 설치 (종속된 라이브러리들도 함께 설치됨)
pip install anipose
# anipose 설치 확인
>> anipose
# vtk, mayavi, ffmpeg 설치
pip install vtk
conda install mayavi ffmpeg
pip install --upgrade apptools
튜토리얼
- 참고: https://anipose.readthedocs.io/en/latest/tutorial.html
- (각 기능은 서로 종속적이므로 튜토리얼을 따라 순차적으로 진행해야함)
- 사전 학습 모델 및 데모 다운로드
https://drive.google.com/drive/u/1/folders/18qGbHyiSJ2au9sFXScZ63EZ83PtC1-ld
- 실행 경로로 이동
hand-demo-unfilled/
- cofig 파일 설정 변경
1. hand-demo-unfilled/config.toml 파일 model_folder 값 변경
model_folder = '../hand-demo-dlc-TuthillLab-2019-08-05'
2. hand-demo-dlc-TuthillLab-2019-08-05/config.yaml 파일 project_path 값 변경
project_path: ../hand-demo-dlc-TuthillLab-2019-08-05
- 실행
>> anipose analyze
실행 테스트
2d label
3d label combined
ISSUES
- calibrate 실행 시 opencv 에러
>> anipose calibrate
>> error: module 'cv2.aruco' has no attribute 'CharucoBoard_create'
- opencv 4.7 버전 이상에서 생기는 문제,
cv2.aruco.CharucoBoard_create
가cv2.aruco.CharucoBoard
로 변경됨 - 에러에서 가리키는
"C:\Users\MSK-IEETU\.conda\envs\anipose\lib\site-packages\aniposelib\boards.py", line 567
의 부분을 수정함 - 첫 두 파라미터(size)는 ()로 묶음
- 아래 에러도 마찬가지로 수정
>> error: module 'cv2.aruco' has no attribute 'DetectorParameters_create'
- **label-3d 실행 시 vtkCommonCorePython 에러 **
>> anipose label-3d
>> ModuleNotFoundError: No module named 'vtkCommonCorePython'
- vtk 재설치 및 업그레이드
pip uninstall mayavi
pip install --ignore-installed -U vtk
pip install mayavi
- label-3D 결과 이상한 이슈
- triangulation 이 이상한 결과를 도출하는 것으로 보임
- config.toml 파일 수정 (RANSAC 만 동작하도록)
- anipose 버전을 0.9.0 버전으로 다운그레이드 하는 것도 방법이라고함
- anipose visualize 실행 시 이슈
cannot import name 'safe_join' from 'flask' 에러
⇒ flask==1.1.2 버전 재설치cannot import name 'escape' from 'jinja2' 에러
⇒ jinja2==3.0.0 버전 재설치cannot import name 'json' from 'itsdangerous' 에러
⇒ itsdangerous==2.0.1 재설치cannot import name 'BaseResponse' from 'werkzeug.wrappers'
⇒ werkzeug==2.0.3 재설치
참고
- Anipose — Anipose 0.8.1 documentation
- anipose label-3d (ModuleNotFoundError: No module named ‘vtkCommonCorePython’) · Issue #69 · lambdaloop/anipose · GitHub
- GitHub - DeepLabCut/DeepLabCut: Official implementation of DeepLabCut: Markerless pose estimation of user-defined features with deep learning for all animals incl. humans
- Demo 3D labeled video doesn’t look like as in example · Issue #88 · lambdaloop/anipose · GitHub