-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
469a711
commit 861dddd
Showing
4 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -31,6 +31,7 @@ dependencies = [ | |
"torch", | ||
"torchvision", | ||
"numpy", | ||
"fibsem-tools" | ||
] | ||
|
||
# extras | ||
|
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,35 @@ | ||
# %% | ||
import csv | ||
from torch.utils.data import Dataset | ||
import tensorstore as tswift | ||
|
||
|
||
# %% | ||
class CellMapDataset(Dataset): | ||
def __init__(self, ...): | ||
... | ||
|
||
def __len__(self): | ||
... | ||
|
||
def __getitem__(self, idx): | ||
... | ||
|
||
def from_csv(self, csv_path): | ||
# Load file data from csv file | ||
dataset_dict = {} | ||
with open(csv_path, 'r') as f: | ||
reader = csv.reader(f) | ||
for row in reader: | ||
if row[0] not in dataset_dict: | ||
dataset_dict[row[0]] = {} | ||
dataset_dict[row[0]]["raw"] = row[1] | ||
dataset_dict[row[0]]["gt"] = row[2] | ||
if len(row) > 3: | ||
dataset_dict[row[0]]["weight"] = row[3] | ||
else: | ||
dataset_dict[row[0]]["weight"] = 1.0 | ||
|
||
self.dataset_dict = dataset_dict | ||
|
||
# %% |
Empty file.
Empty file.