def predict(self, image):
        image = image*0.5 + 0.5 #rescale from [-1,1]-->[0,1]
        image = F.interpolate(image,size=(224,224),mode='bilinear')
        with torch.no_grad():
          prob = self.model(image).data.cpu().numpy()[0]

          mean_score = get_mean_score(prob)
          std_score = get_std_score(prob)
          return mean_score+std_score
예제 #2
0
    def predict(self, image):
        image = self.transform(image)
        image = image.unsqueeze_(0)
        image = torch.autograd.Variable(image, volatile=True)
        prob = self.model(image).data.numpy()[0]

        mean_score = get_mean_score(prob)
        std_score = get_std_score(prob)

        return format_output(mean_score, std_score, prob)
예제 #3
0
    def predict(self, image):
        image = self.transform(image)
        image = image.unsqueeze_(0)
        image = image.to(device)
        prob = self.model(image).data.cpu().numpy()[0]

        mean_score = get_mean_score(prob)
        std_score = get_std_score(prob)

        return format_output(mean_score, std_score, prob)