autodistill-bioclip


Nameautodistill-bioclip JSON
Version 0.1.0 PyPI version JSON
download
home_page
SummaryBioCLIP model for use with Autodistill
upload_time2024-02-08 09:09:54
maintainer
docs_urlNone
authorRoboflow
requires_python>=3.7
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <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 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!

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "autodistill-bioclip",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "",
    "author": "Roboflow",
    "author_email": "support@roboflow.com",
    "download_url": "https://files.pythonhosted.org/packages/dd/a2/8cbb914dd506cec9ec4661dcd221950bdd51fdad5f890324c43273b9d614/autodistill-bioclip-0.1.0.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n  <p>\n    <a align=\"center\" href=\"\" target=\"_blank\">\n      <img\n        width=\"850\"\n        src=\"https://media.roboflow.com/open-source/autodistill/autodistill-banner.png\"\n      >\n    </a>\n  </p>\n</div>\n\n# Autodistill BioCLIP Module\n\nThis repository contains the code supporting the BioCLIP base model for use with [Autodistill](https://github.com/autodistill/autodistill).\n\n[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.\n\nYou 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/).\n\nRead the full [Autodistill documentation](https://autodistill.github.io/autodistill/).\n\nRead the [BioCLIP Autodistill documentation](https://autodistill.github.io/autodistill/base_models/bioclip/).\n\n## Installation\n\nTo use BioCLIP with autodistill, you need to install the following dependency:\n\n\n```bash\npip3 install autodistill-bioclip\n```\n\n## Quickstart\n\n```python\nfrom autodistill_bioclip import BioCLIP\n\n# define an ontology to map class names to our BioCLIP prompt\n# the ontology dictionary has the format {caption: class}\n# where caption is the prompt sent to the base model, and class is the label that will\n# be saved for that caption in the generated annotations\n# then, load the model\nclasses = [\"arabica\", \"robusta\"]\n\nbase_model = BioCLIP(\n    ontology=CaptionOntology(\n        {\n            item: item for item in classes\n        }\n    )\n)\n\nresults = base_model.predict(\"../arabica.jpeg\")\n\ntop = results.get_top_k(1)\ntop_class = classes[top[0][0]]\n\nprint(f\"Predicted class: {top_class}\")\n```\n\n\n## License\n\nThis project is licensed under an [MIT license](LICENSE).\n\nThe underlying [BioCLIP model](https://huggingface.co/imageomics/bioclip) is also licensed under an MIT license.\n\n## \ud83c\udfc6 Contributing\n\nWe love your input! Please see the core Autodistill [contributing guide](https://github.com/autodistill/autodistill/blob/main/CONTRIBUTING.md) to get started. Thank you \ud83d\ude4f to all our contributors!\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "BioCLIP model for use with Autodistill",
    "version": "0.1.0",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cb9fd4c2306e93e5c8f4beda2c323f6530794caf48bdd5b5a14a7c333b3a3ac9",
                "md5": "a8e524f9c76cb2284354fbd932d8539a",
                "sha256": "96ffacde93916bd22f4fd09af97ba30c438b92281dca56be26f0e9739c0f8298"
            },
            "downloads": -1,
            "filename": "autodistill_bioclip-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a8e524f9c76cb2284354fbd932d8539a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 4483,
            "upload_time": "2024-02-08T09:09:53",
            "upload_time_iso_8601": "2024-02-08T09:09:53.304394Z",
            "url": "https://files.pythonhosted.org/packages/cb/9f/d4c2306e93e5c8f4beda2c323f6530794caf48bdd5b5a14a7c333b3a3ac9/autodistill_bioclip-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dda28cbb914dd506cec9ec4661dcd221950bdd51fdad5f890324c43273b9d614",
                "md5": "be02e1554caf038ffe74ee3341de412f",
                "sha256": "c87f28bd6a758be599dbb0108ed92ac84a3ee81cb95f23f69e9408d10a1135ac"
            },
            "downloads": -1,
            "filename": "autodistill-bioclip-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "be02e1554caf038ffe74ee3341de412f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 4206,
            "upload_time": "2024-02-08T09:09:54",
            "upload_time_iso_8601": "2024-02-08T09:09:54.663687Z",
            "url": "https://files.pythonhosted.org/packages/dd/a2/8cbb914dd506cec9ec4661dcd221950bdd51fdad5f890324c43273b9d614/autodistill-bioclip-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-08 09:09:54",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "autodistill-bioclip"
}
        
Elapsed time: 0.55760s