Skip to content

Commit 4709f42

Browse files
authored
Update img_plant_controller.py
1 parent 88b7a55 commit 4709f42

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

ai/img_plant_controller.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,10 @@ def guess_type(image_path, model_path, trainloader):
3434
to_pil = transforms.ToPILImage()
3535
image = image_loader(image_path)
3636
image = to_pil(image)
37-
test_transforms = transforms.Compose([transforms.Resize([224, 224]),
38-
transforms.ToTensor(),
39-
])
4037
model = model_path
41-
image_tensor = test_transforms(image).float()
4238
image_tensor = image.tensor.unsqueeze_(0)
4339
input = Variable(image_tensor)
40+
input = input.to("cpu")
4441
out = model(image_tensor)
4542
index = out.data.cpu().numpy().argmax()
4643
return trainloader.dataset.classes[index]

0 commit comments

Comments
 (0)