2025-02-20 03:10:23 +08:00
|
|
|
@echo off
|
2025-02-21 10:00:48 +08:00
|
|
|
setlocal enabledelayedexpansion
|
|
|
|
|
|
|
|
REM Set environment variables
|
2025-02-23 00:37:03 +08:00
|
|
|
@CALL set "PYTHONDONTWRITEBYTECODE=1"
|
2025-02-23 22:11:30 +08:00
|
|
|
@CALL set "GDOWN_CACHE=%~dp0\cache\gdown"
|
|
|
|
@CALL set "TORCH_HOME=%~dp0\cache\torch"
|
|
|
|
@CALL set "HF_HOME=%~dp0\cache\huggingface"
|
2025-02-20 03:10:23 +08:00
|
|
|
|
|
|
|
@CALL "%~dp0micromamba.exe" shell init --shell cmd.exe --prefix "%~dp0\"
|
2025-02-23 22:11:30 +08:00
|
|
|
@CALL SET PROJECT_DIR=%~dp0
|
2025-02-21 10:00:48 +08:00
|
|
|
@CALL SET CUDA_HOME="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8"
|
|
|
|
@CALL SET BLENDER_DIR="C:\Program Files\Blender Foundation\Blender 3.6"
|
2025-02-23 19:11:03 +08:00
|
|
|
@CALL SET VS_DIR="C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
|
2025-02-19 01:56:32 +08:00
|
|
|
@CALL SET VS_VCVARS="%VS_DIR%\VC\Auxiliary\Build\vcvars64.bat"
|
|
|
|
@CALL SET PATH=%CUDA_HOME%\bin;%PROJECT_DIR%\condabin;%PATH%
|
|
|
|
|
2025-02-20 03:59:54 +08:00
|
|
|
REM Create gaussian_splatting_hair environment
|
2025-02-22 01:48:45 +08:00
|
|
|
@CALL cd %PROJECT_DIR%
|
2025-02-23 00:54:40 +08:00
|
|
|
@CALL "%~dp0micromamba.exe" create -n gaussian_splatting_hair python=3.9 ^
|
2025-02-20 03:59:54 +08:00
|
|
|
-c pytorch -c nvidia -c conda-forge -c anaconda -c fvcore -c iopath -c bottler -r "%~dp0\" -y
|
|
|
|
@CALL "%~dp0condabin\micromamba.bat" activate gaussian_splatting_hair
|
2025-02-22 01:48:45 +08:00
|
|
|
@CALL cd %PROJECT_DIR%
|
2025-02-20 03:59:54 +08:00
|
|
|
@CALL python -m pip install --upgrade pip
|
2025-02-23 19:11:03 +08:00
|
|
|
@CALL python -m pip install torch==2.1.1+cu118 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 --force-reinstall --no-cache-dir
|
|
|
|
@CALL python -m pip install cmake pyhocon icecream einops accelerate jsonmerge easydict iopath tensorboardx scikit-image gdown colmap --force-reinstall --no-cache-dir
|
2025-02-23 00:54:40 +08:00
|
|
|
@CALL python -m pip install pysdf clean-fid face-alignment clip torchdiffeq torchsde resize-right
|
|
|
|
|
2025-02-20 03:10:23 +08:00
|
|
|
|
2025-02-20 03:59:54 +08:00
|
|
|
REM Clone repositories
|
|
|
|
@CALL cd %PROJECT_DIR%
|
2025-02-21 10:00:48 +08:00
|
|
|
@CALL git clone https://github.com/CMU-Perceptual-Computing-Lab/openpose %PROJECT_DIR%\ext\openpose --depth 1
|
|
|
|
@CALL cd %PROJECT_DIR%\ext\openpose && git submodule update --init --recursive --remote
|
|
|
|
@CALL cd %PROJECT_DIR%
|
|
|
|
@CALL git clone https://github.com/hustvl/Matte-Anything %PROJECT_DIR%\ext\Matte-Anything
|
|
|
|
@CALL git clone https://github.com/IDEA-Research/GroundingDINO.git %PROJECT_DIR%\ext\Matte-Anything\GroundingDINO
|
|
|
|
@CALL git clone https://github.com/egorzakharov/NeuralHaircut.git --recursive %PROJECT_DIR%\ext\NeuralHaircut
|
|
|
|
@CALL git clone https://github.com/facebookresearch/pytorch3d %PROJECT_DIR%\ext\pytorch3d
|
|
|
|
@CALL cd %PROJECT_DIR%\ext\pytorch3d && git checkout 2f11ddc5ee7d6bd56f2fb6744a16776fab6536f7
|
|
|
|
@CALL cd %PROJECT_DIR%
|
|
|
|
@CALL git clone https://github.com/camenduru/simple-knn %PROJECT_DIR%\ext\simple-knn
|
|
|
|
@CALL git clone https://github.com/g-truc/glm %PROJECT_DIR%\ext\diff_gaussian_rasterization_hair\third_party\glm
|
|
|
|
@CALL cd %PROJECT_DIR%\ext\diff_gaussian_rasterization_hair\third_party\glm && git checkout 5c46b9c07008ae65cb81ab79cd677ecc1934b903
|
|
|
|
@CALL cd %PROJECT_DIR%
|
|
|
|
@CALL git clone https://github.com/SSL92/hyperIQA %PROJECT_DIR%\ext\hyperIQA
|
2025-02-20 03:59:54 +08:00
|
|
|
@CALL cd %PROJECT_DIR%
|
|
|
|
|
2025-02-21 10:00:48 +08:00
|
|
|
REM Download Neural Haircut files
|
|
|
|
@CALL cd %PROJECT_DIR%\ext\NeuralHaircut
|
|
|
|
@CALL python -m gdown --folder https://drive.google.com/drive/folders/1TCdJ0CKR3Q6LviovndOkJaKm8S1T9F_8
|
|
|
|
@CALL cd %PROJECT_DIR%\ext\NeuralHaircut\pretrained_models\diffusion_prior
|
|
|
|
@CALL python -m gdown 1_9EOUXHayKiGH5nkrayncln3d6m1uV7f
|
|
|
|
@CALL cd %PROJECT_DIR%\ext\NeuralHaircut\PIXIE
|
|
|
|
@CALL python -m gdown 1mPcGu62YPc4MdkT8FFiOCP629xsENHZf
|
2025-02-20 03:10:23 +08:00
|
|
|
@CALL tar -xvzf pixie_data.tar.gz
|
2025-02-21 10:00:48 +08:00
|
|
|
@CALL del /f /q pixie_data.tar.gz
|
|
|
|
@CALL cd %PROJECT_DIR%\ext\hyperIQA
|
|
|
|
@CALL mkdir pretrained
|
|
|
|
@CALL cd pretrained
|
|
|
|
@CALL python -m gdown 1OOUmnbvpGea0LIGpIWEbOyxfWx6UCiiE
|
2025-02-19 01:56:32 +08:00
|
|
|
@CALL cd %PROJECT_DIR%
|
2025-02-20 03:10:23 +08:00
|
|
|
|
2025-02-20 03:59:54 +08:00
|
|
|
@CALL "%~dp0condabin\micromamba.bat" deactivate
|
2025-02-19 01:56:32 +08:00
|
|
|
|
2025-02-20 03:59:54 +08:00
|
|
|
REM Create matte_anything environment
|
2025-02-21 10:00:48 +08:00
|
|
|
@CALL cd %PROJECT_DIR%
|
2025-02-20 03:59:54 +08:00
|
|
|
@CALL "%~dp0micromamba.exe" create -n matte_anything python=3.9 ^
|
2025-02-19 03:41:30 +08:00
|
|
|
-c pytorch -c nvidia -c conda-forge -r "%~dp0\" -y
|
|
|
|
@CALL "%~dp0condabin\micromamba.bat" activate matte_anything
|
2025-02-21 10:00:48 +08:00
|
|
|
@CALL cd %PROJECT_DIR%\ext\Matte-Anything\
|
2025-02-23 00:54:40 +08:00
|
|
|
@CALL python -m pip install --upgrade pip
|
2025-02-23 19:11:03 +08:00
|
|
|
@CALL python -m pip install torch==2.1.1+cu118 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 --force-reinstall --no-cache-dir
|
|
|
|
@CALL python -m pip install mkl easydict wget scikit-image gradio fairscale pyside2 future pillow setuptools future --force-reinstall --no-cache-dir
|
2025-02-22 10:19:41 +08:00
|
|
|
@CALL git clone https://github.com/facebookresearch/segment-anything.git %PROJECT_DIR%\ext\Matte-Anything\segment-anything
|
2025-02-22 03:02:43 +08:00
|
|
|
@CALL cd %PROJECT_DIR%\ext\Matte-Anything\segment-anything
|
|
|
|
@CALL python -m pip install -e .
|
2025-02-22 10:19:41 +08:00
|
|
|
@CALL cd %PROJECT_DIR%\ext\Matte-Anything\
|
|
|
|
@CALL git clone https://github.com/conansherry/detectron2.git %PROJECT_DIR%\ext\Matte-Anything\detectron2
|
2025-02-22 03:02:43 +08:00
|
|
|
@CALL cd %PROJECT_DIR%\ext\Matte-Anything\detectron2
|
|
|
|
@CALL python setup.py build develop
|
2025-02-20 03:59:54 +08:00
|
|
|
@CALL cd %PROJECT_DIR%\ext\Matte-Anything\GroundingDINO
|
2025-02-21 10:00:48 +08:00
|
|
|
@CALL python -m pip install -e .
|
2025-02-22 03:15:39 +08:00
|
|
|
@CALL mkdir %PROJECT_DIR%\ext\Matte-Anything\pretrained
|
|
|
|
@CALL cd %PROJECT_DIR%\ext\Matte-Anything\pretrained
|
2025-02-22 04:01:15 +08:00
|
|
|
@CALL curl -L -o sam_vit_h_4b8939.pth https://dl.fbaipublicfiles.com/segment_anything/sam_vit_h_4b8939.pth
|
|
|
|
@CALL curl -L -o groundingdino_swint_ogc.pth https://github.com/IDEA-Research/GroundingDINO/releases/download/v0.1.0-alpha/groundingdino_swint_ogc.pth
|
2025-02-20 03:10:23 +08:00
|
|
|
@CALL "%~dp0condabin\micromamba.bat" deactivate
|
2025-02-22 04:01:15 +08:00
|
|
|
@CALL "%~dp0condabin\micromamba.bat" activate gaussian_splatting_hair
|
|
|
|
@CALL python -m gdown 1d97oKuITCeWgai2Tf3iNilt6rMSSYzkW
|
2025-02-20 03:59:54 +08:00
|
|
|
|
|
|
|
REM Create openpose environment
|
2025-02-23 22:11:30 +08:00
|
|
|
@CALL cd %PROJECT_DIR%ext\openpose
|
2025-02-22 04:01:15 +08:00
|
|
|
@CALL python -m gdown 1Yn03cKKfVOq4qXmgBMQD20UMRRRkd_tV
|
|
|
|
@CALL tar -xvzf models.tar.gz
|
2025-02-21 10:00:48 +08:00
|
|
|
@CALL git submodule update --init --recursive --remote
|
2025-02-23 19:11:03 +08:00
|
|
|
@CALL cd %PROJECT_DIR%
|
2025-02-23 19:27:21 +08:00
|
|
|
@CALL "%~dp0micromamba.exe" create -y -n openpose python=3.9 cmake=3.20 opencv=4.5.3 -c conda-forge -r "%~dp0\"
|
2025-02-19 03:41:30 +08:00
|
|
|
@CALL "%~dp0condabin\micromamba.bat" activate openpose
|
2025-02-23 19:27:21 +08:00
|
|
|
|
|
|
|
REM 完全清理构建目录
|
2025-02-23 22:11:30 +08:00
|
|
|
@CALL cd %PROJECT_DIR%ext\openpose
|
2025-02-23 19:11:03 +08:00
|
|
|
@CALL rmdir /s /q build 2>nul
|
2025-02-23 19:27:21 +08:00
|
|
|
@CALL del /f /q CMakeCache.txt 2>nul
|
|
|
|
@CALL rmdir /s /q CMakeFiles 2>nul
|
2025-02-19 01:56:32 +08:00
|
|
|
@CALL mkdir build
|
2025-02-23 19:27:21 +08:00
|
|
|
|
|
|
|
REM 设置环境变量
|
2025-02-23 22:11:30 +08:00
|
|
|
@CALL set "OPENPOSE_ROOT=%PROJECT_DIR%ext\openpose"
|
|
|
|
@CALL set "PYTHON_ROOT=%PROJECT_DIR%micromamba\envs\openpose"
|
2025-02-23 19:27:21 +08:00
|
|
|
@CALL set "PYTHON_EXECUTABLE=%PYTHON_ROOT%\python.exe"
|
|
|
|
@CALL set "PYTHON_LIBRARY=%PYTHON_ROOT%\libs\python39.lib"
|
|
|
|
@CALL set "PYTHON_INCLUDE_DIR=%PYTHON_ROOT%\include"
|
|
|
|
@CALL set "OpenCV_DIR=%PYTHON_ROOT%\Library\cmake\opencv4"
|
|
|
|
|
2025-02-23 22:11:30 +08:00
|
|
|
REM 设置 VS 环境
|
|
|
|
@CALL set VS_VCVARS_FIXED="%VS_VCVARS:"=%"
|
|
|
|
@CALL %VS_VCVARS_FIXED%
|
|
|
|
|
|
|
|
REM 执行 CMake 构建
|
|
|
|
@CALL cd %OPENPOSE_ROOT%\build
|
|
|
|
@CALL cmake %OPENPOSE_ROOT% -G "Visual Studio 16 2019" -A x64 -T host=x64 ^
|
2025-02-23 19:27:21 +08:00
|
|
|
-DBUILD_PYTHON=true ^
|
|
|
|
-DUSE_CUDNN=off ^
|
|
|
|
-DOpenCV_DIR="%OpenCV_DIR%" ^
|
|
|
|
-DPYTHON_EXECUTABLE="%PYTHON_EXECUTABLE%" ^
|
|
|
|
-DPYTHON_LIBRARY="%PYTHON_LIBRARY%" ^
|
|
|
|
-DPYTHON_INCLUDE_DIR="%PYTHON_INCLUDE_DIR%" ^
|
|
|
|
-DPYTHON_VERSION_MAJOR=3 ^
|
|
|
|
-DPYTHON_VERSION_MINOR=9 ^
|
|
|
|
-DPYTHON_DEBUG_LIBRARY="" ^
|
|
|
|
-DPYTHON_ROOT_DIR="%PYTHON_ROOT%"
|
|
|
|
|
2025-02-19 01:56:32 +08:00
|
|
|
@CALL cmake --build . --config Release
|
|
|
|
@CALL cd %PROJECT_DIR%
|
2025-02-20 03:10:23 +08:00
|
|
|
@CALL "%~dp0condabin\micromamba.bat" deactivate
|
2025-02-19 01:56:32 +08:00
|
|
|
|
2025-02-20 03:59:54 +08:00
|
|
|
REM Create pixie-env environment
|
2025-02-21 10:00:48 +08:00
|
|
|
@CALL cd %PROJECT_DIR%
|
2025-02-20 03:59:54 +08:00
|
|
|
@CALL "%~dp0micromamba.exe" create -n pixie-env python=3.8 ^
|
2025-02-21 10:00:48 +08:00
|
|
|
-c pytorch -c nvidia -c fvcore -c conda-forge -c pytorch3d -r "%~dp0\" -y
|
2025-02-19 03:41:30 +08:00
|
|
|
@CALL "%~dp0condabin\micromamba.bat" activate pixie-env
|
2025-02-22 02:43:30 +08:00
|
|
|
@CALL cd %PROJECT_DIR%\ext\PIXIE\
|
2025-02-23 00:54:40 +08:00
|
|
|
@CALL python -m pip install --upgrade pip
|
2025-02-23 19:11:03 +08:00
|
|
|
@CALL python -m pip install torch==2.1.1+cu118 torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 --force-reinstall --no-cache-dir
|
2025-02-23 00:54:40 +08:00
|
|
|
@CALL python -m fvcore kornia matplotlib pytorch3d pyyaml
|
2025-02-19 01:56:32 +08:00
|
|
|
@CALL pip install git+https://github.com/1adrianb/face-alignment.git@54623537fd9618ca7c15688fd85aba706ad92b59
|
2025-02-20 03:59:54 +08:00
|
|
|
@CALL cd %PROJECT_DIR%
|
|
|
|
@CALL "%~dp0condabin\micromamba.bat" deactivate
|