Coder Social home page Coder Social logo

akshaybahadur21 / facial-recognition-using-facenet Goto Github PK

View Code? Open in Web Editor NEW
266.0 19.0 137.0 98.99 MB

A simple implementation of facial recognition using facenets for humans ๐Ÿง” ๐Ÿ”

License: MIT License

Python 100.00%
machine-learning deep-learning computer-vision facial-recognition google facenet facenet-model facenet-trained-models

facial-recognition-using-facenet's Introduction

Facial Recognition ๐Ÿง” ๐Ÿ”

This code helps in facial recognition using facenets (https://arxiv.org/pdf/1503.03832.pdf). The concept of facenets was originally presented in a research paper. The main concepts talked about triplet loss function to compare images of different person. This concept uses inception network which has been taken from source and fr_utils.py is taken from deeplearning.ai for reference. I have added several functionalities of my own for providing stability and better detection.

Code Requirements ๐Ÿฆ„

You can install Conda for python which resolves all the dependencies for machine learning.

pip install requirements.txt

Description ๐Ÿ•ต๏ธโ€โ™‚๏ธ

A facial recognition system is a technology capable of identifying or verifying a person from a digital image or a video frame from a video source. There are multiples methods in which facial recognition systems work, but in general, they work by comparing selected facial features from given image with faces within a database.

Functionalities added ๐ŸงŸ

  1. Detecting face only when your eyes are opened. (Security measure)
  2. Using face align functionality from dlib to predict effectively while live streaming.

Python Implementation ๐Ÿ‘จโ€๐Ÿ”ฌ

  1. Network Used- Inception Network
  2. Original Paper - Facenet by Google

If you face any problem, kindly raise an issue

File Organization ๐Ÿ—„๏ธ

โ”œโ”€โ”€ Facial-Recognition-using-Facenet (Current Directory)
    โ”œโ”€โ”€ models : Saved Models
        โ”œโ”€โ”€ face-rec_Google.h5 : Facenet Model 
        โ””โ”€โ”€ shape_predictor_68_face_landmarks.dat : Facial Keypoints Model
    โ”œโ”€โ”€ utils : Utils Folder
        โ”œโ”€โ”€ fr_utils.py 
        โ””โ”€โ”€ inception_blocks_v2.py 
    โ”œโ”€โ”€ create_face.py : Store the faces for module
    โ”œโ”€โ”€ rec-feat.py - Main Application
    โ”œโ”€โ”€ Train-inception.py : Model Trainer
    โ”œโ”€โ”€ LICENSE
    โ”œโ”€โ”€ requirements.txt
    โ””โ”€โ”€ readme.md
        

Setup ๐Ÿ–ฅ๏ธ

  1. If you want to train the network , run Train-inception.py, however you don't need to do that since I have already trained the model and saved it as face-rec_Google.h5 file which gets loaded at runtime.
  2. Now you need to have images in your database. The code check /images folder for that. You can either paste your pictures there or you can click it using web cam. For doing that, run create-face.py the images get stored in /incept folder. You have to manually paste them in /images folder
  3. Run rec-feat.py for running the application.

Execution ๐Ÿ‰

python3 rec-feat.py

Results ๐Ÿ“Š

Made with โค๏ธ and ๐Ÿฆ™ by Akshay Bahadur

References ๐Ÿ”ฑ

facial-recognition-using-facenet's People

Contributors

akshaybahadur21 avatar mauryasameer 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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

facial-recognition-using-facenet's Issues

bad marshal data (unknown type code)

Using TensorFlow backend.
Traceback (most recent call last):
File "rec-feat.py", line 13, in
FRmodel = load_model('face-rec_Google.h5')
File "/usr/local/lib/python2.7/dist-packages/keras/models.py", line 243, in load_model
model = model_from_config(model_config, custom_objects=custom_objects)
File "/usr/local/lib/python2.7/dist-packages/keras/models.py", line 317, in model_from_config
return layer_module.deserialize(config, custom_objects=custom_objects)
File "/usr/local/lib/python2.7/dist-packages/keras/layers/init.py", line 55, in deserialize
printable_module_name='layer')
File "/usr/local/lib/python2.7/dist-packages/keras/utils/generic_utils.py", line 144, in deserialize_keras_object
list(custom_objects.items())))
File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 2510, in from_config
process_layer(layer_data)
File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 2496, in process_layer
custom_objects=custom_objects)
File "/usr/local/lib/python2.7/dist-packages/keras/layers/init.py", line 55, in deserialize
printable_module_name='layer')
File "/usr/local/lib/python2.7/dist-packages/keras/utils/generic_utils.py", line 144, in deserialize_keras_object
list(custom_objects.items())))
File "/usr/local/lib/python2.7/dist-packages/keras/layers/core.py", line 711, in from_config
function = func_load(config['function'], globs=globs)
File "/usr/local/lib/python2.7/dist-packages/keras/utils/generic_utils.py", line 234, in func_load
code = marshal.loads(raw_code)
ValueError: bad marshal data (unknown type code)

