{"id":20279947,"url":"https://github.com/fyt3rp4til/multiclass-facedectionsystem-flask","last_synced_at":"2026-04-28T01:33:26.247Z","repository":{"id":247711975,"uuid":"826641575","full_name":"FYT3RP4TIL/MultiClass-FaceDectionSystem-Flask","owner":"FYT3RP4TIL","description":null,"archived":false,"fork":false,"pushed_at":"2024-08-20T13:52:16.000Z","size":3216,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-10T00:02:29.549Z","etag":null,"topics":["deepface","flask","vgg16"],"latest_commit_sha":null,"homepage":"","language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FYT3RP4TIL.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-10T05:19:14.000Z","updated_at":"2024-08-20T13:52:19.000Z","dependencies_parsed_at":"2024-08-21T03:15:40.947Z","dependency_job_id":null,"html_url":"https://github.com/FYT3RP4TIL/MultiClass-FaceDectionSystem-Flask","commit_stats":null,"previous_names":["fyt3rp4til/multiclass-facedectionsystem-flask"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/FYT3RP4TIL/MultiClass-FaceDectionSystem-Flask","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FYT3RP4TIL%2FMultiClass-FaceDectionSystem-Flask","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FYT3RP4TIL%2FMultiClass-FaceDectionSystem-Flask/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FYT3RP4TIL%2FMultiClass-FaceDectionSystem-Flask/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FYT3RP4TIL%2FMultiClass-FaceDectionSystem-Flask/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FYT3RP4TIL","download_url":"https://codeload.github.com/FYT3RP4TIL/MultiClass-FaceDectionSystem-Flask/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FYT3RP4TIL%2FMultiClass-FaceDectionSystem-Flask/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32362781,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-27T20:07:02.737Z","status":"ssl_error","status_checked_at":"2026-04-27T20:07:00.910Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deepface","flask","vgg16"],"created_at":"2024-11-14T13:33:49.170Z","updated_at":"2026-04-28T01:33:26.234Z","avatar_url":"https://github.com/FYT3RP4TIL.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MultiClass-FaceDectionSystem-Flask\n![](https://github.com/user-attachments/assets/7c5fc8c3-6556-4b49-af19-cbb9b3193b6f)\n## :bulb: Objective :\n\nDevelop a face recognition system that can take user input images and live video, preprocess them, store them, and recognize faces using DeepFace and the VGG16 model, displaying results through a web interface and is to develop a robust and user-friendly face recognition system that leverages advanced deep learning techniques to enhance security and personalization in various applications.\n\n## Project Outline :\n\n1. **Image Recognition with Haarcascade and OpenCV**\n2. **Image Data Preprocessing**\n3. **Face Recognition Classification Model with VGG16**\n4. **Flask (HTML, CSS, HTTP Methods)**\n\nFinally, we will integrate all these components to build a fully functional face recognition web app.\n\n## 🚀\u0026nbsp;Getting Started\n\n### 1. Clone the Repository\n\n```bash\ngit clone https://github.com/FYT3RP4TIL/MultiClass-FaceDectionSystem-Flask.git\n```\n\n### 2. Create a Virtual Environment\n\n```bash\npython -m venv venv\n```\n\n### 3. Activate the Virtual Environment\n\n- On Windows:\n```bash\nvenv\\Scripts\\activate\n```\n- On macOS and Linux:\n```bash\nsource venv/bin/activate\n```\n### 4. Install Dependencies\n```bash\npip install -r requirements.txt\n```\nRestart venv to avoid any issues.\n### 5. Run the App\n```bash\npython main.py\n```\nOpen your web browser and go to http://127.0.0.1:5000/ to see the app in action.\n\n### 6. Usage\n\n1. **Home Page**: \n   - Open the application.\n   - Click on the \"Get Started Today\" button to proceed.\n\n2. **Login Page**:\n   - Enter the credentials: \n     - **Username**: `admin`\n     - **Password**: `admin`\n   - Click \"Login\" to access the Navigation Page.\n\n3. **Navigation Page**:\n   - You'll see three options:\n     1. **Upload Images for Training**: Upload images for face recognition.\n     2. **Train Data**: Train the model using the uploaded images.\n     3. **Face Detection**: Use the trained model to predict faces in new images.\n\n4. **Upload Images for Training**:\n   - Click on the  option.\n   - Upload your images with the name.\n   - The images will be preprocessed and stored automatically in the backend.\n\n5. **Train the Model**:\n   - Click on the \"Train\" option.\n   - The model will train using the preprocessed images and save embeddings\n\n6. **Predict Faces**:\n   - Click on the \"Face Detection\" option.\n   - Upload a new image to predict and recognize faces using the trained model.\n   - The prediction results will be displayed on the screen you can choose between live-video-feed or on static images.\n\n# :cyclone: System Design\n\n## Modules\n\n### 1. User Interface (UI) Module\n- **Description**: \n  - Develop HTML/CSS-based web pages for user interaction.\n  - Implement forms for uploading images and accessing the live video feed.\n\n### 2. Image/Video Capture Module\n- **Description**: \n  - Capture images or live video from the user's device.\n  - Provide functionality for users to upload images manually.\n\n### 3. Preprocessing Module\n- **Description**: \n  - Convert images to grayscale, resize, and normalize.\n  - Detect and align faces within the images/video frames using OpenCV or similar libraries.\n\n### 4. Face Recognition Module\n- **Description**: \n  - Use DeepFace and VGG16 for feature extraction and face recognition.\n  - Implement logic to compare input images with stored images for recognition.\n\n### 5. Database Module\n- **Description**: \n  - Store preprocessed images, extracted features in respected upload and predict folders\n\n### 6. Results Display Module\n- **Description**: \n  - Display recognized faces along with user details on the web interface.\n  - Show real-time recognition results on the live video feed.\n\n## System Flow ([Figma](https://www.figma.com/design/PYza59lyc3BrfsGVIkuRkx/MultiClass-Face-Detection-System-(View)?m=auto\u0026t=iAkc1cWma8sntGfT-1))\n1. **User Access**:\n   - Users can upload images or initiate live video capture through the web interface.\n  \n2. **Preprocessing**:\n   - Uploaded images or video frames are preprocessed to ensure consistency in face detection and recognition.\n\n3. **Face Recognition**:\n   - The preprocessed images are passed through the face recognition module, where features are extracted and compared against stored data.\n\n4. **Results Storage**:\n   - Recognition results, along with preprocessed images and metadata, are stored in dediacted folders.\n\n5. **Results Display**:\n   - The results of the recognition process are displayed on the web interface, updating in real-time for live video feeds.\n\n# [Deepface](https://github.com/serengil/deepface)\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://github.com/user-attachments/assets/96014b9d-89c1-4eee-b8b7-f99e14f7e17c\" width=\"95%\" height=\"95%\"\u003e\u003c/p\u003e\n\n**Face recognition models** \n\nDeepFace is a **hybrid** face recognition package. It currently wraps many **state-of-the-art** face recognition models: [`VGG-Face`](https://sefiks.com/2018/08/06/deep-face-recognition-with-keras/) , [`FaceNet`](https://sefiks.com/2018/09/03/face-recognition-with-facenet-in-keras/), [`OpenFace`](https://sefiks.com/2019/07/21/face-recognition-with-openface-in-keras/), [`DeepFace`](https://sefiks.com/2020/02/17/face-recognition-with-facebook-deepface-in-keras/), [`DeepID`](https://sefiks.com/2020/06/16/face-recognition-with-deepid-in-keras/), [`ArcFace`](https://sefiks.com/2020/12/14/deep-face-recognition-with-arcface-in-keras-and-python/), [`Dlib`](https://sefiks.com/2020/07/11/face-recognition-with-dlib-in-python/), `SFace` and `GhostFaceNet`. The default configuration uses VGG-Face model.\n\n```python\nmodels = [\n  \"VGG-Face\", \n  \"Facenet\", \n  \"Facenet512\", \n  \"OpenFace\", \n  \"DeepFace\", \n  \"DeepID\", \n  \"ArcFace\", \n  \"Dlib\", \n  \"SFace\",\n  \"GhostFaceNet\",\n]\n\n#face verification\nresult = DeepFace.verify(\n  img1_path = \"img1.jpg\",\n  img2_path = \"img2.jpg\",\n  model_name = models[0],\n)\n\n#face recognition\ndfs = DeepFace.find(\n  img_path = \"img1.jpg\",\n  db_path = \"C:/workspace/my_db\", \n  model_name = models[1],\n)\n\n#embeddings\nembedding_objs = DeepFace.represent(\n  img_path = \"img.jpg\",\n  model_name = models[2],\n)\n```\n\nFaceNet, VGG-Face, ArcFace and Dlib are overperforming ones based on experiments - see [`BENCHMARKS`](https://github.com/serengil/deepface/tree/master/benchmarks) for more details. You can find the measured scores of various models in DeepFace and the reported scores from their original studies in the following table.\n\n| Model          | Measured Score | Declared Score     |\n| -------------- | -------------- | ------------------ |\n| Facenet512     | 98.4%          | 99.6%              |\n| Human-beings   | 97.5%          | 97.5%              |\n| Facenet        | 97.4%          | 99.2%              |\n| Dlib           | 96.8%          | 99.3 %             |\n| VGG-Face       | 96.7%          | 98.9%              |\n| ArcFace        | 96.7%          | 99.5%              |\n| GhostFaceNet   | 93.3%          | 99.7%              |\n| SFace          | 93.0%          | 99.5%              |\n| OpenFace       | 78.7%          | 92.9%              |\n| DeepFace       | 69.0%          | 97.3%              |\n| DeepID         | 66.5%          | 97.4%              |\n\nConducting experiments with those models within DeepFace may reveal disparities compared to the original studies, owing to the adoption of distinct detection or normalization techniques. Furthermore, some models have been released solely with their backbones, lacking pre-trained weights. Thus, we are utilizing their re-implementations instead of the original pre-trained weights.\n\nFor more information and on how to use the library go to library `https://github.com/serengil/deepface`\n\n# VGG-16\n\nA convolutional neural network is also known as a ConvNet, which is a kind of artificial neural network. A convolutional neural network has an input layer, an output layer, and various hidden layers. VGG16 is a type of CNN (Convolutional Neural Network) that is considered to be one of the best computer vision models to date. The creators of this model evaluated the networks and increased the depth using an architecture with very small (3 × 3) convolution filters, which showed a significant improvement on the prior-art configurations. They pushed the depth to 16–19 weight layers making it approx — 138 trainable parameters.\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://github.com/user-attachments/assets/66c3615b-7398-455e-88b8-400d1474820b\" width=\"95%\" height=\"95%\"\u003e\u003c/p\u003e\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://github.com/user-attachments/assets/60511a4d-5bd1-45ef-bcc7-1ac74a0c0ac5\" width=\"95%\" height=\"95%\"\u003e\u003c/p\u003e\n\n### Features\n- The 16 in VGG16 refers to 16 layers that have weights. In VGG16 there are thirteen convolutional layers, five Max Pooling layers, and three Dense layers which sum up to 21 layers but it has only sixteen weight layers i.e., learnable parameters layer.\nVGG16 takes input tensor size as 224, 244 with 3 RGB channel\n- Most unique thing about VGG16 is that instead of having a large number of hyper-parameters they focused on having convolution layers of 3x3 filter with stride 1 and always used the same padding and maxpool layer of 2x2 filter of stride 2.\n- The convolution and max pool layers are consistently arranged throughout the whole architecture\n- Conv-1 Layer has 64 number of filters, Conv-2 has 128 filters, Conv-3 has 256 filters, Conv 4 and Conv 5 has 512 filters.\n- Three Fully-Connected (FC) layers follow a stack of convolutional layers: the first two have 4096 channels each, the third performs 1000-way ILSVRC classification and thus contains 1000 channels (one for each class). The final layer is the soft-max layer.\n\n### Architecture\n- **Inputs** : The VGGNet accepts 224224-pixel images as input. To maintain a consistent input size for the ImageNet competition, the model’s developers chopped out the central 224224 patches in each image.\n- **Convolutional Layers** : VGG’s convolutional layers use the smallest feasible receptive field, or 33, to record left-to-right and up-to-down movement. Additionally, 11 convolution filters are used to transform the input linearly. The next component is a ReLU unit, a significant advancement from AlexNet that shortens training time. Rectified linear unit activation function, or ReLU, is a piecewise linear function that, if the input is positive, outputs the input; otherwise, the output is zero. The convolution stride is fixed at 1 pixel to keep the spatial resolution preserved after convolution (stride is the number of pixel shifts over the input matrix).\n- **Hidden Layers** : The VGG network’s hidden layers all make use of ReLU. Local Response Normalization (LRN) is typically not used with VGG as it increases memory usage and training time. Furthermore, it doesn’t increase overall accuracy.\n- **Fully Connected Layers** : The VGGNet contains three layers with full connectivity. The first two levels each have 4096 channels, while the third layer has 1000 channels with one channel for each class.\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://github.com/user-attachments/assets/9957ebd7-ba4a-46f4-a4ab-b34e3da62765\" width=\"95%\" height=\"95%\"\u003e\u003c/p\u003e\n\n### VGG-16-Summary\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://github.com/user-attachments/assets/ff715117-0f66-4492-bc4c-65fb8783874b\" width=\"95%\" height=\"95%\"\u003e\u003c/p\u003e\n\n## Guidance for Manual Training\n\n### VGG-16 Implementation\n\n```python \nfrom tensorflow.keras.layers import Input, Conv2D, MaxPooling2D\nfrom tensorflow.keras.layers import Dense, Flatten\nfrom tensorflow.keras.models import Model\n\n_input = Input((224,224,1)) \n\nconv1  = Conv2D(filters=64, kernel_size=(3,3), padding=\"same\", activation=\"relu\")(_input)\nconv2  = Conv2D(filters=64, kernel_size=(3,3), padding=\"same\", activation=\"relu\")(conv1)\npool1  = MaxPooling2D((2, 2))(conv2)\n\nconv3  = Conv2D(filters=128, kernel_size=(3,3), padding=\"same\", activation=\"relu\")(pool1)\nconv4  = Conv2D(filters=128, kernel_size=(3,3), padding=\"same\", activation=\"relu\")(conv3)\npool2  = MaxPooling2D((2, 2))(conv4)\n\nconv5  = Conv2D(filters=256, kernel_size=(3,3), padding=\"same\", activation=\"relu\")(pool2)\nconv6  = Conv2D(filters=256, kernel_size=(3,3), padding=\"same\", activation=\"relu\")(conv5)\nconv7  = Conv2D(filters=256, kernel_size=(3,3), padding=\"same\", activation=\"relu\")(conv6)\npool3  = MaxPooling2D((2, 2))(conv7)\n\nconv8  = Conv2D(filters=512, kernel_size=(3,3), padding=\"same\", activation=\"relu\")(pool3)\nconv9  = Conv2D(filters=512, kernel_size=(3,3), padding=\"same\", activation=\"relu\")(conv8)\nconv10 = Conv2D(filters=512, kernel_size=(3,3), padding=\"same\", activation=\"relu\")(conv9)\npool4  = MaxPooling2D((2, 2))(conv10)\n\nconv11 = Conv2D(filters=512, kernel_size=(3,3), padding=\"same\", activation=\"relu\")(pool4)\nconv12 = Conv2D(filters=512, kernel_size=(3,3), padding=\"same\", activation=\"relu\")(conv11)\nconv13 = Conv2D(filters=512, kernel_size=(3,3), padding=\"same\", activation=\"relu\")(conv12)\npool5  = MaxPooling2D((2, 2))(conv13)\n\nflat   = Flatten()(pool5)\ndense1 = Dense(4096, activation=\"relu\")(flat)\ndense2 = Dense(4096, activation=\"relu\")(dense1)\noutput = Dense(1000, activation=\"softmax\")(dense2)\n\nvgg16_model  = Model(inputs=_input, outputs=output)\n```\n### Working with pretrained model\n\n```python \nfrom keras.applications.vgg16 import decode_predictions\nfrom keras.applications.vgg16 import preprocess_input\nfrom keras.preprocessing import image\nimport matplotlib.pyplot as plt \nfrom PIL import Image \nimport seaborn as sns\nimport pandas as pd \nimport numpy as np \nimport os \n\nimg1 = \"../input/flowers-recognition/flowers/tulip/10094729603_eeca3f2cb6.jpg\"\nimg2 = \"../input/flowers-recognition/flowers/dandelion/10477378514_9ffbcec4cf_m.jpg\"\nimg3 = \"../input/flowers-recognition/flowers/sunflower/10386540696_0a95ee53a8_n.jpg\"\nimg4 = \"../input/flowers-recognition/flowers/rose/10090824183_d02c613f10_m.jpg\"\nimgs = [img1, img2, img3, img4]\n\ndef _load_image(img_path):\n    img = image.load_img(img_path, target_size=(224, 224))\n    img = image.img_to_array(img)\n    img = np.expand_dims(img, axis=0)\n    img = preprocess_input(img)\n    return img \n\ndef _get_predictions(_model):\n    f, ax = plt.subplots(1, 4)\n    f.set_size_inches(80, 40)\n    for i in range(4):\n        ax[i].imshow(Image.open(imgs[i]).resize((200, 200), Image.ANTIALIAS))\n    plt.show()\n    \n    f, axes = plt.subplots(1, 4)\n    f.set_size_inches(80, 20)\n    for i,img_path in enumerate(imgs):\n        img = _load_image(img_path)\n        preds  = decode_predictions(_model.predict(img), top=3)[0]\n        b = sns.barplot(y=[c[1] for c in preds], x=[c[2] for c in preds], color=\"gray\", ax=axes[i])\n        b.tick_params(labelsize=55)\n        f.tight_layout()\n```\n\n### Utilizing Pretrained Weights if Training Becomes Time-Consuming\n\n```python\nfrom keras.applications.vgg16 import VGG16\nvgg16_weights = '../input/vgg16/vgg16_weights_tf_dim_ordering_tf_kernels.h5'\nvgg16_model = VGG16(weights=vgg16_weights)\n_get_predictions(vgg16_model)\n\n'''\nDownloading data from https://storage.googleapis.com/download.tensorflow.org/data/imagenet_class_index.json\n40960/35363 [==================================] - 0s 0us/step\n'''\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffyt3rp4til%2Fmulticlass-facedectionsystem-flask","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffyt3rp4til%2Fmulticlass-facedectionsystem-flask","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffyt3rp4til%2Fmulticlass-facedectionsystem-flask/lists"}