{"id":18683432,"url":"https://github.com/narasimha1997/pnuemonia_classification_onnx","last_synced_at":"2026-05-04T13:32:36.527Z","repository":{"id":54633269,"uuid":"233366143","full_name":"Narasimha1997/pnuemonia_classification_onnx","owner":"Narasimha1997","description":"Pnuemonia classification at scale using ONNX runtime and an inference server with batching support.","archived":false,"fork":false,"pushed_at":"2020-01-12T13:10:07.000Z","size":396,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-19T09:58:28.283Z","etag":null,"topics":["deep-learning","deployment","keras","onnx","python","python3","tensorflow"],"latest_commit_sha":null,"homepage":null,"language":"Jupyter Notebook","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/Narasimha1997.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}},"created_at":"2020-01-12T09:14:06.000Z","updated_at":"2022-09-09T19:04:14.000Z","dependencies_parsed_at":"2022-08-13T22:10:32.976Z","dependency_job_id":null,"html_url":"https://github.com/Narasimha1997/pnuemonia_classification_onnx","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Narasimha1997/pnuemonia_classification_onnx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Narasimha1997%2Fpnuemonia_classification_onnx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Narasimha1997%2Fpnuemonia_classification_onnx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Narasimha1997%2Fpnuemonia_classification_onnx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Narasimha1997%2Fpnuemonia_classification_onnx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Narasimha1997","download_url":"https://codeload.github.com/Narasimha1997/pnuemonia_classification_onnx/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Narasimha1997%2Fpnuemonia_classification_onnx/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32609555,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-04T10:08:07.713Z","status":"ssl_error","status_checked_at":"2026-05-04T10:08:02.005Z","response_time":58,"last_error":"SSL_read: 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":["deep-learning","deployment","keras","onnx","python","python3","tensorflow"],"created_at":"2024-11-07T10:14:38.414Z","updated_at":"2026-05-04T13:32:36.493Z","avatar_url":"https://github.com/Narasimha1997.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pneumonia_classification_onnx\nPneumonia classification at scale using ONNX runtime and an inference server with batching support.\n\nThe project pneumonia_classification is aimed at understanding the complete AI Research-Development-Production pipeline. The best approach for learning \nis identified in `train.ipynb`, the model is built and trained. Later it is made ready for optimized inference by converting it to ONNX and executing on ONNX Runtime.\nThis repo also provides a comphrensive understanding of how to export and use ONNX Models, if you are looking for a source to understand ONNX practically, you are\nat the right place.\n\n### Quick Setup:\nTo set-up the project locally, run `setup_native.sh`, this downloads latest version of Tensorflow and other python dependencies, and also\nconverts the h5 model to ONNX.\n\nTo launch inference server natively :\n```\npython3 server.py\n```\n\n### Creating a docker image :\nTo setup a docker image, run `setup_docker.sh` and wait for the image to build. Later you can spin up the container by using following command :\n```\ndocker run --net=host  pnuemonia_onnx:latest\n```\n\n### APIs :\nThe inference server which hosts ONNX or Keras runtime provides following APIs:\n\u003cbr/\u003e\nQuery status : `/api/status` GET\n\u003cbr/\u003e\nExample :\n```\ncurl http://localhost:5000/api/status\n```\n\u003cbr/\u003e\n\nInference : `/api/inference`  POST  multipart/form-data\n\u003cbr/\u003e\nExample : \n```\ncurl -X POST -F \"image=@/home/narasimha/pnuemonia_detection/samples/no.jpeg\" -H \"Content-Type: multipart/form-data\"  http://localhost:5000/api/infer\n```\n\n\n### Training your own model \nIf you don't wat to use the pretrained model provided in the repo you can train your own model or optimize the existing one. ( You can port\nthe model to more optimized backends like MobileNet or ResNet50 ). The model is trained using VGG16 transfer learning approach and was benchmarked \nfor `93.8%` validation accuracy over 20 epochs. The model was trained on Google Colab on T4 GPU support.\n\u003cbr/\u003e\nNotebook : `train.ipynb`\n\u003cbr/\u003e\nDataset : [Kaggle Pneumonia Chest X-Ray Images](https://www.kaggle.com/paultimothymooney/chest-xray-pneumonia)\n\n\n### ONNX Runtime\nThe project adds support to run ONNX models directly from the inference server. As a Fallback if ONNX Runtime fails, Keras Runtime takes over \nand starts providing runtime support. ONNX Runtime provides an optimized model runtime, these optimizaitions are hardware specific and are \ncreated during keras to ONNX conversion, see `modules/keras_to_onnx_converter.py` for more. \n\n#### Converting to ONNX :\nTo convert model to ONNX format, you can quickly run `convert.py`. To configure/ set-up optimizations for your target hardware edit\n `modules/keras_to_onnx_converter.py`. The current optimizations and options are as follows :\n \n ```pyhthon\n    options = onnxruntime.SessionOptions()\n    options.enable_cpu_mem_arena = True\n    options.enable_mem_pattern = True\n    options.graph_optimization_level = onnxruntime.GraphOptimizationLevel.ORT_ENABLE_ALL\n    options.optimized_model_filepath = output_path\n \n ```\n Target Opset and Version information:\n ```python\n onnx_model = convert( model_path, {\n        \"name\" : \"pnuemonia.onnx\",\n        \"batch_size\" : 1,\n        \"opset\" : 7,\n        \"target_version\" : onnx.__version__\n  })\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnarasimha1997%2Fpnuemonia_classification_onnx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnarasimha1997%2Fpnuemonia_classification_onnx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnarasimha1997%2Fpnuemonia_classification_onnx/lists"}