Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
machineuser commited on
Commit ·
e7caf98
1
Parent(s): 7fd9bbe
Sync widgets demo
Browse filesFiles changed (2)
123456789101112131415161718192021222324252627282930313233343536373839## Use Cases
### Object Search
Zero-shot object detection models can be used in image search. Smartphones, for example, use zero-shot object detection models to detect entities (such as specific places or objects) and allow the user to search for the entity on the internet.
### Object Counting
Zero-shot object detection models are used to count instances of objects in a given image. This can include counting the objects in warehouses or stores or the number of visitors in a store. They are also used to manage crowds at events to prevent disasters.
## Inference
You can infer with zero-shot object detection models through the `zero-shot-object-detection` pipeline. When calling the pipeline, you just need to specify a path or HTTP link to an image and the candidate labels.
```pythonfrom transformers import pipelinefrom PIL import Image
image = Image.open("my-image.png").convert("RGB")
detector = pipeline(model="google/owlvit-base-patch32", task="zero-shot-object-detection")
predictions = detector( image, candidate_labels=["a photo of a cat", "a photo of a dog"],)
# [{'score': 0.95,# 'label': 'a photo of a cat',# 'box': {'xmin': 180, 'ymin': 71, 'xmax': 271, 'ymax': 178}},# ...# ]```
# Useful Resources
- [Zero-shot object detection task guide](https://huggingface.co/docs/transformers/tasks/zero_shot_object_detection)
This page was made possible thanks to the efforts of [Victor Guichard](https://huggingface.co/VictorGuichard)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657import type { TaskDataCustom } from "..";
const taskData: TaskDataCustom = { datasets: [], demo: { inputs: [ { filename: "zero-shot-object-detection-input.jpg", type: "img", }, { label: "Classes", content: "cat, dog, bird", type: "text", }, ], outputs: [ { filename: "zero-shot-object-detection-output.jpg", type: "img", }, ], }, metrics: [ { description: "The Average Precision (AP) metric is the Area Under the PR Curve (AUC-PR). It is calculated for each class separately", id: "Average Precision", }, { description: "The Mean Average Precision (mAP) metric is the overall average of the AP values", id: "Mean Average Precision", }, { description: "The APα metric is the Average Precision at the IoU threshold of a α value, for example, AP50 and AP75", id: "APα", }, ], models: [ { description: "Solid zero-shot object detection model that uses CLIP as backbone.", id: "google/owlvit-base-patch32", }, { description: "The improved version of the owlvit model.", id: "google/owlv2-base-patch16-ensemble", }, ], spaces: [], summary: "Zero-shot object detection is a computer vision task to detect objects and their classes in images, without any prior training or knowledge of the classes. Zero-shot object detection models receive an image as input, as well as a list of candidate classes, and output the bounding boxes and labels where the objects have been detected.", widgetModels: [], youtubeId: "",};
export default taskData;packages/tasks/src/tasks/zero-shot-object-detection/about.mdAdded+39
packages/tasks/src/tasks/zero-shot-object-detection/data.tsAdded+57