Refactor to simplify support for additional detector types (#3656)

* Refactor EdgeTPU and CPU model handling to detector submodules.

* Fix selecting the correct detection device type from the config

* Remove detector type check when creating ObjectDetectProcess

* Fixes after rebasing to 0.11

* Add init file to detector folder

* Rename to detect_api

Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>

* Add unit test for LocalObjectDetector class

* Add configuration for model inputs
Support transforming detection regions to RGB or BGR.
Support specifying the input tensor shape.  The tensor shape has a standard format ["BHWC"] when handed to the detector, but can be transformed in the detector to match the model shape using the model  input_tensor config.

* Add documentation for new model config parameters

* Add input tensor transpose to LocalObjectDetector

* Change the model input tensor config to use an enumeration

* Updates for model config documentation

Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com>
This commit is contained in:
Nate Meyer
2022-11-03 22:23:09 -04:00
committed by GitHub
parent 1bc9efd529
commit 4383b883c0
17 changed files with 456 additions and 150 deletions

View File

@@ -16,7 +16,7 @@ import cv2
import numpy as np
from frigate.config import FrigateConfig
from frigate.edgetpu import LocalObjectDetector
from frigate.object_detection import LocalObjectDetector
from frigate.motion import MotionDetector
from frigate.object_processing import CameraState
from frigate.objects import ObjectTracker
@@ -117,13 +117,12 @@ class ProcessClip:
detection_enabled = mp.Value("d", 1)
motion_enabled = mp.Value("d", True)
stop_event = mp.Event()
model_shape = (self.config.model.height, self.config.model.width)
process_frames(
self.camera_name,
self.frame_queue,
self.frame_shape,
model_shape,
self.config.model,
self.camera_config.detect,
self.frame_manager,
motion_detector,