nischi / MMM-Face-Reco-DNN

Face recognition with opencv and deep neural network
MIT License
91 stars 46 forks source link

'NoneType' object has no attribute 'shape' #44

Closed mdjeilander closed 4 years ago

mdjeilander commented 4 years ago

Running into the following error when livestream is starting:

[2020-06-10 03:24:30.896] [LOG] [MMM-Face-Reco-DNN] loading encodings + face detector... [2020-06-10 03:24:31.153] [LOG] [MMM-Face-Reco-DNN] starting video stream... [2020-06-10 03:24:34.320] [LOG] Whoops! There was an uncaught exception... [2020-06-10 03:24:34.321] [ERROR] PythonShellError: AttributeError: 'NoneType' object has no attribute 'shape' at PythonShell.parseError (/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:246:21) at terminateIfNeeded (/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:129:32) at ChildProcess. (/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:121:13) at ChildProcess.emit (events.js:200:13) at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12) ----- Python Traceback ----- File "modules/MMM-Face-Reco-DNN/tools/facerecognition.py", line 101, in frame = imutils.resize(originalFrame, width=500) File "/home/pi/.virtualenvs/cv/lib/python3.7/site-packages/imutils/convenience.py", line 69, in resize (h, w) = image.shape[:2] { traceback: 'Traceback (most recent call last):\n File ' + '"modules/MMM-Face-Reco-DNN/tools/facerecognition.py", line 101, in ' + '\n frame = imutils.resize(originalFrame, width=500)\n File ' + '"/home/pi/.virtualenvs/cv/lib/python3.7/site-packages/imutils/convenience.py", ' + 'line 69, in resize\n (h, w) = image.shape[:2]\nAttributeError: ' + "'NoneType' object has no attribute 'shape'\n", executable: '/home/pi/.virtualenvs/cv/bin/python3.7', options: null, script: 'modules/MMM-Face-Reco-DNN/tools/facerecognition.py', args: [ '--cascade=modules/MMM-Face-Reco-DNN/tools/haarcascade_frontalface_default.xml', '--encodings=modules/MMM-Face-Reco-DNN/tools/encodings.pickle', '--usePiCamera=0', '--source=0', '--rotateCamera=0', '--method=dnn', '--detectionMethod=hog', '--interval=2000', '--output=0', '--extendDataset=False', '--dataset=modules/MMM-Face-Reco-DNN/dataset/' ], exitCode: 1 }

Have tried debugging but without much success unfortunately. Some help would be appreciated!

nischi commented 4 years ago

Hmm need to google a little bit, seems this is not an issue with my module. Maybe you can find a solution in this blog post?

https://www.pyimagesearch.com/2016/12/26/opencv-resolving-nonetype-errors/

They say one of this is possible? Can you please check this?

x3mEr commented 4 years ago

@mdjeilander , try to change line in config.js from source: 0 to source: "/dev/video0"