Upload folder using huggingface_hub
Browse files- README.md +6 -5
- preprocessor_config.json +1 -1
README.md
CHANGED
|
@@ -26,17 +26,17 @@ This model is a ResNet50 architecture trained on the ImageNet dataset for image
|
|
| 26 |
## Usage
|
| 27 |
|
| 28 |
```python
|
| 29 |
-
from transformers import
|
| 30 |
import torch
|
| 31 |
from PIL import Image
|
| 32 |
|
| 33 |
-
# Load model and
|
| 34 |
model = AutoModelForImageClassification.from_pretrained("jatingocodeo/ImageNet")
|
| 35 |
-
|
| 36 |
|
| 37 |
# Prepare image
|
| 38 |
image = Image.open("path/to/image.jpg")
|
| 39 |
-
inputs =
|
| 40 |
|
| 41 |
# Get predictions
|
| 42 |
with torch.no_grad():
|
|
@@ -56,5 +56,6 @@ The model was trained on the ImageNet dataset with the following configuration:
|
|
| 56 |
## Preprocessing
|
| 57 |
|
| 58 |
The model expects images to be preprocessed as follows:
|
| 59 |
-
- Resize to
|
|
|
|
| 60 |
- Normalize with mean [0.485, 0.456, 0.406] and std [0.229, 0.224, 0.225]
|
|
|
|
| 26 |
## Usage
|
| 27 |
|
| 28 |
```python
|
| 29 |
+
from transformers import AutoFeatureExtractor, AutoModelForImageClassification
|
| 30 |
import torch
|
| 31 |
from PIL import Image
|
| 32 |
|
| 33 |
+
# Load model and feature extractor
|
| 34 |
model = AutoModelForImageClassification.from_pretrained("jatingocodeo/ImageNet")
|
| 35 |
+
feature_extractor = AutoFeatureExtractor.from_pretrained("jatingocodeo/ImageNet")
|
| 36 |
|
| 37 |
# Prepare image
|
| 38 |
image = Image.open("path/to/image.jpg")
|
| 39 |
+
inputs = feature_extractor(image, return_tensors="pt")
|
| 40 |
|
| 41 |
# Get predictions
|
| 42 |
with torch.no_grad():
|
|
|
|
| 56 |
## Preprocessing
|
| 57 |
|
| 58 |
The model expects images to be preprocessed as follows:
|
| 59 |
+
- Resize shortest edge to 224
|
| 60 |
+
- Center crop to 224x224
|
| 61 |
- Normalize with mean [0.485, 0.456, 0.406] and std [0.229, 0.224, 0.225]
|
preprocessor_config.json
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
{"do_normalize": true, "do_resize": true, "image_mean": [0.485, 0.456, 0.406], "
|
|
|
|
| 1 |
+
{"crop_size": {"height": 224, "width": 224}, "do_center_crop": true, "do_normalize": true, "do_resize": true, "feature_extractor_type": "ImageFeatureExtractor", "image_mean": [0.485, 0.456, 0.406], "image_std": [0.229, 0.224, 0.225], "resample": 2, "size": {"shortest_edge": 224}}
|