Update run.bat

This commit is contained in:
Jeffreytsai1004 2025-02-19 02:56:40 +08:00
parent 0734b3080f
commit f912fd2bf7

371
run.bat
View File

@ -1,6 +1,4 @@
@echo off @CALL "%~dp0micromamba.exe" shell init --shell cmd.exe --prefix "%~dp0\"
@CALL "%~dp0micromamba.exe" shell init --shell cmd.exe --prefix "%~dp0\"
@CALL SET PROJECT_DIR=%~dp0 @CALL SET PROJECT_DIR=%~dp0
@CALL SET MICROMAMBA_EXE=%PROJECT_DIR%\micromamba.exe @CALL SET MICROMAMBA_EXE=%PROJECT_DIR%\micromamba.exe
@CALL SET CUDA_HOME="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\" @CALL SET CUDA_HOME="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\"
@ -9,310 +7,233 @@
@CALL SET VS_VCVARS="%VS_DIR%\VC\Auxiliary\Build\vcvars64.bat" @CALL SET VS_VCVARS="%VS_DIR%\VC\Auxiliary\Build\vcvars64.bat"
@CALL SET PATH=%CUDA_HOME%\bin;%PROJECT_DIR%\condabin;%PATH% @CALL SET PATH=%CUDA_HOME%\bin;%PROJECT_DIR%\condabin;%PATH%
@CALL condabin\micromamba.bat activate gaussian_splatting_hair @CALL SET GPU="0"
@CALL SET CAMERA="PINHOLE"
@CALL SET EXP_NAME_1="stage1"
@CALL SET EXP_NAME_2="stage2"
@CALL SET EXP_NAME_3="stage3"
REM 确保以下环境变量可用: REM 确保以下环境变量可用:
REM PROJECT_DIR 和 DATA_PATH REM PROJECT_DIR 和 DATA_PATH
REM 检查必要的环境变量
IF "%PROJECT_DIR%"=="" (
echo ERROR: PROJECT_DIR environment variable is not set
@exit /b 1
)
IF "%DATA_PATH%"=="" (
echo ERROR: DATA_PATH environment variable is not set
@exit /b 1
)
IF NOT EXIST "%BLENDER_DIR%" (
echo ERROR: BLENDER_DIR path does not exist: %BLENDER_DIR%
@exit /b 1
)
IF NOT EXIST "%MICROMAMBA_EXE%" (
echo ERROR: micromamba not found at %MICROMAMBA_EXE%
@echo Please install micromamba from https://mamba.readthedocs.io/en/latest/installation.html
@exit /b 1
)
REM ################## REM ##################
REM # 预处理阶段 # REM # 预处理阶段 #
REM ################## REM ##################
REM 将原始图像整理成3D Gaussian Splatting格式 REM 将原始图像整理成3D Gaussian Splatting格式
@CALL condabin\micromamba.bat activate gaussian_splatting_hair @CALL "%~dp0condabin\micromamba.bat" activate gaussian_splatting_hair
@CALL cd %PROJECT_DIR%\src\preprocessing @CALL cd %PROJECT_DIR%\src\preprocessing
@CALL set CUDA_VISIBLE_DEVICES=%GPU% @CALL SET CUDA_VISIBLE_DEVICES=%GPU% && @CALL python preprocess_raw_images.py ^
@CALL python preprocess_raw_images.py --data_path %DATA_PATH% --data_path %DATA_PATH%
IF %ERRORLEVEL% NEQ 0 (
@echo ERROR: Failed to run command
@exit /b 1
)
REM 运行COLMAP重建并去畸变图像和相机 REM 运行COLMAP重建并去畸变图像和相机
@CALL condabin\micromamba.bat activate gaussian_splatting_hair @CALL "%~dp0condabin\micromamba.bat" activate gaussian_splatting_hair
@CALL cd %PROJECT_DIR%\src @CALL cd %PROJECT_DIR%\src
@CALL set CUDA_VISIBLE_DEVICES=%GPU% @CALL SET CUDA_VISIBLE_DEVICES=%GPU% && @CALL python convert.py -s %DATA_PATH% ^
@CALL python convert.py -s %DATA_PATH% --camera %CAMERA% --max_size 1024 --camera %CAMERA% --max_size 1024
IF %ERRORLEVEL% NEQ 0 (
@echo ERROR: Failed to run command
@exit /b 1
)
REM 运行Matte-Anything REM 运行Matte-Anything
@CALL condabin\micromamba.bat activate matte_anything @CALL "%~dp0condabin\micromamba.bat" activate matte_anything
@CALL cd %PROJECT_DIR%\src\preprocessing @CALL cd %PROJECT_DIR%\src\preprocessing
@CALL set CUDA_VISIBLE_DEVICES=%GPU% @CALL SET CUDA_VISIBLE_DEVICES=%GPU% && @CALL python calc_masks.py ^
@CALL python calc_masks.py --data_path %DATA_PATH% --image_format png --max_size 2048 --data_path %DATA_PATH% --image_format png --max_size 2048
IF %ERRORLEVEL% NEQ 0 (
@echo ERROR: Failed to run command
@exit /b 1
)
REM 使用IQA分数过滤图像 REM 使用IQA分数过滤图像
@CALL condabin\micromamba.bat activate gaussian_splatting_hair @CALL "%~dp0condabin\micromamba.bat" activate gaussian_splatting_hair
@CALL cd %PROJECT_DIR%\src\preprocessing @CALL cd %PROJECT_DIR%\src\preprocessing
@CALL set CUDA_VISIBLE_DEVICES=%GPU% @CALL SET CUDA_VISIBLE_DEVICES=%GPU% && @CALL python filter_extra_images.py ^
@CALL python filter_extra_images.py --data_path %DATA_PATH% --max_imgs 128 --data_path %DATA_PATH% --max_imgs 128
IF %ERRORLEVEL% NEQ 0 (
@echo ERROR: Failed to run command
@exit /b 1
)
REM 调整图像大小 REM 调整图像大小
@CALL condabin\micromamba.bat activate gaussian_splatting_hair @CALL "%~dp0condabin\micromamba.bat" activate gaussian_splatting_hair
@CALL cd %PROJECT_DIR%\src\preprocessing @CALL cd %PROJECT_DIR%\src\preprocessing
@CALL set CUDA_VISIBLE_DEVICES=%GPU% @CALL SET CUDA_VISIBLE_DEVICES=%GPU% && @CALL python resize_images.py --data_path %DATA_PATH%
@CALL python resize_images.py --data_path %DATA_PATH%
IF %ERRORLEVEL% NEQ 0 (
@echo ERROR: Failed to run command
@exit /b 1
)
REM 计算方向图 REM 计算方向图
@CALL condabin\micromamba.bat activate gaussian_splatting_hair @CALL "%~dp0condabin\micromamba.bat" activate gaussian_splatting_hair
@CALL cd %PROJECT_DIR%\src\preprocessing @CALL cd %PROJECT_DIR%\src\preprocessing
@CALL set CUDA_VISIBLE_DEVICES=%GPU% @CALL SET CUDA_VISIBLE_DEVICES=%GPU% && @CALL python calc_orientation_maps.py ^
@CALL python calc_orientation_maps.py --img_path %DATA_PATH%\images_2 --mask_path %DATA_PATH%\masks_2\hair --orient_dir %DATA_PATH%\orientations_2\angles --conf_dir %DATA_PATH%\orientations_2\vars --filtered_img_dir %DATA_PATH%\orientations_2\filtered_imgs --vis_img_dir %DATA_PATH%\orientations_2\vis_imgs --img_path %DATA_PATH%\images_2 ^
IF %ERRORLEVEL% NEQ 0 ( --mask_path %DATA_PATH%\masks_2\hair ^
@echo ERROR: Failed to run command --orient_dir %DATA_PATH%\orientations_2\angles ^
@exit /b 1 --conf_dir %DATA_PATH%\orientations_2\vars ^
) --filtered_img_dir %DATA_PATH%\orientations_2\filtered_imgs ^
--vis_img_dir %DATA_PATH%\orientations_2\vis_imgs
REM 运行OpenPose REM 运行OpenPose
@CALL condabin\micromamba.bat activate openpose @CALL "%~dp0condabin\micromamba.bat" deactivate && cd %PROJECT_DIR%\ext\openpose
@CALL cd %PROJECT_DIR%\ext\openpose @CALL "%~dp0condabin\micromamba.bat" activate openpose
@CALL mkdir %DATA_PATH%\openpose @CALL mkdir %DATA_PATH%\openpose
@CALL set CUDA_VISIBLE_DEVICES=%GPU% @CALL SET CUDA_VISIBLE_DEVICES=%GPU% && @CALL "%PROJECT_DIR%\ext\openpose\build\x64\Release\OpenPoseDemo.exe" ^
@CALL "%PROJECT_DIR%\ext\openpose\build\x64\Release\OpenPoseDemo.exe" --image_dir %DATA_PATH%\images_4 --scale_number 4 --scale_gap 0.25 --face --hand --display 0 --write_json %DATA_PATH%\openpose\json --write_images %DATA_PATH%\openpose\images --write_images_format jpg --image_dir %DATA_PATH%\images_4 ^
IF %ERRORLEVEL% NEQ 0 ( --scale_number 4 --scale_gap 0.25 --face --hand --display 0 ^
@echo ERROR: Failed to run command --write_json %DATA_PATH%\openpose\json ^
@exit /b 1 --write_images %DATA_PATH%\openpose\images --write_images_format jpg
)
REM 运行Face-Alignment REM 运行Face-Alignment
@CALL condabin\micromamba.bat activate gaussian_splatting_hair @CALL "%~dp0condabin\micromamba.bat" activate gaussian_splatting_hair
@CALL cd %PROJECT_DIR%\src\preprocessing @CALL cd %PROJECT_DIR%\src\preprocessing
@CALL set CUDA_VISIBLE_DEVICES=%GPU% @CALL SET CUDA_VISIBLE_DEVICES=%GPU% && @CALL python calc_face_alignment.py ^
@CALL python calc_face_alignment.py --data_path %DATA_PATH% --image_dir "images_4" --data_path %DATA_PATH% --image_dir "images_4"
IF %ERRORLEVEL% NEQ 0 (
@echo ERROR: Failed to run command
@exit /b 1
)
REM 运行PIXIE REM 运行PIXIE
@CALL condabin\micromamba.bat activate pixie-env @CALL "%~dp0condabin\micromamba.bat" activate pixie-env
@CALL cd %PROJECT_DIR%\ext\PIXIE @CALL cd %PROJECT_DIR%\ext\PIXIE
@CALL set CUDA_VISIBLE_DEVICES=%GPU% @CALL SET CUDA_VISIBLE_DEVICES=%GPU% && @CALL python demos\demo_fit_face.py ^
@CALL python demos\demo_fit_face.py -i %DATA_PATH%\images_4 -s %DATA_PATH%\pixie --saveParam True --lightTex False --useTex False --rasterizer_type pytorch3d -i %DATA_PATH%\images_4 -s %DATA_PATH%\pixie ^
IF %ERRORLEVEL% NEQ 0 ( --saveParam True --lightTex False --useTex False ^
@echo ERROR: Failed to run command --rasterizer_type pytorch3d
@exit /b 1
)
REM 合并所有PIXIE预测到单个文件 REM 合并所有PIXIE预测到单个文件
@CALL condabin\micromamba.bat activate gaussian_splatting_hair @CALL "%~dp0condabin\micromamba.bat" activate gaussian_splatting_hair
@CALL cd %PROJECT_DIR%\src\preprocessing @CALL cd %PROJECT_DIR%\src\preprocessing
@CALL set CUDA_VISIBLE_DEVICES=%GPU% @CALL SET CUDA_VISIBLE_DEVICES=%GPU% && @CALL python merge_smplx_predictions.py ^
@CALL python merge_smplx_predictions.py --data_path %DATA_PATH% --data_path %DATA_PATH%
IF %ERRORLEVEL% NEQ 0 (
@echo ERROR: Failed to run command
@exit /b 1
)
REM 将COLMAP相机转换为txt REM 将COLMAP相机转换为txt
@CALL condabin\micromamba.bat activate gaussian_splatting_hair @CALL "%~dp0condabin\micromamba.bat" activate gaussian_splatting_hair
@CALL mkdir %DATA_PATH%\sparse_txt @CALL mkdir %DATA_PATH%\sparse_txt
@CALL set CUDA_VISIBLE_DEVICES=%GPU% @CALL SET CUDA_VISIBLE_DEVICES=%GPU% && @CALL colmap model_converter ^
@CALL colmap model_converter --input_path %DATA_PATH%\sparse\0 --output_path %DATA_PATH%\sparse_txt --output_type TXT --input_path %DATA_PATH%\sparse\0 ^
IF %ERRORLEVEL% NEQ 0 ( --output_path %DATA_PATH%\sparse_txt --output_type TXT
@echo ERROR: Failed to run command
@exit /b 1
)
REM 将COLMAP相机转换为H3DS格式 REM 将COLMAP相机转换为H3DS格式
@CALL condabin\micromamba.bat activate gaussian_splatting_hair @CALL "%~dp0condabin\micromamba.bat" activate gaussian_splatting_hair
@CALL cd %PROJECT_DIR%\src\preprocessing @CALL cd %PROJECT_DIR%\src\preprocessing
@CALL set CUDA_VISIBLE_DEVICES=%GPU% @CALL SET CUDA_VISIBLE_DEVICES=%GPU% && @CALL python colmap_parsing.py ^
@CALL python colmap_parsing.py --path_to_scene %DATA_PATH% --path_to_scene %DATA_PATH%
IF %ERRORLEVEL% NEQ 0 (
@echo ERROR: Failed to run command
@exit /b 1
)
REM 删除原始文件以节省磁盘空间 REM 删除原始文件以节省磁盘空间
@CALL rmdir /s /q %DATA_PATH%\input %DATA_PATH%\images %DATA_PATH%\masks %DATA_PATH%\iqa* @CALL rmdir /s /q %DATA_PATH%\input %DATA_PATH%\images %DATA_PATH%\masks %DATA_PATH%\iqa*
IF %ERRORLEVEL% NEQ 0 (
@echo ERROR: Failed to run command
@exit /b 1
)
REM 清理临时文件
@CALL del /f /s /q %DATA_PATH%\*.tmp >nul 2>&1
REM ################## REM ##################
REM # 重建阶段 # REM # 重建阶段 #
REM ################## REM ##################
set EXP_PATH_1=%DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1% @CALL SET EXP_PATH_1=%DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1%
REM 运行3D Gaussian Splatting重建 REM 运行3D Gaussian Splatting重建
@CALL condabin\micromamba.bat activate gaussian_splatting_hair @CALL "%~dp0condabin\micromamba.bat" activate gaussian_splatting_hair && cd %PROJECT_DIR%\src
@CALL cd %PROJECT_DIR%\src @CALL SET CUDA_VISIBLE_DEVICES=%GPU% && @CALL python train_gaussians.py ^
@CALL set CUDA_VISIBLE_DEVICES=%GPU% -s %DATA_PATH% -m "%EXP_PATH_1%" -r 1 --port "888%GPU%" ^
@CALL python train_gaussians.py -s %DATA_PATH% -m "%EXP_PATH_1%" -r 1 --port "888%GPU%" --trainable_cameras --trainable_intrinsics --use_barf --lambda_dorient 0.1 --trainable_cameras --trainable_intrinsics --use_barf ^
IF %ERRORLEVEL% NEQ 0 ( --lambda_dorient 0.1
@echo ERROR: Failed to run command
@exit /b 1
)
REM 运行FLAME网格拟合 REM 运行FLAME网格拟合
@CALL condabin\micromamba.bat activate gaussian_splatting_hair @CALL "%~dp0condabin\micromamba.bat" activate gaussian_splatting_hair
@CALL cd %PROJECT_DIR%\ext\NeuralHaircut\src\multiview_optimization @CALL cd %PROJECT_DIR%\ext\NeuralHaircut\src\multiview_optimization
@CALL set CUDA_VISIBLE_DEVICES=%GPU% @CALL SET CUDA_VISIBLE_DEVICES=%GPU% && @CALL python fit.py --conf confs\train_person_1.conf ^
@CALL python fit.py --conf confs\train_person_1.conf --batch_size 1 --train_rotation True --fixed_images True --save_path %DATA_PATH%\flame_fitting\%EXP_NAME_1%\stage_1 --data_path %DATA_PATH% --fitted_camera_path %EXP_PATH_1%\cameras\30000_matrices.pkl --batch_size 1 --train_rotation True --fixed_images True ^
IF %ERRORLEVEL% NEQ 0 ( --save_path %DATA_PATH%\flame_fitting\%EXP_NAME_1%\stage_1 ^
@echo ERROR: Failed to run command --data_path %DATA_PATH% ^
@exit /b 1 --fitted_camera_path %EXP_PATH_1%\cameras\30000_matrices.pkl
)
@CALL python fit.py --conf confs\train_person_1.conf --batch_size 4 --train_rotation True --fixed_images True --save_path %DATA_PATH%\flame_fitting\%EXP_NAME_1%\stage_2 --checkpoint_path %DATA_PATH%\flame_fitting\%EXP_NAME_1%\stage_1\opt_params_final --data_path %DATA_PATH% --fitted_camera_path %EXP_PATH_1%\cameras\30000_matrices.pkl @CALL SET CUDA_VISIBLE_DEVICES=%GPU% && @CALL python fit.py --conf confs\train_person_1.conf ^
IF %ERRORLEVEL% NEQ 0 ( --batch_size 4 --train_rotation True --fixed_images True ^
@echo ERROR: Failed to run command --save_path %DATA_PATH%\flame_fitting\%EXP_NAME_1%\stage_2 ^
@exit /b 1 --checkpoint_path %DATA_PATH%\flame_fitting\%EXP_NAME_1%\stage_1\opt_params_final ^
) --data_path %DATA_PATH% ^
--fitted_camera_path %EXP_PATH_1%\cameras\30000_matrices.pkl
@CALL python fit.py --conf confs\train_person_1_.conf --batch_size 32 --train_rotation True --train_shape True --save_path %DATA_PATH%\flame_fitting\%EXP_NAME_1%\stage_3 --checkpoint_path %DATA_PATH%\flame_fitting\%EXP_NAME_1%\stage_2\opt_params_final --data_path %DATA_PATH% --fitted_camera_path %EXP_PATH_1%\cameras\30000_matrices.pkl @CALL SET CUDA_VISIBLE_DEVICES=%GPU% && @CALL python fit.py --conf confs\train_person_1_.conf ^
IF %ERRORLEVEL% NEQ 0 ( --batch_size 32 --train_rotation True --train_shape True ^
@echo ERROR: Failed to run command --save_path %DATA_PATH%\flame_fitting\%EXP_NAME_1%\stage_3 ^
@exit /b 1 --checkpoint_path %DATA_PATH%\flame_fitting\%EXP_NAME_1%\stage_2\opt_params_final ^
) --data_path %DATA_PATH% ^
--fitted_camera_path %EXP_PATH_1%\cameras\30000_matrices.pkl
REM 裁剪重建的场景 REM 裁剪重建的场景
@CALL condabin\micromamba.bat activate gaussian_splatting_hair @CALL "%~dp0condabin\micromamba.bat" activate gaussian_splatting_hair && cd %PROJECT_DIR%\src\preprocessing
@CALL cd %PROJECT_DIR%\src\preprocessing @CALL SET CUDA_VISIBLE_DEVICES=%GPU% && @CALL python scale_scene_into_sphere.py ^
@CALL set CUDA_VISIBLE_DEVICES=%GPU% --path_to_data %DATA_PATH% ^
@CALL python scale_scene_into_sphere.py --path_to_data %DATA_PATH% -m "%DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1%" --iter 30000 -m "%DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1%" --iter 30000
IF %ERRORLEVEL% NEQ 0 (
@echo ERROR: Failed to run command
@exit /b 1
)
REM 移除与FLAME头部网格相交的头发高斯体 REM 移除与FLAME头部网格相交的头发高斯体
@CALL condabin\micromamba.bat activate gaussian_splatting_hair @CALL "%~dp0condabin\micromamba.bat" activate gaussian_splatting_hair && cd %PROJECT_DIR%\src\preprocessing
@CALL cd %PROJECT_DIR%\src\preprocessing @CALL SET CUDA_VISIBLE_DEVICES=%GPU% && @CALL python filter_flame_intersections.py ^
@CALL set CUDA_VISIBLE_DEVICES=%GPU% --flame_mesh_dir %DATA_PATH%\flame_fitting\%EXP_NAME_1% ^
@CALL python filter_flame_intersections.py --flame_mesh_dir %DATA_PATH%\flame_fitting\%EXP_NAME_1% -m "%DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1%" --iter 30000 --project_dir %PROJECT_DIR%\ext\NeuralHaircut -m "%DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1%" --iter 30000 ^
IF %ERRORLEVEL% NEQ 0 ( --project_dir %PROJECT_DIR%\ext\NeuralHaircut
@echo ERROR: Failed to run command
@exit /b 1
)
REM 为训练视图运行渲染 REM 为训练视图运行渲染
@CALL condabin\micromamba.bat activate gaussian_splatting_hair @CALL "%~dp0condabin\micromamba.bat" activate gaussian_splatting_hair && cd %PROJECT_DIR%\src
@CALL cd %PROJECT_DIR%\src @CALL SET CUDA_VISIBLE_DEVICES=%GPU% && @CALL python render_gaussians.py ^
@CALL set CUDA_VISIBLE_DEVICES=%GPU% -s %DATA_PATH% -m "%DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1%" ^
@CALL python render_gaussians.py -s %DATA_PATH% -m "%DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1%" --skip_test --scene_suffix "_cropped" --iteration 30000 --trainable_cameras --trainable_intrinsics --use_barf --skip_test --scene_suffix "_cropped" --iteration 30000 ^
IF %ERRORLEVEL% NEQ 0 ( --trainable_cameras --trainable_intrinsics --use_barf
@echo ERROR: Failed to run command
@exit /b 1
)
REM 获取FLAME网格头皮图 REM 获取FLAME网格头皮图
@CALL condabin\micromamba.bat activate gaussian_splatting_hair @CALL "%~dp0condabin\micromamba.bat" activate gaussian_splatting_hair && cd %PROJECT_DIR%\src\preprocessing
@CALL cd %PROJECT_DIR%\src\preprocessing @CALL SET CUDA_VISIBLE_DEVICES=%GPU% && @CALL python extract_non_visible_head_scalp.py ^
@CALL set CUDA_VISIBLE_DEVICES=%GPU% --project_dir %PROJECT_DIR%\ext\NeuralHaircut --data_dir %DATA_PATH% ^
@CALL python extract_non_visible_head_scalp.py --project_dir %PROJECT_DIR%\ext\NeuralHaircut --data_dir %DATA_PATH% --flame_mesh_dir %DATA_PATH%\flame_fitting\%EXP_NAME_1% --cams_path %DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1%\cameras\30000_matrices.pkl -m "%DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1%" --flame_mesh_dir %DATA_PATH%\flame_fitting\%EXP_NAME_1% ^
IF %ERRORLEVEL% NEQ 0 ( --cams_path %DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1%\cameras\30000_matrices.pkl ^
@echo ERROR: Failed to run command -m "%DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1%"
@exit /b 1
)
REM 运行潜在头发股线重建 REM 运行潜在头发股线重建
@CALL condabin\micromamba.bat activate gaussian_splatting_hair @CALL "%~dp0condabin\micromamba.bat" activate gaussian_splatting_hair && cd %PROJECT_DIR%\src
@CALL cd %PROJECT_DIR%\src @CALL SET CUDA_VISIBLE_DEVICES=%GPU% && @CALL python train_latent_strands.py ^
@CALL set CUDA_VISIBLE_DEVICES=%GPU% -s %DATA_PATH% -m "%DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1%" -r 1 ^
@CALL python train_latent_strands.py -s %DATA_PATH% -m "%DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1%" -r 1 --model_path_hair "%DATA_PATH%\strands_reconstruction\%EXP_NAME_2%" --flame_mesh_dir "%DATA_PATH%\flame_fitting\%EXP_NAME_1%" --pointcloud_path_head "%EXP_PATH_1%\point_cloud_filtered\iteration_30000\raw_point_cloud.ply" --hair_conf_path "%PROJECT_DIR%\src\arguments\hair_strands_textured.yaml" --lambda_dmask 0.1 --lambda_dorient 0.1 --lambda_dsds 0.01 --load_synthetic_rgba --load_synthetic_geom --binarize_masks --iteration_data 30000 --trainable_cameras --trainable_intrinsics --use_barf --iterations 20000 --port "800%GPU%" --model_path_hair "%DATA_PATH%\strands_reconstruction\%EXP_NAME_2%" ^
IF %ERRORLEVEL% NEQ 0 ( --flame_mesh_dir "%DATA_PATH%\flame_fitting\%EXP_NAME_1%" ^
@echo ERROR: Failed to run command --pointcloud_path_head "%EXP_PATH_1%\point_cloud_filtered\iteration_30000\raw_point_cloud.ply" ^
@exit /b 1 --hair_conf_path "%PROJECT_DIR%\src\arguments\hair_strands_textured.yaml" ^
) --lambda_dmask 0.1 --lambda_dorient 0.1 --lambda_dsds 0.01 ^
--load_synthetic_rgba --load_synthetic_geom --binarize_masks --iteration_data 30000 ^
--trainable_cameras --trainable_intrinsics --use_barf ^
--iterations 20000 --port "800%GPU%"
REM 运行头发股线重建 REM 运行头发股线重建
@CALL condabin\micromamba.bat activate gaussian_splatting_hair @CALL "%~dp0condabin\micromamba.bat" activate gaussian_splatting_hair && cd %PROJECT_DIR%\src
@CALL cd %PROJECT_DIR%\src @CALL SET CUDA_VISIBLE_DEVICES=%GPU% && @CALL python train_strands.py ^
@CALL set CUDA_VISIBLE_DEVICES=%GPU% -s %DATA_PATH% -m "%DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1%" -r 1 ^
@CALL python train_strands.py -s %DATA_PATH% -m "%DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1%" -r 1 --model_path_curves "%DATA_PATH%\curves_reconstruction\%EXP_NAME_3%" --flame_mesh_dir "%DATA_PATH%\flame_fitting\%EXP_NAME_1%" --pointcloud_path_head "%EXP_PATH_1%\point_cloud_filtered\iteration_30000\raw_point_cloud.ply" --start_checkpoint_hair "%DATA_PATH%\strands_reconstruction\%EXP_NAME_2%\checkpoints\20000.pth" --hair_conf_path "%PROJECT_DIR%\src\arguments\hair_strands_textured.yaml" --lambda_dmask 0.1 --lambda_dorient 0.1 --lambda_dsds 0.01 --load_synthetic_rgba --load_synthetic_geom --binarize_masks --iteration_data 30000 --position_lr_init 0.0000016 --position_lr_max_steps 10000 --trainable_cameras --trainable_intrinsics --use_barf --iterations 10000 --port "800%GPU%" --model_path_curves "%DATA_PATH%\curves_reconstruction\%EXP_NAME_3%" ^
IF %ERRORLEVEL% NEQ 0 ( --flame_mesh_dir "%DATA_PATH%\flame_fitting\%EXP_NAME_1%" ^
@echo ERROR: Failed to run command --pointcloud_path_head "%EXP_PATH_1%\point_cloud_filtered\iteration_30000\raw_point_cloud.ply" ^
@exit /b 1 --start_checkpoint_hair "%DATA_PATH%\strands_reconstruction\%EXP_NAME_2%\checkpoints\20000.pth" ^
) --hair_conf_path "%PROJECT_DIR%\src\arguments\hair_strands_textured.yaml" ^
--lambda_dmask 0.1 --lambda_dorient 0.1 --lambda_dsds 0.01 ^
--load_synthetic_rgba --load_synthetic_geom --binarize_masks --iteration_data 30000 ^
--position_lr_init 0.0000016 --position_lr_max_steps 10000 ^
--trainable_cameras --trainable_intrinsics --use_barf ^
--iterations 10000 --port "800%GPU%"
@CALL rmdir /s /q "%DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1%\train_cropped" @CALL rmdir /s /q "%DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1%\train_cropped"
IF %ERRORLEVEL% NEQ 0 (
@echo ERROR: Failed to run command
@exit /b 1
)
REM ################## REM ##################
REM # 可视化阶段 # REM # 可视化阶段 #
REM ################## REM ##################
REM 导出结果的股线为pkl和ply格式 REM 导出结果的股线为pkl和ply格式
@CALL condabin\micromamba.bat activate gaussian_splatting_hair @CALL "%~dp0condabin\micromamba.bat" activate gaussian_splatting_hair && cd %PROJECT_DIR%\src\preprocessing
@CALL cd %PROJECT_DIR%\src\preprocessing @CALL SET CUDA_VISIBLE_DEVICES=%GPU% && @CALL python export_curves.py ^
@CALL set CUDA_VISIBLE_DEVICES=%GPU% --data_dir %DATA_PATH% --model_name %EXP_NAME_3% --iter 10000 ^
@CALL python export_curves.py --data_dir %DATA_PATH% --model_name %EXP_NAME_3% --iter 10000 --flame_mesh_path "%DATA_PATH%\flame_fitting\%EXP_NAME_1%\stage_3\mesh_final.obj" --scalp_mesh_path "%DATA_PATH%\flame_fitting\%EXP_NAME_1%\scalp_data\scalp.obj" --hair_conf_path "%PROJECT_DIR%\src\arguments\hair_strands_textured.yaml" --flame_mesh_path "%DATA_PATH%\flame_fitting\%EXP_NAME_1%\stage_3\mesh_final.obj" ^
IF %ERRORLEVEL% NEQ 0 ( --scalp_mesh_path "%DATA_PATH%\flame_fitting\%EXP_NAME_1%\scalp_data\scalp.obj" ^
@echo ERROR: Failed to run command --hair_conf_path "%PROJECT_DIR%\src\arguments\hair_strands_textured.yaml"
@exit /b 1
)
REM 渲染可视化 REM 渲染可视化
@CALL condabin\micromamba.bat activate gaussian_splatting_hair @CALL "%~dp0condabin\micromamba.bat" activate gaussian_splatting_hair && cd %PROJECT_DIR%\src\postprocessing
@CALL cd %PROJECT_DIR%\src\postprocessing @CALL SET CUDA_VISIBLE_DEVICES=%GPU% && @CALL python render_video.py ^
@CALL set CUDA_VISIBLE_DEVICES=%GPU% --blender_path "%BLENDER_DIR%" --input_path "%DATA_PATH%" ^
@CALL python render_video.py --blender_path "%BLENDER_DIR%" --input_path "%DATA_PATH%" --exp_name_1 "%EXP_NAME_1%" --exp_name_3 "%EXP_NAME_3%" --exp_name_1 "%EXP_NAME_1%" --exp_name_3 "%EXP_NAME_3%"
IF %ERRORLEVEL% NEQ 0 (
@echo ERROR: Failed to run command
@exit /b 1
)
REM 渲染股线 REM 渲染股线
@CALL condabin\micromamba.bat activate gaussian_splatting_hair @CALL "%~dp0condabin\micromamba.bat" activate gaussian_splatting_hair && cd %PROJECT_DIR%\src
@CALL cd %PROJECT_DIR%\src @CALL SET CUDA_VISIBLE_DEVICES=%GPU% && @CALL python render_strands.py ^
@CALL set CUDA_VISIBLE_DEVICES=%GPU% -s %DATA_PATH% --data_dir "%DATA_PATH%" --data_device 'cpu' --skip_test ^
@CALL python render_strands.py -s %DATA_PATH% --data_dir "%DATA_PATH%" --data_device 'cpu' --skip_test -m "%DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1%" --iteration 30000 --flame_mesh_dir "%DATA_PATH%\flame_fitting\%EXP_NAME_1%" --model_hair_path "%DATA_PATH%\curves_reconstruction\%EXP_NAME_3%" --hair_conf_path "%PROJECT_DIR%\src\arguments\hair_strands_textured.yaml" --checkpoint_hair "%DATA_PATH%\strands_reconstruction\%EXP_NAME_2%\checkpoints\20000.pth" --checkpoint_curves "%DATA_PATH%\curves_reconstruction\%EXP_NAME_3%\checkpoints\10000.pth" --pointcloud_path_head "%EXP_PATH_1%\point_cloud\iteration_30000\raw_point_cloud.ply" --interpolate_cameras -m "%DATA_PATH%\3d_gaussian_splatting\%EXP_NAME_1%" --iteration 30000 ^
IF %ERRORLEVEL% NEQ 0 ( --flame_mesh_dir "%DATA_PATH%\flame_fitting\%EXP_NAME_1%" ^
@echo ERROR: Failed to run command --model_hair_path "%DATA_PATH%\curves_reconstruction\%EXP_NAME_3%" ^
@exit /b 1 --hair_conf_path "%PROJECT_DIR%\src\arguments\hair_strands_textured.yaml" ^
) --checkpoint_hair "%DATA_PATH%\strands_reconstruction\%EXP_NAME_2%\checkpoints\20000.pth" ^
--checkpoint_curves "%DATA_PATH%\curves_reconstruction\%EXP_NAME_3%\checkpoints\10000.pth" ^
--pointcloud_path_head "%EXP_PATH_1%\point_cloud\iteration_30000\raw_point_cloud.ply" ^
--interpolate_cameras
REM 制作视频 REM 制作视频
@CALL condabin\micromamba.bat activate gaussian_splatting_hair @CALL "%~dp0condabin\micromamba.bat" activate gaussian_splatting_hair && cd %PROJECT_DIR%\src\postprocessing
@CALL cd %PROJECT_DIR%\src\postprocessing @CALL SET CUDA_VISIBLE_DEVICES=%GPU% && @CALL python concat_video.py ^
@CALL set CUDA_VISIBLE_DEVICES=%GPU% --input_path "%DATA_PATH%" --exp_name_3 "%EXP_NAME_3%"
@CALL python concat_video.py --input_path "%DATA_PATH%" --exp_name_3 "%EXP_NAME_3%"
IF %ERRORLEVEL% NEQ 0 (
@echo ERROR: Failed to run command
@exit /b 1
)