https://github.com/autodistill/autodistill-bioclip
BioCLIP base model for use with Autodistill.
https://github.com/autodistill/autodistill-bioclip
autodistill bioclip biology computer-vision zero-shot-classification
Last synced: 4 months ago
JSON representation
BioCLIP base model for use with Autodistill.
- Host: GitHub
- URL: https://github.com/autodistill/autodistill-bioclip
- Owner: autodistill
- License: mit
- Created: 2024-02-08T08:05:02.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-08T09:09:38.000Z (over 1 year ago)
- Last Synced: 2024-12-30T19:48:47.631Z (6 months ago)
- Topics: autodistill, bioclip, biology, computer-vision, zero-shot-classification
- Language: Python
- Homepage: https://docs.autodistill.com
- Size: 6.84 KB
- Stars: 1
- Watchers: 5
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Autodistill BioCLIP Module
This repository contains the code supporting the BioCLIP base model for use with [Autodistill](https://github.com/autodistill/autodistill).
[BioCLIP](https://github.com/Imageomics/BioCLIP) is a CLIP model trained on the [TreeOfLife-10M](https://huggingface.co/datasets/imageomics/TreeOfLife-10M) dataset, created by the researchers who made BioCLIP. The dataset on which BioCLIP was trained included more than 450,000 classes.
You can use BioCLIP to auto-label natural organisms (i.e. animals, plants) in images for use in training a classification model. You can combine this model with a grounded detection model to identify the exact region in which a given class is present in an image. [Learn more about combining models with Autodistill](https://docs.autodistill.com/utilities/combine-models/).
Read the full [Autodistill documentation](https://autodistill.github.io/autodistill/).
Read the [BioCLIP Autodistill documentation](https://autodistill.github.io/autodistill/base_models/bioclip/).
## Installation
To use BioCLIP with autodistill, you need to install the following dependency:
```bash
pip3 install autodistill-bioclip
```## Quickstart
```python
from autodistill_bioclip import BioCLIP# define an ontology to map class names to our BioCLIP 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
classes = ["arabica", "robusta"]base_model = BioCLIP(
ontology=CaptionOntology(
{
item: item for item in classes
}
)
)results = base_model.predict("../arabica.jpeg")
top = results.get_top_k(1)
top_class = classes[top[0][0]]print(f"Predicted class: {top_class}")
```## License
This project is licensed under an [MIT license](LICENSE).
The underlying [BioCLIP model](https://huggingface.co/imageomics/bioclip) is also licensed under an MIT 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!