update ieemoo-ai-isempty.py.
This commit is contained in:
@ -82,7 +82,7 @@ class Predictor(object):
|
||||
# self.model = torch.load(self.args.pretrained_model)
|
||||
# else:
|
||||
# self.model = torch.load(self.args.pretrained_model,map_location='cpu')
|
||||
self.model = torch.load(self.args.pretrained_model)
|
||||
self.model = torch.load(self.args.pretrained_model,map_location=torch.device('cpu'))
|
||||
self.model.eval()
|
||||
self.model.to("cuda")
|
||||
|
||||
@ -95,8 +95,8 @@ class Predictor(object):
|
||||
else:
|
||||
with torch.no_grad():
|
||||
x = self.test_transform(img_data)
|
||||
if torch.cuda.is_available():
|
||||
x = x.cuda()
|
||||
# if torch.cuda.is_available():
|
||||
# x = x.cuda()
|
||||
part_logits = self.model(x.unsqueeze(0))
|
||||
probs = torch.nn.Softmax(dim=-1)(part_logits)
|
||||
topN = torch.argsort(probs, dim=-1, descending=True).tolist()
|
||||
|
Reference in New Issue
Block a user