while trying to run the rec-feat.py facing this error

need your help here!!!!

C:\Users\Facial-Recognition-using-Facenet-master>python rec-feat.py
C:\Users\AppData\Local\Continuum\anaconda3\lib\site-packages\h5py_init_.py:36: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type.
from ._conv import register_converters as _register_converters
Using TensorFlow backend.
2018-06-13 13:17:08.655028: I T:\src\github\tensorflow\tensorflow\core\platform\cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
C:\Users\AppData\Local\Continuum\anaconda3\lib\site-packages\keras\engine\saving.py:270: UserWarning: No training configuration found in save file: the model was not compiled. Compile it manually.
warnings.warn('No training configuration found in save file: '
Total Params: 3743280
Traceback (most recent call last):
File "rec-feat.py", line 112, in
recognize()
File "rec-feat.py", line 103, in recognize
extract_face_info(img, img_rgb, database,ear)
File "rec-feat.py", line 59, in extract_face_info
name, min_dist = recognize_face(image, database)
File "rec-feat.py", line 44, in recognize_face
if int(identity) <=4:
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

TypeError: 'NoneType' object is not iterable

Traceback (most recent call last):
File "rec-feat.py", line 112, in
recognize()
File "rec-feat.py", line 103, in recognize
extract_face_info(img, img_rgb, database,ear)
File "rec-feat.py", line 59, in extract_face_info
name, min_dist = recognize_face(image, database)
TypeError: 'NoneType' object is not iterable

Tensorflow shape error while importing model

I get this error while running the file:

tensorflow.python.framework.errors_impl.InvalidArgumentError: Shape must be rank 1 but is rank 4 for 'bn1/cond/FusedBatchNorm' (op: 'FusedBatchNorm') with input shapes: [?,64,48,48], [1,64,1,1], [1,64,1,1], [1,64,1,1], [1,64,1,1].

When running rec-feat.py Tensorflow Binary Not compiled error

This prints when I try to run rec-feat-py file.
Create-Face file worked for me but getting this error for rec-feat
Using TensorFlow backend.
2018-09-18 16:03:08.073673: I T:\src\github\tensorflow\tensorflow\core\platform\cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
Please can anybody suggest some fix
I am using python 3.5

Getiing ValueError: Shape must be rank 1 but is rank 0 when running rec_feat.py

ValueError: Shape must be rank 1 but is rank 0 for 'bn1/cond/Reshape_4' (op: 'Reshape') with input shapes: [1,64,1,1], [].

Full Stack Trace

Traceback (most recent call last):
File "/home/cyanamous/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1567, in _create_c_op
c_op = c_api.TF_FinishOperation(op_desc)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Shape must be rank 1 but is rank 0 for 'bn1/cond/Reshape_4' (op: 'Reshape') with input shapes: [1,64,1,1], [].

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "rec-feat.py", line 13, in
FRmodel = load_model('face-rec_Google.h5')
File "/home/cyanamous/anaconda3/envs/py36/lib/python3.6/site-packages/keras/engine/saving.py", line 419, in load_model
model = _deserialize_model(f, custom_objects, compile)
File "/home/cyanamous/anaconda3/envs/py36/lib/python3.6/site-packages/keras/engine/saving.py", line 225, in _deserialize_model
model = model_from_config(model_config, custom_objects=custom_objects)
File "/home/cyanamous/anaconda3/envs/py36/lib/python3.6/site-packages/keras/engine/saving.py", line 458, in model_from_config
return deserialize(config, custom_objects=custom_objects)
File "/home/cyanamous/anaconda3/envs/py36/lib/python3.6/site-packages/keras/layers/init.py", line 55, in deserialize
printable_module_name='layer')
File "/home/cyanamous/anaconda3/envs/py36/lib/python3.6/site-packages/keras/utils/generic_utils.py", line 145, in deserialize_keras_object
list(custom_objects.items())))
File "/home/cyanamous/anaconda3/envs/py36/lib/python3.6/site-packages/keras/engine/network.py", line 1032, in from_config
process_node(layer, node_data)
File "/home/cyanamous/anaconda3/envs/py36/lib/python3.6/site-packages/keras/engine/network.py", line 991, in process_node
layer(unpack_singleton(input_tensors), **kwargs)
File "/home/cyanamous/anaconda3/envs/py36/lib/python3.6/site-packages/keras/engine/base_layer.py", line 457, in call
output = self.call(inputs, **kwargs)
File "/home/cyanamous/anaconda3/envs/py36/lib/python3.6/site-packages/keras/layers/normalization.py", line 206, in call
training=training)
File "/home/cyanamous/anaconda3/envs/py36/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 3123, in in_train_phase
x = switch(training, x, alt)
File "/home/cyanamous/anaconda3/envs/py36/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 3058, in switch
else_expression_fn)
File "/home/cyanamous/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 432, in new_func
return func(*args, **kwargs)
File "/home/cyanamous/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/ops/control_flow_ops.py", line 2072, in cond
orig_res_f, res_f = context_f.BuildCondBranch(false_fn)
File "/home/cyanamous/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/ops/control_flow_ops.py", line 1913, in BuildCondBranch
original_result = fn()
File "/home/cyanamous/anaconda3/envs/py36/lib/python3.6/site-packages/keras/layers/normalization.py", line 167, in normalize_inference
epsilon=self.epsilon)
File "/home/cyanamous/anaconda3/envs/py36/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 1908, in batch_normalization
mean = tf.reshape(mean, (-1))
File "/home/cyanamous/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/ops/gen_array_ops.py", line 6113, in reshape
"Reshape", tensor=tensor, shape=shape, name=name)
File "/home/cyanamous/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/home/cyanamous/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 3392, in create_op
op_def=op_def)
File "/home/cyanamous/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1734, in init
control_input_ops)
File "/home/cyanamous/anaconda3/envs/py36/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 1570, in _create_c_op
raise ValueError(str(e))
ValueError: Shape must be rank 1 but is rank 0 for 'bn1/cond/Reshape_4' (op: 'Reshape') with input shapes: [1,64,1,1], [].

