PDG commited on
Commit
20328b0
·
1 Parent(s): 8e8bbb8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -9
app.py CHANGED
@@ -109,16 +109,12 @@ def classifyCar(im):
109
 
110
  # if a car was detected, extract the car and perform modernity score classification
111
  if len(boxes) != 0:
112
- #max_idx = torch.tensor([(x[2] - x[0])*(x[3] - x[1]) for x in boxes]).argmax().item()
113
-
114
- #im2 = Image.fromarray(np.uint8(im)).convert('RGB').crop(boxes[max_idx].to(torch.int64).numpy())
115
- im2 = cropImage(outputs, im, boxes, car_class_true)
116
- #carResize = transforms.Compose([transforms.Resize((224, 224))])
117
- #im2 = carResize(im2)
118
 
119
- with torch.no_grad():
120
- scores = torch.nn.functional.softmax(DesignModernityModel(carTransforms(im2).unsqueeze(0))[0])
121
- label = {LABELS[i]: float(scores[i]) for i in range(n_labels)}
122
 
123
  # if no car was detected, show original image and print "No car detected"
124
  else:
 
109
 
110
  # if a car was detected, extract the car and perform modernity score classification
111
  if len(boxes) != 0:
112
+ im2 = cropImage(outputs, im, boxes, car_class_true)
113
+
 
 
 
 
114
 
115
+ with torch.no_grad():
116
+ scores = torch.nn.functional.softmax(DesignModernityModel(carTransforms(im2).unsqueeze(0))[0])
117
+ label = {LABELS[i]: float(scores[i]) for i in range(n_labels)}
118
 
119
  # if no car was detected, show original image and print "No car detected"
120
  else: