trigeorgis / face_normals_cvpr17

Code for "Face Normals `in-the-wild' using Fully Convolutional Networks" (CVPR 17)
BSD 3-Clause "New" or "Revised" License
45 stars 8 forks source link

Cannot execute ipython notebook (menpo library issue) #1

Closed lazysquid closed 6 years ago

lazysquid commented 7 years ago

I tried to run the source code that you uploaded but it's not working. The error looks like this.

/usr/local/lib/python3.5/dist-packages/menpo/io/input/base.py:26: MenpoDeprecationWarning: normalise is no longer supported and will be removed in a future version of Menpo. Use normalize instead.
  MenpoDeprecationWarning)
Traceback (most recent call last):
  File "run.py", line 81, in <module>
    im = crop_face(im, shape=(200, 200))
  File "run.py", line 35, in crop_face
    pc = img.landmarks[group]
  File "/usr/local/lib/python3.5/dist-packages/menpo/landmark/base.py", line 199, in __getitem__
    "landmark groups".format(self.n_groups))
ValueError: Cannot use None as a key as there are 0 landmark groups

The error above is caused by menpo library. I think it is because version issue. Can you tell me which version of menpo do you use? And as far as I know, the roll of menpo is just crop the face and resize it to feed the network. Is there any way to NOT use menpo? cause I prefer opencv.

trigeorgis commented 6 years ago

The code assumes that each image comes with a predefined set of landmarks (so I can easily crop the face/visualise the result). As the image you are trying to import has no landmarks attached the code breaks down.

You can use an existing image with landmarks ie.,

im = mio.import_builtin_asset.breakingbad_jpg()

or use the menpodetect to detect the face bounding box and extract landmarks. You can simply crop the image your self and resize it to (200, 200) pixels, so you don't have to do any of this.