I'm using a webcam to detect changes in an environment. When a person walks into view of the webcam the Status displays "INTRUDER ALERT". I want an alarm to sound when this is displayed.
Code:
while (true) {
if (classifier.getNumClasses() > 0) {
  // Get the activation from mobilenet from the webcam.
  const activation = net.infer(webcamElement, 'conv_preds');
  // Get the most likely class and confidences from the classifier module.
  const result = await classifier.predictClass(activation);
  const classes = ['SECURED', 'INTRUDER ALERT'];
  document.getElementById('console').innerText = `
    Status: ${classes[result.classIndex]}\n
    Accuracy: ${result.confidences[result.classIndex]}
  `;
}
await tf.nextFrame();