riccardomusmeci
commited on
Commit
•
aae35ab
1
Parent(s):
1ac026b
Update README.md
Browse files
README.md
CHANGED
@@ -1,8 +1,66 @@
|
|
1 |
---
|
2 |
-
license:
|
3 |
tags:
|
4 |
- mlx
|
5 |
-
- mlx-
|
6 |
-
-
|
7 |
-
-
|
|
|
|
|
|
|
|
|
8 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
license: apache-2.0
|
3 |
tags:
|
4 |
- mlx
|
5 |
+
- mlx-image
|
6 |
+
- vision
|
7 |
+
- image-classification
|
8 |
+
datasets:
|
9 |
+
- imagenet-1k
|
10 |
+
library_name: mlx-image
|
11 |
+
|
12 |
---
|
13 |
+
|
14 |
+
# WideResNet50 2
|
15 |
+
|
16 |
+
WideResNet50 2 is a computer vision model trained on imagenet-1k representing an improvement of ResNet architecture. It was introduced in the paper [Wide Residual Networks](https://arxiv.org/abs/1605.07146).
|
17 |
+
|
18 |
+
Disclaimer: This is a porting of the torchvision model weights to Apple MLX Framework.
|
19 |
+
|
20 |
+
|
21 |
+
## How to use
|
22 |
+
```bash
|
23 |
+
pip install mlx-image
|
24 |
+
```
|
25 |
+
|
26 |
+
Here is how to use this model for image classification:
|
27 |
+
|
28 |
+
```python
|
29 |
+
from mlxim.model import create_model
|
30 |
+
from mlxim.io import read_rgb
|
31 |
+
from mlxim.transform import ImageNetTransform
|
32 |
+
|
33 |
+
transform = ImageNetTransform(train=False, img_size=224)
|
34 |
+
x = transform(read_rgb("cat.png"))
|
35 |
+
x = mx.expand_dims(x, 0)
|
36 |
+
|
37 |
+
model = create_model("resnet18")
|
38 |
+
model.eval()
|
39 |
+
|
40 |
+
logits = model(x)
|
41 |
+
```
|
42 |
+
|
43 |
+
You can also use the embeds from last conv layer:
|
44 |
+
```python
|
45 |
+
from mlxim.model import create_model
|
46 |
+
from mlxim.io import read_rgb
|
47 |
+
from mlxim.transform import ImageNetTransform
|
48 |
+
|
49 |
+
transform = ImageNetTransform(train=False, img_size=224)
|
50 |
+
x = transform(read_rgb("cat.png"))
|
51 |
+
x = mx.expand_dims(x, 0)
|
52 |
+
|
53 |
+
# first option
|
54 |
+
model = create_model("resnet18", num_classes=0)
|
55 |
+
model.eval()
|
56 |
+
|
57 |
+
embeds = model(x)
|
58 |
+
|
59 |
+
# second option
|
60 |
+
model = create_model("resnet18")
|
61 |
+
model.eval()
|
62 |
+
|
63 |
+
embeds = model.features(x)
|
64 |
+
```
|
65 |
+
|
66 |
+
https://arxiv.org/abs/1605.07146
|