Add area labels to bounding boxes (#47)

* Add object size to the bounding box

Remove script from Dockerfile

Fix framerate command

Move default value for framerate

update dockerfile

dockerfile changes

Add person_area label to surrounding box


Update dockerfile


ffmpeg config bug


Add `person_area` label to `best_person` frame


Resolve debug view showing area label for non-persons


Add object size to the bounding box


Add object size to the bounding box

* Move object area outside of conditional to work with all object types
This commit is contained in:
Kyle Niewiada 2019-07-03 07:14:39 -04:00 committed by Blake Blackshear
parent 8fee8f86a2
commit c653567cc1
2 changed files with 6 additions and 4 deletions

View File

@ -81,7 +81,7 @@ class BestPersonFrame(threading.Thread):
if not self.best_person is None and self.best_person['frame_time'] in recent_frames: if not self.best_person is None and self.best_person['frame_time'] in recent_frames:
best_frame = recent_frames[self.best_person['frame_time']] best_frame = recent_frames[self.best_person['frame_time']]
label = "{}: {}%".format(self.best_person['name'],int(self.best_person['score']*100)) label = "{}: {}% {}".format(self.best_person['name'],int(self.best_person['score']*100),int(self.best_person['area']))
draw_box_with_label(best_frame, self.best_person['xmin'], self.best_person['ymin'], draw_box_with_label(best_frame, self.best_person['xmin'], self.best_person['ymin'],
self.best_person['xmax'], self.best_person['ymax'], label) self.best_person['xmax'], self.best_person['ymax'], label)

View File

@ -234,8 +234,10 @@ class Camera:
return return
for obj in objects: for obj in objects:
# Store object area to use in bounding box labels
obj['area'] = (obj['xmax']-obj['xmin'])*(obj['ymax']-obj['ymin'])
if obj['name'] == 'person': if obj['name'] == 'person':
person_area = (obj['xmax']-obj['xmin'])*(obj['ymax']-obj['ymin'])
# find the matching region # find the matching region
region = None region = None
for r in self.regions: for r in self.regions:
@ -250,7 +252,7 @@ class Camera:
# if the min person area is larger than the # if the min person area is larger than the
# detected person, don't add it to detected objects # detected person, don't add it to detected objects
if region and region['min_person_area'] > person_area: if region and region['min_person_area'] > obj['area']:
continue continue
# compute the coordinates of the person and make sure # compute the coordinates of the person and make sure
@ -279,7 +281,7 @@ class Camera:
# draw the bounding boxes on the screen # draw the bounding boxes on the screen
for obj in detected_objects: for obj in detected_objects:
label = "{}: {}%".format(obj['name'],int(obj['score']*100)) label = "{}: {}% {}".format(obj['name'],int(obj['score']*100),int(obj['area']))
draw_box_with_label(frame, obj['xmin'], obj['ymin'], obj['xmax'], obj['ymax'], label) draw_box_with_label(frame, obj['xmin'], obj['ymin'], obj['xmax'], obj['ymax'], label)
for region in self.regions: for region in self.regions: