|
--- |
|
language: |
|
- en |
|
tags: |
|
- openvino |
|
--- |
|
|
|
# microsoft-swin-tiny-patch4-window7-224-ov |
|
|
|
This is the [microsoft/swin-tiny-patch4-window7-224](https://huggingface.co/microsoft/swin-tiny-patch4-window7-224) model converted to [OpenVINO](https://openvino.ai), for accellerated inference. |
|
|
|
An example of how to do inference on this model: |
|
|
|
```python |
|
from optimum.intel.openvino import OVModelForImageClassification |
|
from transformers import AutoFeatureExtractor, pipeline |
|
|
|
model_id = "helenai/microsoft-swin-tiny-patch4-window7-224" |
|
model = OVModelForImageClassification.from_pretrained(model_id, compile=False) |
|
feature_extractor = AutoFeatureExtractor.from_pretrained(model_id) |
|
|
|
model.reshape(1,3, feature_extractor.size["height"], feature_extractor.size["width"]) |
|
model.compile() |
|
ov_pipe = pipeline("image-classification", model=model, feature_extractor=feature_extractor) |
|
|
|
image_url_or_path = "http://images.cocodataset.org/val2017/000000039769.jpg" |
|
ov_pipe(image_url_or_path) |
|
``` |
|
|