lexandstuff commited on
Commit
660e29b
·
verified ·
1 Parent(s): 7a32e35

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. README.md +61 -3
  2. model.safetensors +3 -0
README.md CHANGED
@@ -1,3 +1,61 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ library_name: mlx-image
4
+ tags:
5
+ - mlx
6
+ - mlx-image
7
+ - vision
8
+ - image-classification
9
+ datasets:
10
+ - imagenet-1k
11
+ ---
12
+ # efficientnet_b0
13
+
14
+ An EFFICIENTNET-B0 image classification model. Pretrained on ImageNet-1K.
15
+
16
+ Disclaimer: This is a port of the PyTorch model weights to Apple MLX Framework.
17
+
18
+ ## How to use
19
+ ```bash
20
+ pip install mlx-image
21
+ ```
22
+
23
+ Here is how to use this model for image classification:
24
+
25
+ ```python
26
+ from mlxim.model import create_model
27
+ from mlxim.io import read_rgb
28
+ from mlxim.transform import ImageNetTransform
29
+
30
+ transform = ImageNetTransform(train=False, img_size=224)
31
+ x = transform(read_rgb("cat.png"))
32
+ x = mx.expand_dims(x, 0)
33
+
34
+ model = create_model("efficientnet_b0")
35
+ model.eval()
36
+
37
+ logits = model(x)
38
+ ```
39
+
40
+ You can also use the embeds from layer before head:
41
+ ```python
42
+ from mlxim.model import create_model
43
+ from mlxim.io import read_rgb
44
+ from mlxim.transform import ImageNetTransform
45
+
46
+ transform = ImageNetTransform(train=False, img_size=224)
47
+ x = transform(read_rgb("cat.png"))
48
+ x = mx.expand_dims(x, 0)
49
+
50
+ # first option
51
+ model = create_model("efficientnet_b0", num_classes=0)
52
+ model.eval()
53
+
54
+ embeds = model(x)
55
+
56
+ # second option
57
+ model = create_model("efficientnet_b0")
58
+ model.eval()
59
+
60
+ embeds = model.get_features(x)
61
+ ```
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:983c97b98acf9239e4fc4c37775ef36c9633e7692e0c543608372b86aab3ae78
3
+ size 21355017