Skip to content

Commit

Permalink
refactor: 🚧
Browse files Browse the repository at this point in the history
  • Loading branch information
rhoadesScholar committed Mar 21, 2024
1 parent 469a711 commit 861dddd
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ dependencies = [
"torch",
"torchvision",
"numpy",
"fibsem-tools"
]

# extras
Expand Down
35 changes: 35 additions & 0 deletions src/cellmap_data/dataset.py
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 added src/cellmap_data/utils.py
Empty file.

0 comments on commit 861dddd

Please sign in to comment.