Mask Detection

This function block detects faces and classifies whether masks are worn correctly. It returns an annotated image for visual inspection and numeric counts for quick metrics.

πŸ“₯ Inputs

Image RGB Image input to analyze. Accepts color images from cameras, files, or previous processing blocks.

πŸ“€ Outputs

Image RGB Annotated image with detection overlays for visualization.

Masked Count of faces detected with correct mask usage.

Uncorrect Masked Count of faces detected with masks worn incorrectly (e.g., nose uncovered).

No Mask Count of faces detected without a mask.

πŸ•ΉοΈ Controls

Confidence Threshold % Slider to adjust detection confidence. Increase to reduce false positives; decrease to find weaker detections. Use small adjustments to balance precision and recall for your scene.

🎯 Features

  • Visual output with detection overlays for quick review.

  • Numeric outputs for easy integration into logging, alarms, or dashboards.

  • Runtime confidence tuning via the slider for adaptability to different lighting and distances.

πŸ“ Usage Instructions

  1. Provide an image to the Image RGB input (live or static).

  2. Adjust the Confidence Threshold % slider to the desired sensitivity.

  3. Read the annotated image from the Image RGB output and the counts from Masked, Uncorrect Masked, and No Mask for downstream processing.

βš™οΈ Evaluation

When the block runs it analyzes the supplied image, annotates detected faces, and outputs the annotated image plus counts of each mask status. Use the confidence slider to tune detection behavior for your environment.

πŸ’‘ Tips and Tricks

  • For live camera input use Camera USB, Camera IP (ONVIF), or Stream Reader as the image source to continuously analyze a stream.

  • To inspect results visually while developing, route the annotated image to Show Image.

  • If you need to process large frames faster, insert Image Resize before this block to reduce input size and increase throughput.

  • Limit detection to a region of interest using Image ROI, Image ROI Select, or Image ROI Polygon to avoid irrelevant detections and speed up processing.

  • Overlay or format detection output for presentations using Draw Detections to add rectangles and labels.

  • Log or save suspicious frames with Image Logger, Image Write, or Record Video when counts exceed thresholds.

  • Combine with Object_Detection_Tracker if you need to track mask status over time for the same person (use counts to trigger tracking or logging).

  • For batch analysis of stored images, start with Load Image and then feed into this block for offline processing.

πŸ› οΈ Troubleshooting

  • No detections: try lowering Confidence Threshold %, ensure the input image is clear and well lit, or crop to the relevant area with Image ROI.

  • Many false positives: raise Confidence Threshold %, use Image Resize to maintain appropriate scale, or restrict analysis with an ROI.

  • Slow performance: downscale input with Image Resize, or run on fewer frames (skip frames upstream). Use Image Logger to capture only frames that meet conditions.

  • Unreliable results under poor lighting: improve illumination, or apply preprocessing like Denoising and Contrast Optimization before feeding images into this block.

Last updated

Was this helpful?