forked from Github/frigate
add models and convert speed to ms
This commit is contained in:
@@ -36,10 +36,10 @@ class ObjectDetector():
|
||||
|
||||
if edge_tpu_delegate is None:
|
||||
self.interpreter = tflite.Interpreter(
|
||||
model_path=model_file)
|
||||
model_path='/cpu_model.tflite')
|
||||
else:
|
||||
self.interpreter = tflite.Interpreter(
|
||||
model_path=model_file,
|
||||
model_path='/edgetpu_model.tflite',
|
||||
experimental_delegates=[edge_tpu_delegate])
|
||||
|
||||
self.interpreter.allocate_tensors()
|
||||
|
||||
@@ -13,7 +13,7 @@ import matplotlib.pyplot as plt
|
||||
from frigate.util import draw_box_with_label
|
||||
from frigate.edgetpu import load_labels
|
||||
|
||||
PATH_TO_LABELS = '/lab/labelmap.txt'
|
||||
PATH_TO_LABELS = '/labelmap.txt'
|
||||
|
||||
LABELS = load_labels(PATH_TO_LABELS)
|
||||
cmap = plt.cm.get_cmap('tab10', len(LABELS.keys()))
|
||||
|
||||
@@ -122,12 +122,9 @@ def track_camera(name, config, ffmpeg_global_config, global_objects_config, dete
|
||||
for obj in objects_with_config:
|
||||
object_filters[obj] = {**global_object_filters.get(obj, {}), **camera_object_filters.get(obj, {})}
|
||||
|
||||
min_fps = config.get('min_fps', 0)
|
||||
expected_fps = config['fps']
|
||||
take_frame = config.get('take_frame', 1)
|
||||
|
||||
# TODO: some kind of watchdog replacement...
|
||||
# watchdog_timeout = config.get('watchdog_timeout', 300)
|
||||
|
||||
frame_shape = get_frame_shape(ffmpeg_input)
|
||||
frame_size = frame_shape[0] * frame_shape[1] * frame_shape[2]
|
||||
|
||||
@@ -175,7 +172,6 @@ def track_camera(name, config, ffmpeg_global_config, global_objects_config, dete
|
||||
frame_bytes = ffmpeg_process.stdout.read(frame_size)
|
||||
|
||||
if not frame_bytes:
|
||||
# TODO: restart the ffmpeg process and track number of restarts
|
||||
break
|
||||
|
||||
# limit frame rate
|
||||
@@ -197,7 +193,7 @@ def track_camera(name, config, ffmpeg_global_config, global_objects_config, dete
|
||||
motion_boxes = motion_detector.detect(frame)
|
||||
|
||||
# skip object detection if we are below the min_fps
|
||||
if frame_num > 50 and fps.value < min_fps:
|
||||
if frame_num > 50 and fps.value < expected_fps-1:
|
||||
skipped_fps_tracker.update()
|
||||
skipped_fps.value = skipped_fps_tracker.eps()
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user