Closed edalquist closed 3 years ago
fixed. i tested the fix by running argos-stream locally on a video file with the following config:
from configs.config_base import ConfigBase
from configs.config_patterns import door_movement
from lib.constants import InputMode, DetectorType
from detection.door_state_detectors import SingleShotFrameDiffDoorStateDetector
class Config(ConfigBase):
def __init__(self):
super().__init__()
self.show_fps = True
self.video_feed_fps = -1
self.send_mqtt = False
self.send_webhook = False
self.fps_print_frames = 10
self.md_min_cont_area = 50
self.md_tval = 25
self.md_bg_accum_weight = 0.5
self.md_show_all_contours = True
self.md_warmup_frame_count = -1
self.md_update_bg_model = True
self.md_reset_bg_model = False
self.md_enable_erode = False
self.md_enable_dilate = False
self.md_erode_iterations = 2
self.md_dilate_iterations = 2
self.md_box_threshold_y = 200
self.md_box_threshold_x = 200
self.md_mask = (250, 0, 690, 720)
self.tf_model_path = 'tf_models/tflite/coco_ssd_mobilenet_v1_1.0_quant/detect.tflite'
self.tf_path_to_labelmap = 'tf_models/tflite/coco_ssd_mobilenet_v1_1.0_quant/labelmap.txt'
self.tf_accuracy_threshold = 0.4
self.tf_detection_labels = ['person', 'dog']
self.tf_detection_masks = None
self.tf_detection_nmasks = None
self.tf_box_thresholds = (150, 150)
self.tf_detection_buffer_enabled = False
self.tf_detection_buffer_duration = 3000
self.tf_detection_buffer_threshold = 4
self.tf_detector_type = DetectorType.TFLITE
self.tf_apply_md = True
self.tf_od_frame_write = True
self.tf_od_annotation_write = True
self.tf_output_detection_path = ./detections'
self.pattern_detection_enabled = False
self.pattern_detection_pattern_steps = door_movement.pattern_steps
self.pattern_detection_state_history_length = 200
self.pattern_detection_state_history_length_partial = 300
self.pattern_detection_interval = 1
self.door_state_detector = SingleShotFrameDiffDoorStateDetector((215, 114, 227, 123), (196, 131, 215, 147))
self.door_state_detector_show_detection = True
self.md_frame_rate = 10
self.debug_mode = False
self.input_mode = InputMode.VIDEO_FILE
self.video_file_path = './tests/data/door_pattern_videos/doorexiting5.mov'
self.video_in_sync = False
it works now and detects objects (persons) without pattern detection:
stream.py" --ip 0.0.0.0 --port 8081 --config configs.config_tflite_ssd_debug
2021-02-14 12:53:10:INFO:__main__:package import START
2021-02-14 12:53:11:INFO:__main__:package import END
2021-02-14 12:53:11:INFO:__main__:flask init..
2021-02-14 12:53:11:INFO:__main__:start reading video file
2021-02-14 12:53:11:INFO:__main__:TFObjectDetector init START
* Serving Flask app "stream" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: off
2021-02-14 12:53:12:INFO:input.videofilestream:playing at original video fps of file [./tests/data/door_pattern_videos/doorexiting5.mov]: 15
2021-02-14 12:53:12:INFO:werkzeug: * Running on http://0.0.0.0:8081/ (Press CTRL+C to quit)
2021-02-14 12:53:15:INFO:__main__:TFObjectDetector init END
2021-02-14 12:53:15:INFO:__main__:detect_objects init..
2021-02-14 12:53:15:INFO:__main__:od=0.00/md=0.00/st=14.33 fps
2021-02-14 12:53:16:INFO:broker:enqueuing notification NotificationTypes.OBJECT_DETECTED [(('person', 0.57421875, 'detections/detection_person_14-02-2021-12-53-15-845490.jpg'), 1613287395.84549)]
2021-02-14 12:53:16:INFO:notifier:object notification: label [person], accuracy[0.57421875]
2021-02-14 12:53:16:INFO:broker:enqueuing notification NotificationTypes.OBJECT_DETECTED [(('person', 0.5234375, 'detections/detection_person_14-02-2021-12-53-15-941366.jpg'), 1613287395.941366)]
2021-02-14 12:53:16:INFO:notifier:NotificationTypes.OBJECT_DETECTED notification rate limited at 1.000000 fps
2021-02-14 12:53:16:INFO:broker:enqueuing notification NotificationTypes.OBJECT_DETECTED [(('person', 0.55078125, 'detections/detection_person_14-02-2021-12-53-16-103831.jpg'), 1613287396.103831)]
2021-02-14 12:53:16:INFO:notifier:NotificationTypes.OBJECT_DETECTED notification rate limited at 1.000000 fps
2021-02-14 12:53:16:INFO:broker:enqueuing notification NotificationTypes.OBJECT_DETECTED [(('person', 0.5, 'detections/detection_person_14-02-2021-12-53-16-198083.jpg'), 1613287396.1980832)]
2021-02-14 12:53:16:INFO:notifier:NotificationTypes.OBJECT_DETECTED notification rate limited at 1.000000 fps
2021-02-14 12:53:16:INFO:broker:enqueuing notification NotificationTypes.OBJECT_DETECTED [(('person', 0.5390625, 'detections/detection_person_14-02-2021-12-53-16-305324.jpg'), 1613287396.305324)]
2021-02-14 12:53:16:INFO:notifier:NotificationTypes.OBJECT_DETECTED notification rate limited at 1.000000 fps
2021-02-14 12:53:16:INFO:broker:enqueuing notification NotificationTypes.OBJECT_DETECTED [(('person', 0.5859375, 'detections/detection_person_14-02-2021-12-53-16-407260.jpg'), 1613287396.40726)]
2021-02-14 12:53:16:INFO:notifier:NotificationTypes.OBJECT_DETECTED notification rate limited at 1.000000 fps
2021-02-14 12:53:16:INFO:broker:enqueuing notification NotificationTypes.OBJECT_DETECTED [(('person', 0.57421875, 'detections/detection_person_14-02-2021-12-53-16-509196.jpg'), 1613287396.509196)]
2021-02-14 12:53:16:INFO:notifier:NotificationTypes.OBJECT_DETECTED notification rate limited at 1.000000 fps
2021-02-14 12:53:16:INFO:__main__:od=10.00/md=9.09/st=14.15 fps
2021-02-14 12:53:16:INFO:broker:enqueuing notification NotificationTypes.OBJECT_DETECTED [(('person', 0.48828125, 'detections/detection_person_14-02-2021-12-53-16-616444.jpg'), 1613287396.6164439)]
2021-02-14 12:53:16:INFO:notifier:NotificationTypes.OBJECT_DETECTED notification rate limited at 1.000000 fps
2021-02-14 12:53:17:INFO:broker:enqueuing notification NotificationTypes.OBJECT_DETECTED [(('person', 0.4765625, 'detections/detection_person_14-02-2021-12-53-16-714196.jpg'), 1613287396.714196)]
2021-02-14 12:53:17:INFO:notifier:NotificationTypes.OBJECT_DETECTED notification rate limited at 1.000000 fps
2021-02-14 12:53:17:INFO:broker:enqueuing notification NotificationTypes.OBJECT_DETECTED [(('person', 0.48828125, 'detections/detection_person_14-02-2021-12-53-16-820347.jpg'), 1613287396.8203468)]
2021-02-14 12:53:17:INFO:notifier:NotificationTypes.OBJECT_DETECTED notification rate limited at 1.000000 fps
2021-02-14 12:53:17:INFO:broker:enqueuing notification NotificationTypes.OBJECT_DETECTED [(('person', 0.5625, 'detections/detection_person_14-02-2021-12-53-16-918979.jpg'), 1613287396.9189792)]
2021-02-14 12:53:17:INFO:notifier:object notification: label [person], accuracy[0.5625]
2021-02-14 12:53:17:INFO:broker:enqueuing notification NotificationTypes.OBJECT_DETECTED [(('person', 0.42578125, 'detections/detection_person_14-02-2021-12-53-17-022224.jpg'), 1613287397.022224)]
2021-02-14 12:53:17:INFO:notifier:NotificationTypes.OBJECT_DETECTED notification rate limited at 1.000000 fps
2021-02-14 12:53:17:INFO:broker:enqueuing notification NotificationTypes.OBJECT_DETECTED [(('person', 0.5, 'detections/detection_person_14-02-2021-12-53-17-123878.jpg'), 1613287397.123878)]
2021-02-14 12:53:17:INFO:notifier:NotificationTypes.OBJECT_DETECTED notification rate limited at 1.000000 fps
2021-02-14 12:53:17:INFO:broker:enqueuing notification NotificationTypes.OBJECT_DETECTED [(('person', 0.48828125, 'detections/detection_person_14-02-2021-12-53-17-222904.jpg'), 1613287397.222904)]
2021-02-14 12:53:17:INFO:notifier:NotificationTypes.OBJECT_DETECTED notification rate limited at 1.000000 fps
2021-02-14 12:53:17:INFO:broker:enqueuing notification NotificationTypes.OBJECT_DETECTED [(('person', 0.609375, 'detections/detection_person_14-02-2021-12-53-17-327528.jpg'), 1613287397.327528)]
2021-02-14 12:53:17:INFO:notifier:NotificationTypes.OBJECT_DETECTED notification rate limited at 1.000000 fps
2021-02-14 12:53:17:INFO:broker:enqueuing notification NotificationTypes.OBJECT_DETECTED [(('person', 0.57421875, 'detections/detection_person_14-02-2021-12-53-17-426926.jpg'), 1613287397.4269261)]
2021-02-14 12:53:17:INFO:notifier:NotificationTypes.OBJECT_DETECTED notification rate limited at 1.000000 fps
2021-02-14 12:53:17:INFO:__main__:od=7.50/md=9.52/st=14.40 fps
2021-02-14 12:53:17:INFO:broker:enqueuing notification NotificationTypes.OBJECT_DETECTED [(('person', 0.5859375, 'detections/detection_person_14-02-2021-12-53-17-531829.jpg'), 1613287397.5318289)]
2021-02-14 12:53:17:INFO:notifier:NotificationTypes.OBJECT_DETECTED notification rate limited at 1.000000 fps
2021-02-14 12:53:17:INFO:broker:enqueuing notification NotificationTypes.OBJECT_DETECTED [(('person', 0.609375, 'detections/detection_person_14-02-2021-12-53-17-631341.jpg'), 1613287397.631341)]
2021-02-14 12:53:17:INFO:notifier:NotificationTypes.OBJECT_DETECTED notification rate limited at 1.000000 fps
2021-02-14 12:53:18:INFO:broker:enqueuing notification NotificationTypes.OBJECT_DETECTED [(('person', 0.64453125, 'detections/detection_person_14-02-2021-12-53-17-734744.jpg'), 1613287397.734744)]
2021-02-14 12:53:18:INFO:notifier:NotificationTypes.OBJECT_DETECTED notification rate limited at 1.000000 fps
2021-02-14 12:53:18:INFO:broker:enqueuing notification NotificationTypes.OBJECT_DETECTED [(('person', 0.6796875, 'detections/detection_person_14-02-2021-12-53-17-837876.jpg'), 1613287397.837876)]
2021-02-14 12:53:18:INFO:notifier:object notification: label [person], accuracy[0.6796875]
2021-02-14 12:53:18:INFO:broker:enqueuing notification NotificationTypes.OBJECT_DETECTED [(('person', 0.65625, 'detections/detection_person_14-02-2021-12-53-17-939812.jpg'), 1613287397.9398122)]
2021-02-14 12:53:18:INFO:notifier:NotificationTypes.OBJECT_DETECTED notification rate limited at 1.000000 fps
2021-02-14 12:53:18:INFO:detection.object_detector_base:detection [(228, 159, 312, 401)] smaller than box thresholds [(150, 150)]
2021-02-14 12:53:18:INFO:broker:enqueuing notification NotificationTypes.OBJECT_DETECTED [(('person', 0.6875, 'detections/detection_person_14-02-2021-12-53-18-039405.jpg'), 1613287398.039405)]
2021-02-14 12:53:18:INFO:notifier:NotificationTypes.OBJECT_DETECTED notification rate limited at 1.000000 fps
2021-02-14 12:53:18:INFO:broker:enqueuing notification NotificationTypes.OBJECT_DETECTED [(('person', 0.71875, 'detections/detection_person_14-02-2021-12-53-18-141315.jpg'), 1613287398.141315)]
2021-02-14 12:53:18:INFO:notifier:NotificationTypes.OBJECT_DETECTED notification rate limited at 1.000000 fps
2021-02-14 12:53:18:INFO:broker:enqueuing notification NotificationTypes.OBJECT_DETECTED [(('person', 0.7109375, 'detections/detection_person_14-02-2021-12-53-18-245946.jpg'), 1613287398.2459462)]
2021-02-14 12:53:18:INFO:notifier:NotificationTypes.OBJECT_DETECTED notification rate limited at 1.000000 fps
2021-02-14 12:53:18:INFO:broker:enqueuing notification NotificationTypes.OBJECT_DETECTED [(('person', 0.69921875, 'detections/detection_person_14-02-2021-12-53-18-347801.jpg'), 1613287398.347801)]
2021-02-14 12:53:18:INFO:notifier:NotificationTypes.OBJECT_DETECTED notification rate limited at 1.000000 fps
2021-02-14 12:53:18:INFO:broker:enqueuing notification NotificationTypes.OBJECT_DETECTED [(('person', 0.5859375, 'detections/detection_person_14-02-2021-12-53-18-450315.jpg'), 1613287398.450315)]
2021-02-14 12:53:18:INFO:notifier:NotificationTypes.OBJECT_DETECTED notification rate limited at 1.000000 fps
2021-02-14 12:53:18:INFO:__main__:od=8.57/md=9.67/st=14.40 fps
2021-02-14 12:53:18:INFO:broker:enqueuing notification NotificationTypes.OBJECT_DETECTED [(('person', 0.55078125, 'detections/detection_person_14-02-2021-12-53-18-554451.jpg'), 1613287398.554451)]
2021-02-14 12:53:18:INFO:notifier:NotificationTypes.OBJECT_DETECTED notification rate limited at 1.000000 fps
2021-02-14 12:53:19:INFO:broker:enqueuing notification NotificationTypes.OBJECT_DETECTED [(('person', 0.5234375, 'detections/detection_person_14-02-2021-12-53-18-659309.jpg'), 1613287398.6593091)]
2021-02-14 12:53:19:INFO:notifier:NotificationTypes.OBJECT_DETECTED notification rate limited at 1.000000 fps
2021-02-14 12:53:19:INFO:broker:enqueuing notification NotificationTypes.OBJECT_DETECTED [(('person', 0.51171875, 'detections/detection_person_14-02-2021-12-53-18-763174.jpg'), 1613287398.7631738)]
2021-02-14 12:53:19:INFO:notifier:NotificationTypes.OBJECT_DETECTED notification rate limited at 1.000000 fps
2021-02-14 12:53:19:INFO:broker:enqueuing notification NotificationTypes.OBJECT_DETECTED [(('person', 0.48828125, 'detections/detection_person_14-02-2021-12-53-18-865024.jpg'), 1613287398.865024)]
2021-02-14 12:53:19:INFO:notifier:object notification: label [person], accuracy[0.48828125]
2021-02-14 12:53:19:INFO:__main__:od=8.75/md=9.75/st=14.20 fps
2021-02-14 12:53:20:INFO:input.videofilestream:Reached the end of the video! [8 seconds]
At fe0da14 when I set
pattern_detection_enabled
toFalse
I get:It looks like pattern_detection_enabled=False results in pattern_detector being set to None but that isn't handled in the door and motion state handler init: