Jorgvt commited on
Commit
bc344f8
·
1 Parent(s): 3867743

:tada: uploaded baseline model

Browse files
Files changed (4) hide show
  1. README.md +69 -0
  2. config.json +1 -0
  3. weights.msgpack +3 -0
  4. weights.safetensors +3 -0
README.md CHANGED
@@ -1,3 +1,72 @@
1
  ---
2
  license: apache-2.0
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
+ tags:
4
+ - jax
5
+ - safetensors
6
  ---
7
+
8
+ # Baseline PerceptNet
9
+
10
+ ## Model Description
11
+
12
+ ## How to use it
13
+
14
+ ### Install the model's package from source:
15
+ ```
16
+ git clone https://github.com/Jorgvt/paramperceptnet.git
17
+ cd paramperceptnet
18
+ pip install -e .
19
+ ```
20
+
21
+ ### 1.Import necessary libraries:
22
+
23
+ ```
24
+ import json
25
+
26
+ from huggingface_hub import hf_hub_download
27
+ import flax
28
+ import orbax.checkpoint
29
+ from ml_collections import ConfigDict
30
+
31
+ from paramperceptnet.models import Baseline as PerceptNet
32
+ ```
33
+
34
+ ### 2.Download the configuration
35
+
36
+ ```
37
+ config_path = hf_hub_download(repo_id="Jorgvt/ppnet-baseline",
38
+ filename="config.json")
39
+ with open(config_path, "r") as f:
40
+ config = ConfigDict(json.load(f))
41
+ ```
42
+
43
+ ### 3. Download the weights
44
+
45
+ #### 3.1. Using `safetensors`
46
+
47
+ ```
48
+ from safetensors.flax import load_file
49
+
50
+ weights_path = hf_hub_download(repo_id="Jorgvt/ppnet-baseline",
51
+ filename="weights.safetensors")
52
+ variables = load_file(weights_path)
53
+ variables = flax.traverse_util.unflatten_dict(variables, sep=".")
54
+ params = variables["params"]
55
+ ```
56
+
57
+ #### 3.2. Using `mgspack`
58
+ ```
59
+ weights_path = hf_hub_download(repo_id="Jorgvt/ppnet-fully-trained",
60
+ filename="weights.msgpack")
61
+ with open(weights_path, "rb") as f:
62
+ variables = orbax.checkpoint.msgpack_utils.msgpack_restore(f.read())
63
+ variables = jax.tree_util.tree_map(lambda x: jnp.array(x), variables)
64
+ params = variables["params"]
65
+ ```
66
+
67
+ ### 4. Use the model
68
+
69
+ ```
70
+ from jax import numpy as jnp
71
+ pred = model.apply({"params": params}, jnp.ones((1,384,512,3)))
72
+ ```
config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"A_GABOR": true, "A_GDNSPATIOFREQORIENT": true, "BATCH_SIZE": 64, "CS_KERNEL_SIZE": 5, "END_LR": 0.005, "EPOCHS": 500, "GABOR_KERNEL_SIZE": 5, "GDNFINAL_KERNEL_SIZE": 1, "GDNGAUSSIAN_KERNEL_SIZE": 1, "GDN_CLIPPING": true, "INITIAL_LR": 0.01, "INIT_GABOR": false, "INIT_JH": false, "LEARNING_RATE": 0.003, "NORMALIZE_ENERGY": true, "NORMALIZE_PROB": false, "PEAK_LR": 0.04, "SEED": 42, "TRAIN_CS": false, "TRAIN_GABOR": false, "TRAIN_GDNCOLOR": false, "TRAIN_GDNGAMMA": false, "TRAIN_GDNGAUSSIAN": false, "TRAIN_JH": false, "TRAIN_ONLY_LAST_GDN": true, "USE_BIAS": false, "USE_GAMMA": false, "WARMUP_EPOCHS": 15, "ZERO_MEAN": true}
weights.msgpack ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:77fd6911c18eb9813a955b568682809855201e4396889f34774920047f721e5d
3
+ size 30395788
weights.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6e0876beebc3fe5bff1ae63f484ce1ab25a90dbf624757f4962c888ef9d808a8
3
+ size 30396424