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
Provide an image to the
Image RGBinput (live or static).Adjust the
Confidence Threshold %slider to the desired sensitivity.Read the annotated image from the
Image RGBoutput and the counts fromMasked,Uncorrect Masked, andNo Maskfor 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), orStream Readeras 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 Resizebefore this block to reduce input size and increase throughput.Limit detection to a region of interest using
Image ROI,Image ROI Select, orImage ROI Polygonto avoid irrelevant detections and speed up processing.Overlay or format detection output for presentations using
Draw Detectionsto add rectangles and labels.Log or save suspicious frames with
Image Logger,Image Write, orRecord Videowhen counts exceed thresholds.Combine with
Object_Detection_Trackerif 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 Imageand 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 withImage ROI.Many false positives: raise
Confidence Threshold %, useImage Resizeto maintain appropriate scale, or restrict analysis with an ROI.Slow performance: downscale input with
Image Resize, or run on fewer frames (skip frames upstream). UseImage Loggerto capture only frames that meet conditions.Unreliable results under poor lighting: improve illumination, or apply preprocessing like
DenoisingandContrast Optimizationbefore feeding images into this block.
Last updated
Was this helpful?