Handler Example

Handlers for detection results

DB Writer

class eyewitness.result_handler.db_writer.BboxNativeSQLiteDbWriter(db_path)

Bases: eyewitness.detection_utils.DetectionResultHandler, eyewitness.image_id.ImageRegister

Parameters:db_path (str) -- database path
create_db_table()

create ImageInfo, BboxDetectionResult table if table not exist

detection_method

BBOX

Type:str
insert_detection_objs(image_id, detected_objects)

insert detection results into db.

Parameters:
  • image_id (str) -- image_id
  • detected_objects (List[BoundedBoxObject]) -- detected objects
insert_image_info(image_id, raw_image_path=None)

insert image_info which used for unit-test

Parameters:
  • image_id (str) -- image_id
  • raw_image_path (str) -- the path of raw image stored
update_image_drawn_image_path(image_id, drawn_image_path)

update db image_id.drawn_image_path

class eyewitness.result_handler.db_writer.BboxPeeweeDbWriter(database, auto_image_registration=False)

Bases: eyewitness.detection_utils.DetectionResultHandler, eyewitness.image_id.ImageRegister

Parameters:
  • database (peewee.Database) -- peewee db obj
  • auto_image_registration (Bool) -- enable the auto_image_registration will check if image registered or not which might make the handle function more slowly
check_proxy_db()

check if the db proxy is correct one, if not initialize again.

create_db_table()

create ImageInfo, BboxDetectionResult table if table not exist

detection_method
insert_detection_objs(image_id, detected_objects)

insert detection results into db.

Parameters:
  • image_id (str) -- image_id
  • detected_objects (List[BoundedBoxObject]) -- detected objects
insert_image_info(image_id, raw_image_path=None)

insert image_info which used for unit-test

Parameters:
  • image_id (ImageId obj) -- image_id obj (including channel, timestamp, file-format)
  • raw_image_path (str) -- the path of raw image stored
update_image_drawn_image_path(image_id, drawn_image_path)

update db image_id.drawn_image_path

class eyewitness.result_handler.db_writer.FalseAlertPeeweeDbWriter(database)

Bases: eyewitness.feedback_msg_utils.FeedbackMsgHandler, eyewitness.audience_id.AudienceRegister, eyewitness.image_id.ImageRegister

Parameters:database (peewee.Database) -- peewee db obj
check_proxy_db()

check if the db proxy is correct one, if not initialize again.

create_db_table()

create ImageInfo, RegisteredAudience, FalseAlertFeedback table if table not exist

feedback_method

feedback_method

Type:str
insert_feedback_obj(feedback_msg)

insert feedback obj into db.

Parameters:feedback_msg (FeedbackMsg) --
insert_image_info(image_id, raw_image_path=None)

insert image_info which used for unit-test

Parameters:
  • image_id (str) -- image_id
  • raw_image_path (str) -- the path of raw image stored
insert_registered_user(audience_id, register_time, description)

insert image_info which used for unit-test

Parameters:
  • audience_id (AudienceId) --
  • register_time (int) --
  • description (str) --