{"id":24107821,"url":"https://github.com/alessiosavi/pyrecognizer","last_synced_at":"2025-05-12T18:26:31.956Z","repository":{"id":38361950,"uuid":"223577007","full_name":"alessiosavi/PyRecognizer","owner":"alessiosavi","description":"\"A neural network to rule them all, a neural network to find them, a neural network to bring them all and verify if is you !!\" (Face recognition tool)","archived":false,"fork":false,"pushed_at":"2024-11-01T02:15:50.000Z","size":30480,"stargazers_count":36,"open_issues_count":61,"forks_count":14,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-01T01:40:47.103Z","etag":null,"topics":["celebrities","cuda-support","face-detection","face-recognition","facial-recognition","gpu-support","mlp","mlp-networks","neural-network","photos","rest-api","video-guide"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alessiosavi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2019-11-23T11:23:11.000Z","updated_at":"2024-12-23T04:39:43.000Z","dependencies_parsed_at":"2024-01-21T19:58:02.464Z","dependency_job_id":"820a80ce-cdcf-48f8-9d04-f0e8dda518e9","html_url":"https://github.com/alessiosavi/PyRecognizer","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alessiosavi%2FPyRecognizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alessiosavi%2FPyRecognizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alessiosavi%2FPyRecognizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alessiosavi%2FPyRecognizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alessiosavi","download_url":"https://codeload.github.com/alessiosavi/PyRecognizer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253796877,"owners_count":21965801,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["celebrities","cuda-support","face-detection","face-recognition","facial-recognition","gpu-support","mlp","mlp-networks","neural-network","photos","rest-api","video-guide"],"created_at":"2025-01-10T22:53:02.220Z","updated_at":"2025-05-12T18:26:31.937Z","avatar_url":"https://github.com/alessiosavi.png","language":"Python","readme":"# PyRecognizer\n\nA simple face recognition engine\n\n![Python application](https://github.com/alessiosavi/PyRecognizer/workflows/Python%20application/badge.svg)[![License](https://img.shields.io/github/license/alessiosavi/PyRecognizer)](https://img.shields.io/github/license/alessiosavi/PyRecognizer) [![Version](https://img.shields.io/github/v/tag/alessiosavi/PyRecognizer)](https://img.shields.io/github/v/tag/alessiosavi/PyRecognizer) [![Code size](https://img.shields.io/github/languages/code-size/alessiosavi/PyRecognizer)](https://img.shields.io/github/languages/code-size/alessiosavi/PyRecognizer) [![Repo size](https://img.shields.io/github/repo-size/alessiosavi/PyRecognizer)](https://img.shields.io/github/repo-size/alessiosavi/PyRecognizer) [![Issue open](https://img.shields.io/github/issues/alessiosavi/PyRecognizer)](https://img.shields.io/github/issues/alessiosavi/PyRecognizer)\n[![Issue closed](https://img.shields.io/github/issues-closed/alessiosavi/PyRecognizer)](https://img.shields.io/github/issues-closed/alessiosavi/PyRecognizer)[![DeepSource](https://static.deepsource.io/deepsource-badge-light-mini.svg)](https://deepsource.io/gh/alessiosavi/PyRecognizer/?ref=repository-badge)\n\n## Video guide for train/predict\n\n\u003chttps://youtu.be/Tctui-KzPaM\u003e\n\n## Model tuned for some celebrities\n\nThe following list contains the name of the celebrity and the number of photos used for training, ordered by the number of photos\n\n\u003cdetails\u003e\u003csummary\u003e Celebrites list\u003c/summary\u003e\u003cbr\u003e\u003cpre\u003e\nGeorge_W_Bush  530\nColin_Powell  236\nTony_Blair  144\nDonald_Rumsfeld  121\nGerhard_Schroeder  109\nAriel_Sharon  77\nHugo_Chavez   71\nJunichiro_Koizumi  60\nJean_Chretien  55\nJohn_Ashcroft  53\nSerena_Williams \t52\nJacques_Chirac  52\nVladimir_Putin  49\nLuiz_Inacio_Lula_da_Silva \t48\nGloria_Macapagal_Arroyo  44\nJennifer_Capriati \t42\nArnold_Schwarzenegger  42\nLleyton_Hewitt \t41\nLaura_Bush \t41\nHans_Blix  39\nAlejandro_Toledo \t39\nNestor_Kirchner  37\nAndre_Agassi  36\nAlvaro_Uribe  35\nTom_Ridge  33\nSilvio_Berlusconi  33\nMegawati_Sukarnoputri  33\nVicente_Fox  32\nRoh_Moo-hyun  32\nKofi_Annan  32\nJohn_Negroponte  31\nDavid_Beckham  31\nRecep_Tayyip_Erdogan  30\nGuillermo_Coria  30\nMahmoud_Abbas \t29\nBill_Clinton  29\nJuan_Carlos_Ferrero  28\nJack_Straw \t28\nRicardo_Lagos  27\nRudolph_Giuliani  26\nGray_Davis  26\nTom_Daschle \t25\nWinona_Ryder \t24\nJeremy_Greenstock  24\nAtal_Bihari_Vajpayee  24\nTiger_Woods \t23\nSaddam_Hussein  23\nJose_Maria_Aznar \t23\nPete_Sampras  22\nNaomi_Watts \t22\nLindsay_Davenport  22\nHamid_Karzai \t22\nGeorge_Robertson  22\nJennifer_Lopez \t21\nJennifer_Aniston \t21\nCarlos_Menem \t21\nAmelie_Mauresmo \t21\nPaul_Bremer \t20\nMichael_Bloomberg \t20\nJiang_Zemin \t20\nIgor_Ivanov \t20\nAngelina_Jolie \t20\nTim_Henman \t19\nNicole_Kidman \t19\nJulianne_Moore \t19\nJoschka_Fischer \t19\nJohn_Howard \t19\nCarlos_Moya \t19\nAbdullah_Gul \t19\nRichard_Myers \t18\nPervez_Musharraf \t18\nMichael_Schumacher \t18\nLance_Armstrong \t18\nFidel_Castro \t18\nVenus_Williams \t17\nSpencer_Abraham \t17\nRenee_Zellweger \t17\nJohn_Snow \t17\nJohn_Kerry \t17\nJohn_Bolton  17\nJean_Charest  17\nBill_Gates  17\nTrent_Lott \t16\nTommy_Franks  16\nHalle_Berry \t16\nTaha_Yassin_Ramadan  15\nPierce_Brosnan \t15\nNorah_Jones  15\nNancy_Pelosi \t15\nMohammed_Al-Douri \t15\nMeryl_Streep \t15\nJulie_Gerberding \t15\nHu_Jintao \t15\nDominique_de_Villepin \t15\nBill_Simon \t15\nAndy_Roddick \t15\nYoriko_Kawaguchi \t14\nRoger_Federer \t14\nMahathir_Mohamad \t14\nKim_Clijsters \t14\nJames_Blake \t14\nHillary_Clinton \t14\nEduardo_Duhalde \t14\nDick_Cheney \t14\nDavid_Nalbandian \t14\nBritney_Spears \t14\nWen_Jiabao \t13\nSalma_Hayek \t13\nQueen_Elizabeth_II \t13\nLucio_Gutierrez \t13\nJoe_Lieberman \t13\nJackie_Chan \t13\nGordon_Brown \t13\nGeorge_HW_Bush \t13\nEdmund_Stoiber \t13\nCharles_Moose \t13\nAri_Fleischer \t13\nRubens_Barrichello \t12\nMichael_Jackson \t12\nKeanu_Reeves \t12\nJennifer_Garner \t12\nJeb_Bush \t12\nHoward_Dean \t12\nHarrison_Ford \t12\nGonzalo_Sanchez_de_Lozada \t12\nAnna_Kournikova \t12\nAdrien_Brody \t12\nTang_Jiaxuan \t11\nSergio_Vieira_De_Mello \t11\nSergey_Lavrov \t11\nRichard_Gephardt \t11\nPaul_Burrell \t11\nNicanor_Duarte_Frutos \t11\nMike_Weir \t11\nMark_Philippoussis \t11\nKim_Ryong-sung \t11\nJohn_Paul_II \t11\nJohn_Allen_Muhammad \t11\nJiri_Novak \t11\nJames_Kelly \t11\nCondoleezza_Rice \t11\nCatherine_Zeta-Jones \t11\nAnn_Veneman \t11\nWalter_Mondale \t10\nTommy_Thompson \t10\nTom_Hanks \t10\nTom_Cruise \t10\nRichard_Gere \t10\nPaul_Wolfowitz \t10\nParadorn_Srichaphan \t10\nMuhammad_Ali \t10\nMohammad_Khatami \t10\nJean-David_Levitte \t10\nJavier_Solana \t10\nJason_Kidd \t10\nJacques_Rogge \t10\nIan_Thorpe \t10\nBill_McBride \t10\nZhu_Rongji \t9\nVaclav_Havel \t9\nTung_Chee-hwa \t9\nThomas_OBrien \t9\nSylvester_Stallone \t9\nRichard_Armitage \t9\nRay_Romano \t9\nPaul_ONeill \t9\nLi_Peng \t9\nLeonardo_DiCaprio \t9\nKate_Hudson \t9\nJose_Serra \t9\nJohn_Abizaid \t9\nJoan_Laporta \t9\nJimmy_Carter \t9\nJesse_Jackson \t9\nJeong_Se-hyun \t9\nHugh_Grant \t9\nHosni_Mubarak \t9\nHeizo_Takenaka \t9\nGeorge_Clooney \t9\nFernando_Gonzalez \t9\nColin_Farrell \t9\nCharles_Taylor \t9\nBill_Graham \t9\nBill_Frist \t9\nYasser_Arafat \t8\nYao_Ming \t8\nShimon_Peres \t8\nSheryl_Crow \t8\nRon_Dittemore \t8\nRobert_Redford \t8\nRobert_Duvall \t8\nRobert_Blake \t8\nRichard_Virenque \t8\nRalf_Schumacher \t8\nPaul_Martin \t8\nNaji_Sabri \t8\nMohamed_ElBaradei \t8\nMichelle_Kwan \t8\nMichael_Chang \t8\nMaria_Shriver \t8\nLi_Zhaoxing \t8\nKim_Dae-jung \t8\nKevin_Costner \t8\nJustin_Timberlake \t8\nJuan_Pablo_Montoya \t8\nJonathan_Edwards \t8\nJohn_Edwards \t8\nJelena_Dokic \t8\nGerry_Adams \t8\nFernando_Henrique_Cardoso \t8\nCesar_Gaviria \t8\nCeline_Dion \t8\nBob_Hope \t8\nAntonio_Palocci \t8\nAna_Palacio \t8\nAli_Naimi \t8\nAl_Gore \t8\nYashwant_Sinha \t7\nWilliam_Ford_Jr \t7\nWilliam_Donaldson \t7\nVojislav_Kostunica \t7\nVincent_Brooks \t7\nSteven_Spielberg \t7\nSophia_Loren \t7\nRomano_Prodi \t7\nRobert_Zoellick \t7\nPedro_Almodovar \t7\nPaul_McCartney \t7\nOscar_De_La_Hoya \t7\nNorm_Coleman \t7\nMike_Myers \t7\nMike_Martz \t7\nMatthew_Perry \t7\nMartin_Scorsese \t7\nMariah_Carey \t7\nLiza_Minnelli \t7\nLarry_Brown \t7\nJustine_Pasek \t7\nJon_Gruden \t7\nJohn_Travolta \t7\nJohn_McCain \t7\nJohn_Manley \t7\nJean-Pierre_Raffarin \t7\nHolly_Hunter \t7\nGunter_Pleuger \t7\nGoldie_Hawn \t7\nGeoff_Hoon \t7\nElton_John \t7\nDennis_Kucinich \t7\nDavid_Wells \t7\nBob_Stoops \t7\nBinyamin_Ben-Eliezer \t7\nBen_Affleck \t7\nAna_Guevara \t7\nAmelia_Vega \t7\nAl_Sharpton \t7\nZinedine_Zidane \t6\nYoko_Ono \t6\nValery_Giscard_dEstaing \t6\nValentino_Rossi \t6\nTony_Stewart \t6\nTommy_Haas \t6\nThaksin_Shinawatra \t6\nTariq_Aziz \t6\nSusan_Sarandon \t6\nSteve_Lavin \t6\nSilvan_Shalom \t6\nSarah_Jessica_Parker \t6\nSarah_Hughes \t6\nRoy_Moore \t6\nRoman_Polanski \t6\nRob_Marshall \t6\nRobert_De_Niro \t6\nRick_Perry \t6\nRicardo_Sanchez \t6\nPaula_Radcliffe \t6\nNatalie_Coughlin \t6\nMonica_Seles \t6\nMike_Krzyzewski \t6\nMichael_Douglas \t6\nMarco_Antonio_Barrera \t6\nLuis_Horna \t6\nLuis_Ernesto_Derbez_Bautista \t6\nLeonid_Kuchma \t6\nKamal_Kharrazi \t6\nJose_Manuel_Durao_Barroso \t6\nJK_Rowling  6\nJim_Furyk \t6\nJay_Garner \t6\nJan_Ullrich \t6\nGwyneth_Paltrow \t6\nFujio_Cho  6\nElsa_Zylberstein \t6\nEdward_Lu \t6\nDiana_Krall \t6\nDennis_Hastert \t6\nCostas_Simitis \t6\nClint_Eastwood \t6\nClay_Aiken \t6\nChristine_Todd_Whitman \t6\nCharlton_Heston \t6\nCarmen_Electra \t6\nCameron_Diaz \t6\nCalista_Flockhart \t6\nBulent_Ecevit \t6\nBoris_Becker \t6\nBob_Graham \t6\nBilly_Crystal \t6\nArminio_Fraga \t6\nAngela_Bassett \t6\nAlbert_Costa \t6\n\u003c/pre\u003e\u003c/details\u003e\n\n## Introduction\n\nThis project is developed for have a plug-and-play facial recognition tool able to detect and recognize *__multiple__* faces from photos.\nIt aim to be inter-operable with other tool. For this purpose, it expose REST api in order to interact with the internal face-recognition engine (train/tune/predict) and return the result of the prediction in a JSON format.\n\nIt's written for be a basecode/project-template for future project where a more complicated facial detect + neural network have to be engaged.\nBut is a complete face recognition tool that can be deployed on Docker.\nCurrently it use a Multi Layer Perceptron (MLP) as neural network in order to predict the given faces.\n\nThe tool is powered with `Flask_MonitoringDashboard` that expose some useful utilization/performance graph at the `/dashboard` endpoint\n\n## Requirements\n\n- [face_recognition](https://github.com/ageitgey/face_recognition) Extract face point from image\n- [Flask](https://github.com/pallets/flask) The Python micro framework for building web applications\n- [Flask_MonitoringDashboard](https://github.com/flask-dashboard/Flask-MonitoringDashboard) Automatically monitor the evolving performance of Flask/Python web services\n- [numpy](https://github.com/numpy/numpy) The fundamental package for scientific computing with Python.\n- [olefile](https://github.com/decalage2/olefile) Parse, read and write Microsoft OLE2 files (deal with image)\n- [Pillow](https://github.com/python-pillow/Pillow) The friendly PIL fork (Python Imaging Library)\n- [py-bcrypt](https://code.google.com/archive/p/py-bcrypt/) Python wrapper of OpenBSD's Blowfish password hashing code\n- [redis-py](https://github.com/andymccurdy/redis-py) The Python interface to the Redis key-value store.\n- [scikit-learn](https://github.com/scikit-learn/scikit-learn) Machine learning in Python\n- [tqdm](https://github.com/tqdm/tqdm) A Fast, Extensible Progress Bar\n- [werkzeug](https://github.com/pallets/werkzeug) The comprehensive WSGI web application library\n\n***NOTE***: If you encounter an error during `pip install -r requirements.txt`, it's possible that you have not installed `cmake`. `dlib` need `cmake`.\nYou can install `cmake` using:  \n\n- `apt install cmake -y` (Debian/Ubuntu).  \n- `yum install cmake -y` (CentOS/Fedora/RedHat).\n\n## Table Of Contents\n\n- [PyRecognizer](#pyrecognizer)\n  - [Video guide for train/predict](#video-guide-for-trainpredict)\n  - [Model tuned for some celebrities](#model-tuned-for-some-celebrities)\n  - [Introduction](#introduction)\n  - [Requirements](#requirements)\n  - [Table Of Contents](#table-of-contents)\n  - [Prerequisites](#prerequisites)\n  - [Usage](#usage)\n  - [In Details](#in-details)\n  - [Example response](#example-response)\n  - [Contributing](#contributing)\n  - [Versioning](#versioning)\n  - [Authors](#authors)\n  - [License](#license)\n  - [Acknowledgments](#acknowledgments)\n\n## Prerequisites\n\nThe software is coded in `Python`, into the `requirements.txt` file are saved the necessary dependencies.\n\nCreate a virtual environment with you favorite `python` package manager\n\n```bash\n# Create a new environment\nconda create -n PyRecognizer python=3.7.4\n# Activate the environment\nconda activate PyRecognizer\n# Install the necessary dependencies\npip install -r requirements.txt\n```\n\nAt this point all the necessary library for run the tool are ready, and you can run the software.\n\n## Usage\n\nYou can view the following example video in order to understand how to interact with the tool for the following process:\n\n- Create dataset from images\n- Predict image\n- Train/Tune the neural network\n\n[Video guide for train/predict](#video-guide-for-trainpredict)  \n\nBefore you can train the neural network with the photos, you need to create an archive that contains the image of the people's faces that you want to predict.\n\n- Save a bunch of images of the people that you need to recognize.\n- Copy the image in a folder. The name of that folder is important, cause it will be used as a label for the dataset (images) that contains during prediction.\n- Compress the folders in a `zip` file.\n\nBefore train the neural network, you have to create a dataset with the people images that you want to recognize.\nIf your dataset tree structure look likes the following tree dir, you can continue with training phase.\n\n```text\n├── bfegan\n      └── ...\n├── chris\n      └── ...\n├── dhawley\n      └── ...\n├── graeme\n      └──...\n├── heather\n      └──...\n```\n\nIn this case we have a dataset that contains the photos of 5 people (bfegan, dhawley, heather etc).  \nEach directory, contains the photos related to the \"target\".\n\nYou can find an example dataset at the following link:\n\u003chttps://www.kaggle.com/jessicali9530/lfw-dataset\u003e\n\nSome people in this dataset have only very few image.\n\nWe can create a new one dataset using the following `bash` command, in order to extract only the people that contains more than 5 images:\n\n```bash\n# Extract only the people that have more than 5 photos (-gt 5)\nfor i in $(ls); do a=$(ls $i |wc -l); if [ \"$a\" -gt 5 ]; then echo $i ; fi ; done \u003e people_ok\n# Create a directory for store the images\nmkdir -p /tmp/faces\n# Copy the filtered directory in the new one\nfor i in $(cat people_ok  | xargs echo -n) ; do cp -r $i /tmp/faces/ ; done\n```\n\nAt this point the dataset is complete and you can continue with training/tuning.\n\nBackup and remove the already present model (if present,inside the `dataset/model` directory), the tool will understand that you want to train the model and will initialize a new MLP model. The model have the following name template: `%Y%m%d_%H%M%S`, related to the time that was generated.\n\nOpen your browser at the `endpoint:port/train` specified in the configuration file (`conf/test.json`) and you will be redirect to the Administrator login page.\n**NOTE:** you can switch on/off the SSL, be sure to add `https` before the endpoint ip/hostname if it is enabled.  \n**NOTE:** In order to access to the training/tuning page, you have to run the script in [utils/add_users.py](utils/add_users.py) for create an admin user, capable of manage the train/tune for the neural network.  \n**NOTE:** A instance of `redis` have to be up and running if you want to train your custom neural network, cause the login will read the data from `redis`.\n\nAt this point you can upload the dataset (the previous `zip` file) and wait for the training of the neural network.\n\nYou can tail the log in `log/pyrecognizer.log` in order to understand the status of the training (`lnav` is your friends).\n\nOnce completed, the browser page will be refreshed automatically and you can:\n\n- predict a new photos that the neural network haven't seen before, realated to the peoeple in the dataset.\n- reduce the treeshold and see how you are similar to a celebrity!.\n\n**NOTE:** The same procedure can be applied for `tune` the neural network. By this way, you are going to execute an exhaustive search over specified parameter values for the KNN classifier. And, obviously, is more time consuming and the neural network produced will be more precise. The endpoint is `/tune` instead of `/train`\n\nAfter `train/tune` phase, you have to modify the configuration file in order to use the new model. The model is saved in a new folder with the related timestamp (modify classifier -\u003e timestamp in the configuration file)\n\n## In Details\n\n```bash\ntree\n.\n├── api\n│   ├── Api.py                           # Code that contains the API endpoint logic\n│   └── templates                        # Folder that contains the HTML template for tune/train/predict\n│       ├── train.html\n│       └── upload.html\n├── conf                                 # Configuration folder\n│   ├── conf.json                        # Tool configuration file\n│   ├── dashboard.ini                    # File related to the Dashboard configuration\n│   ├── flask_monitoringdashboard.db     # Dashboard database\n│   ├── ssl                              # SSL Certificates folder\n│   │   ├── localhost.crt\n│   │   └── localhost.key\n\n├── dataset                              # Model folder + test dataset\n│   ├── face_training_dataset_little.zip # Model used for test train\n│   ├── face_training_dataset.zip\n│   └── model                            # Neural network model's folder\n│       ├── 20191123_171821              # Folder for the NN model\n│       │   ├── model.clf                # Neural network dumped\n│       │   ├── model.dat                # Data used for train/tune\n│       │   └── model.json               # Hyperparmaters of the NN\n│       └── README.md\n├── datastructure                        # Datastructure/Class used\n│   ├── Administrator.py                 # Class that handle the admin of the NN, for train/tune\n│   ├── Classifier.py                    # Class delegated to predict the photos\n│   ├── Person.py                        # Class delegated to handle the \"stuff\" related to loading people data\n│   └── Response.py                      # Class delegated to wrap the response\n├── docker-compose.yml                   # docker-compose file for raise up the PyRecognizer (predict + train/tune)\n├── Dockerfile                           # Dockerfile related to the PyRecognizer only (only predict)\n├── LICENSE                              # License file\n├── log                                  # Log folder\n│   └── pyrecognizer.log\n├── main.py                              # Main program to spawn the tool\n├── README.md\n├── requirements.txt                     # Dependencies file\n├── uploads                              # Folder that contains the upload data\n├── test                                 # Test folder\n│   ├── conf_test.json\n│   ├── test_classifier.py               # File with test cases\n│   ├── test_images                      # Test data\n│   │   ├── bush_test.jpg\n│   │   ├── multi_face_test.jpg\n│   │   └── unknown_face.jpg\n│   ├── test_log                         # Log of the test\n│   │   └── pyrecognizer.log\n│   └── uploads\n│       ├── predict\n│       ├── training\n│       ├── unknown\n│       └── upload\n│   ├── predict\n│   ├── training\n│   └── upload\n├── utils                                \n│   ├── add_users.py                     # Python file for add a new user for train/tune the network\n│   └── util.py                          # Common methods\n└── wsgi.py\n```\n\n## Example response\n\n- **Missing the photo in request**\n\n```text\n{\n  \"response\": {\n    \"data\": null,\n    \"date\": \"2020-01-12 15:12:14.762526\",\n    \"description\": \"You have sent a request without the photo to predict :/\",\n    \"error\": \"NO_FILE_IN_REQUEST\",\n    \"status\": \"KO\"\n  }\n}\n```\n\n- **Missing threshold parameter in request**\n\n```text\n{\n  \"response\": {\n    \"data\": null,\n    \"date\": \"2020-01-12 15:12:14.769286\",\n    \"description\": \"You have sent a request without the `threshold` parameter :/\",\n    \"error\": \"THRESHOLD_NOT_PROVIDED\",\n    \"status\": \"KO\"\n  }\n}\n```\n\n- **Threshold provided is a number not in the properly range**\n\n```text\n{\n  \"response\": {\n    \"data\": null,\n    \"date\": \"2020-01-12 15:12:14.776730\",\n    \"description\": \"Threshold have to be greater than 0 and lesser than 100!\",\n    \"error\": \"THRESHOLD_ERROR_VALUE\",\n    \"status\": \"KO\"\n  }\n}\n```\n\n- **File in request is not a valid one**\n  \n```text\n{\n  \"response\": {\n    \"data\": null,\n    \"date\": \"2019-11-23 18:10:11.038329\",\n    \"description\": \"Seems that the file that you have tried to upload is not valid ...\",\n    \"error\": \"FILE_NOT_VALID\",\n    \"status\": \"KO\"\n  }\n}\n```\n\n- **Error parsing the threshold parameter**\n\n```text\n{\n  \"response\": {\n    \"data\": null,\n    \"date\": \"2020-01-12 15:12:14.784154\",\n    \"description\": \"Threshold is not an integer!\",\n    \"error\": \"UNABLE_CAST_INT\",\n    \"status\": \"KO\"\n  }\n}\n```\n\n- **Dataset upload is not valid**\n  \n```text\n{\n  \"response\": {\n    \"data\": null,\n    \"date\": \"2019-11-23 18:10:11.038329\",\n    \"description\": \"Seems that the dataset is not valid\",\n    \"error\": \"ERROR DURING LOADING DAT\",\n    \"status\": \"KO\"\n  }\n}\n```\n\n- **Unable to detect a face**\n  \n```text\n{\n  \"response\": {\n    \"data\": null,\n    \"date\": \"2019-11-23 18:10:11.038329\",\n    \"description\": \"Seems that in this images there is no face :/\",\n    \"error\": \"FACE_NOT_FOUND\",\n    \"status\": \"KO\"\n  }\n}\n```\n\n- **Face not recognized**\n\n```text\n{\n  \"response\": {\n    \"data\": {},\n    \"date\": \"2019-11-23 18:17:58.287413\",\n    \"description\": \"FACE_NOT_RECOGNIZED\",\n    \"error\": null,\n    \"status\": \"OK\"\n  }\n}\n```\n\n- **Face recognized**\n\n```text\n{\n  \"response\": {\n    \"data\": {\n      \"iroy\": 0.5762745881923004 # Name of the person: confidence\n    },\n    \"date\": \"2019-11-23 18:23:01.762757\",\n    \"description\": \"ijyibbvcgq.png\", # Random string for view image prediction (visit /uploads/ijyibbvcgq.png)\n    \"error\": null,\n    \"status\": \"OK\"\n  }\n}\n```\n\n- **Missing model's classifier**\n\n```text\n{\n  \"response\": {\n    \"data\": null,\n    \"date\": \"2019-11-23 18:27:55.761851\",\n    \"description\": \"CLASSIFIER_NOT_LOADED\",\n    \"error\": null,\n    \"status\": \"KO\"\n  }\n}\n```\n\n- **Login not successfully**\n\n```text\n{\n  \"response\": {\n    \"data\": null,\n    \"date\": \"2019-11-23 18:27:55.761851\",\n    \"description\": \"The password inserted is not valid!\",\n    \"error\": \"PASSWORD_NOT_VALID\",\n    \"status\": \"KO\"\n  }\n}\n```\n\n- **Unable to connect to redis**\n\n```text\n{\n  \"response\": {\n    \"data\": null,\n    \"date\": \"2019-11-23 18:27:55.761851\",\n    \"description\": \"Seems that the DB is not reachable!\",\n    \"error\": \"UNABLE_CONNECT_REDIS_DB\",\n    \"status\": \"KO\"\n  }\n}\n```\n\n\n## Contributing\n\n- Feel free to open issue in order to __*require new functionality*__;  \n- Feel free to open issue __*if you discover a bug*__;  \n- New idea/request/concept are very appreciated!;  \n\n## Test\n\nIn order to run the basic test case, you need to:\n- Spawn the `PyRecognizer` tool using `python main.py`\n- Change directory into the `test/` folder\n- Run `python -m unittest test_classifier.TestPredict`\n\nIf you are the admin of the neural network, you can test the Admin related methods:\n- Spawn the docker image of a redis-db `docker run -dt -p 6379:6379 redis`\n- Change directory into the `test/` folder\n- Run `python -m unittest test_admin.TestAdmin`\n\n## Versioning\n\nWe use [SemVer](http://semver.org/) for versioning.\n\n## Authors\n\n- **Alessio Savi** - *Initial work \u0026 Concept* - [Linkedin](https://www.linkedin.com/in/alessio-savi-2136b2188/) - [Github](https://github.com/alessiosavi/PyRecognizer)\n\n## Contributors\n- **Alessio Savi** \n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details\n\n## Acknowledgments\n\nFace data are sensible information. In order to mitigate the risk of stealing sensible data, the tool can run in SSL mode for avoid packet sniffing and secure every request using a CSRF mitigation\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falessiosavi%2Fpyrecognizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falessiosavi%2Fpyrecognizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falessiosavi%2Fpyrecognizer/lists"}