Commit
·
b245f32
1
Parent(s):
11effdf
Update README.md
Browse files
README.md
CHANGED
|
@@ -15,23 +15,23 @@ The input shape of the model is 224, 224, 12. To extract features you should rem
|
|
| 15 |
The model can be read as (example in jupyer):
|
| 16 |
```
|
| 17 |
!git lfs install
|
| 18 |
-
!git clone https://huggingface.co/MITCriticalData/Sentinel-
|
| 19 |
|
| 20 |
import tensorflow as tf
|
| 21 |
from transformers import TFViTModel
|
| 22 |
|
| 23 |
|
| 24 |
-
model = tf.keras.models.load_model('Sentinel-
|
| 25 |
```
|
| 26 |
|
| 27 |
You can extract the embeddings removing the last layer using:
|
| 28 |
```
|
| 29 |
import tensorflow as tf
|
| 30 |
|
| 31 |
-
|
| 32 |
|
| 33 |
-
for layer in
|
| 34 |
-
|
| 35 |
|
| 36 |
```
|
| 37 |
|
|
|
|
| 15 |
The model can be read as (example in jupyer):
|
| 16 |
```
|
| 17 |
!git lfs install
|
| 18 |
+
!git clone https://huggingface.co/MITCriticalData/Sentinel-2_ViT_Autoencoder_12Bands
|
| 19 |
|
| 20 |
import tensorflow as tf
|
| 21 |
from transformers import TFViTModel
|
| 22 |
|
| 23 |
|
| 24 |
+
model = tf.keras.models.load_model('Sentinel-2_ViT_Autoencoder_12Bands', custom_objects={"TFViTModel": TFViTModel})
|
| 25 |
```
|
| 26 |
|
| 27 |
You can extract the embeddings removing the last layer using:
|
| 28 |
```
|
| 29 |
import tensorflow as tf
|
| 30 |
|
| 31 |
+
backbone = tf.keras.Sequential()
|
| 32 |
|
| 33 |
+
for layer in model.layers[:-1]: # just exclude last layer from copying
|
| 34 |
+
backbone.add(layer)
|
| 35 |
|
| 36 |
```
|
| 37 |
|