{"id":15065021,"url":"https://github.com/layerex/keras-image-classification-wrapper","last_synced_at":"2026-01-03T01:13:11.188Z","repository":{"id":62573947,"uuid":"424622701","full_name":"Layerex/keras-image-classification-wrapper","owner":"Layerex","description":"A thin wrapper around keras image classification applications.","archived":false,"fork":false,"pushed_at":"2022-07-09T13:39:33.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-14T09:31:55.593Z","etag":null,"topics":["artificial-intelligence","image-classification","keras","keras-tensorflow","machine-learning","tensorflow"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Layerex.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-11-04T14:20:44.000Z","updated_at":"2021-11-06T08:24:55.000Z","dependencies_parsed_at":"2022-11-03T18:43:05.783Z","dependency_job_id":null,"html_url":"https://github.com/Layerex/keras-image-classification-wrapper","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/Layerex%2Fkeras-image-classification-wrapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Layerex%2Fkeras-image-classification-wrapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Layerex%2Fkeras-image-classification-wrapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Layerex%2Fkeras-image-classification-wrapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Layerex","download_url":"https://codeload.github.com/Layerex/keras-image-classification-wrapper/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243801610,"owners_count":20350106,"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":["artificial-intelligence","image-classification","keras","keras-tensorflow","machine-learning","tensorflow"],"created_at":"2024-09-25T00:29:36.455Z","updated_at":"2026-01-03T01:13:11.158Z","avatar_url":"https://github.com/Layerex.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# keras-image-classification-wrapper\n\nA thin wrapper around keras image classification applications.\n\n## Installation\n\n```sh\npip install keras-image-classification-wrapper\n```\n\n## Usage\n\n```python\ndef classify(\n    image: Union[str, bytes, pillow.Image.Image],\n    results: int = 3,\n    model: str = INCEPTIONV3,\n) -\u003e tuple:\n```\n\nClassify an image.\n\n`results` has to be less that 5, since keras applications don't give more than five results.\n\n`model` has to be one of: `XCEPTION`, `VGG16`, `VGG19`, `RESNET50`, `RESNET101`, `RESNET152`, `RESNET50V2`, `RESNET101V2`, `RESNET152V2`, `RESNETRS101`, `RESNETRS152`, `RESNETRS200`, `RESNETRS270`, `RESNETRS350`, `RESNETRS420`, `REGNETX002`, `REGNETX004`, `REGNETX006`, `REGNETX008`, `REGNETX016`, `REGNETX032`, `REGNETX040`, `REGNETX064`, `REGNETX080`, `REGNETX120`, `REGNETX160`, `REGNETX320`, `REGNETY002`, `REGNETY004`, `REGNETY006`, `REGNETY008`, `REGNETY016`, `REGNETY032`, `REGNETY040`, `REGNETY064`, `REGNETY080`, `REGNETY120`, `REGNETY160`, `REGNETY320`, `INCEPTIONV3`, `INCEPTIONRESNETV2`, `MOBILENET`, `MOBILENETV2`, `MOBILENETV3SMALL`, `MOBILENETV3LARGE`, `DENSENET121`, `DENSENET169`, `DENSENET201`, `NASNETMOBILE`, `NASNETLARGE`, `EFFICIENTNETB0`, `EFFICIENTNETB1`, `EFFICIENTNETB2`, `EFFICIENTNETB3`, `EFFICIENTNETB4`, `EFFICIENTNETB5`, `EFFICIENTNETB6`, `EFFICIENTNETB7`, `EFFICIENTNETV2B0`, `EFFICIENTNETV2B1`, `EFFICIENTNETV2B2`, `EFFICIENTNETV2B3`, `EFFICIENTNETV2S`, `EFFICIENTNETV2M`, `EFFICIENTNETV2L`. Take a look at [model characteristics](https://keras.io/api/applications/#available-models), if you are not sure, which one to choose.\n\n```python\ndef load_model(model: str) -\u003e None:\n```\n\nPreload a model.\n\nLoading of desired model is done automatically at the first call of `classify`. But it can take significant time, if weights need to be downloaded. So you can preload a model.\n\n## Usage examples\n\nWith local files:\n\n```python\nimport keras_image_classification as image_classification\n\nfile_path = \"path/to/image.png\"\n\nlabels = image_classification.classify(file_path, results = 3,\n                                       model = image_classification.INCEPTIONV3)\nprint(labels)\n```\n\nWith byte-like objects (here with [requests](https://pypi.org/project/requests/)):\n\n```python\nimport requests\nimport keras_image_classification as image_classification\n\nresponse = requests.get(\"https://http.cat/100\")\nassert response.status_code == 200\n\nlabels = image_classification.classify(response.content, results = 3,\n                                       model = image_classification.INCEPTIONV3)\nprint(labels)\n```\n\nYou can also pass [pillow](https://pypi.org/project/Pillow/) images directly:\n\n```python\nimport PIL as pillow\nimport keras_image_classification as image_classification\n\nfile_path = \"path/to/image.png\"\nimage = pillow.Image.open(file_path)\n\nlabels = image_classification.classify(image, results = 3,\n                                       model = image_classification.INCEPTIONV3)\nprint(labels)\n```\n\nOutput:\n\n```\n({'imagenet_id': 'n02123394', 'label': 'Persian_cat', 'probability': 0.7993967533111572},\n {'imagenet_id': 'n06359193', 'label': 'web_site', 'probability': 0.03162319213151932},\n {'imagenet_id': 'n03598930', 'label': 'jigsaw_puzzle', 'probability': 0.013497020117938519})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flayerex%2Fkeras-image-classification-wrapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flayerex%2Fkeras-image-classification-wrapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flayerex%2Fkeras-image-classification-wrapper/lists"}