Spaces:
Runtime error
Runtime error
reverted to torchvision transformations
Browse files
model.py
CHANGED
@@ -21,10 +21,10 @@ SAMPLES_PATH = "./samples/*.jpg"
|
|
21 |
|
22 |
class ImageLoader():
|
23 |
def __init__(self):
|
24 |
-
self.transformer = torchvision.transforms.Compose([
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
torchvision.transforms.ToTensor()])
|
29 |
def load(self, im_path):
|
30 |
im = torch.FloatTensor(self.transformer(Image.open(im_path))).unsqueeze(0)
|
|
|
21 |
|
22 |
class ImageLoader():
|
23 |
def __init__(self):
|
24 |
+
self.transformer = torchvision.transforms.Compose([
|
25 |
+
torchvision.transforms.Resize(256),
|
26 |
+
torchvision.transforms.CenterCrop(224),
|
27 |
+
torchvision.transforms.Normalize((.485, .456, .406), (.229, .224, .225)),
|
28 |
torchvision.transforms.ToTensor()])
|
29 |
def load(self, im_path):
|
30 |
im = torch.FloatTensor(self.transformer(Image.open(im_path))).unsqueeze(0)
|