riccardomusmeci commited on
Commit
8e0b454
1 Parent(s): b265497

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +67 -0
README.md ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ {}
3
+ ---
4
+
5
+ ---
6
+ license: apache-2.0
7
+ tags:
8
+ - mlx
9
+ - mlx-image
10
+ - vision
11
+ - image-classification
12
+ datasets:
13
+ - imagenet-1k
14
+ library_name: mlx-image
15
+ ---
16
+ # regnet_y_800mf
17
+
18
+ A RegNetY-800MF image classification model. Pretrained in ImageNet by torchvision contributors (see ImageNet1K-V2 weight details https://github.com/pytorch/vision/issues/3995#new-recipe).
19
+
20
+ Disclaimer: This is a porting of the torch model weights to Apple MLX Framework.
21
+
22
+ ## How to use
23
+ ```bash
24
+ pip install mlx-image
25
+ ```
26
+
27
+ Here is how to use this model for image classification:
28
+
29
+ ```python
30
+ from mlxim.model import create_model
31
+ from mlxim.io import read_rgb
32
+ from mlxim.transform import ImageNetTransform
33
+
34
+ transform = ImageNetTransform(train=False, img_size=224)
35
+ x = transform(read_rgb("cat.png"))
36
+ x = mx.expand_dims(x, 0)
37
+
38
+ model = create_model("regnet_y_800mf")
39
+ model.eval()
40
+
41
+ logits = model(x)
42
+ ```
43
+
44
+ You can also use the embeds from layer before head:
45
+ ```python
46
+ from mlxim.model import create_model
47
+ from mlxim.io import read_rgb
48
+ from mlxim.transform import ImageNetTransform
49
+
50
+ transform = ImageNetTransform(train=False, img_size=224)
51
+ x = transform(read_rgb("cat.png"))
52
+ x = mx.expand_dims(x, 0)
53
+
54
+ # first option
55
+ model = create_model("regnet_y_800mf", num_classes=0)
56
+ model.eval()
57
+
58
+ embeds = model(x)
59
+
60
+ # second option
61
+ model = create_model("regnet_y_800mf")
62
+ model.eval()
63
+
64
+ embeds = model.get_features(x)
65
+ ```
66
+
67
+