Giter VIP home page Giter VIP logo

soumik12345 / nearest-celebrity-face Goto Github PK

View Code? Open in Web Editor NEW
30.0 3.0 6.0 26.18 MB

Tensorflow Implementation of FaceNet: A Unified Embedding for Face Recognition and Clustering to find the celebrity whose face matches the closest to yours.

Home Page: https://soumik12345.github.io/geekyrakshit-blog/computervision/deeplearning/facenet/inception/keras/nearestcelebrityface/python/tensorflow/2019/08/07/nearest-celebrity-face.html

Python 1.06% Jupyter Notebook 98.94%
machine-learning machinelearning deep-learning deep-neural-networks deeplearning inception inceptionv2 inception-resnet-v2 face-recognition face

nearest-celebrity-face's Introduction

Nearest-Celebrity-Face

HitCount

PWC PWC PWC PWC PWC

Overview

Implementation of FaceNet: A Unified Embedding for Face Recognition and Clustering to find the celebrity whose face matches the closest to yours. The input face is encoded with a pretrained inception model into a vector and then its geometric distance is calculated with the encoded vectors of all the images present in the dataset and the image with the least distance is selected.

Article Link: https://soumik12345.github.io/geekyrakshit-blog/computervision/deeplearning/facenet/inception/keras/nearestcelebrityface/python/tensorflow/2019/08/07/nearest-celebrity-face.html

Installation

  1. Create a new conda environment using conda create --name nearest_celeb_face
  2. Activate the activate nearest_celeb_face if you are on Windows and source activate nearest_celeb_face if you are on Linux
  3. Clone the repository using git clone https://github.com/soumik12345/Nearest-Celebrity-Face
  4. Enter the root directory using cd Nearest-Celebrity-Face
  5. Install the required dependencies using pip install -r requirements.txt

Usage

The TestCases folder contains two folders Actual that contains full sized images of individuals and Preprocessed containing the faces manually cropped out of the full sized images. Any number of testcases can be added provided that one image each is present in the Actual and Preprocessed folders with the exact same filename and the preprocessed image should have the face manually cropped out for best performance. Refer to the already cropped images for further detail on how to crop. Once the tescases are setup, run python main.py or python3 main.py to run the program.

Sample Outputs

Citation

@article{1503.03832,
  Author = {Florian Schroff and Dmitry Kalenichenko and James Philbin},
  Title = {FaceNet: A Unified Embedding for Face Recognition and Clustering},
  Year = {2015},
  Eprint = {arXiv:1503.03832},
  Doi = {10.1109/CVPR.2015.7298682},
}

nearest-celebrity-face's People

Contributors

soumik12345 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

nearest-celebrity-face's Issues

Tensorflow 2.0 ValueError: A `Concatenate` layer requires inputs with matching shapes except for the concat axis.

I tried to run the code after porting it to Tensorflow 2.0 and for that, I only made changes in the imports. But while creating the model object it throws an error for shape mismatch in feature concatenation operation in inception_block_1a. Can you please check?

Environment:
Python==3.6.8
Tensorflow==2.1.0

But I think the environment has nothing to do with shape mismatch in the model.

Full traceback of the error:

Traceback (most recent call last): File "inception_blocks_v2.py", line 270, in <module> inception_resnet_v2((3, 96, 96)) File "inception_blocks_v2.py", line 246, in inception_resnet_v2 X = inception_block_1b(X) File "inception_blocks_v2.py", line 75, in inception_block_1b inception = concatenate([X_3x3, X_5x5, X_pool, X_1x1], axis=-1) File "/home/rishab/anaconda3/envs/fr_env/lib/python3.6/site-packages/tensorflow_core/python/keras/layers/merge.py", line 716, in concatenate return Concatenate(axis=axis, **kwargs)(inputs) File "/home/rishab/anaconda3/envs/fr_env/lib/python3.6/site-packages/tensorflow_core/python/keras/engine/base_layer.py", line 748, in __call__ self._maybe_build(inputs) File "/home/rishab/anaconda3/envs/fr_env/lib/python3.6/site-packages/tensorflow_core/python/keras/engine/base_layer.py", line 2116, in _maybe_build self.build(input_shapes) File "/home/rishab/anaconda3/envs/fr_env/lib/python3.6/site-packages/tensorflow_core/python/keras/utils/tf_utils.py", line 306, in wrapper output_shape = fn(instance, input_shape) File "/home/rishab/anaconda3/envs/fr_env/lib/python3.6/site-packages/tensorflow_core/python/keras/layers/merge.py", line 401, in build raise ValueError(err_msg) ValueError: A Concatenate layer requires inputs with matching shapes except for the concat axis. Got inputs shapes: [(None, 128, 12, 12), (None, 64, 12, 12), (None, 64, 12, 12), (None, 64, 12, 12)]

Thanks in advance.
Any help is appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.