Metadata-Version: 2.1
Name: autodistill-efficient-yolo-world
Version: 0.1.1
Summary: EfficientSAM + YOLO-World base model for use with Autodistill
Home-page: https://github.com/roboflow/autodistill-efficient-yolo-world
Author: Roboflow
Author-email: support@roboflow.com
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
Requires-Dist: supervision
Requires-Dist: autodistill-yolo-world
Requires-Dist: autodistill-efficientsam
Requires-Dist: numpy
Requires-Dist: torch
Provides-Extra: dev
Requires-Dist: flake8; extra == "dev"
Requires-Dist: black==22.3.0; extra == "dev"
Requires-Dist: isort; extra == "dev"
Requires-Dist: twine; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Requires-Dist: wheel; extra == "dev"

<div align="center">
  <p>
    <a align="center" href="" target="_blank">
      <img
        width="850"
        src="https://media.roboflow.com/open-source/autodistill/autodistill-banner.png"
      >
    </a>
  </p>
</div>

# Autodistill EfficientYOLOWorld Module

This repository contains the code supporting the EfficientYOLOWorld base model for use with [Autodistill](https://github.com/autodistill/autodistill).

EfficientYOLOWorld is a combination of two models:

1. YOLO-World, a zero-shot object detection model, and;
2. EfficientSAM, an image segmentation model.

This model runs EfficientSAM on each bounding box region generated by YOLO-World. This allows you to retrieve both the bounding box and the segmentation mask for each object of interest in an image.

Read the full [Autodistill documentation](https://autodistill.github.io/autodistill/).

Read the [EfficientYOLOWorld Autodistill documentation](https://autodistill.github.io/autodistill/base_models/efficient_yolo_world/).

## Installation

To use EfficientYOLOWorld with autodistill, you need to install the following dependency:


```bash
pip3 install autodistill-efficient-yolo-world
```

## Quickstart

```python
from autodistill_efficient_yolo_world import EfficientYOLOWorld
from autodistill.detection import CaptionOntology
import cv2
import supervision as sv

# define an ontology to map class names to our EfficientYOLOWorld prompt
# the ontology dictionary has the format {caption: class}
# where caption is the prompt sent to the base model, and class is the label that will
# be saved for that caption in the generated annotations
# then, load the model
base_model = EfficientYOLOWorld(ontology=CaptionOntology({"book": "book"}))

# predict on an image
result = base_model.predict("bookshelf.jpeg", confidence=0.1)

image = cv2.imread("bookshelf.jpeg")

mask_annotator = sv.MaskAnnotator()
annotated_frame = mask_annotator.annotate(
	scene=image.copy(),
	detections=result,
)

sv.plot_image(annotated_frame)

base_model.label("./context_images", extension=".jpeg")
```


## License

EfficientSAM is licensed under an [Apache 2.0 license](EFFICIENT_SAM_LICENSE).

YOLO-World is licensed under a [GPL-3.0 license](YOLO_WORLD_LICENSE).

## 🏆 Contributing

We love your input! Please see the core Autodistill [contributing guide](https://github.com/autodistill/autodistill/blob/main/CONTRIBUTING.md) to get started. Thank you 🙏 to all our contributors!
