add some debug logging to frame cache

This commit is contained in:
Blake Blackshear 2020-11-14 07:41:08 -06:00
parent ce2a583ff9
commit 0cf78277b5
2 changed files with 3 additions and 1 deletions

View File

@ -20,7 +20,7 @@ RUN apt-get -qq update \
python3-pip \ python3-pip \
&& pip3 install -U /wheels/*.whl \ && pip3 install -U /wheels/*.whl \
&& APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn apt-key adv --fetch-keys https://packages.cloud.google.com/apt/doc/apt-key.gpg \ && APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn apt-key adv --fetch-keys https://packages.cloud.google.com/apt/doc/apt-key.gpg \
&& echo "deb https://packages.cloud.google.com/apt coral-edgetpu-unstable main" > /etc/apt/sources.list.d/coral-edgetpu.list \ && echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" > /etc/apt/sources.list.d/coral-edgetpu.list \
&& echo "libedgetpu1-max libedgetpu/accepted-eula select true" | debconf-set-selections \ && echo "libedgetpu1-max libedgetpu/accepted-eula select true" | debconf-set-selections \
&& apt-get -qq update && apt-get -qq install --no-install-recommends -y \ && apt-get -qq update && apt-get -qq install --no-install-recommends -y \
libedgetpu1-max=15.0 \ libedgetpu1-max=15.0 \

View File

@ -311,6 +311,7 @@ class CameraState():
if (not updated_obj.false_positive if (not updated_obj.false_positive
and updated_obj.thumbnail_data['frame_time'] == frame_time and updated_obj.thumbnail_data['frame_time'] == frame_time
and frame_time not in self.frame_cache): and frame_time not in self.frame_cache):
logging.info(f"Adding {frame_time} to cache.")
self.frame_cache[frame_time] = np.copy(current_frame) self.frame_cache[frame_time] = np.copy(current_frame)
# call event handlers # call event handlers
@ -376,6 +377,7 @@ class CameraState():
current_best_frames = set([obj.thumbnail_data['frame_time'] for obj in self.best_objects.values()]) current_best_frames = set([obj.thumbnail_data['frame_time'] for obj in self.best_objects.values()])
thumb_frames_to_delete = [t for t in self.frame_cache.keys() if not t in current_thumb_frames and not t in current_best_frames] thumb_frames_to_delete = [t for t in self.frame_cache.keys() if not t in current_thumb_frames and not t in current_best_frames]
for t in thumb_frames_to_delete: for t in thumb_frames_to_delete:
logging.info(f"Removing {t} from cache.")
del self.frame_cache[t] del self.frame_cache[t]
with self.current_frame_lock: with self.current_frame_lock: