未在python的mtcnn中定义名称“ MTCNN”

时间:2019-08-15 20:14:54

标签: python-2.7 conv-neural-network gan

我安装了mtcnn软件包,如下所示:

# confirm mtcnn was installed correctly
import mtcnn
# print version
print(mtcnn.__version__)

结果:

0.0.9

然后我使用以下内容:

# prepare model
model = MTCNN()
# detect face in the image
faces = model.detect_faces(pixels)
# extract details of the face
x1, y1, width, height = faces[0]['box']

结果:

1 # prepare model
----> 2 model = MTCNN()
      3 # detect face in the image
      4 faces = model.detect_faces(pixels)
      5 # extract details of the face

NameError: name 'MTCNN' is not defined

2 个答案:

答案 0 :(得分:2)

文档是一个不错的起点:https://github.com/ipazc/mtcnn

WARN admin.RepoDumpJob - Backup skipped: A backup for
repo 'ProjectsNew' is already running, as indicated by
prior existence of progress log
'C:\csvn\data\log​s\temp\job-progres​s-ProjectsNew-dump.l​og'

答案 1 :(得分:1)

有时人们所做的就是将他们正在处理的文件命名为mtcnn.py,这会导致此错误。将文件mtcnn.py的名称更改为其他名称即可。