错误的输入形状():训练分类器时出现 Openface 问题
bad input shape () : Openface issue when training the classifier
我正在尝试按照我在网上找到的这个很棒的教程的说明通过照片识别人物:Modern Face Recognition with Deep Learning
本项目使用Python、Openface和dlib来完成任务
我已经能够设置所有内容并正常工作,但在 运行 以下命令中遇到问题:
python3 ./demos/classifier.py train ./generated-embeddings/
在我的终端上执行上述命令会出现以下错误:
> /usr/local/lib/python3.5/dist-packages/sklearn/utils/fixes.py:64: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() instead
if ‘order’ in inspect.getargspec(np.copy)[0]:
Loading embeddings.
Traceback (most recent call last):
File “./demos/classifier.py”, line 291, in <module>
train(args)
File “./demos/classifier.py”, line 112, in train
le = LabelEncoder().fit(labels)
File “/usr/local/lib/python3.5/dist-packages/sklearn/preprocessing/label.py”, line 110, in fit
y = column_or_1d(y, warn=True)
File “/usr/local/lib/python3.5/dist-packages/sklearn/utils/validation.py”, line 485, in column_or_1d
raise ValueError(“bad input shape {0}”.format(shape))
ValueError: bad input shape ()
我的设置:
- UBUNTU 16.04 LTS 64 位
- Python 3.5.2
- dlib 19.7.0
- 开脸
有人知道发生了什么以及如何解决这个问题吗?
我解决了这个错误,我 post 在这里提供了解决方案,希望它对遇到此问题的任何其他用户有用。
来自执行命令的输入形状错误
python3 ./demos/classifier.py train ./generated-embeddings/
修改文件openface/demos/classifier.py加入下面一行代码即可轻松解决
labels=list(labels)
在 fit 函数调用之前
le = LabelEncoder().fit(labels)
默认情况下类型(标签)returns 映射,这就是导致错误的原因,因为 LabelEncoder.fit() 函数接受一个类似数组的形状作为输入(n_samples, ) 而不是地图对象。
希望对您有所帮助
我正在尝试按照我在网上找到的这个很棒的教程的说明通过照片识别人物:Modern Face Recognition with Deep Learning
本项目使用Python、Openface和dlib来完成任务
我已经能够设置所有内容并正常工作,但在 运行 以下命令中遇到问题:
python3 ./demos/classifier.py train ./generated-embeddings/
在我的终端上执行上述命令会出现以下错误:
> /usr/local/lib/python3.5/dist-packages/sklearn/utils/fixes.py:64: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() instead
if ‘order’ in inspect.getargspec(np.copy)[0]:
Loading embeddings.
Traceback (most recent call last):
File “./demos/classifier.py”, line 291, in <module>
train(args)
File “./demos/classifier.py”, line 112, in train
le = LabelEncoder().fit(labels)
File “/usr/local/lib/python3.5/dist-packages/sklearn/preprocessing/label.py”, line 110, in fit
y = column_or_1d(y, warn=True)
File “/usr/local/lib/python3.5/dist-packages/sklearn/utils/validation.py”, line 485, in column_or_1d
raise ValueError(“bad input shape {0}”.format(shape))
ValueError: bad input shape ()
我的设置:
- UBUNTU 16.04 LTS 64 位
- Python 3.5.2
- dlib 19.7.0
- 开脸
有人知道发生了什么以及如何解决这个问题吗?
我解决了这个错误,我 post 在这里提供了解决方案,希望它对遇到此问题的任何其他用户有用。
来自执行命令的输入形状错误
python3 ./demos/classifier.py train ./generated-embeddings/
修改文件openface/demos/classifier.py加入下面一行代码即可轻松解决
labels=list(labels)
在 fit 函数调用之前
le = LabelEncoder().fit(labels)
默认情况下类型(标签)returns 映射,这就是导致错误的原因,因为 LabelEncoder.fit() 函数接受一个类似数组的形状作为输入(n_samples, ) 而不是地图对象。
希望对您有所帮助