1. 前置环境准备
requirements.txt
文件,建议直接运行pip install -r requirements.txt
批量安装。2. 安装步骤要点
git clone https://github.com/your-repo/GeneFace++.git
(替换为实际仓库地址)克隆项目至本地,或下载ZIP压缩包解压。python -m venv geneface_env
创建虚拟环境,激活环境(geneface_env\Scripts\activate
),激活后命令行前会显示(geneface_env)
标识。cd GeneFace++
),运行pip install -r requirements.txt
安装所有依赖;若安装过程中出现错误,可尝试升级pip(python -m pip install --upgrade pip
)后重新运行。build
目录(mkdir build
)并进入,运行cmake ..
生成Visual Studio项目文件,再运行cmake --build . --config Release
编译项目(Release模式为优化版本)。D:\GeneFace++
)或build
目录添加至系统PATH环境变量(右键“此电脑”→“属性”→“高级系统设置”→“环境变量”→编辑PATH)。3. 关键注意事项
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
,并通过nvidia-smi
命令验证GPU是否被正确识别;若未识别,需检查CUDA/cuDNN安装是否正确。python main.py
或项目提供的测试命令);若程序正常运行且无报错(如显示“Model loaded successfully”或人脸识别结果),则说明安装成功。