MCPcopy Create free account
hub / github.com/KerenLab/CellSighter / CellCropsDataset

Class CellCropsDataset

data/data.py:5–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3
4
5class CellCropsDataset(Dataset):
6 def __init__(self,
7 crops,
8 mask=False,
9 transform=None):
10 super().__init__()
11 self._crops = crops
12 self._transform = transform
13 self._mask = mask
14
15 def __len__(self):
16 return len(self._crops)
17
18 def __getitem__(self, idx):
19 sample = self._crops[idx].sample(self._mask)
20 aug = self._transform(np.dstack(
21 [sample['image'], sample['all_cells_mask'][:, :, np.newaxis], sample['mask'][:, :, np.newaxis]])).float()
22 sample['image'] = aug[:-1, :, :]
23 sample['mask'] = aug[[-1], :, :]
24
25 return sample

Callers 2

eval.pyFile · 0.90
train.pyFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected