Buckets:
| ## Image Classification | |
| Image classification is the task of assigning a label or class to an entire image. Images are expected to have only one class for each image. | |
| > [!TIP] | |
| > For more details about the `image-classification` task, check out its [dedicated page](https://huggingface.co/tasks/image-classification)! You will find examples and related materials. | |
| ### Recommended models | |
| - [google/vit-base-patch16-224](https://huggingface.co/google/vit-base-patch16-224): A strong image classification model. | |
| - [facebook/deit-base-distilled-patch16-224](https://huggingface.co/facebook/deit-base-distilled-patch16-224): A robust image classification model. | |
| - [facebook/convnext-large-224](https://huggingface.co/facebook/convnext-large-224): A strong image classification model. | |
| Explore all available models and find the one that suits you best [here](https://huggingface.co/models?inference=warm&pipeline_tag=image-classification&sort=trending), or from the terminal with the [`hf` CLI](https://huggingface.co/docs/huggingface_hub/package_reference/cli#hf-models-list): | |
| ```bash | |
| hf models ls --warm --pipeline-tag image-classification --sort trending_score | |
| ``` | |
| ### Using the API | |
| <InferenceSnippet | |
| pipeline=image-classification | |
| providersMapping={ {"hf-inference":{"modelId":"Falconsai/nsfw_image_detection","providerModelId":"Falconsai/nsfw_image_detection"}} } | |
| /> | |
| ### API specification | |
| #### Request | |
| | Headers | | | | |
| | :--- | :--- | :--- | | |
| | **authorization** | _string_ | Authentication header in the form `'Bearer: hf_****'` when `hf_****` is a personal user access token with "Inference Providers" permission. You can generate one from [your settings page](https://huggingface.co/settings/tokens/new?ownUserPermissions=inference.serverless.write&tokenType=fineGrained). | | |
| | Payload | | | | |
| | :--- | :--- | :--- | | |
| | **inputs*** | _string_ | The input image data as a base64-encoded string. If no `parameters` are provided, you can also provide the image data as a raw bytes payload. | | |
| | **parameters** | _object_ | | | |
| | ** function_to_apply** | _enum_ | Possible values: sigmoid, softmax, none. | | |
| | ** top_k** | _integer_ | When specified, limits the output to the top K most probable classes. | | |
| #### Response | |
| | Body | | | |
| | :--- | :--- | :--- | | |
| | **(array)** | _object[]_ | Output is an array of objects. | | |
| | ** label** | _string_ | The predicted class label. | | |
| | ** score** | _number_ | The corresponding probability. | | |
Xet Storage Details
- Size:
- 2.64 kB
- Xet hash:
- 593c6b22fa4d485a9450aa41c0efcbbcd21a74e4e269be65279d29d80782842d
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.