yohanshin/WHAMのメモ(win10+cuda11.8環境)
3次元姿勢推定モデルのWHAMのインストール手順をメモします。
インストール手順は以下を参考にします。
依存関係のインストールが問題でした。
PyTorch周りは通常通りインストールします。
PyTorch3D
PyTorch3Dに合わせて環境構築します。
今回は有志の公開してるwheelで導入しました。
他にも以下のwheelが提供されているようなので必要に応じて参照してみたい。
detectron2
diff_gaussian_rasterization
fairseq
fused_ssim
mmcv
MultiScaleDeformableAttention
pytorch3d
SAM_2
simple_knn
tinycudann
公開されているPyTorch3Dの最新版のうち、自環境のPython 3.12, CUDA11.8に対応しているPyTorchのバージョンが最も新しいものはPyTorch 2.6.0でした。
自環境はPython 3.12, CUDA11.8です。
I:\dev\sam2\WHAM>nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Wed_Sep_21_10:41:10_Pacific_Daylight_Time_2022
Cuda compilation tools, release 11.8, V11.8.89
Build cuda_11.8.r11.8/compiler.31833905_0
I:\dev\sam2\WHAM>python
Python 3.12.10 (tags/v3.12.10:0cc8128, Apr 8 2025, 12:21:36) [MSC v.1943 64 bit (AMD64)] on win32
PyTorchはレガシーの2.6.0を導入しました。
古いバージョンはPyTorchの公式サイトに導入法は書いてあります。
pip install torch==2.6.0 torchvision==0.21.0 torchaudio==2.6.0 --index-url https://download.pytorch.org/whl/cu118
torch == 2.6.0+cu118
なので、0.7.8+pt2.6.0cu118を導入します。
pytorch3d-0.7.8+pt2.6.0cu118-cp312-cp312-win_amd64.whl
をダウンロードしました。
依存関係にfvcore, iopathも導入しています。
.whlファイルをダウンロードしたディレクトリに
pip install fvcore iopath
pip install pytorch3d-0.7.8+pt2.6.0cu118-cp312-cp312-win_amd64.whl
そのほかの依存関係
こちらを参照
numpy
1.x系である必要がありました。
pip install numpy==1.26.4
chumpy
自環境では--no-build-isolationオプションが必要でした。
pip install chumpy@git+https://github.com/mattloper/chumpy --no-build-isolation
xtcocotools
これだけこけました。
自環境ではWindows 10 SDKが足りなかったようです。
Visual Studio Build Tools 2022から追加インストールしました。
Visual Studio Build Tools 2022
インストール後のオプションの一覧

