You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from autodistill_fastvit import FastViT, FASTVIT_IMAGENET_1K_CLASSES
from autodistill.detection import CaptionOntology
# zero shot with prompts from FASTVIT_IMAGENET_1K_CLASSES
base_model = FastViT(
ontology=CaptionOntology(
{
"Beagle": "beagle",
"Border Collie": "collie"
}
)
)
# zero shot without prompts
# base_model = FastViT(None)
predictions = base_model.predict("example.png")
labels = [FASTVIT_IMAGENET_1K_CLASSES[i] for i in predictions.class_id.tolist()]
print(labels)
ERROR
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
[<ipython-input-4-c319f567610d>](https://localhost:8080/#) in <cell line: 17>()
15 # base_model = FastViT(None)
16
---> 17 predictions = base_model.predict("example.png")
18
19 labels = [FASTVIT_IMAGENET_1K_CLASSES[i] for i in predictions.class_id.tolist()]
6 frames
[/usr/local/lib/python3.10/dist-packages/torchvision/transforms/_functional_tensor.py](https://localhost:8080/#) in normalize(tensor, mean, std, inplace)
926 if std.ndim == 1:
927 std = std.view(-1, 1, 1)
--> 928 return tensor.sub_(mean).div_(std)
929
930
RuntimeError: The size of tensor a (4) must match the size of tensor b (3) at non-singleton dimension 0
Additional
No response
Are you willing to submit a PR?
Yes I'd like to help by submitting a PR!
The text was updated successfully, but these errors were encountered:
This error is now fixed. The issue was that the image had four channels -- RGBA -- and the module only supports RGB images. The requisite conversion code has been added to autodistill-fastvit, and we will likely incorporate similar logic in the main autodistillload_image function.
To use the updated code, run pip install --upgrade autodistill-fastvit.
Search before asking
Bug
Environment
Minimal Reproducible Example
ERROR
Additional
No response
Are you willing to submit a PR?
The text was updated successfully, but these errors were encountered: