avatarify-python人脸识别报错

github地址:https://github.com/alievk/avatarify-python
在研究智能识别人脸过程,运行工程报错,有下面两个,记录一下

代码报错1

[1593366601.652137] Loading Predictor
C:\Users\xxx\avatarify\afy\predictor_local.py:34: YAMLLoadWarning: calling yaml.load() without Loader=… is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
config = yaml.load(f)
Downloading the face detection CNN. Please wait…
Traceback (most recent call last):
File “C:\Users\xxx\miniconda3\envs\avatarify\lib\urllib\request.py”, line 1319, in do_open
encode_chunked=req.has_header(‘Transfer-encoding’))
File “C:\Users\xxx\miniconda3\envs\avatarify\lib\http\client.py”, line 1252, in request
self._send_request(method, url, body, headers, encode_chunked)
File “C:\Users\xxx\miniconda3\envs\avatarify\lib\http\client.py”, line 1298, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File “C:\Users\xxx\miniconda3\envs\avatarify\lib\http\client.py”, line 1247, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File “C:\Users\xxx\miniconda3\envs\avatarify\lib\http\client.py”, line 1026, in _send_output
self.send(msg)
File “C:\Users\xxx\miniconda3\envs\avatarify\lib\http\client.py”, line 966, in send
self.connect()
File “C:\Users\xxx\miniconda3\envs\avatarify\lib\http\client.py”, line 1422, in connect
server_hostname=server_hostname)
File “C:\Users\xxx\miniconda3\envs\avatarify\lib\ssl.py”, line 423, in wrap_socket
session=session
File “C:\Users\xxx\miniconda3\envs\avatarify\lib\ssl.py”, line 870, in _create
self.do_handshake()
File “C:\Users\xxx\miniconda3\envs\avatarify\lib\ssl.py”, line 1139, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “afy/cam_fomm.py”, line 195, in
**predictor_args
File “C:\Users\xxx\avatarify\afy\predictor_local.py”, line 27, in init
self.fa = face_alignment.FaceAlignment(face_alignment.LandmarksType._2D, flip_input=True, device=self.device)
File “C:\Users\xxx\miniconda3\envs\avatarify\lib\site-packages\face_alignment\api.py”, line 66, in init
self.face_detector = face_detector_module.FaceDetector(device=device, verbose=verbose)
File “C:\Users\xxx\miniconda3\envs\avatarify\lib\site-packages\face_alignment\detection\sfd\sfd_detector.py”, line 39, in init
os.path.join(path_to_temp_detector))
File “C:\Users\xxx\miniconda3\envs\avatarify\lib\urllib\request.py”, line 247, in urlretrieve
with contextlib.closing(urlopen(url, data)) as fp:
File “C:\Users\xxx\miniconda3\envs\avatarify\lib\urllib\request.py”, line 222, in urlopen
return opener.open(url, data, timeout)
File “C:\Users\xxx\miniconda3\envs\avatarify\lib\urllib\request.py”, line 525, in open
response = self._open(req, data)
File “C:\Users\xxx\miniconda3\envs\avatarify\lib\urllib\request.py”, line 543, in _open
‘_open’, req)
File “C:\Users\xxx\miniconda3\envs\avatarify\lib\urllib\request.py”, line 503, in _call_chain
result = func(*args)
File “C:\Users\xxx\miniconda3\envs\avatarify\lib\urllib\request.py”, line 1362, in https_open
context=self._context, check_hostname=self._check_hostname)
File “C:\Users\xxx\miniconda3\envs\avatarify\lib\urllib\request.py”, line 1321, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076)>
解决办法:找到文件run_windows.bat,打开查看源码

@echo off

call scripts/settings_windows.bat

call conda activate %CONDA_ENV_NAME%

set CONFIG=fomm/config/vox-adv-256.yaml

set PYTHONPATH=%PYTHONPATH%;%CD%;%CD%/fomm
call python afy/cam_fomm.py --config %CONFIG% --relative --adapt_scale --no-pad --checkpoint vox-adv-cpk.pth.tar %*

看到运行的是afy/cam_fomm.py这个文件,在这个文件中加入如下代码

import ssl
ssl._create_default_https_context = ssl._create_unverified_context

代码报错2

OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.
OMP: Hint This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade performance or cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please see http://www.intel.com/software/products/support/.

解决方法:还是上面文件加入下面代码

import os
os.environ["KMP_DUPLICATE_LIB_OK"]  =  "TRUE"
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小~小

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值