Troubleshooting (-15:Bad number of channels) for face landmarks detection

Turned out the problem wasn’t with the image size but whether or not the image contained a face. If no faces are detected faces is an empty tuple and facemark.fit does not handle that being empty.

I verified this by modifying the landmark_demo.py script with a non-face image and was able to reproduce the issue.

I ended up fixing this by putting a conditional before the fit in case no faces are detected.

1 Like