CentOS7.x安装anaconda

  1. 作者QQ:67065435 QQ群:821635552

  2. 本站内容全部为作者原创,转载请注明出处!

  3. 进入anaconda官网

  4. 复制anaconda下载链接

  5. 下载anaconda安装脚本

    cd /usr/local
    wget https://repo.anaconda.com/archive/Anaconda3-2021.05-Linux-x86_64.sh
    
  6. 运行anaconda安装脚本

    chmod -R 755 Anaconda3-2021.05-Linux-x86_64.sh
    
    ./Anaconda3-2021.05-Linux-x86_64.sh
    # 依次输入
        >>> ENTER
        >>> yes
        >>> /usr/local/anaconda
        >>> yes
    
    rm -rf Anaconda3-2021.05-Linux-x86_64.sh
    
  7. anaconda加入环境变量

    vim /etc/profile
    
    export PATH=$PATH:/usr/local/anaconda/bin
    
    ESC
    :wq
    
    source /etc/profile
    
  8. 新建anaconda环境

    python3 --version
    conda create --name faceswap python=3.8
    
  9. 进入faceswap环境

    # 进入faceswap环境
    source activate
    conda activate faceswap
    
    # 退出faceswap环境
    conda deactivate
    
  10. 修改anaconda归属

    useradd www
    chown -R www:www /usr/local/anaconda
    
  11. 进入faceswap官网

  12. 复制faceswap下载链接

  13. 获取faceswap源码

    mkdir -p /usr/local/faceswap
    chown -R www:www /usr/local/faceswap
    su www
    cd /usr/local/faceswap
    wget https://github.com/deepfakes/faceswap/releases/latest/download/faceswap_setup_x64.sh
    chmod -R 755 faceswap_setup_x64.sh
    
    ./faceswap_setup_x64.sh
    # 依次输入
        ENTER
        YES
        faceswap
        /usr/local/faceswap
        3
        yes
    
    rm -rf faceswap_setup_x64.sh
    
  14. 安装faceswap依赖

    cd /usr/local/faceswap
    python3 setup.py
    # 如果过程中有包安装失败,则通过以下命令重新安装
    pip install --default-timeout=1000 -i https://mirrors.aliyun.com/pypi/simple <需要的包>
    
  15. 新建工作目录

    cd /usr/local/faceswap
    mkdir -p /usr/local/faceswap/work
    
    mkdir -p /usr/local/faceswap/work/video           #video
    
    mkdir -p /usr/local/faceswap/work/photo           #photo
    mkdir -p /usr/local/faceswap/work/photo/new       #photo-新face
    mkdir -p /usr/local/faceswap/work/photo/old       #photo-老face
    
    mkdir -p /usr/local/faceswap/work/model           #model
    mkdir -p /usr/local/faceswap/work/model/mod1      #model-模型1
    
    mkdir -p /usr/local/faceswap/work/output          #output
    mkdir -p /usr/local/faceswap/work/output/photo    #output-生成photo
    mkdir -p /usr/local/faceswap/work/output/video    #output-最终video
    
  16. 下面以将new.mp4的face替换到old.mp4的face为例

  17. 提取face

    cd /usr/local/faceswap
    # 将new.mp4、old.mp4放到/usr/local/faceswap/work/video目录,执行分别提取两个video的face
    python3 faceswap.py extract -i ./work/video/new.mp4  -o ./work/photo/new/
    python3 faceswap.py extract -i ./work/video/old.mp4  -o ./work/photo/old/
    
  18. 训练素材(时间较长)

    cd /usr/local/faceswap
    python3 faceswap.py train -A ./work/photo/old/ -B ./work/photo/new/ -m ./work/model/mod1/
    # 或者使用 -p 显示预览
    python3 faceswap.py train -A ./work/photo/old/ -B ./work/photo/new/ -m ./work/model/mod1/ -p
    
  19. 保存替换face图片

    cd /usr/local/faceswap
    python3 faceswap.py convert -i ./work/video/old.mp4  -o ./work/output/photo/ -m ./work/model/mod1/
    
  20. 保存替换face视频

    cd /usr/local/faceswap
    python3 tools.py effmpeg  -i  ./work/output/photo/ -r ./work/video/old.mp4 -o ./work/output/video/new.mp4 -a gen-vid
    
Copyright © 豆包嘿嘿~ 2012-∞ 冀ICP备17033181号 all right reserved,powered by Gitbook修订: 21-06-18 13:18

results matching ""

    No results matching ""