mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
implement min person size again
This commit is contained in:
parent
200d769003
commit
a26d2217d4
@ -61,16 +61,16 @@ def detect_objects(prepped_frame_array, prepped_frame_time,
|
||||
'xmax': int((box[2] * region_box[0]) + region_box[1]),
|
||||
'ymax': int((box[3] * region_box[0]) + region_box[2])
|
||||
})
|
||||
else:
|
||||
object_queue.put({
|
||||
'frame_time': frame_time,
|
||||
'name': 'dummy',
|
||||
'score': 0.99,
|
||||
'xmin': int(0 + region_box[1]),
|
||||
'ymin': int(0 + region_box[2]),
|
||||
'xmax': int(10 + region_box[1]),
|
||||
'ymax': int(10 + region_box[2])
|
||||
})
|
||||
# else:
|
||||
# object_queue.put({
|
||||
# 'frame_time': frame_time,
|
||||
# 'name': 'dummy',
|
||||
# 'score': 0.99,
|
||||
# 'xmin': int(0 + region_box[1]),
|
||||
# 'ymin': int(0 + region_box[2]),
|
||||
# 'xmax': int(10 + region_box[1]),
|
||||
# 'ymax': int(10 + region_box[2])
|
||||
# })
|
||||
|
||||
class PreppedQueueProcessor(threading.Thread):
|
||||
def __init__(self, prepped_frame_array,
|
||||
|
@ -4,16 +4,39 @@ import threading
|
||||
import cv2
|
||||
from object_detection.utils import visualization_utils as vis_util
|
||||
class ObjectParser(threading.Thread):
|
||||
def __init__(self, object_queue, objects_parsed, detected_objects):
|
||||
def __init__(self, object_queue, objects_parsed, detected_objects, regions):
|
||||
threading.Thread.__init__(self)
|
||||
self._object_queue = object_queue
|
||||
self._objects_parsed = objects_parsed
|
||||
self._detected_objects = detected_objects
|
||||
self.regions = regions
|
||||
|
||||
def run(self):
|
||||
# frame_times = {}
|
||||
while True:
|
||||
obj = self._object_queue.get()
|
||||
# filter out persons
|
||||
# [obj['score'] for obj in detected_objects if obj['name'] == 'person']
|
||||
if obj['name'] == 'person':
|
||||
person_area = (obj['xmax']-obj['xmin'])*(obj['ymax']-obj['ymin'])
|
||||
# find the matching region
|
||||
region = None
|
||||
for r in self.regions:
|
||||
if (
|
||||
obj['xmin'] >= r['x_offset'] and
|
||||
obj['ymin'] >= r['y_offset'] and
|
||||
obj['xmax'] <= r['x_offset']+r['size'] and
|
||||
obj['ymax'] <= r['y_offset']+r['size']
|
||||
):
|
||||
region = r
|
||||
break
|
||||
|
||||
# if the min person area is larger than the
|
||||
# detected person, don't add it to detected objects
|
||||
if region and region['min_person_area'] > person_area:
|
||||
continue
|
||||
|
||||
|
||||
# frame_time = obj['frame_time']
|
||||
# if frame_time in frame_times:
|
||||
# if frame_times[frame_time] == 7:
|
||||
|
Loading…
Reference in New Issue
Block a user