Gabriele commited on
Commit
d075dda
·
1 Parent(s): d0e7527

PCA visualization: add whitening and sigmoid

Browse files
Files changed (1) hide show
  1. README.md +2 -1
README.md CHANGED
@@ -96,7 +96,8 @@ from sklearn.decomposition import PCA
96
 
97
  spatial = out.patch_tokens.reshape(1, 32, 32, 768)
98
  feat = spatial[0].detach().numpy().reshape(-1, 768)
99
- rgb = PCA(n_components=3).fit_transform(feat).reshape(32, 32, 3)
 
100
  print(rgb.shape) # (32, 32, 3) — PCA of patch features as RGB
101
  ```
102
 
 
96
 
97
  spatial = out.patch_tokens.reshape(1, 32, 32, 768)
98
  feat = spatial[0].detach().numpy().reshape(-1, 768)
99
+ rgb = PCA(n_components=3, whiten=True).fit_transform(feat).reshape(32, 32, 3)
100
+ rgb = 1 / (1 + np.exp(-2.0 * rgb)) # sigmoid for [0, 1] range with good contrast
101
  print(rgb.shape) # (32, 32, 3) — PCA of patch features as RGB
102
  ```
103