clement-w commited on
Commit
bbbeefd
1 Parent(s): 83ab202

Update color of bounding boxes

Browse files
Files changed (1) hide show
  1. app.py +1 -3
app.py CHANGED
@@ -64,7 +64,6 @@ def draw_bounding_box_on_image(image,
64
 
65
 
66
  def draw_boxes(image, boxes, class_names, scores, max_boxes=10, min_score=0.1):
67
- colors = list(ImageColor.colormap.values())
68
 
69
  try:
70
  font = ImageFont.truetype("/usr/share/fonts/truetype/liberation/LiberationSansNarrow-Regular.ttf",
@@ -78,7 +77,7 @@ def draw_boxes(image, boxes, class_names, scores, max_boxes=10, min_score=0.1):
78
  ymin, xmin, ymax, xmax = tuple(boxes[0][i])
79
  display_str = "{}: {}%".format(class_names[i],
80
  int(100 * scores[0][i]))
81
- color = colors[hash(class_names[i]) % len(colors)]
82
  image_pil = Image.fromarray(np.uint8(image)).convert("RGB")
83
  draw_bounding_box_on_image(
84
  image_pil,
@@ -115,7 +114,6 @@ def run_detector(url_input, image_input, minscore=0.1):
115
  return image_with_boxes
116
 
117
 
118
-
119
  demo = gr.Blocks()
120
 
121
  title = """<h1 style="text-align: center;" id="title">Custom Cyclists detector</h1>"""
 
64
 
65
 
66
  def draw_boxes(image, boxes, class_names, scores, max_boxes=10, min_score=0.1):
 
67
 
68
  try:
69
  font = ImageFont.truetype("/usr/share/fonts/truetype/liberation/LiberationSansNarrow-Regular.ttf",
 
77
  ymin, xmin, ymax, xmax = tuple(boxes[0][i])
78
  display_str = "{}: {}%".format(class_names[i],
79
  int(100 * scores[0][i]))
80
+ color = '#00ff00'
81
  image_pil = Image.fromarray(np.uint8(image)).convert("RGB")
82
  draw_bounding_box_on_image(
83
  image_pil,
 
114
  return image_with_boxes
115
 
116
 
 
117
  demo = gr.Blocks()
118
 
119
  title = """<h1 style="text-align: center;" id="title">Custom Cyclists detector</h1>"""