Hi @shashi that was my fault…
I was deleting confidential data and copied from wrong edit. I do not use ZoneCount but ObjectCount
The current smart_nvr looks like this:
import degirum as dg, degirum_tools
from degirum_tools import streams as dgstreams
hw_location = "10.0.0.2:8778"
model_zoo_url = "aiserver://home/pi/DeGirum/zoo"
model_name = "yolov8s_coco--640x640_quant_hailort_hailo8_1"
video_source = "rtmp://input.server/man/livestream"
holdoff_sec = 3.0
notification_config = "json://console" # just prints to console
# notification_config="mailto://10.0.0.1:8025?user=pepe@pepe.pep&pass=p&from='AI notification <noreply@pepe.pep>'&to=pep@pepe.pep"
clip_duration = 10
storage_config = degirum_tools.ObjectStorageConfig(
endpoint="temp_folder/detections", # Object storage endpoint URL or local path
access_key="", # Access key for the storage account
secret_key="", # Secret key for the storage account
bucket=".", # Bucket name for S3 or local directory name
)
"""
storage_config = degirum_tools.ObjectStorageConfig(
endpoint="./temp_folder", # Object storage endpoint URL or local path
access_key="", # Access key for the storage account
secret_key="", # Secret key for the storage account
bucket="detections", # Bucket name for S3 or local directory name
)
"""
# load model
model = dg.load_model(
model_name,
hw_location,
model_zoo_url,
overlay_show_probabilities=True,
overlay_line_width=1,
)
#
# create analyzers:
#
anchor = degirum_tools.AnchorPoint.CENTER
window_name = "Live Display (press 'q' to quit)"
event_name = "object_detected"
# object tracker
object_tracker = degirum_tools.ObjectTracker(
track_thresh=0.35,
track_buffer=100,
match_thresh=0.9999,
trail_depth=10,
anchor_point=anchor,
)
# zone counter
# event detector: object in zone
zone_detector = degirum_tools.EventDetector(
f"""
Trigger: {event_name}
when: ObjectCount
is greater than: 0
during: [10, frames]
for at least: [90, percent]
""",
show_overlay=False,
)
# event notifier
notifier = degirum_tools.EventNotifier(
event_name,
event_name,
message="{time}: person is detected in zone",
holdoff=holdoff_sec,
notification_config=notification_config,
clip_save=True,
clip_duration=clip_duration,
clip_pre_trigger_delay=clip_duration // 2,
storage_config=storage_config,
)
degirum_tools.attach_analyzers(
model, [object_tracker, zone_detector, notifier]
)
#
# create gizmos
#
# video source gizmo
cam_source = dgstreams.VideoSourceGizmo(video_source)
# detection gizmo
detector = dgstreams.AiSimpleGizmo(model)
# local display gizmo (just for debugging)
display = dgstreams.VideoDisplayGizmo(window_name, show_ai_overlay=True)
# start composition
dgstreams.Composition(cam_source >> detector >> display).start()
as said, this shows the notification event (only one), but does not create the clip_file nor send the email to the aiosmtpd