BhumikaMak commited on
Commit
c7e11d7
·
1 Parent(s): 4795cf5

Fix: parsing results

Browse files
Files changed (1) hide show
  1. app.py +1 -2
app.py CHANGED
@@ -17,9 +17,9 @@ COLORS = np.random.uniform(0, 255, size=(80, 3))
17
 
18
  # Function to parse YOLO detections
19
  def parse_detections(results, yolo_version):
 
20
  if yolo_version == "yolov5":
21
  detections = results.pandas().xyxy[0].to_dict()
22
- boxes, colors, names = [], [], []
23
  for i in range(len(detections["xmin"])):
24
  confidence = detections["confidence"][i]
25
  if confidence < 0.2:
@@ -35,7 +35,6 @@ def parse_detections(results, yolo_version):
35
  confidences = results[0].boxes.conf # Confidence scores
36
  class_ids = results[0].boxes.cls # Class IDs
37
  names.append(results[0].names) # Class names (from model)
38
- colors = []
39
  # Append predefined color based on category (class ID)
40
  for class_id in class_ids:
41
  # Map class ID to a color from the COLORS list (make sure you have enough colors)
 
17
 
18
  # Function to parse YOLO detections
19
  def parse_detections(results, yolo_version):
20
+ boxes, colors, names = [], [], []
21
  if yolo_version == "yolov5":
22
  detections = results.pandas().xyxy[0].to_dict()
 
23
  for i in range(len(detections["xmin"])):
24
  confidence = detections["confidence"][i]
25
  if confidence < 0.2:
 
35
  confidences = results[0].boxes.conf # Confidence scores
36
  class_ids = results[0].boxes.cls # Class IDs
37
  names.append(results[0].names) # Class names (from model)
 
38
  # Append predefined color based on category (class ID)
39
  for class_id in class_ids:
40
  # Map class ID to a color from the COLORS list (make sure you have enough colors)