stevfoy commited on
Commit
e0d6085
·
1 Parent(s): 63fc900
Files changed (1) hide show
  1. app.py +18 -4
app.py CHANGED
@@ -69,7 +69,21 @@ def process_image_and_plot(image,iou_threshold=0.5, threshold=0.4):
69
  transformed_image = transforms(image=image)["image"].unsqueeze(0)
70
  print("transformed_image 2")
71
  output = model(transformed_image)
72
- print("transformed_image 3")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
  bboxes = [[] for _ in range(1)]
74
 
75
  print("transformed_image 4")
@@ -81,9 +95,9 @@ def process_image_and_plot(image,iou_threshold=0.5, threshold=0.4):
81
  for idx, box in enumerate(boxes_scale_i):
82
  bboxes[idx] += box
83
  print("transformed_image 5")
84
- nms_boxes = non_max_suppression(
85
- bboxes[0], iou_threshold=iou_threshold, threshold=threshold, box_format="midpoint",
86
- )
87
  print("transformed_image 6")
88
  fig = plot_image(transformed_image[0].permute(1, 2, 0), nms_boxes)
89
  print("transformed_image 7")
 
69
  transformed_image = transforms(image=image)["image"].unsqueeze(0)
70
  print("transformed_image 2")
71
  output = model(transformed_image)
72
+
73
+
74
+
75
+
76
+ labels = []
77
+ sample_metrics = [] # List of tuples (TP, confs, pred)
78
+
79
+ # Extract labels
80
+
81
+
82
+ with torch.no_grad():
83
+ outputs = model(imgs)
84
+ outputs = non_max_suppression(outputs, conf_thres=iou_threshold, iou_thres=threshold)
85
+ # sample_metrics = get_batch_statistics(outputs, targets, iou_threshold=threshold)
86
+
87
  bboxes = [[] for _ in range(1)]
88
 
89
  print("transformed_image 4")
 
95
  for idx, box in enumerate(boxes_scale_i):
96
  bboxes[idx] += box
97
  print("transformed_image 5")
98
+
99
+
100
+
101
  print("transformed_image 6")
102
  fig = plot_image(transformed_image[0].permute(1, 2, 0), nms_boxes)
103
  print("transformed_image 7")