autodistill-metaclip


Nameautodistill-metaclip JSON
Version 0.1.3 PyPI version JSON
download
home_pagehttps://github.com/autodistill/autodistill-metaclip
SummaryMetaCLIP base model for use with Autodistill.
upload_time2023-12-05 09:10:45
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 MetaCLIP Module

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

[MetaCLIP](https://github.com/facebookresearch/MetaCLIP), developed by Meta AI Research, is a computer vision model trained using pairs of images and text. The model was described in the [Demystifying CLIP Data](https://arxiv.org/abs/2309.16671) paper. You can use MetaCLIP with autodistill for image classification.

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

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

## Installation

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

```bash
pip3 install autodistill-metaclip
```

## Quickstart

### get predictions

```python
from autodistill_metaclip import MetaCLIP

# define an ontology to map class names to our MetaCLIP 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 = MetaCLIP(
    ontology=CaptionOntology(
        {
            "person": "person",
            "a forklift": "forklift"
        }
    )
)

results = base_model.predict("./image.png")
print(results)
```

### calculate and compare embeddings

```python
from autodistill_metaclip import MetaCLIP

base_model = MetaCLIP(None)

text = base_model.embed_text("coffee")
image = base_model.embed_image("coffeeshop.jpg")

print(base_model.compare(text, image))
```

## License

This project was licensed under a Creative Commons [Attribution-NonCommercial 4.0 International](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": "https://github.com/autodistill/autodistill-metaclip",
    "name": "autodistill-metaclip",
    "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/56/12/c9c4f7323713c101b028a411af5c300ef0912840acfe33af9529cf82867e/autodistill-metaclip-0.1.3.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 MetaCLIP Module\n\nThis repository contains the code supporting the MetaCLIP base model for use with [Autodistill](https://github.com/autodistill/autodistill).\n\n[MetaCLIP](https://github.com/facebookresearch/MetaCLIP), developed by Meta AI Research, is a computer vision model trained using pairs of images and text. The model was described in the [Demystifying CLIP Data](https://arxiv.org/abs/2309.16671) paper. You can use MetaCLIP with autodistill for image classification.\n\nRead the full [Autodistill documentation](https://autodistill.github.io/autodistill/).\n\nRead the [MetaCLIP Autodistill documentation](https://autodistill.github.io/autodistill/base_models/metaclip/).\n\n## Installation\n\nTo use MetaCLIP with autodistill, you need to install the following dependency:\n\n```bash\npip3 install autodistill-metaclip\n```\n\n## Quickstart\n\n### get predictions\n\n```python\nfrom autodistill_metaclip import MetaCLIP\n\n# define an ontology to map class names to our MetaCLIP 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\nbase_model = MetaCLIP(\n    ontology=CaptionOntology(\n        {\n            \"person\": \"person\",\n            \"a forklift\": \"forklift\"\n        }\n    )\n)\n\nresults = base_model.predict(\"./image.png\")\nprint(results)\n```\n\n### calculate and compare embeddings\n\n```python\nfrom autodistill_metaclip import MetaCLIP\n\nbase_model = MetaCLIP(None)\n\ntext = base_model.embed_text(\"coffee\")\nimage = base_model.embed_image(\"coffeeshop.jpg\")\n\nprint(base_model.compare(text, image))\n```\n\n## License\n\nThis project was licensed under a Creative Commons [Attribution-NonCommercial 4.0 International](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": "MetaCLIP base model for use with Autodistill.",
    "version": "0.1.3",
    "project_urls": {
        "Homepage": "https://github.com/autodistill/autodistill-metaclip"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1a826547a18c55e628e85b83c219230cede1b6a1150c22f529acf9042d4e4948",
                "md5": "954c00365b0d201df4953980d944848e",
                "sha256": "7ce6fa139e3a8a236b59a1dfd6713faf4584c9dfd334c8544fbf6cf59f5ca2e7"
            },
            "downloads": -1,
            "filename": "autodistill_metaclip-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "954c00365b0d201df4953980d944848e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 10149,
            "upload_time": "2023-12-05T09:10:43",
            "upload_time_iso_8601": "2023-12-05T09:10:43.043151Z",
            "url": "https://files.pythonhosted.org/packages/1a/82/6547a18c55e628e85b83c219230cede1b6a1150c22f529acf9042d4e4948/autodistill_metaclip-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5612c9c4f7323713c101b028a411af5c300ef0912840acfe33af9529cf82867e",
                "md5": "7f41b37853e18d6c29ece27dcdbcd26b",
                "sha256": "3826aa55404601047a5dda0f51aac787e4e77b9d2aff4156a237ced65b100d38"
            },
            "downloads": -1,
            "filename": "autodistill-metaclip-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "7f41b37853e18d6c29ece27dcdbcd26b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 9727,
            "upload_time": "2023-12-05T09:10:45",
            "upload_time_iso_8601": "2023-12-05T09:10:45.718760Z",
            "url": "https://files.pythonhosted.org/packages/56/12/c9c4f7323713c101b028a411af5c300ef0912840acfe33af9529cf82867e/autodistill-metaclip-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-12-05 09:10:45",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "autodistill",
    "github_project": "autodistill-metaclip",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "autodistill-metaclip"
}
        
Elapsed time: 0.35017s