Edvin Behdadijd commited on
Commit
5506573
·
verified ·
1 Parent(s): dc0055b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -18,6 +18,9 @@ colors = [
18
  ]
19
 
20
  def detect_objects(image):
 
 
 
21
  # Convert the input image to a format YOLO can work with
22
  image = np.array(image)
23
 
@@ -35,7 +38,7 @@ def detect_objects(image):
35
  # Draw the bounding box with a thinner line
36
  cv2.rectangle(image, (x1, y1), (x2, y2), color, 1) # Line width set to 1
37
 
38
- # Put the class name above the bounding box
39
  class_name = model.model.names[int(class_id)]
40
  cv2.putText(image, f'{class_name} {score:.2f}', (x1, y1 - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.4, color, 1)
41
 
 
18
  ]
19
 
20
  def detect_objects(image):
21
+ # Resize the input image to 200x200 pixels
22
+ image = image.resize((200, 200))
23
+
24
  # Convert the input image to a format YOLO can work with
25
  image = np.array(image)
26
 
 
38
  # Draw the bounding box with a thinner line
39
  cv2.rectangle(image, (x1, y1), (x2, y2), color, 1) # Line width set to 1
40
 
41
+ # Put the class name above the bounding box with smaller font
42
  class_name = model.model.names[int(class_id)]
43
  cv2.putText(image, f'{class_name} {score:.2f}', (x1, y1 - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.4, color, 1)
44