Instructions to use microsoft/resnet-18 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use microsoft/resnet-18 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="microsoft/resnet-18") pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")# Load model directly from transformers import AutoImageProcessor, AutoModelForImageClassification processor = AutoImageProcessor.from_pretrained("microsoft/resnet-18") model = AutoModelForImageClassification.from_pretrained("microsoft/resnet-18", device_map="auto") - Inference
- Notebooks
- Google Colab
- Kaggle
Fix code example
Browse files
README.md
CHANGED
|
@@ -46,8 +46,8 @@ Here is how to use this model:
|
|
| 46 |
>>> dataset = load_dataset("huggingface/cats-image")
|
| 47 |
>>> image = dataset["test"]["image"][0]
|
| 48 |
|
| 49 |
-
>>> feature_extractor = AutoFeatureExtractor.from_pretrained("microsoft/resnet-
|
| 50 |
-
>>> model = ResNetForImageClassification.from_pretrained("microsoft/resnet-
|
| 51 |
|
| 52 |
>>> inputs = feature_extractor(image, return_tensors="pt")
|
| 53 |
|
|
|
|
| 46 |
>>> dataset = load_dataset("huggingface/cats-image")
|
| 47 |
>>> image = dataset["test"]["image"][0]
|
| 48 |
|
| 49 |
+
>>> feature_extractor = AutoFeatureExtractor.from_pretrained("microsoft/resnet-18")
|
| 50 |
+
>>> model = ResNetForImageClassification.from_pretrained("microsoft/resnet-18")
|
| 51 |
|
| 52 |
>>> inputs = feature_extractor(image, return_tensors="pt")
|
| 53 |
|