我无法让 FER 使用示例代码
Posted
技术标签:
【中文标题】我无法让 FER 使用示例代码【英文标题】:I can't get FER to work with the example code 【发布时间】:2021-02-06 22:20:06 【问题描述】:我想使用 FER 只是为了好玩和修补,但是在我安装它之后,我正在尝试运行示例代码,但我遇到了这个错误,请受过更多教育的人帮助我。
最新的 TensorFlow 版本, 视窗 10 专业版, Python 3.8.6 64位
https://github.com/justinshenk/fer
https://github.com/justinshenk/fer/blob/master/example.py
WARNING:tensorflow:From C:\Users\perlu\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\compat\v2_compat.py:96: disable_resource_variables (from tensorflow.python.ops.variable_scope) is deprecated and will be removed in a future version.
Instructions for updating:
non-resource variables are not supported in the long term
WARNING:tensorflow:From C:\Users\perlu\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\keras\engine\training_v1.py:2070: Model.state_updates (from tensorflow.python.keras.engine.training) is deprecated and will be removed in a future version.
Instructions for updating:
This property should not be used in TensorFlow 2.0, as updates are applied automatically.
23-10-2020:22:29:59,746 WARNING [deprecation.py:317] From C:\Users\perlu\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\keras\engine\training_v1.py:2070: Model.state_updates (from tensorflow.python.keras.engine.training) is deprecated and will be removed in a future version.
Instructions for updating:
This property should not be used in TensorFlow 2.0, as updates are applied automatically.
Traceback (most recent call last):
File "C:\Users\perlu\Desktop\benj.py", line 8, in <module>
result = detector.detect_emotions(image)
File "C:\Users\perlu\AppData\Roaming\Python\Python38\site-packages\fer\fer.py", line 236, in detect_emotions
face_rectangles = self.find_faces(img, bgr=True)
File "C:\Users\perlu\AppData\Roaming\Python\Python38\site-packages\fer\fer.py", line 194, in find_faces
results = self._mtcnn.detect_faces(img)
File "C:\Users\perlu\AppData\Roaming\Python\Python38\site-packages\mtcnn\mtcnn.py", line 302, in detect_faces
result = stage(img, result[0], result[1])
File "C:\Users\perlu\AppData\Roaming\Python\Python38\site-packages\mtcnn\mtcnn.py", line 342, in __stage1
out = self._pnet.predict(img_y)
File "C:\Users\perlu\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\keras\engine\training_v1.py", line 983, in predict
return func.predict(
File "C:\Users\perlu\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\keras\engine\training_arrays.py", line 708, in predict
return predict_loop(
File "C:\Users\perlu\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\keras\engine\training_arrays.py", line 386, in model_iteration
batch_outs = f(ins_batch)
File "C:\Users\perlu\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\keras\backend.py", line 3824, in __call__
fetched = self._callable_fn(*array_vals,
File "C:\Users\perlu\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\client\session.py", line 1470, in __call__
ret = tf_session.TF_SessionRunCallable(self._session._session,
tensorflow.python.framework.errors_impl.UnknownError: 2 root error(s) found.
(0) Unknown: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
[[node conv2d/Conv2D]]
[[conv2d_4/BiasAdd/_783]]
(1) Unknown: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.
[[node conv2d/Conv2D]]
0 successful operations.
0 derived errors ignored.
【问题讨论】:
【参考方案1】:您使用的是 Anaconda 还是 Miniconda? 尝试在本地机器上安装 tensorflow + fer,不使用环境,它对我有用。
【讨论】:
您的答案可以通过额外的支持信息得到改进。请edit 添加更多详细信息,例如引用或文档,以便其他人可以确认您的答案是正确的。你可以找到更多关于如何写好答案的信息in the help center。以上是关于我无法让 FER 使用示例代码的主要内容,如果未能解决你的问题,请参考以下文章
无法在 Cordova.x Android 上使用导航器地理定位最小示例