| 31 | |
| 32 | |
| 33 | class Dataset(): |
| 34 | def __init__(self, x, y, transform=None, fitr=None): |
| 35 | self.x = x |
| 36 | self.y = y |
| 37 | self.transform = transform |
| 38 | self.fitr = fitr |
| 39 | |
| 40 | def __getitem__(self, idx): |
| 41 | x, y = self.x[idx], self.y[idx] |
| 42 | |
| 43 | ''' low pass filtering ''' |
| 44 | if self.fitr is not None: |
| 45 | x = self.fitr(x) |
| 46 | |
| 47 | ''' data augmentation ''' |
| 48 | if self.transform is not None: |
| 49 | x = self.transform( Image.fromarray(x) ) |
| 50 | |
| 51 | return x, y |
| 52 | |
| 53 | def __len__(self): |
| 54 | return len(self.x) |
| 55 | |
| 56 | |
| 57 | class IndexedDataset(): |
no outgoing calls
no test coverage detected