Linux如何安装GeneFace++

AI技术
小华
2025-10-30

Note: The official name of the project is GeneFace++ (not "GeneFace" or "Easy-Wav2lip"), and its installation steps vary by Linux distribution. Below are detailed guides for CentOS (the most commonly documented distribution) and general notes for other Linux systems.

Preparations

Before installing GeneFace++, ensure your system meets the following requirements:

  • Hardware: NVIDIA GPU (e.g., RTX 3090) with sufficient VRAM (≥8GB recommended).
  • System: Linux distribution (CentOS 7/8, Ubuntu 18.04/20.04, etc.), kernel version ≥4.15.
  • Dependencies: Git, Python 3.9+, CMake, GCC (≥7.0), and a compatible CUDA toolkit (≥11.3).
  • Permissions: Root or sudo access for system-wide installations.

Installation Steps for CentOS

1. Update System and Install Core Dependencies

Run the following commands to update your system and install essential development tools and libraries:

sudo yum update -y
sudo yum groupinstall -y "Development Tools"  # Installs GCC, Make, etc.
sudo yum install -y cmake git wget          # Installs build tools and version control

These steps ensure your system has the necessary tools to compile and install GeneFace++.

2. Install Python and Python Dependencies

GeneFace++ requires Python 3.9+ and several Python packages. Use conda to create an isolated environment and avoid conflicts:

# Download and install Miniconda (if not already installed)
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh -b -p $HOME/miniconda
source $HOME/miniconda/etc/profile.d/conda.sh
# Create and activate a Python 3.9 environment
conda create -n geneface python=3.9 -y
conda activate geneface
# Install Python dependencies (including FFmpeg for video processing)
conda install -y conda-forge::ffmpeg
pip install -r requirements.txt  # Replace with the actual path to GeneFace++'s requirements file

This step sets up a clean Python environment and installs critical packages like numpy, torch, and opencv-python.

3. Clone GeneFace++ Repository

Clone the GeneFace++ source code from its official GitHub repository (replace the URL with the correct one if needed):

git clone https://github.com/yerfor/GeneFacePlusPlus.git
cd GeneFacePlusPlus

Ensure you have Git installed (sudo yum install -y git) before running this command.

4. Compile and Install GeneFace++

Navigate to the project directory and compile the source code using cmake and make:

mkdir build && cd build
cmake ..  # Configures the build system
make -j$(nproc)  # Compiles the code using all available CPU cores (speeds up the process)
sudo make install  # Installs GeneFace++ to the system (default path: /usr/local/)

This step compiles the C++/CUDA components of GeneFace++ and installs them to your system.

5. Configure Environment Variables

If the installation path is non-standard (e.g., not /usr/local/), add the following lines to your shell configuration file (e.g., ~/.bashrc or ~/.zshrc):

export PATH=$PATH:/path/to/GeneFacePlusPlus/build/bin  # Replace with the actual binary path
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/path/to/GeneFacePlusPlus/build/lib  # Replace with the actual library path

Apply the changes by running source ~/.bashrc (or source ~/.zshrc).

6. Verify Installation

Run the following command to check if GeneFace++ is installed correctly:

geneface++ --help

You should see a list of available commands and options. If this fails, revisit the previous steps to ensure all dependencies and configurations are correct.

Post-Installation Steps (Optional but Recommended)

1. Prepare 3DMM Models

GeneFace++ requires 3D Morphable Models (3DMMs) for face reconstruction. Download the BFM2009 model (or another supported model) and place it in the designated directory (e.g., GeneFacePlusPlus/deep_3drecon/BFM/). Follow the project’s documentation for specific file placement instructions.

2. Run a Test Inference

Execute a sample inference script to verify that GeneFace++ works as expected. For example:

python inference/genefacepp_infer.py --a2m_ckpt=checkpoints/audio2motion_vae --head_ckpt=checkpoints/motion2video_nerf/may_head --torso_ckpt=checkpoints/motion2video_nerf/may_torso --drv_aud=data/raw/val_wavs/example.wav --out_name=demo_output.mp4

Replace example.wav with the path to your audio file. This script generates a video (demo_output.mp4) with synthesized facial animations.

Troubleshooting Common Issues

  • Dependency Errors: If you encounter missing libraries (e.g., libpng, libjpeg), install them using your distribution’s package manager (e.g., sudo yum install -y libpng-devel libjpeg-devel).
  • CUDA Errors: Ensure your CUDA toolkit version matches the version required by PyTorch (check the requirements.txt or project documentation). Reinstall CUDA if necessary.
  • Python Version Conflicts: Use conda to create an isolated environment (as shown above) to avoid conflicts with system Python packages.
  • Compilation Errors: Verify that your GCC version is ≥7.0 (gcc --version) and that all build tools are installed.

Notes for Non-CentOS Distributions

For Ubuntu/Debian-based systems, replace yum with apt in the dependency installation steps (e.g., sudo apt update && sudo apt install -y cmake git wget). The compilation and installation steps remain largely the same. Always refer to the official GeneFace++ documentation or repository README for distribution-specific adjustments.

亿速云提供售前/售后服务

售前业务咨询

售后技术保障

400-100-2938

7*24小时售后电话

官方微信小程序