Gabriele commited on
Commit ·
6f6f8e8
1
Parent(s): bc0c462
Update README
Browse files
README.md
CHANGED
|
@@ -74,6 +74,17 @@ similarity = cls @ text_emb.T
|
|
| 74 |
prediction = similarity.argmax(dim=-1)
|
| 75 |
```
|
| 76 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 77 |
### GPU inference
|
| 78 |
|
| 79 |
```python
|
|
|
|
| 74 |
prediction = similarity.argmax(dim=-1)
|
| 75 |
```
|
| 76 |
|
| 77 |
+
### Zero-shot segmentation
|
| 78 |
+
|
| 79 |
+
```python
|
| 80 |
+
import numpy as np
|
| 81 |
+
from sklearn.decomposition import PCA
|
| 82 |
+
|
| 83 |
+
spatial = out.patch_tokens.reshape(1, 32, 32, 768)
|
| 84 |
+
feat = spatial[0].detach().numpy().reshape(-1, 768)
|
| 85 |
+
rgb = PCA(n_components=3).fit_transform(feat).reshape(32, 32, 3)
|
| 86 |
+
```
|
| 87 |
+
|
| 88 |
### GPU inference
|
| 89 |
|
| 90 |
```python
|