davidsandberg / facenet

Face recognition using Tensorflow
MIT License
13.62k stars 4.8k forks source link

can't align. "Number of successfully aligned images: 0" #794

Open Hunterwolf88 opened 6 years ago

Hunterwolf88 commented 6 years ago

I have a folder named "data1" with some pictures in it, When I run

export PYTHONPATH=[...]/facenet/src
python ./src/align/align_dataset_mtcnn.py ./dataset/data1/ ./dataset/data1-aligned/ --image_size 182 --margin 44

I get

Total number of images: 0
Number of successfully aligned images: 0

data1-aligned folder is created, bounding_boxes_43723.txt and revision_info.txt are created inside that folder, the first is empty, the second one contains this text:

arguments: ./src/align/align_dataset_mtcnn.py ./dataset/data1/ ./dataset/data1-aligned/ --image_size 182 --margin 44
--------------------
tensorflow version: 1.7.0
--------------------
git hash: 096ed770f163957c1e56efa7feeb194773920f6e
--------------------

as said, no image is aligned and/or put into the created folder.

mohammed-Emad commented 6 years ago

Check the correct image path However, I doubt that you have a mistake in configuring your images Because he really can not see your photos

Anyhow the shape of the pictures should be this way

/dataset/data1/
├── Colin Powell
│   ├── Colin Powell_0006.png
│   ├── Colin Powell_0007.png
│   ├── Colin Powell_0008.png
│   ├── Colin Powell_0009.png
│   └── Colin Powell_0010.png
├── Arnold_Schwarzenegger
│   ├── Arnold_Schwarzenegger_0006.png
│   ├── Arnold_Schwarzenegger_0007.png
│   ├── Arnold_Schwarzenegger_0008.png
│   ├── Arnold_Schwarzenegger_0009.png
│   └── Arnold_Schwarzenegger_0010.png
├── Lleyton Hewitt:
│   ├── Lleyton Hewitt:_0006.png
│   ├── Lleyton Hewitt:_0007.png
...
...etc

Also see the details of the start (align) images on here Validate-on-LFW

In the Data folder, there is a folder with the name of each person Inside each person's folder are a set of photos of their own

The image format is important and may be different for you I do not know but I used two types of extensions and they work [.png, jpg]

But I do not think the formula has an effect because it searches for all files in all tracks This is according to this function hereget_dataset But check your files well Thanks

clayettet commented 5 years ago

@mohammed-Emad is right, I had the same issue and putting all my images in a class directory fixed it. If your dataset is not shaped like this you can modify it with: find . -name "*.png" -exec sh -c 'mkdir "${1%.*}" ; mv "$1" "${1%.*}" ' _ {} \; source

It basically put each image in a file named like it.

Worked fine for me!

mohammed-Emad commented 5 years ago

Yes a very good solution is to find images and place them in one place For clarification only Please know how to stretch your photos accurately I mean here b [ .png] Which can be replaced by any extension [ .jpg] [* .jpeg] and etc

thank you

yatharthahuja commented 4 years ago

fatal: not a git repository (or any of the parent directories): .git Not a git repository To compare two paths outside a working tree: usage: git diff [--no-index] Creating networks and loading parameters 2019-07-16 13:29:48.734213: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations. 2019-07-16 13:29:48.734243: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations. 2019-07-16 13:29:48.734262: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations. 2019-07-16 13:29:48.734277: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations. 2019-07-16 13:29:48.734301: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations. /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/srk/2.jpeg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/srk/6.jpeg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/srk/10.jpeg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/srk/4.jpeg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/srk/9.jpeg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/srk/7.jpeg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/srk/3.jpeg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/srk/5.jpeg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/srk/8.jpeg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/srk/1.jpeg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/Julie/LeftSide.jpg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/Julie/RightSide.jpg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/Julie/TopDown.jpg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/Julie/FromBelow.jpg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/Julie/FrontOn.jpg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/Graham/FacingUp.jpg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/Graham/LeftSide.jpg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/Graham/RightSide.jpg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/Graham/Laughing.jpg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/Graham/RightSide2.jpg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/Graham/FrontOn.jpg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/prof rajesh rohilla/2.jpeg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/prof rajesh rohilla/6.jpeg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/prof rajesh rohilla/4.jpeg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/prof rajesh rohilla/3.jpeg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/prof rajesh rohilla/5.jpeg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/prof rajesh rohilla/1.jpeg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/50Cent/TopDown.png /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/50Cent/LeftFace.jpg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/50Cent/RightFace.jpg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/50Cent/FrontOn.jpg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/Michael/Smile /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/Michael/Smirk.jpg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/Michael/SuperLaugh.jpg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/Michael/RightTilt.jpeg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/Michael/Grin.jpg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/Michael/LeftSide.jpg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/Michael/RightSide.jpg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/Michael/Laughing.jpg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/Michael/FromBelow.jpg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/Michael/FrontOn.jpg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/Michael/LeftTilt.jpg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/Kate/LeftSide.jpg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/Kate/RightSide.jpg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/Kate/TopDown.jpg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/Kate/LeftSideOlder.jpg /home/yatharth/Desktop/FaceNet_Project/facial-recognition-video-facenet-master/training_data_raw/Kate/FrontOn.jpg Total number of images: 47 Number of successfully aligned images: 0

@mohammed-Emad What might be the problem in this?

mohammed-Emad commented 4 years ago

Hi First, your photos already exist This is obvious because the following message has not been executed

   except (IOError, ValueError, IndexError) as e:
                        errorMessage = '{}: {}'.format(image_path, e)
                        print(errorMessage)

It means the tracks are completely intact. And indeed it is see about (47) images

But he has a problem finding the face via (mtcnn) Either the images have no faces or the images have already been acted upon before I mean the pictures are actually faces that have already been cut

Note Data must contain images of faces that have not been completely cut, which means a bit far from the level of the edges of the face Or that the images contain more than one face while you are using the default option that does not depend on the processing of multiple faces.

To check it out please look at your photos or You can share a photo if possible