Skip to main content

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!

Release files for autodistill-fastvit 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for autodistill-fastvit 0.1.2
File Size Uploaded
autodistill_fastvit-0.1.2.tar.gz 18.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for autodistill-fastvit 0.1.2
File Interpreter ABI Platform
autodistill_fastvit-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 30.0 kB

Release files / autodistill_fastvit-0.1.2.tar.gz

Download URL autodistill_fastvit-0.1.2.tar.gz
Size 18.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2a661d941e802dce473774abd8cdcb413c43a88426578c008d4e7ef0d48060b9
BLAKE2b-256 checksum
How to use checksums
bb0af21e7f0ed4379e1a74ca27dcfb0a097acb48e939408c31b5bb5c927f676d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release files / autodistill_fastvit-0.1.2-py3-none-any.whl

Download URL autodistill_fastvit-0.1.2-py3-none-any.whl
Size 11.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f478c93ee934dfd07b4542fb3aec43d9f765766d40f061debb7e36afab9cbbdf
BLAKE2b-256 checksum
How to use checksums
d5bd39cd9567c3212195f3f46eaa0bba0da31dce1acfb520d4c8fc6c933a0fd7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.7

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page