Acoustic micro imaging (AMI) can capture defect information at specific layers of a wafer or advanced package sample. Automated acoustic microscopes are typically used for wafer inspection and inline tray scanning for back end packaging devices. During an automated inspection, defects are detected based on their signal amplitude (and polarity, as relevant), and failure criteria is automatically applied based on factors such as size, quantity, and location of defects. As wafer patterns become more complex, test image analysis requires added flexibility to ensure high quality, consistent defect detection. Traditional acoustic image analysis works in many cases, however complex die structures such as metallization and via patterns typically appear at the same signal amplitude as voids, which leads to a need for a new type of defect detection. This allows analysis to be fully automated and move away from manual, visual classification. Multi-Gate Image Analysis (MGIA) is a new software tool which uses machine learning to recognize patterns, exclude them from void count, and combine defect analysis from different layers into one straightforward result based on customized failure criteria. Automated in-line acoustic microscopes can inspect multiple sample layers simultaneously, evaluate voiding, and detect failures early on in the production process. Using an MGIA machine learning model, it is possible to obtain an accurate defect count and apply relevant failure criteria without artificially inflating the defect count and size by including vias, metallization, or other patterns. This software model is a precursor to anomaly detection, which will be able to identify defects and anomalies after being trained on a set of known good parts. Using a calibration wafer as a case study, it is possible to train a machine learning model and to use that model to differentiate between delaminations and intentionally created calibration voids. This model can be integrated into a production recipe to better quantify defects on production wafers and trays.