From d2995431bd12ade6fbd138040703e68f4a3a6e34 Mon Sep 17 00:00:00 2001 From: GP Date: Wed, 13 Nov 2024 16:23:14 +0100 Subject: [PATCH] Merge pi classifier (#214) * sub preview frames from start rec datetime * up version --------- Co-authored-by: gferraro --- pyproject.toml | 2 +- src/piclassifier/piclassifier.py | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index dc53c1c5..e038aaa7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -8,7 +8,7 @@ build-backend = "hatchling.build" [project] name = "classifier_pipeline" -version = "0.0.17" +version = "0.0.18" authors = [ { name="Giampaolo Ferraro", email="giampaolo@cacophony.org.nz" }, ] diff --git a/src/piclassifier/piclassifier.py b/src/piclassifier/piclassifier.py index a875ba7c..edbbdbca 100644 --- a/src/piclassifier/piclassifier.py +++ b/src/piclassifier/piclassifier.py @@ -1,4 +1,4 @@ -from datetime import datetime +from datetime import datetime, timedelta import json import logging import os @@ -8,7 +8,6 @@ import logging from track.clip import Clip - from .motiondetector import SlidingWindow from .processor import Processor @@ -290,8 +289,11 @@ def new_clip(self, preview_frames): ) global clip clip = self.clip - self.clip.video_start_time = datetime.now() - self.clip.num_preview_frames = self.preview_frames + self.clip.video_start_time = datetime.now() - timedelta( + seconds=len(preview_frames) / self.headers.fps + ) + + self.clip.num_preview_frames = len(preview_frames) self.clip.set_res(self.res_x, self.res_y) self.clip.set_frame_buffer( @@ -303,7 +305,6 @@ def new_clip(self, preview_frames): ), max_frames=self.max_keep_frames, ) - edge_pixels = self.tracking_config.edge_pixels self.clip.update_background(self.motion_detector.background.copy()) self.clip._background_calculated()