Kosmos-2 base model for use with Autodistill.
Project description
Autodistill Kosmos-2 Module
This repository contains the code supporting the Kosmos-2 base model for use with Autodistill.
Kosmos-2, developed by Microsoft, is a multimodal language model that you can use for zero-shot object detection. You can use Kosmos-2 with autodistill for object detection.
Read the full Autodistill documentation.
Read the Kosmos-2 Autodistill documentation.
Installation
To use Kosmos-2 with autodistill, you need to install the following dependency:
pip3 install autodistill-kosmos-2
Quickstart
from autodistill_kosmos_2 import Kosmos2
# define an ontology to map class names to our Kosmos2 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 = Kosmos2(
ontology=CaptionOntology(
{
"person": "person",
"a forklift": "forklift"
}
)
)
predictions = base_model.predict("./example.png")
base_model.label("./context_images", extension=".jpeg")
License
This package is implemented using the Transformers Kosmos-2 work in progress implementation. The underlying Kosmos-2 model, developed by Microsoft, is licensed under an MIT license.
🏆 Contributing
We love your input! Please see the core Autodistill contributing guide to get started. Thank you 🙏 to all our contributors!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for autodistill-kosmos-2-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d280d6058679a3c046e334f4cb0b6f0247e132d0b28257adb8f91f737e97d5f |
|
MD5 | 6c29aaa6c9eae49ab6dd52842c877e12 |
|
BLAKE2b-256 | e4f0786671b1767c7eac313ed86640c667aeb37c8f45ddeb6354dbfb09e809c7 |
Hashes for autodistill_kosmos_2-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 989a4cc30cc729903c1327c009084b653f80964964ccf542492fc138b8b51c5c |
|
MD5 | 024c6573a70959d258fd8839d7a5efbb |
|
BLAKE2b-256 | 68aeb4563eba9bf791fd10a75d6af4e371af52b1971f716e83d08b6778585d8c |