I want to build a real-time face recognition for attendance based on web app and I'm using flask for website and for face recognition I'm using OpenCV and CNN for the train method so.. where do I must get started and how to make the dataset for real-time face recognition using our faces ??
CodePudding user response:
I can share you a path for this project but let me tell you that Projects are fun when made from scratch by yourself so probably you will not get ready made ideas but you can get a good guidance.
Let's start from Datasets:
- Go to Google datasets and there you can search for facial recognition datasets and you will find really good datasets by researchers who have open sourced it.
Now, let's move to building your application:
First of all you should think about your latency of the system. Do you want it to be real time or some amount of latency will be fine for your users. That depends on your use cases. As far as Flask is concerned it is pretty slow in handling multiple web requests as each request is served in the same thread so until the first request completes the next request has to wait. You can even use threading for that matter but GIL will never allow to serve concurrent requests to your web server. So, if latency is your concern then you can choose NodeJs otherwise Flask can be good for faster development of your API's to serve your requests.
Now, after making those system decisions you can first jump to model training for your system and for that as you said are using OpenCV and it's pretty good library. You can use opencv to do some preprocessing before even training the models.
Also, you can try OpenCV with Keras or TensorFlow or PyTorch. They work well in combination especially when you need to export your models, save it and then load it.
You have written you are using CNN but you should study about different CNN's as there are various types of CNN so you can study about them here and compare if you want to build your model from scratch or you want to use transfer learning i.e. building model on top of already open sourced ready made model based on your type of dataset. I would recommend you can start from resnet50 for your system.
Also remember to split your dataset for training, testing, validation as 80/20/10 rule (it can be changed as per dataset requirement).
Now you need to save your model and export it and have a reference of the path in your flask app through environment variable.
Then, you can create a endpoint for your app where you can simply load your trained model and pass your input frames and show the output as desired.
Finally, you can setup a backend server and host it on a hosting platform. For beginners, I would recommend pythonanywhere.com, Heroku and if you are already aware of web technology, then you can go for AWS, GCP etc.
For reference, you can check this out.
Try to be as creative but the most important part is your decisions you take beforehand to design your systems even before you start coding because that will decide your application's fate in long run and better experience for your users.