Skip to main content

FastViT model for use with Autodistill

Project description

Autodistill FastViT Module

This repository contains the code supporting the FastViT base model for use with Autodistill.

FastViT, developed by Apple, is a classification model that supports zero-shot classification.

Read the full Autodistill documentation.

Read the FastViT Autodistill documentation.

Installation

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

pip3 install autodistill-fastvit

Quickstart

FastViT works using the ImageNet-1k class list. This class list is available in the FASTVIT_IMAGENET_1K_CLASSES variable.

You can provide classes from the list to retrieve predictions for a specific class in the list. You can also provide a custom ontology to map classes from the list to your own classes.

from autodistill_fastvit import FastViT, FASTVIT_IMAGENET_1K_CLASSES
from autodistill.detection import CaptionOntology

# zero shot with no prompts
base_model = FastViT(None)

# zero shot with prompts from FASTVIT_IMAGENET_1K_CLASSES
base_model = FastViT(
    ontology=CaptionOntology(
        {
            "coffeemaker": "coffeemaker",
            "ice cream": "ice cream"
        }
    )
)

predictions = base_model.predict("./example.png")

labels = [FASTVIT_IMAGENET_1K_CLASSES[i] for i in predictions.class_id.tolist()]

print(labels)

License

See LICENSE for the model license.

🏆 Contributing

We love your input! Please see the core Autodistill contributing guide to get started. Thank you 🙏 to all our contributors!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autodistill-fastvit-0.1.1.tar.gz (17.8 kB view hashes)

Uploaded Source

Built Distribution

autodistill_fastvit-0.1.1-py3-none-any.whl (11.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page