Google Colaboratory: Unable to open landmarks.dat

2k Views Asked by At

I am newbie and am currently trying out the Python Notebook https://github.com/TessFerrandez/research-papers/tree/master/facenet on Google Colaboratory.

I added

!pip install face-recognition
!git clone https://github.com/TessFerrandez/research-papers.git
%cd research-papers/facenet

at the start of the notebook so that I can import the right utils.

However, in one of the cells below, I am unable to run the code. I get this error message:

RuntimeError                                
Traceback (most recent call last)
ipython-input-14-45bae69bfbbe in <module>()
15 # Initialize the OpenFace face alignment utility
---> 16 alignment = AlignDlib('models/landmarks.dat')
/content/research-papers/facenet/research-papers/facenet/align.py in __init__(self, facePredictor)    
88         self.detector = dlib.get_frontal_face_detector()
---> 89         self.predictor = dlib.shape_predictor(facePredictor)
RuntimeError: Unable to open models/landmarks.dat

Do you know where to find models/landmarks.dat so that AlignDlib will not throw an error?

Do I have to install openface into the google colabortary or upload the model from somewhere?

1

There are 1 best solutions below

1
On

You can download and decompress the necessary file with this code.

!wget http://dlib.net/files/shape_predictor_68_face_landmarks.dat.bz2
!bunzip2 "shape_predictor_68_face_landmarks.dat.bz2"