Spaces:
Runtime error
Runtime error
added to tesnor
Browse files
model.py
CHANGED
@@ -22,6 +22,7 @@ SAMPLES_PATH = "./samples/*.jpg"
|
|
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)),
|
@@ -29,9 +30,8 @@ class ImageLoader():
|
|
29 |
def load(self, im_path):
|
30 |
im = torch.FloatTensor(self.transformer(Image.open(im_path))).unsqueeze(0)
|
31 |
return {"image": im}
|
32 |
-
|
33 |
def raw_load(self, im_path):
|
34 |
-
im = torch.FloatTensor(Image.open(im_path))
|
35 |
return {"image": im}
|
36 |
def transform(self, image):
|
37 |
im = torch.FloatTensor(self.transformer(image)).unsqueeze(0)
|
|
|
22 |
class ImageLoader():
|
23 |
def __init__(self):
|
24 |
self.transformer = torchvision.transforms.Compose([
|
25 |
+
torchvision.transforms.ToTensor(),
|
26 |
torchvision.transforms.Resize(256),
|
27 |
torchvision.transforms.CenterCrop(224),
|
28 |
torchvision.transforms.Normalize((.485, .456, .406), (.229, .224, .225)),
|
|
|
30 |
def load(self, im_path):
|
31 |
im = torch.FloatTensor(self.transformer(Image.open(im_path))).unsqueeze(0)
|
32 |
return {"image": im}
|
|
|
33 |
def raw_load(self, im_path):
|
34 |
+
im = torch.FloatTensor(Image.open(im_path))
|
35 |
return {"image": im}
|
36 |
def transform(self, image):
|
37 |
im = torch.FloatTensor(self.transformer(image)).unsqueeze(0)
|