Image Classification
Image · HuggingFace · Visual
The Image Classification detector runs any HuggingFace image-classification pipeline on image assets. It returns labels and confidence scores, optionally maps specific labels to severity levels, and stores findings alongside the source image reference.
When to use
- NSFW detection — classify uploaded or scanned images for adult or explicit content before they reach storage or downstream systems.
- Harmful content filtering — flag images containing violence, self-harm indicators, or other policy-violating categories.
- Custom image category labelling — deploy a model fine-tuned on your own image dataset to tag product photos, document scans, or media assets.
- Automated content moderation — route high-severity predictions to a human review queue using
severity_map. - Compliance and data governance — detect sensitive image types (e.g. ID documents, medical imagery) in data lake scans.
How it works
Classifyre loads the HuggingFace vision model and runs the image-classification pipeline on each image asset. The top-k predictions above confidence_threshold are stored as findings. Labels in the severity_map override the default severity level.
The default model is google/vit-base-patch16-224 when no model is specified — a general-purpose ViT that serves as a useful baseline before you deploy a task-specific checkpoint.
Configuration
| Parameter | Type | Required | Description | Default | Constraints |
|---|---|---|---|---|---|
| model | string | No | HuggingFace hub ID or local path. Defaults to 'google/vit-base-patch16-224' when null. | null | — |
| model_revision | string | No | Git branch, tag, or commit hash when fetching from the HuggingFace hub. | null | — |
| device | string | No | Inference device: 'cpu' (default), 'cuda', 'mps', or a CUDA device string like 'cuda:0'. | cpu | — |
| top_k | integer | No | Maximum number of top predictions to return per image. | null | — |
| function_to_apply | string | No | Score normalization applied after the model forward pass. | null | — |
| confidence_threshold | number | No | Minimum prediction confidence to report a label as a finding (0-1). Defaults to 0 so all top_k predictions are reported. | 0 | min 0, max 1 |
| severity_map | array | No | Ordered rules mapping predicted labels to severity levels. Labels with no matching rule receive 'info' severity. | null | — |
Examples
NSFW image detection (default model)
{
"type": "IMAGE_CLASSIFICATION",
"confidence_threshold": 0.75,
"severity_map": [
{ "label": "nsfw", "severity": "high" },
{ "label": "suggestive", "severity": "medium" }
]
}Custom document-type classifier
{
"type": "IMAGE_CLASSIFICATION",
"model": "my-org/document-type-classifier",
"model_revision": "main",
"device": "cpu",
"top_k": 3,
"confidence_threshold": 0.6,
"severity_map": [
{ "label": "passport", "severity": "high" },
{ "label": "id_card", "severity": "high" },
{ "label": "medical_record", "severity": "high" }
],
"severity": "info"
}Last updated on