{"id":20638492,"url":"https://github.com/ahmetfurkandemir/deploy-tensorflow-2-object-detection-api-models-with-python-flask","last_synced_at":"2025-04-15T21:52:59.602Z","repository":{"id":110786354,"uuid":"380685185","full_name":"AhmetFurkanDEMIR/Deploy-TensorFlow-2-Object-Detection-API-models-with-Python-Flask","owner":"AhmetFurkanDEMIR","description":"Easily deliver models you create with TensorFlow 2 Object Detection API to people.","archived":false,"fork":false,"pushed_at":"2021-06-27T12:08:37.000Z","size":45351,"stargazers_count":15,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-15T21:52:31.484Z","etag":null,"topics":["flask","image-processing","object-detection","opencv","python3","tensorflow-object-detection-api","tensorflow2"],"latest_commit_sha":null,"homepage":"","language":"Python","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/AhmetFurkanDEMIR.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":"2021-06-27T08:09:02.000Z","updated_at":"2024-12-11T06:13:44.000Z","dependencies_parsed_at":"2023-03-06T21:15:32.778Z","dependency_job_id":null,"html_url":"https://github.com/AhmetFurkanDEMIR/Deploy-TensorFlow-2-Object-Detection-API-models-with-Python-Flask","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AhmetFurkanDEMIR%2FDeploy-TensorFlow-2-Object-Detection-API-models-with-Python-Flask","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AhmetFurkanDEMIR%2FDeploy-TensorFlow-2-Object-Detection-API-models-with-Python-Flask/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AhmetFurkanDEMIR%2FDeploy-TensorFlow-2-Object-Detection-API-models-with-Python-Flask/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AhmetFurkanDEMIR%2FDeploy-TensorFlow-2-Object-Detection-API-models-with-Python-Flask/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AhmetFurkanDEMIR","download_url":"https://codeload.github.com/AhmetFurkanDEMIR/Deploy-TensorFlow-2-Object-Detection-API-models-with-Python-Flask/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249161130,"owners_count":21222469,"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":["flask","image-processing","object-detection","opencv","python3","tensorflow-object-detection-api","tensorflow2"],"created_at":"2024-11-16T15:18:16.904Z","updated_at":"2025-04-15T21:52:59.594Z","avatar_url":"https://github.com/AhmetFurkanDEMIR.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":" ![](https://img.shields.io/badge/microsoft%20azure-0089D6?style=for-the-badge\u0026logo=microsoft-azure\u0026logoColor=white) ![](https://img.shields.io/badge/Ubuntu-E95420?style=for-the-badge\u0026logo=ubuntu\u0026logoColor=white) ![](https://img.shields.io/badge/Python-14354C?style=for-the-badge\u0026logo=python\u0026logoColor=white) ![](https://img.shields.io/badge/TensorFlow%20-%23FF6F00.svg?\u0026style=for-the-badge\u0026logo=TensorFlow\u0026logoColor=white) ![](https://img.shields.io/badge/Flask-000000?style=for-the-badge\u0026logo=flask\u0026logoColor=white) ![](https://img.shields.io/badge/JavaScript-323330?style=for-the-badge\u0026logo=javascript\u0026logoColor=F7DF1E) ![](https://img.shields.io/badge/HTML5-E34F26?style=for-the-badge\u0026logo=html5\u0026logoColor=white)\r\n \r\n# **Deploy TensorFlow 2 Object Detection API models with Python-Flask**\r\n\r\nThis website allows you to deploy the models you created with TensorFlow 2 Object Detection API on the server and make them available to other people. Thus, the models you write will not stay in the air and people will be able to use them. The main purpose of artificial intelligence is to solve problems, so you will be able to solve problems in daily life.\r\n\r\n\r\n### How the application works ?\r\n\r\nThe operation of the application is given in the diagram below, the image taken from the client, ie people, reaches the server, and these images are processed here, then the final state of the image array is visualized on the front with html.\r\n\r\n![asd](https://user-images.githubusercontent.com/54184905/123537436-1e371980-d738-11eb-8d5b-6cb35ed355a0.png)\r\n\r\n\r\n### Steps to run the web application on the server\r\n\r\nFirst of all, install the python packages in the requirements.txt to the server (you can install these packages with the command below).\r\n\r\n```console\r\nsudo su\r\npip3 install -r requirements.txt\r\n```\r\n\r\nAfter installing the Python packages, we need to make the necessary tensorflow package configurations (just run the commands below).\r\n\r\n```console\r\ncd tf\r\n./bin/protoc object_detection/protos/*.proto --python_out=.\r\nexport PYTHONPATH=$PYTHONPATH:`pwd`/:`pwd`/slim\r\ncd ..\r\n```\r\n\r\nAfter installing the necessary python packages and tensorflow configuration, we must make the https and 443 ports public on the server (Run the following commands in order).\r\n\r\n```console\r\nsudo systemctl status ufw \r\nsudo ufw enable\r\nsudo ufw allow https\r\nsudo ufw allow 443\r\n```\r\n\r\nAfter completing these processes, you can now access the website with public ip, but we still have some shortcomings, we must create an SSL certificate and include it in python flask, otherwise your browser will not trust the website and will not open your web cam (run the following commands).\r\n\r\n```console\r\npip3 install pyopenssl\r\nopenssl req -x509 -newkey rsa:4096 -nodes -out cert.pem -keyout key.pem -days 365\r\n```\r\n\r\nIt will create the necessary certificates in the folder and I have included these certificates in the code for you, you don't need to do anything.\r\n\r\n```python\r\nsocketio.run(app, host=\"0.0.0.0\", port=443, ssl_context=('cert.pem', 'key.pem'))\r\n```\r\n\r\nEverything is ok now, your python site will be up with the following command and you can access the site by going to https://xxxx. I will go to https://168.62.57.147, you can edit the url part according to you.\r\n\r\n```console\r\nsudo python3 main.py\r\n```\r\n\r\n**Information :** In the current application, we will use the model named \"ssd_mobilenet_v2_320x320_coco17_tpu-8\" and we will use ready-made \"coco\" weights and classes, if you wish, you can use this web application with your own model and your own classes.\r\n\r\n### Test image and video\r\n\r\n[v](https://user-images.githubusercontent.com/54184905/123538349-234a9780-d73d-11eb-9334-f811bfdf3822.mp4)\r\n\r\n![Screenshot_20210626-101819_Chrome](https://user-images.githubusercontent.com/54184905/123538664-b2a47a80-d73e-11eb-8cff-f384cd52fe85.jpg)\r\n\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahmetfurkandemir%2Fdeploy-tensorflow-2-object-detection-api-models-with-python-flask","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fahmetfurkandemir%2Fdeploy-tensorflow-2-object-detection-api-models-with-python-flask","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahmetfurkandemir%2Fdeploy-tensorflow-2-object-detection-api-models-with-python-flask/lists"}