Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
a0405u committed Dec 29, 2020
1 parent f5881c4 commit d23596f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lab3/lab3.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import torch
from torch2trt import torch2trt
from torch2trt import TRTModule
from torchvision.models.alexnet import alexnet
# from torchvision.models.alexnet import alexnet
from torchvision.models.wide_resnet101_2 import wide_resnet101_2
from torch.autograd import Variable
from torchvision import transforms
import matplotlib.pyplot as plt
Expand Down Expand Up @@ -30,7 +31,8 @@

timest = time.time()

model = alexnet(pretrained = True).eval().cuda()
model = wide_resnet101_2(pretrained = True).eval().cuda()
# model = alexnet(pretrained = True).eval().cuda()

print("model loaded in {}s".format(round(time.time() - timest, 2)))

Expand Down Expand Up @@ -92,7 +94,7 @@ def predict(image):
#output = model_trt(input)
output = model(input)

print("output: " + str(output[0]))
print(torch.nn.functional.softmax(output[0], dim=0))

print("image processed in {}s".format(round(time.time() - timest, 3)))

Expand Down

0 comments on commit d23596f

Please sign in to comment.