-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
restructure repo st transforms, datasets, dictionaries are all in bas…
…e level, not in data dir
- Loading branch information
belsten
committed
Nov 22, 2024
1 parent
828dc9d
commit 32848c3
Showing
5 changed files
with
82 additions
and
63 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import os | ||
import torch | ||
import numpy as np | ||
import pickle as pkl | ||
|
||
MODULE_PATH = os.path.dirname(__file__) | ||
DICTIONARY_PATH = os.path.join(MODULE_PATH, "data/dictionaries") | ||
|
||
|
||
def load_dictionary_from_pickle(path): | ||
dictionary_file = open(path, 'rb') | ||
numpy_dictionary = pkl.load(dictionary_file) | ||
dictionary_file.close() | ||
dictionary = torch.tensor(numpy_dictionary.astype(np.float32)) | ||
return dictionary | ||
|
||
|
||
def load_bars_dictionary(): | ||
path = os.path.join(DICTIONARY_PATH, "bars", "bars-16_by_16.p") | ||
return load_dictionary_from_pickle(path) | ||
|
||
|
||
def load_olshausen_dictionary(): | ||
path = os.path.join(DICTIONARY_PATH, "olshausen", "olshausen-1.5x_overcomplete.p") | ||
return load_dictionary_from_pickle(path) | ||
|
File renamed without changes.
File renamed without changes.