package version problem

Could you show me the versions of packages you used in this repo?
Let me see "pip list", Thank you.

I get some problems, and i think unmatched versions result in this.

Dimension error in inception_blocks_v2.py

Traceback (most recent call last):
File "Train-inception.py", line 38, in
main()
File "Train-inception.py", line 33, in main
FRmodel = faceRecoModel(input_shape=(3, 96, 96))
File "/home/pirl/Downloads/ken/Classes/FACENET_CLONED/Facial-Recognition-using-Facenet/inception_blocks_v2.py", line 260, in faceRecoModel
X = inception_block_1a(X)
File "/home/pirl/Downloads/ken/Classes/FACENET_CLONED/Facial-Recognition-using-Facenet/inception_blocks_v2.py", line 48, in inception_block_1a
inception = concatenate([X_3x3, X_5x5, X_pool, X_1x1], axis=2)
File "/home/pirl/anaconda3/envs/facenet/lib/python3.6/site-packages/keras/layers/merge.py", line 641, in concatenate
return Concatenate(axis=axis, **kwargs)(inputs)
File "/home/pirl/anaconda3/envs/facenet/lib/python3.6/site-packages/keras/engine/topology.py", line 594, in call
self.build(input_shapes)
File "/home/pirl/anaconda3/envs/facenet/lib/python3.6/site-packages/keras/layers/merge.py", line 354, in build
'Got inputs shapes: %s' % (input_shape))
ValueError: A Concatenate layer requires inputs with matching shapes except for the concat axis. Got inputs shapes: [(None, 128, 12, 192), (None, 32, 12, 192), (None, 32, 12, 102), (None, 64, 12, 192)

this error has been occred when run Train_inception.py

Code breaking in "Rec-feat.py"

Traceback (most recent call last):
File "rec-feat.py", line 13, in
FRmodel = load_model('face-rec_Google.h5')
File "/Users/venkatamohan.jakkula/anaconda3/lib/python3.7/site-packages/keras/engine/saving.py", line 419, in load_model
model = _deserialize_model(f, custom_objects, compile)
File "/Users/venkatamohan.jakkula/anaconda3/lib/python3.7/site-packages/keras/engine/saving.py", line 225, in _deserialize_model
model = model_from_config(model_config, custom_objects=custom_objects)
File "/Users/venkatamohan.jakkula/anaconda3/lib/python3.7/site-packages/keras/engine/saving.py", line 458, in model_from_config
return deserialize(config, custom_objects=custom_objects)
File "/Users/venkatamohan.jakkula/anaconda3/lib/python3.7/site-packages/keras/layers/init.py", line 55, in deserialize
printable_module_name='layer')
File "/Users/venkatamohan.jakkula/anaconda3/lib/python3.7/site-packages/keras/utils/generic_utils.py", line 145, in deserialize_keras_object
list(custom_objects.items())))
File "/Users/venkatamohan.jakkula/anaconda3/lib/python3.7/site-packages/keras/engine/network.py", line 1032, in from_config
process_node(layer, node_data)
File "/Users/venkatamohan.jakkula/anaconda3/lib/python3.7/site-packages/keras/engine/network.py", line 991, in process_node
layer(unpack_singleton(input_tensors), **kwargs)
File "/Users/venkatamohan.jakkula/anaconda3/lib/python3.7/site-packages/keras/engine/base_layer.py", line 457, in call
output = self.call(inputs, **kwargs)
File "/Users/venkatamohan.jakkula/anaconda3/lib/python3.7/site-packages/keras/layers/merge.py", line 161, in call
return self._merge_function(inputs)
File "/Users/venkatamohan.jakkula/anaconda3/lib/python3.7/site-packages/keras/layers/merge.py", line 365, in _merge_function
return K.concatenate(inputs, axis=self.axis)
File "/Users/venkatamohan.jakkula/anaconda3/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py", line 1956, in concatenate
return tf.concat([to_dense(x) for x in tensors], axis)
File "/Users/venkatamohan.jakkula/anaconda3/lib/python3.7/site-packages/tensorflow/python/ops/array_ops.py", line 1075, in concat
dtype=dtypes.int32).get_shape(
File "/Users/venkatamohan.jakkula/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/ops.py", line 669, in convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "/Users/venkatamohan.jakkula/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/constant_op.py", line 176, in _constant_tensor_conversion_function
return constant(v, dtype=dtype, name=name)
File "/Users/venkatamohan.jakkula/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/constant_op.py", line 165, in constant
tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape, verify_shape=verify_shape))
File "/Users/venkatamohan.jakkula/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/tensor_util.py", line 367, in make_tensor_proto
_AssertCompatible(values, dtype)
File "/Users/venkatamohan.jakkula/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/tensor_util.py", line 302, in _AssertCompatible
(dtype.name, repr(mismatch), type(mismatch).name))
TypeError: Expected int32, got list containing Tensors of type '_Message' instead.

