GithubHelp home page GithubHelp logo

ahmethamzaemra / intelegent_lock Goto Github PK

View Code? Open in Web Editor NEW
176.0 18.0 59.0 220.26 MB

lock mechanism with face recognition and liveness detection

License: MIT License

Python 100.00%
deep-learning face-recognition liveness-detection opencv cv2 python3 tflearn keras keras-tensorflow conv3d

intelegent_lock's People

Contributors

ahmethamzaemra 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

intelegent_lock's Issues

will this work for photo ?

hi,
i want to use this as api from my mobile app. will this work for image i send from camera ?

can you mention which algorithm is this ? if any paper link, it will be good

Reshape Error

Hi there, I am trying to make a server script based on your project. I only require the liveness detection part and have utilized that code only. My structure of code is such that the client posts a single frame to the server code which should then process and return a boolean corresponding to liveness. However, when I post a frame I get the error on both the client and server sides. Following is the error:

inp = inp.reshape(1,24,100,100,1)
ValueError: cannot reshape array of size 10000 into shape (1,24,100,100,1)

DataLossError...............!

hi,
I am getting the following error when i run "python3 main_code.py"

/usr/local/lib/python3.5/dist-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
WARNING:tensorflow:From /usr/local/lib/python3.5/dist-packages/tflearn/initializations.py:119: UniformUnitScaling.init (from tensorflow.python.ops.init_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.initializers.variance_scaling instead with distribution=uniform to get equivalent behavior.
2018-01-23 20:01:46.705732: 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
path ./model/my_model.tflearn
2018-01-23 20:01:48.172555: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Checksum does not match: stored 1023142078 vs. calculated on the restored bytes 662328829
2018-01-23 20:01:48.174926: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Checksum does not match: stored 91664377 vs. calculated on the restored bytes 1572371477
2018-01-23 20:01:48.175126: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Checksum does not match: stored 3562051217 vs. calculated on the restored bytes 1436366305
2018-01-23 20:01:48.175151: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Checksum does not match: stored 2743233166 vs. calculated on the restored bytes 3423742601
2018-01-23 20:01:48.175129: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Checksum does not match: stored 511452201 vs. calculated on the restored bytes 1214729159
2018-01-23 20:01:48.176313: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Checksum does not match: stored 91664377 vs. calculated on the restored bytes 1572371477
2018-01-23 20:01:48.176791: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Checksum does not match: stored 3162266982 vs. calculated on the restored bytes 2890847604
2018-01-23 20:01:48.177508: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Checksum does not match: stored 3363158527 vs. calculated on the restored bytes 2356514541
2018-01-23 20:01:48.177826: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Checksum does not match: stored 2315723916 vs. calculated on the restored bytes 2015907768
2018-01-23 20:01:48.177916: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Checksum does not match: stored 314258516 vs. calculated on the restored bytes 3942222521
2018-01-23 20:01:48.177982: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Checksum does not match: stored 188339952 vs. calculated on the restored bytes 1017069575
2018-01-23 20:01:48.178938: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Checksum does not match: stored 66084754 vs. calculated on the restored bytes 2795228591
2018-01-23 20:01:48.179333: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Checksum does not match: stored 141094046 vs. calculated on the restored bytes 3595362799
2018-01-23 20:01:48.180934: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Checksum does not match: stored 1392521279 vs. calculated on the restored bytes 322347086
2018-01-23 20:01:48.181136: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Checksum does not match: stored 1630541749 vs. calculated on the restored bytes 1040120677
2018-01-23 20:01:48.181926: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Checksum does not match: stored 3645530385 vs. calculated on the restored bytes 3707079508
2018-01-23 20:01:48.182506: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Checksum does not match: stored 3496139171 vs. calculated on the restored bytes 2262869991
2018-01-23 20:01:48.182594: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Checksum does not match: stored 3388135107 vs. calculated on the restored bytes 3397996067
2018-01-23 20:01:48.183270: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Checksum does not match: stored 717201017 vs. calculated on the restored bytes 715239342
2018-01-23 20:01:48.183758: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Checksum does not match: stored 191385343 vs. calculated on the restored bytes 31375631
2018-01-23 20:01:48.184008: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Checksum does not match: stored 1422169722 vs. calculated on the restored bytes 3952386992
2018-01-23 20:01:48.184868: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Checksum does not match: stored 3232978774 vs. calculated on the restored bytes 3357983005
2018-01-23 20:01:48.186157: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Checksum does not match: stored 3023058454 vs. calculated on the restored bytes 3508275387
2018-01-23 20:01:48.187281: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Checksum does not match: stored 169337673 vs. calculated on the restored bytes 1684377793
2018-01-23 20:01:48.187666: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Checksum does not match: stored 3486943653 vs. calculated on the restored bytes 4173295646
2018-01-23 20:01:48.188954: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Checksum does not match: stored 3862857029 vs. calculated on the restored bytes 2054704094
2018-01-23 20:01:48.189544: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Checksum does not match: stored 3041038455 vs. calculated on the restored bytes 1001679085
2018-01-23 20:01:48.190107: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Checksum does not match: stored 2460926327 vs. calculated on the restored bytes 4148356436
2018-01-23 20:01:48.192712: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Checksum does not match: stored 411918014 vs. calculated on the restored bytes 2088034305
2018-01-23 20:01:48.193644: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Checksum does not match: stored 2789654764 vs. calculated on the restored bytes 1471532794
2018-01-23 20:01:48.194545: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Checksum does not match: stored 2360534724 vs. calculated on the restored bytes 3916115864
2018-01-23 20:01:48.197834: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Checksum does not match: stored 4259864811 vs. calculated on the restored bytes 3296806277
2018-01-23 20:01:48.198637: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Checksum does not match: stored 4094537850 vs. calculated on the restored bytes 1570163143
2018-01-23 20:01:48.199320: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Checksum does not match: stored 2037083310 vs. calculated on the restored bytes 2531465183
2018-01-23 20:01:49.684359: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Checksum does not match: stored 519988316 vs. calculated on the restored bytes 349520506
2018-01-23 20:01:49.720522: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Checksum does not match: stored 2959698197 vs. calculated on the restored bytes 1805099933
2018-01-23 20:01:49.743673: W tensorflow/core/framework/op_kernel.cc:1192] Data loss: Checksum does not match: stored 2749618925 vs. calculated on the restored bytes 129760129
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1323, in _do_call
return fn(*args)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1302, in _run_fn
status, run_metadata)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/errors_impl.py", line 473, in exit
c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.DataLossError: Checksum does not match: stored 1023142078 vs. calculated on the restored bytes 662328829
[[Node: save_1/RestoreV2_38 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save_1/Const_0_0, save_1/RestoreV2_38/tensor_names, save_1/RestoreV2_38/shape_and_slices)]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "main_code.py", line 29, in
model.load(path)
File "/usr/local/lib/python3.5/dist-packages/tflearn/models/dnn.py", line 308, in load
self.trainer.restore(model_file, weights_only, **optargs)
File "/usr/local/lib/python3.5/dist-packages/tflearn/helpers/trainer.py", line 490, in restore
self.restorer.restore(self.session, model_file)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saver.py", line 1666, in restore
{self.saver_def.filename_tensor_name: save_path})
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 889, in run
run_metadata_ptr)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1120, in _run
feed_dict_tensor, options, run_metadata)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1317, in _do_run
options, run_metadata)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1336, in _do_call
raise type(e)(node_def, op, message)
tensorflow.python.framework.errors_impl.DataLossError: Checksum does not match: stored 1023142078 vs. calculated on the restored bytes 662328829
[[Node: save_1/RestoreV2_38 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save_1/Const_0_0, save_1/RestoreV2_38/tensor_names, save_1/RestoreV2_38/shape_and_slices)]]