その後、以下のようにインストールできました。
C:\Windows\system32>pip install xtcocotools --no-build-isolation
Collecting xtcocotools
Using cached xtcocotools-1.14.3.tar.gz (28 kB)
Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: setuptools>=18.0 in c:\program files\python312\lib\site-packages (from xtcocotools) (80.8.0)
Requirement already satisfied: cython>=0.27.3 in c:\users\himak\appdata\roaming\python\python312\site-packages (from xtcocotools) (3.1.1)
Requirement already satisfied: matplotlib>=2.1.0 in c:\users\himak\appdata\roaming\python\python312\site-packages (from xtcocotools) (3.10.3)
Requirement already satisfied: numpy>=1.20.0 in c:\program files\python312\lib\site-packages (from xtcocotools) (1.26.4)
Requirement already satisfied: contourpy>=1.0.1 in c:\users\himak\appdata\roaming\python\python312\site-packages (from matplotlib>=2.1.0->xtcocotools) (1.3.2)
Requirement already satisfied: cycler>=0.10 in c:\users\himak\appdata\roaming\python\python312\site-packages (from matplotlib>=2.1.0->xtcocotools) (0.12.1)
Requirement already satisfied: fonttools>=4.22.0 in c:\program files\python312\lib\site-packages (from matplotlib>=2.1.0->xtcocotools) (4.58.0)
Requirement already satisfied: kiwisolver>=1.3.1 in c:\users\himak\appdata\roaming\python\python312\site-packages (from matplotlib>=2.1.0->xtcocotools) (1.4.8)
Requirement already satisfied: packaging>=20.0 in c:\program files\python312\lib\site-packages (from matplotlib>=2.1.0->xtcocotools) (23.2)
Requirement already satisfied: pillow>=8 in c:\program files\python312\lib\site-packages (from matplotlib>=2.1.0->xtcocotools) (11.1.0)
Requirement already satisfied: pyparsing>=2.3.1 in c:\program files\python312\lib\site-packages (from matplotlib>=2.1.0->xtcocotools) (3.2.3)
Requirement already satisfied: python-dateutil>=2.7 in c:\program files\python312\lib\site-packages (from matplotlib>=2.1.0->xtcocotools) (2.9.0.post0)
Requirement already satisfied: six>=1.5 in c:\program files\python312\lib\site-packages (from python-dateutil>=2.7->matplotlib>=2.1.0->xtcocotools) (1.17.0)
Building wheels for collected packages: xtcocotools
Building wheel for xtcocotools (pyproject.toml) ... done
Created wheel for xtcocotools: filename=xtcocotools-1.14.3-cp312-cp312-win_amd64.whl size=82233 sha256=eb2686f0d00b253ee7476e552bacebb74a4e2fa70405ae11ade616fb5afde347
Stored in directory: c:\users\himak\appdata\local\pip\cache\wheels\1c\bd\54\9e99a23b44bcf86559636a737814e16f69781371cb34f394c7
Successfully built xtcocotools
Installing collected packages: xtcocotools
Successfully installed xtcocotools-1.14.3
ViTPoseのインストール
ViTPoseのusageの通りインストールしました。
git clone https://github.com/ViTAE-Transformer/ViTPose.git
cd ViTPose
pip install -v -e .
DPVOのインストール
インストール手順をClaude Opus 4にwindows用として書き換えてもらいました。
torch-scatterは同じく有志のwheelからのインストールになります。
:: Install DPVO
cd third-party\DPVO
:: Eigenのダウンロード(curlを使用)
curl -o eigen-3.4.0.zip https://gitlab.com/libeigen/eigen/-/archive/3.4.0/eigen-3.4.0.zip
:: ZIPファイルの展開(PowerShellコマンドを呼び出し)
powershell -command "Expand-Archive -Path eigen-3.4.0.zip -DestinationPath thirdparty"
del eigen-3.4.0.zip
:: pytorch-scatterのインストール
pip install torch-scatter -f https://data.pyg.org/whl/torch-2.7.0+cu118.html
コマンドラインからpowershellって呼べるんだね。
実行結果
手順が前後していますが、PyTorch3Dに合わせて環境構築したところ、以下の通りちゃんと動きました。
I:\dev\sam2\WHAM>python demo.py --video examples/IMG_9732.mov --visualize
apex is not installed
apex is not installed
apex is not installed
C:\Program Files\Python312\Lib\site-packages\mmcv\cnn\bricks\transformer.py:27: UserWarning: Fail to import ``MultiScaleDeformableAttention`` from ``mmcv.ops.multi_scale_deform_attn``, You should install ``mmcv-full`` if you need this module.
warnings.warn('Fail to import ``MultiScaleDeformableAttention`` from '
C:\Users\himak\AppData\Roaming\Python\Python312\site-packages\timm\models\layers\__init__.py:48: FutureWarning: Importing from timm.models.layers is deprecated, please import via timm.layers
warnings.warn(f"Importing from {__name__} is deprecated, please import via timm.layers", FutureWarning)
2025-06-03 00:52:14.731 | INFO | __main__:<module>:27 - DPVO is not properly installed. Only estimate in local coordinates !
2025-06-03 00:52:14.737 | INFO | __main__:<module>:209 - GPU name -> NVIDIA GeForce RTX 3090
2025-06-03 00:52:14.737 | INFO | __main__:<module>:210 - GPU feat -> _CudaDeviceProperties(name='NVIDIA GeForce RTX 3090', major=8, minor=6, total_memory=24575MB, multi_processor_count=82, uuid=5181be71-25a9-f1b3-1fa6-7d8bedff8658, L2_cache_size=6MB)
2025-06-03 00:52:15.287 | INFO | lib.models:build_network:36 - => loaded checkpoint 'checkpoints/wham_vit_bedlam_w_3dpw.pth.tar'
2025-06-03 00:52:15.295 | INFO | __main__:run:95 - Already processed data exists at output/demo\IMG_9732 ! Load the data .
Rendering results ... |################################| 660/660
2025-06-03 00:52:47.617 | INFO | __main__:<module>:233 - Done !
実行結果は以下の通りです。