Optimising SecuritySpy’s AI Object Detection

The new AI-powered motion detection features in SecuritySpy version 5 use deep neural networks to detect the presence of humans and vehicles. This allows for highly-accurate triggering of recordings and notifications of just the events that you are interested in.

The AI algorithms output a prediction probability, indicating the likelihood for the presence of a human or vehicle, and you can choose the threshold at which this triggers recording and notifications. Generally, a threshold of 50% gives good results.

However, the accuracy of the AI depends on many factors such as the distance to the subject, lighting, resolution and quality of the camera. You might find that the threshold you have chosen is letting through too many false-positive triggers, or conversely is preventing real motion from generating a trigger.

To see how the AI is performing on your system, create a folder called “AI Predictions” in the SecuritySpy folder within your Home folder (to get to the Home folder, click the Go menu in the Finder and select Home). Then, whenever a video frame is passed through the AI, SecuritySpy will annotate the frame with the motion area and prediction probabilities, and will save it to this folder as an image file. Inspecting these images allows you to determine what the AI is “seeing”, and will therefore allow you to adjust your trigger thresholds for optimum results on your system.

Here are some examples of these annotated images (cropped to just the relevant area):

annotated1

annotated2

A high-quality setup with a high-resolution camera and good lighting is likely to result in highly accurate predictions that are close to 100%. In this case, you might like to increase the threshold value (perhaps to 90%) in order to to cut out more false-positive detections. Conversely, if the image quality is not so good, the AI predictions are likely to be less certain, and you probably want to reduce the trigger threshold to make sure that you don’t miss any real motion.

Note that in general, the AI algorithms work best with high-quality cameras. If you are using low-quality cameras, or your cameras are frequently operating in low lighting conditions and producing grainy/noisy images, it may be best to disable the AI and stick to standard motion detection.

Minimising CPU Usage

Initially, standard motion detection is performed on the incoming video stream to determine which frames to pass to the AI for further analysis. Because the AI can consume significant CPU resources, it is important to use suitable settings for this first-stage motion detection. Generally, this means using a sensitivity setting of 50-60% and a trigger time setting of at least 1 second.

prefs-cameras-triggers

Exactly how much CPU time is used depends on the speed of your Mac and whether it supports GPU-based hardware acceleration. Without hardware acceleration, analysing one video frame via the AI results in very high CPU usage for a very short period of time (e.g. 50-100ms). Conversely, on the latest M1 Macs, analysis is done in specialised hardware in 2ms or faster, resulting in negligible CPU usage.

14 thoughts on “Optimising SecuritySpy’s AI Object Detection

  1. Nan

    I am trialing the new software, you mention above GPU based hardware acceleration. I’m not a computer expert. I am running SS on a 2019 IMac 27″ 5k retina. Does it have the hardware to run this sofware properly. I ask as I have had several warnings about high CPU use since installing the trial version 3 weeks ago. Thanks!

    Reply
    1. Ben Software Post author

      Yes, your iMac is suitable for running SecuritySpy. If you are getting warnings about high CPU usage, this can be resolved with some settings tweaks. The main thing to check is the frame rates (fps) that your cameras are set to, as unnecessarily high frame rates can lead to high CPU usage. Connect to each of your cameras using a web browser to check their settings and adjust the frame rate of video that they are sending – I suggest that 10fps is good for general-purpose CCTV. We also have some further recommendations in the Optimising Performance section of the user manual.

      Reply
    1. Ben Software Post author

      Not at the moment, but we are working on this feature and it will be available in a near-future version of SecuritySpy.

      Reply
  2. Greg

    Hi,

    Three questions.

    In a 4 camera set up, is there a way to have AI Predictions on only one of the cameras? I have cameras facing two directions, and I want to have AI predictions saved for only one direction. The second direction is new and is not a lot of movement and I’d like to leave AI predictions turned on so I can see how things are recognized to help dial in the thresholds. Is it possible to have just a subset of cameras putting data in the AI Predictions folder?

    Next, in a scene where vehicles are parked but people are moving the “Human” % is really low but “Vehicle” is 100%. It is fortunately recording the video, but the reason it is recording is the false high value on vehicle, not the actual people moving around. This has other implications (see next question).

    Finally, I have found it is possible for a person moving sort of slowly with .5 second duration set to not trigger the recording. However, 1 frame duration ends up creating a lot of false positives with animals. For example a rabbit or bird moving on the ground near a vehicle is incorrectly tagged as Vehicle 100% and recording (single frame) even if the vehicle is not moving. Moving to .5 second mostly stops this, however slower moving people no longer triggers record either. Any suggestions on dialing this in?

    Thanks,
    Greg

    Reply
    1. Ben Software Post author

      Hi Greg,

      All cameras will save to the “AI Predictions” folder if it exists. I think a better method for you might be to use the new “Movie search metadata” options under Preferences > Cameras > Triggers to save all the AI info to the captured movie files themselves. Then you can use the Browser feature in SecuritySpy to see where the detections took place.

      Note that the AI can’t distinguish between static and moving objects. So if you have enabled vehicle detection, and you have some other object (e.g. an animal) moving in front of a static vehicle, the image that gets sent to the AI for classification, which contains both the animal and the vehicle, will trigger the vehicle AI. So in a scene where there are static vehicles, the vehicle detector isn’t going to be very useful unfortunately.

      Reply
    1. Ben Software Post author

      The files in this folder do not get cleared automatically. This functionality is for diagnostic purposes, so that you can investigate how the AI is operating – when you are done with this, simply delete the whole folder, and no further files will be created.

      Reply
  3. cliffg

    Does this software only support its own motion detection? Or can it leverage cameras with built-in motion detection that send out ONVIF compatible event alerts?

    Reply
  4. Dale Pittock

    I am starting to use the AI Predictions folder and am a little confused about why the jpegs show predictions on items that are not checked in the Trig section. For example I have one zone only looking for Humans and Animals – but the JPEG shows a % on vehicle. Why wast the time????

    Dale

    Reply
    1. Ben Software Post author

      Hi Dale, SecuritySpy’s AI algorithm is a “mutli-label classifier”, which is one that outputs multiple predictions (in this case, one for humans, one for vehicles and one for animals) for each image that is run through the network once. Therefore, all three predictions are always available after the image is analysed by the AI, and including the vehicle prediction in the images you are referring to does not take any extra time.

      Reply
  5. Chris Brock

    Does SecuritySpy have any way of functioning as an ALPR (or Britain may call it ANPR) to recognize and store number plates?

    Reply
    1. Ben Software Post author

      Hi Chris, currently SecuritySpy does not have ANPR/ALPR functionality. We are considering adding this in a future update, but I can’t promise if/when this will happen.

      Reply

Leave a Reply to Ben Software Cancel reply

Your email address will not be published. Required fields are marked *