Skip to content

Notification Latching + Resetting Algorithm

When the AI software is running and tracking detections, it needs to decide when to send notifications or actions. This document describes the behavior that allows or disallows the software to perform any of these said actions.

Notifications

It is important that the software is not spamming you with notifications when an item is detected consistently. For this reason we use the following criteria to decide wether a notification can be sent:

  1. Is the number of notifications sent in the last 4 hours less than 10?
  2. Was the most recent notification sent more than 10 minutes ago?
  3. Is the Trigger active?

The answer to all three of the questions above must be Yes in order for a notification to be sent.

What is Trigger active?

The Trigger is a variable that tells the software whether it is able to resend another notification once one notification has already been sent.

  • Trigger starts as TRUE in the beginning of a print job and is set to FALSE once a notification has been sent due to a defect detection.
  • Trigger will be set back to TRUE if the EMA score stays at or below the Notification Threshold for at least 60% * buffer_length cycles. With default values for OctoPrint this is 10 cycles.

Visualization

The example below shows raw detection scores with the associated EMA at every inference cycle for ~100 cycles. The vertical yellow dashed and dotted line is the moment when a notification is sent to the user. In this example the notification is sent and then for whatever reason, the defect goes away and the detection scores decrease.

image

At ~ 80 cycles the Trigger is reset back to TRUE, meaning another notification can be sent if the Notification Threshold is crossed again.

Actions

The latching for actions is more simple since the buffer resets when the print is paused, and for the print to continue the user must resume the print (The assumption here is that if the user resumes the print, the defect has either been removed or fixed).

For this reason, the criteria for an action to be sent are only:

  1. Was the most recent action sent more than 10 minutes ago?