Caused by op 'save_1/RestoreV2_38', defined at:
File "main_code.py", line 25, in
model = tflearn.DNN(network, tensorboard_verbose=0)
File "/usr/local/lib/python3.5/dist-packages/tflearn/models/dnn.py", line 65, in init
best_val_accuracy=best_val_accuracy)
File "/usr/local/lib/python3.5/dist-packages/tflearn/helpers/trainer.py", line 147, in init
allow_empty=True)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saver.py", line 1218, in init
self.build()
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saver.py", line 1227, in build
self._build(self._filename, build_save=True, build_restore=True)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saver.py", line 1263, in _build
build_save=build_save, build_restore=build_restore)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saver.py", line 751, in _build_internal
restore_sequentially, reshape)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saver.py", line 427, in _AddRestoreOps
tensors = self.restore_op(filename_tensor, saveable, preferred_shard)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/training/saver.py", line 267, in restore_op
[spec.tensor.dtype])[0])
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/gen_io_ops.py", line 1021, in restore_v2
shape_and_slices=shape_and_slices, dtypes=dtypes, name=name)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 2956, in create_op
op_def=op_def)
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 1470, in init
self._traceback = self._graph._extract_stack() # pylint: disable=protected-access

DataLossError (see above for traceback): Checksum does not match: stored 1023142078 vs. calculated on the restored bytes 662328829
[[Node: save_1/RestoreV2_38 = RestoreV2[dtypes=[DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save_1/Const_0_0, save_1/RestoreV2_38/tensor_names, save_1/RestoreV2_38/shape_and_slices)]]

*********** please tell me what does it mean.
thank you.

Detect video from input file mp4

the detection from live webcam was good enough for me, but why when the input video from file like mp4, the result is unstable? thanks sir, and what must i do thanks

Readme in Details

Could you please give us a readme file in details ;e.m. training part , opencv version , test part on this project . Thank you...

How to run this project in Win7

Hi, I am a newbie to python, So can you please advise me about how to test this project with python? and Is this complete liveness detection project?

Awaiting for your reply.

Train script

Provide the training script so that one can finetune your model with more images

Prediction is not stable

First of all, thank you for sharing your code.
Second, I have 2 main issues when I use it.
1- The prediction is really good when it works, but suddenly and without changing anything, the liveness score lowers from 99.9% to less than 50% for my real face.
2- The prediction is really poor when I have dark backgrounds.

Do you have explanation or solution for these situations?
Thanks in advance.

Question - Please advise how to create a dataset and train it

Hello,
I a few thousand face images from around the web.

Can you please explain (or point me to a doc / website) that will describe how I get from face image to the point that is required to run in your app. I assume being the "model".

I am new to this (retired 65yo IT guy of 44 years in coding) and would love to be able to lean more about this.

Thanks in advance.

tflite version has an okay recall rate on laptop camera compared to phone camera

I have translated the model into tflite, it works great most of the time. It is extremely hard to spoof. However, it has a very high recall rate, despite it woking perfectly in the same exact enviroment with a laptop camera. It has a likely hood to call a live person fake in any sub optimal conditions. I have tried to play around with exposure and it helps. Do you have any other ideas.

Liveness detection on multiple detected faces in the frame!

Hi, I am trying to tweak your code to create a liveness detector that can detect the liveness on multiple faces. Since it seems that this liveness detector will use one detected faces liveness result as the truth and if any other face is detected than it will impose the first ones result on everyone of the faces.

Im trying to think of ways but i can't get anywhere, could you please guide me ?

## main_code.py run error

I try to use the main_code to show the face recognition result, but when l load the model it return error.

File "D:\Developer\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\client\session.py", line 587, in __del__
AttributeError: 'NoneType' object has no attribute 'TF_NewStatus'

Training data

Could you please provide datasets which were used for the training?

Issues with data in .csv file?

Hello,

I was taking a look at doing something like this project with a friend, but it looks like the training data in the .csv file (in the liveness detection folder, presumably used by liveness_finetune.py) literally has "..." in it in between the pixel data (so it would look something like "[1, 2, 3] ... [4, 5, 6]" but without any actual data hidden in the "..." part).
Is there any way you could give access to the picture data (spoofed v.s. not) itself?

Sorry for the trouble, and thanks for your time

Model hakkında

Kullanılan pretrained model hakkında bilgilendirir misiniz ? Hangi eğitilmiş model kullanıldı ? Model neleri göz önünde bulundurarak canlılığa karar veriyor ? Modelle ilgili daha fazla bilgiyi nerede bulabilirim ?

confidence is so small

hi. when I run main_code.py with your pritrained model for gray video, the result for pred is so small for real face?
I appreciate if you can help me.

Results

Just to share results of testing
screen shot 2018-03-14 at 2 34 40 pm

Do you maybe know about some open source data set?
Also, did you play with some hyperparameters to increase accuracy?
At the end, I would appreciate if you send me the paper you used to implement this.

What is the liveness indicator?

You have written that you have used 3D CNN but how will it differentiate between a live image and an image. Could you please elaborate on the distinction criteria or how it works?

retrain

Hi thanks for your rep
I want to train with my datasets but I cant find finetuning script in your codes..
would you please to send me your finetuning script?
thanks you advanced for your reply

Increasing confidence

The confidence with which it is telling the person is alive or not is very small. Can you please upload your own model on which you have trained the classifier to get liveness detection?

Training Steps

I want to train this classifier for my own face, can you please provide a detailed description as to how and where to start from

The trained model doesn't work well on phone recorded video

When I tested this model by using laptop camera, everything works beautifully.
But when I upload a phone recorded video and let the model to predict is it a live person, the model actually return a very low accuracy (the model often return les than 5% prediction even though it is a live person).
Do you have any idea how to solve this?
Maybe we can dive deeper, what's the dataset you used to train this liveness detection model?

VIdeo Capture Not Starting

image
Showing logs it's not starting
I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: SSE SSE2 SSE3 SSE4.1 SSE4.2 AVX AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
Loaded model from disk
the end

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.