prediction accuracy

Hi can you give an example on how to get 100% accuracy on live face and stored image in folder prediction. Just a newbie on facenet. thanks a lot!

Default MaxPoolingOp only supports NHWC on device type CPU

I am getting the above error when I run your code on a CPU. can you please help me figure out this error?
Below is the error dump:
2020-08-11 11:14:53.225743: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found
2020-08-11 11:14:53.230514: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2020-08-11 11:14:58.467702: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'nvcuda.dll'; dlerror: nvcuda.dll not found
2020-08-11 11:14:58.484449: E tensorflow/stream_executor/cuda/cuda_driver.cc:313] failed call to cuInit: UNKNOWN ERROR (303)
2020-08-11 11:14:58.680196: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: DESKTOP-5P2P0GO
2020-08-11 11:14:58.684570: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: DESKTOP-5P2P0GO
2020-08-11 11:14:58.766228: I tensorflow/core/platform/cpu_feature_guard.cc:143] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2020-08-11 11:14:59.500350: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x20f03ea2f50 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-08-11 11:14:59.505708: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version
WARNING:tensorflow:No training configuration found in the save file, so the model was not compiled. Compile it manually.
Total Params: 3743280
Traceback (most recent call last):
File "rec-feat.py", line 114, in
recognize()
File "rec-feat.py", line 84, in recognize
database = initialize()
File "rec-feat.py", line 79, in initialize
database[identity] = fr_utils.img_path_to_encoding(file, FRmodel)
File "C:\Users\Dell\PycharmProjects\FACENET_IMPL\Facial-Recognition-using-Facenet_akb\fr_utils.py", line 194, in img_path_to_encoding
return img_to_encoding(img1, model)
File "C:\Users\Dell\PycharmProjects\FACENET_IMPL\Facial-Recognition-using-Facenet_akb\fr_utils.py", line 202, in img_to_encoding
embedding = model.predict(x_train)
File "C:\Users\Dell\anaconda3\envs\akb\lib\site-packages\tensorflow\python\keras\engine\training.py", line 88, in _method_wrapper
return method(self, *args, **kwargs)
File "C:\Users\Dell\anaconda3\envs\akb\lib\site-packages\tensorflow\python\keras\engine\training.py", line 1268, in predict
tmp_batch_outputs = predict_function(iterator)
File "C:\Users\Dell\anaconda3\envs\akb\lib\site-packages\tensorflow\python\eager\def_function.py", line 580, in call
result = self._call(*args, **kwds)
File "C:\Users\Dell\anaconda3\envs\akb\lib\site-packages\tensorflow\python\eager\def_function.py", line 650, in _call
return self._concrete_stateful_fn._filtered_call(canon_args, canon_kwds) # pylint: disable=protected-access
File "C:\Users\Dell\anaconda3\envs\akb\lib\site-packages\tensorflow\python\eager\function.py", line 1665, in _filtered_call
self.captured_inputs)
File "C:\Users\Dell\anaconda3\envs\akb\lib\site-packages\tensorflow\python\eager\function.py", line 1746, in _call_flat
ctx, args, cancellation_manager=cancellation_manager))
File "C:\Users\Dell\anaconda3\envs\akb\lib\site-packages\tensorflow\python\eager\function.py", line 598, in call
ctx=ctx)
File "C:\Users\Dell\anaconda3\envs\akb\lib\site-packages\tensorflow\python\eager\execute.py", line 60, in quick_execute
inputs, attrs, num_outputs)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Default MaxPoolingOp only supports NHWC on device type CPU
[[node FaceRecoModel/max_pooling2d_1/MaxPool (defined at C:\Users\Dell\PycharmProjects\FACENET_IMPL\Facial-Recognition-using-Facenet_akb\fr_utils.py:202) ]] [Op:__inference_predict_function_5808]

