MCPcopy Create free account
hub / github.com/geekcomputers/Python / __init__

Method __init__

ML/src/python/neuralforge/data/datasets.py:211–230  ·  view source on GitHub ↗
(self, root='./data', split='train', transform=None, download=True)

Source from the content-addressed store, hash-verified

209
210class Food101Dataset:
211 def __init__(self, root='./data', split='train', transform=None, download=True):
212 if transform is None:
213 if split == 'train':
214 transform = transforms.Compose([
215 transforms.RandomResizedCrop(224),
216 transforms.RandomHorizontalFlip(),
217 transforms.RandomRotation(15),
218 transforms.ColorJitter(0.3, 0.3, 0.3),
219 transforms.ToTensor(),
220 transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
221 ])
222 else:
223 transform = transforms.Compose([
224 transforms.Resize(256),
225 transforms.CenterCrop(224),
226 transforms.ToTensor(),
227 transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
228 ])
229
230 self.dataset = datasets.Food101(root=root, split=split, transform=transform, download=download)
231
232 def __len__(self):
233 return len(self.dataset)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected