Skip to content

Commit

Permalink
colab
Browse files Browse the repository at this point in the history
  • Loading branch information
huzeyann committed Feb 7, 2024
1 parent 3d548bf commit 6896ae5
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 50 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ toy.py
tmp
core
*.pkl
*.pth
*.pt
*.npy
*.npz
Expand Down
Binary file added assets/weights/clip_factorTopy.pth
Binary file not shown.
15 changes: 9 additions & 6 deletions brainnet/plmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,19 @@


class PLModel(pl.LightningModule):
def __init__(self, config, backbone, cached=True, draw=True):
def __init__(self, config, backbone, cached=True, draw=True, skip_data=False):
super().__init__()
self.config = config
self.draw = draw

# dataset
self.dataset = BrainDataset(config.DATASET.DATA_DIR, config.DATASET.RESOLUTION)
self.train_dataset, self.val_dataset = torch.utils.data.random_split(
self.dataset, [9000, 841]
)
if not skip_data:
self.dataset = BrainDataset(
config.DATASET.DATA_DIR, config.DATASET.RESOLUTION
)
self.train_dataset, self.val_dataset = torch.utils.data.random_split(
self.dataset, [9000, 841]
)

# coordinates
self.coords = load_coords()[nsdgeneral_indices]
Expand Down Expand Up @@ -249,7 +252,7 @@ def get_top_channels(self, x):
for roi in roi_names:
# roi_indices
roi_indices = rh_roi_dict[roi]
fsaverage = np.zeros(327684) # convert fsaverage and nsdgeneral space
fsaverage = np.zeros(327684) # convert fsaverage and nsdgeneral space
fsaverage[nsdgeneral_indices] = np.arange(nsdgeneral_indices.shape[0])
roi_indices = fsaverage[roi_indices]
# pca of weights
Expand Down
1 change: 1 addition & 0 deletions conda_env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ dependencies:
- scipy
- fast-pytorch-kmeans
- einops
- colorstamps
- open_clip_torch==2.20.0
- git+https://github.com/facebookresearch/segment-anything.git@6fdee8f2727f4506cfbbe553e23b895e27956588
- git+https://github.com/facebookresearch/dinov2.git@ebc1cba1096de0a5388527817cf1e5d4d3896699
Expand Down
81 changes: 38 additions & 43 deletions example.ipynb

Large diffs are not rendered by default.

0 comments on commit 6896ae5

Please sign in to comment.