datitran/face2face-demo

Error: No module named 'cv2' when generating train data

brunofrancisco opened this issue · 4 comments

Hi. I cloned this repo, then created the conda environment from file (Mac OS) and dowloaded the dataSet (angela_merkel_speech.mp4 and shape_predictor_68_face_landmarks.dat). OBS: I placed the both files of the dataSet inside the face2face-demo folder. Finally I run the follow command inside the project folder, but something went wrong.

face2face-demo] $ python generate_train_data.py --file angela_merkel_speech.mp4 --num 400 --landmark-model shape_predictor_68_face_landmarks.dat
Traceback (most recent call last):
File "generate_train_data.py", line 2, in
import cv2
ModuleNotFoundError: No module named 'cv2'

This is because you don't have opencv library. Try to install it first:

pip install opencv-python

I guess you are using pyline Visual code editor... Once there was a report of this error
I think you got to change some settings in vs code
Or try spyder use Anaconda

Maybe you dont activate environment face2face-demo

This is because you don't have opencv library. Try to install it first:

pip install opencv-python

For some reason, the - menpo::opencv3=3.1.0=py35_0 install from environment.yml didn’t work for me either. This pip install solved it, thanks.