Function call stack:
predict_function

recognise faces from live cc camera stream(with ip known)

  • Python version:3.7.1(anaconda distrubution)
  • Operating System:ubuntu 16.04

Description

  1. i have the IP of cc camera eg.10.2.0.10
  2. I have the pictures of my friend's face (known peoples folder)
  3. I want to recognize his face from the stream I get from cc camera(just like a webcam)
    what changes can i make to this to happen?
    please help!

Installation fails

So i'm using pip 18.1 with python 3.7, and its failing. So what pip and python version should i use it with?

How to map 1000 images?

In your code you are mapping the images manually but what if we have more than 1000 images how we will map then?
Here is what you have done:

    if int(identity) <=4:
        return str('abc'), min_dist
    if int(identity) <=8:
        return str('xyz'), min_dist

If we have more than 1000 images of images it is not possible to map it according to that , Is there any other approach to do it.
Please help

ValueError: invalid literal for int() with base 10:

ops@18:14:[~/Developpement/Facial-Recognition-using-Facenet] python3 rec-feat.py
Using TensorFlow backend.
2018-06-08 18:16:23.935963: I tensorflow/core/platform/cpu_feature_guard.cc:140] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/keras/engine/saving.py:270: UserWarning: No training configuration found in save file: the model was not compiled. Compile it manually.
warnings.warn('No training configuration found in save file: '
Total Params: 3743280
distance for Pierre9 is 0.05126756
distance for Pierre8 is 0.06121227
distance for Pierre5 is 0.06684167
distance for Pierre4 is 0.068645105
distance for Pierre6 is 0.07133803
distance for Pierre7 is 0.067103155
distance for Pierre3 is 0.071579434
distance for Pierre2 is 0.0652888
distance for Pierre1 is 0.05116783
distance for Pierre10 is 0.049484182
Traceback (most recent call last):
File "rec-feat.py", line 112, in
recognize()
File "rec-feat.py", line 103, in recognize
extract_face_info(img, img_rgb, database,ear)
File "rec-feat.py", line 59, in extract_face_info
name, min_dist = recognize_face(image, database)
File "rec-feat.py", line 44, in recognize_face
if int(identity) <=4:
ValueError: invalid literal for int() with base 10: 'Pierre10'

I run create_face.py to get picture of myself. I copy the picture directly in the images folder I created. (Do I need to keep the subfolder with the ID ?)
Then I run rec-feat.py with python3 command.

'PierreX' represent the photo and their associated number.

Do you know how to solve it ?

ValueError: invalid literal for int() with base 10: 'bhargav15'

Using TensorFlow backend.
2019-07-29 18:07:21.830389: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
/home/bhargav/anaconda3/lib/python3.6/site-packages/keras/engine/saving.py:292: UserWarning: No training configuration found in save file: the model was not compiled. Compile it manually.
warnings.warn('No training configuration found in save file: '
Total Params: 3743280
distance for bhargav15 is 0.07610167
bhargav15
Traceback (most recent call last):
File "rec-feat.py", line 116, in
recognize()
File "rec-feat.py", line 107, in recognize
extract_face_info(img, img_rgb, database,ear)
File "rec-feat.py", line 63, in extract_face_info
name, min_dist = recognize_face(image, database)
File "rec-feat.py", line 45, in recognize_face
print(int(identity))
ValueError: invalid literal for int() with base 10: `'bhargav15'

Dlib Lilibrary is not installing in my system

I was trying to compiled your project but it's getting error or TensorFlow and Segmentation fault in both version of python, I've Install each and every Requirements of this module including Tensorflow module,
Have a look of error
deepinscreenshot_deepin-terminal_20180521195313

shape_predictor_5_face_landmarks.dat

i use 5 landmark.dat but appear some error

C:\Facial-Recognition-using-Facenet-master>python rec-feat.py
Using TensorFlow backend.
2019-06-27 16:42:10.730621: I T:\src\github\tensorflow\tensorflow\core\platform\cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2019-06-27 16:42:10.957470: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1392] Found device 0 with properties:
name: GeForce GTX 1060 6GB major: 6 minor: 1 memoryClockRate(GHz): 1.7085
pciBusID: 0000:01:00.0
totalMemory: 6.00GiB freeMemory: 4.96GiB
2019-06-27 16:42:10.961398: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1471] Adding visible gpu devices: 0
2019-06-27 16:42:11.545961: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:952] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-06-27 16:42:11.548929: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:958] 0
2019-06-27 16:42:11.551175: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:971] 0: N
2019-06-27 16:42:11.552894: I T:\src\github\tensorflow\tensorflow\core\common_runtime\gpu\gpu_device.cc:1084] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 4726 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1060 6GB, pci bus id: 0000:01:00.0, compute capability: 6.1)
C:\Users\user\AppData\Local\Programs\Python\Python36\lib\site-packages\keras\models.py:282: UserWarning: No training configuration found in save file: the model was not compiled. Compile it manually.
warnings.warn('No training configuration found in save file: '
Total Params: 3743280
Traceback (most recent call last):
File "rec-feat.py", line 113, in
recognize()
File "rec-feat.py", line 97, in recognize
leftEAR = eye_aspect_ratio(leftEye)
File "rec-feat.py", line 20, in eye_aspect_ratio
A = distance.euclidean(eye[1], eye[5])
IndexError: index 1 is out of bounds for axis 0 with size 0
[ WARN:1] terminating async callback

Code breaking in "Rec-feat.py" and "Train-inception.py"

1.While running Rec-feat.py, Python.exe stops working abnormally. It breaks at following line while debugging

FRmodel = load_model('face-rec_Google.h5')

2.While running Train-inception.py, getting following error:

---------------------------------------ERROR------------------------------------------------

File "C:\Anaconda3\lib\site-packages\keras\layers\merge.py", line 354, in build
'Got inputs shapes: %s' % (input_shape))

ValueError: A Concatenate layer requires inputs with matching shapes except for the concat axis. Got inputs shapes: [(None, 128, 12, 192), (None, 32, 12, 192), (None, 32, 12, 102), (None, 64, 12, 192)]

Code where its breaking.
file: merge.py

def concatenate(inputs, axis=-1, **kwargs):
"""Functional interface to the Concatenate layer.

# Arguments
    inputs: A list of input tensors (at least 2).
    axis: Concatenation axis.
    **kwargs: Standard layer keyword arguments.

# Returns
    A tensor, the concatenation of the inputs alongside axis `axis`.
"""
return Concatenate(axis=axis, **kwargs)(inputs)

please help

Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
Segmentation fault (core dumped)

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.