File size: 977 Bytes
c8b8cdf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
---
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)
```
|