• ondyari / FaceForensics配置指南


    https://github.com/ondyari/FaceForensics

    安装配置方法:

    $ git clone https://github.com/ondyari/FaceForensics.git
    $ cd FaceForensics/classification/
    $ pip install -r requirements.txt 找不到的包可以将其删除,测试发现不影响
    下载已训练的模型 http://kaldir.vc.in.tum.de/FaceForensics/models/faceforensics++_models.zip
    $ unzip faceforensics++_models.zip
    下载预训练模型xception-b5690688.pth https://data.lip6.fr/cadene/pretrainedmodels/

    1. 修改FaceForensics/classification/detect_from_video.py
      209 #cv2.imshow('test', image) 注释此行
    2. 修改FaceForensics/classification/network/models.py
      25 state_dict = torch.load('/home/ondyari/.torch/models/xception-b5690688.pth')修改为对应路径

    AttributeError: 'Conv2d' object has no attribute 'padding_mode'问题解决

    找了相关资料,发现其问题为pytorch版本的问题,即原来的预训练模型为pytorch 1.0版本环境下训练编译的,而现在的开发环境为pytorch 1.1版本。

    这种比较笨的办法,为了实现更加简单的操作,调试到conv2d这种函数的forward中,主要是其中的self.paddingmode未赋值,导致的退出。

    解决方法为根据报错信息,在conv2d这种函数的forward开头添加以下语句:

    if not hasattr(self, 'padding_mode'):

      self.padding_mode = "none"

    运行格式:

    python detect_from_video.py
    -i <path to input video or folder of videos with extenstion '.mp4' or '.avi'>
    -m <path to model file, default is imagenet model
    -o <path to output folder, will contain output video(s)

    可以使用python
    detect_from_video.py -h 查看更加详细的情况
    例:python detect_from_video.py -i ../../test_videos/ -m ../../faceforensics++_models_subset/face_detection/xception/all_raw.p -o ../../output/ --cuda
  • 相关阅读:
    CSS
    WebStorm快捷键
    每日一题
    周末了周末了
    集合,个人理解
    Linux学习笔记
    Java对象的序列化和反序列化实践
    Android 实现蘑菇街购物车动画效果
    【转】android手势处理揭秘
    【转】android 手势识别和VelocityTracker
  • 原文地址:https://www.cnblogs.com/lucifer1997/p/12310743.html
Copyright © 2020-2023  润新知