Defect detection method and apparatus based on static engine and computation graph instance

By combining a static engine and computational graph instances, the problems of low inference throughput and unstable latency in semiconductor AOI inspection are solved, achieving efficient and stable defect detection, which is suitable for large-area wafer and panel block scanning scenarios.

CN123181418APending Publication Date: 2026-11-27深圳市壹倍科技有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611596287.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-15
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

Traditional deep learning inference solutions suffer from low inference throughput, unstable latency, and large timing jitter in semiconductor AOI inspection, failing to meet the stability requirements of high-end equipment.

Method used

A defect detection method based on a static engine and computation graph instances is adopted. By combining the static TensorRT engine with CUDA streams, the computation graph instances are preheated and saved. The resident buffer is used for zero padding and full vectorization batch post-processing to avoid recapture of the computation graph and improve detection throughput and stability.

Benefits of technology

Significantly reduces inference latency jitter, ensures production line timing stability, improves detection throughput, avoids performance bottlenecks caused by CPU serial loops, and adapts to defect localization needs in block scanning scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123181418A_ABST
    Figure CN123181418A_ABST
Patent Text Reader

Abstract

The application discloses a defect detection method and device based on a static engine and a computation graph instance, comprising: through static engine file and dimension alignment with a resident buffer, preheating and one-time capturing and saving a computation graph instance in an independent CUDA stream, completing reasoning only through replaying the computation graph, avoiding repeated recapturing of the computation graph, and significantly reducing reasoning delay jitter. Zero padding is performed on real slice images to obtain an initial tensor with fixed dimensions, which adapts to the input requirements of static reasoning. After reasoning, the invalid data caused by zero padding is removed by intercepting the predicted tensor, so that the detection accuracy is not affected by the zero padding operation. Subsequent full vectorization batch post-processing is performed to obtain a detection frame set, and the post-processing operation is transferred to the GPU side to avoid the performance bottleneck caused by CPU serial loops. Global coordinate compensation is performed on the detection frame set, and the defect position in the wafer coordinate system is output, which adapts to the defect positioning requirements in the block scanning scene.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of industrial machine vision, semiconductor automated optical inspection, and deep learning inference acceleration technology, and particularly to a defect detection method and apparatus based on static engine and computational graph instances for large-area wafer and panel block scanning scenarios. Background Technology

[0002] In semiconductor AOI (Automated Optical Inspection) equipment, the entire wafer needs to be photographed in sections by a camera. The ultra-large field-of-view image is then divided into a large number of fixed-size slices. A deep learning object detection model is then used to inspect the chip position slice by slice, as well as defects such as scratches, dirt, edge chipping, and discoloration. Online inspection on the production line has extremely high requirements for inference throughput, latency stability, and timing jitter. Traditional deep learning inference solutions have multiple performance bottlenecks and cannot meet the stability requirements of high-end semiconductor equipment. Summary of the Invention

[0003] This invention provides a defect detection method, apparatus, computer device, and storage medium based on a static engine and computation graph instances, eliminating inference timing jitter and CPU post-processing bottlenecks, and improving semiconductor AOI detection throughput and operational stability.

[0004] A defect detection method based on a static engine and computational graph instances includes: Determine the inference context corresponding to the static engine file and initialize the resident buffer; align the size of the fixed batch in the static engine file with the dimensions of the resident buffer; the dimensions of the resident buffer cannot be adjusted during the inference runtime phase; Create isolated inference tasks in the CUDA stream and perform model warm-up within the CUDA stream through the inference context, capturing and saving computation graph instances all at once; Based on the acquired multiple real slice images, the resident buffer is padded with zeros to obtain the initial tensor; The computation graph instance is replayed and inference is performed based on the initial tensor to obtain the predicted tensor, and the predicted tensor is truncated. The truncated prediction tensor is fully vectorized and batch post-processed to obtain a set of detection boxes. Global coordinate compensation is then performed on the set of detection boxes to obtain the defect location in the wafer coordinate system. Fully vectorized batch post-processing includes at least adaptive decoding, confidence and wafer edge security boundary filtering, and batch nonmaximum suppression processing.

[0005] In one embodiment, determining the inference context corresponding to the static engine file and initializing the video memory buffer includes: determining a static TensorRT engine object by compiling a static engine file with a fixed batch size and binding it to a specified GPU device; creating an inference context based on the static TensorRT engine object; allocating a resident buffer to the video memory of the specified GPU device according to a preset maximum batch size; and during the initialization phase, binding the input and output tensors of the inference context to the resident buffer.

[0006] In one embodiment, the resident buffer is zero-padding to obtain an initial tensor based on multiple acquired real slice images, including: asynchronously copying the real slice images to the front segment of the resident buffer; the number of dimensions of the front segment is the same as the number of real slice images; zero-padding is performed on the rear segment of the resident buffer located after the front segment; and the tensors in the copied and padded front and rear segments are combined to obtain the initial tensor.

[0007] In one embodiment, the truncated prediction tensor is subjected to full vectorization batch post-processing to obtain a set of detection boxes, including: adaptively decoding the truncated prediction tensor to obtain multiple prediction boxes; reorganizing the dimensions of the decoded prediction boxes and retaining the index label of the real slice image to which each prediction box belongs; performing confidence and wafer edge safety boundary filtering in parallel through GPU tensor broadcasting mechanism; when performing batch nonmaximum suppression, segmenting and isolating according to the index label of each prediction box; completing the deduplication processing of segmented batch nonmaximum suppression to obtain the detection box corresponding to each real slice image; the detection box includes coordinates, confidence, category, and index label.

[0008] In one embodiment, adaptive decoding of the truncated prediction tensor to obtain multiple prediction boxes includes: determining the target dimension size of the last channel in the truncated prediction tensor and determining the target encoding format based on the target dimension size; and adaptively decoding each truncated prediction tensor according to the target encoding format to obtain multiple prediction boxes.

[0009] In one embodiment, when performing batch nonmaximum suppression, segmentation isolation is performed based on the index label of each predicted box, including: grouping multiple predicted boxes according to the index label of each predicted box; multiple predicted boxes in each group correspond to a real slice image; filtering the head predicted box and multiple remaining predicted boxes from the multiple predicted boxes in the current group according to the confidence of the predicted boxes; performing box suppression processing on the head predicted box and multiple remaining predicted boxes to obtain multiple detection boxes; and concatenating the multiple detection boxes output by each group using tensors to obtain a set of detection boxes after segmentation isolation.

[0010] In one embodiment, the fixed batch size is determined based on at least the maximum number of slice images that the production line block camera can generate in a single run, the available video memory size of the GPU device, and the maximum inference latency allowed per frame; the number of fixed batches is greater than the number of actual slice images; during the inference run phase, the fixed batch size cannot be dynamically modified and the dimension of the resident buffer cannot be adjusted.

[0011] A defect detection device based on a static engine and computational graph instances, comprising: The engine loading and memory management module is used to determine the inference context corresponding to the static engine file and initialize the resident buffer; the size of the fixed batch in the static engine file is aligned with the dimension of the resident buffer; the dimension of the resident buffer cannot be adjusted during the inference runtime phase; The instance capture and inference module is used to create isolated inference tasks for CUDA streams and perform model warm-up within the CUDA stream through the inference context, capturing and saving computation graph instances in one go. The image zero-padding and copying module is used to fill the resident buffer with zeros based on multiple real slice images to obtain the initial tensor; The instance capture and inference module is also used to replay computation graph instances and infer based on the initial tensor to obtain the predicted tensor; The vectorization post-processing module is used to truncate the prediction tensor and perform full vectorization batch post-processing on the truncated prediction tensor to obtain a set of detection boxes; the full vectorization batch post-processing includes at least adaptive decoding, confidence and wafer edge safety boundary filtering, and batch nonmaximum suppression processing; The batch global coordinate compensation module is used to perform global coordinate compensation on the detection box set to obtain the defect location in the wafer coordinate system.

[0012] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the aforementioned defect detection method based on a static engine and computational graph instances.

[0013] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the aforementioned defect detection method based on a static engine and computational graph instances.

[0014] The aforementioned defect detection method, apparatus, computer equipment, and storage medium based on a static engine and computational graph instances align the static engine file with the resident buffer dimensions, preheat and capture and save the computational graph instances in a single batch within an independent CUDA stream, and complete inference only by replaying the computational graph, avoiding repeated recapture of the computational graph, significantly reducing inference latency jitter, and ensuring production line timing stability. Zero-padding is performed on the real slice image to obtain a fixed-dimensional initial tensor, adapting to the static inference input requirements. After inference, the predicted tensor is truncated to remove invalid data caused by zero-padding, ensuring that detection accuracy is not affected by the zero-padding operation. Subsequently, full-vectorization batch post-processing is performed to obtain a set of detection boxes, transferring post-processing operations to the GPU side to avoid the performance bottleneck caused by CPU serial loops; then global coordinate compensation is performed on the detection box set to output the defect location in the wafer coordinate system, adapting to the defect localization requirements in block scanning scenarios. Therefore, this invention reduces CPU-GPU interaction overhead overall, improving detection throughput and timing stability without adding new hardware, and can support long-term continuous inspection operations of semiconductor AOI equipment. Attached Figure Description

[0015] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings described below are merely some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without any creative effort.

[0016] Figure 1 This is a schematic diagram of the application environment of a defect detection method based on a static engine and computational graph instances in one embodiment; Figure 2 This is a flowchart of a defect detection method based on a static engine and computation graph instances in one embodiment; Figure 3 This is a flowchart of a defect detection method based on TensorRT and CUDA Graph in one embodiment; Figure 4 This is a schematic diagram of the structure of a computer device in one embodiment. Detailed Implementation

[0017] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0018] The defect detection method based on a static engine and computational graph instances provided in this invention can be applied to, for example... Figure 1The application environment shown is suitable for scenarios such as online inspection of semiconductor surface defects and high-throughput real-time industrial vision inspection. Specifically, it includes, for example... Figure 1 The client and server shown communicate over a network to implement static engine loading and resident memory buffer initialization, single CUDA Graph instance capture and fixation, dynamic real batch adaptive zero-padding, fixed-form CUDA Graph instance replay inference, accurate extraction of effective inference results, fully vectorized batch post-processing, batch vectorized global coordinate compensation, and adaptive compatibility of YOLO model output formats across multiple versions. The client, also known as the user terminal, is the program that provides local services to the client, corresponding to the server. The client can be installed on, but is not limited to, various personal computers, laptops, smartphones, tablets, and portable wearable devices. The server can be implemented using a standalone server or a server cluster consisting of multiple servers.

[0019] In one embodiment, such as Figure 2 As shown, a defect detection method based on a static engine and computational graph instances is provided, and this method is applied to... Figure 1 Taking the server in the example, the following steps are included: Step S101: Determine the inference context corresponding to the static engine file and initialize the resident buffer.

[0020] Step S102: Create an isolated inference task for the CUDA stream, and perform model warm-up within the CUDA stream through the inference context, capturing and saving the computation graph instance all at once.

[0021] In this context, the fixed batch size in the static engine file is aligned with the dimension of the resident buffer; the dimension of the resident buffer cannot be adjusted during the inference runtime phase. Static engines include, for example, the TensorRT engine (TensorRuntime); CUDA streams are ordered execution queues of asynchronous GPU tasks, used to host isolated inference tasks; computation graph instances include CUDA Graph instances (Compute Unified Device Architecture Graph), which include GPU compute nodes, memory copy nodes, and dependency edges representing the execution order of nodes, and can be repeatedly replayed after being captured once; the fixed batch size B_max is the batch dimension fixed during the compilation of the static engine.

[0022] Specifically, this invention addresses the large batches of sliced ​​images generated by wafer slab scanning, sampling based on the TensorRT static engine and CUDA computation graph to achieve high-speed defect detection inference. First, the server acquires a pre-compiled static engine file, constructs the corresponding inference context, and initializes the GPU resident buffer, aligning its dimensions with the fixed batch size defined in the static engine file. This pre-allocation of GPU memory resources provides a stable memory platform for subsequent inference. Next, the server creates a CUDA stream to isolate inference tasks, confining inference operations to an independent CUDA stream. Model warm-up is achieved using the inference context, and computation graph instances are captured and saved in a single pass. Subsequent inference does not recapture the computation graph; only the saved instances are reused, completely eliminating latency jitter caused by recapturing computation graph instances.

[0023] Step S103: Based on the acquired multiple real slice images, zero-padding is performed on the resident buffer to obtain the initial tensor.

[0024] Step S104: Replay the computation graph instance and infer based on the initial tensor to obtain the predicted tensor, and truncate the predicted tensor.

[0025] Step S105: Perform full vectorization batch post-processing on the truncated prediction tensor to obtain the detection box set, and perform global coordinate compensation on the detection box set to obtain the defect location in the wafer coordinate system.

[0026] The full-vectorization batch post-processing includes at least adaptive decoding, confidence and wafer edge security boundary filtering, and batch non-maximum suppression. Each detection box in the detection box set includes coordinates, confidence, category, and index label.

[0027] Specifically, during production line inspection, multiple real slice images are acquired. The real slice image data is filled into a resident buffer, and any remaining empty spaces in the resident buffer are padded with zeros to generate an initial tensor with a fixed batch matching dimensions. The server replays a pre-saved computation graph instance, performs GPU inference operations based on the initial tensor, and outputs a predicted tensor. Then, the predicted tensor is truncated according to the number of real slice images, discarding invalid predicted data corresponding to zero-padded positions. The server performs full GPU vectorization batch post-processing on the truncated predicted tensor, completing decoding, filtering, and isolated batch non-maximum suppression to obtain a set of detection boxes. Finally, based on the offset parameters corresponding to each real slice image, global coordinate compensation is performed on each detection box in the detection box set, uniformly converting the slice's local coordinates to the defect location in the wafer coordinate system, thus completing defect localization.

[0028] In one embodiment, the fixed batch size is determined at least based on the maximum number of slice images that the production line slicing camera can produce in a single run, the available video memory size of the GPU device, and the maximum allowable inference latency per frame.

[0029] In one embodiment, during the inference run phase where computation graph instances are replayed and inference is performed based on the initial tensor, the fixed batch cannot be dynamically modified and the dimension of the resident buffer cannot be adjusted.

[0030] The aforementioned defect detection method based on a static engine and computational graph instances aligns the static engine file with the resident buffer dimensions, preheats and captures and saves computational graph instances in a single batch within an independent CUDA stream, and completes inference solely through computational graph playback. This avoids repeated recapture of the computational graph, significantly reducing inference latency jitter and ensuring production line timing stability. Zero-padding is performed on the real slice image to obtain a fixed-dimensional initial tensor, adapting to the static inference input requirements. After inference, the predicted tensor is truncated to remove invalid data resulting from zero-padding, ensuring that detection accuracy is not affected by the zero-padding operation. Subsequent full-vectorization batch post-processing yields a set of detection boxes, transferring post-processing operations to the GPU side to avoid the performance bottleneck caused by CPU serial loops. Global coordinate compensation is then performed on the detection box set to output the defect location in wafer coordinates, adapting to the defect localization requirements in block scanning scenarios.

[0031] In one embodiment, determining the inference context corresponding to the static engine file and initializing the video memory buffer includes: determining a static TensorRT engine object by compiling a static engine file with a fixed batch size and binding it to a specified GPU device; creating an inference context based on the static TensorRT engine object; allocating a resident buffer to the video memory of the specified GPU device according to a preset maximum batch size; and during the initialization phase, binding the input and output tensors of the inference context to the resident buffer.

[0032] Specifically, the server reads a pre-compiled static engine file with a fixed batch size B_max, parses it to generate a static TensorRT engine object, and binds this engine object to the specified GPU device, thus associating inference resources with the target hardware. Based on the obtained static TensorRT engine object, a corresponding inference context is created to manage tensor information and execution scheduling during inference. Next, the server allocates resident buffers for input and output in the specified GPU device's video memory using a preset maximum batch size parameter. The tensor dimensions of the resident buffers are aligned with the fixed batch size, achieving pre-static allocation of video memory. During the initialization phase, the input and output tensors of the inference context are bound to this resident buffer all at once.

[0033] In this embodiment, unlike the traditional inference method of repeatedly binding video memory addresses in each round of loop, video memory is no longer reallocated and tensor address binding is no longer repeatedly executed during the inference execution phase. This reduces the interaction overhead between the CPU and GPU in high-frequency inference scenarios, avoids performance loss and video memory fragmentation caused by frequent video memory operations, and ensures the subsequent capture of computation graph instances.

[0034] Furthermore, traditional multi-GPU deployment solutions do not strongly bind inference resources to device contexts, making them prone to cross-GPU memory access anomalies, resource contention among multiple instances, and poor long-term device stability. This invention binds each computation graph instance to a specific GPU device, creating the engine context, CUDA streams, and memory buffers entirely within the target GPU, achieving hardware-level resource isolation across multiple instances. This deployment mechanism eliminates cross-GPU errors and resource conflicts, significantly improving the reliability of continuous device operation in multi-GPU parallel scenarios.

[0035] In one embodiment, the resident buffer is zero-padding to obtain an initial tensor based on multiple real slice images, including: asynchronously copying the real slice images to the front segment of the resident buffer; zero-padding the rear segment of the resident buffer located after the front segment; and combining the tensors in the copied and padded front and rear segments to obtain the initial tensor.

[0036] In this section, the number of dimensions of the front segment is the same as the number of actual slice images. The number of fixed batches is greater than the number of actual slice images.

[0037] Specifically, the server asynchronously copies the real slice images collected from the production line to the first section of the GPU resident buffer, storing the valid image data for the current batch. The remaining empty spaces in the second section of the resident buffer are filled with zeros to fill in the missing sample positions due to insufficient real slice images. Both the copying and filling operations are performed within the same resident GPU buffer, eliminating the need for additional GPU memory for data concatenation. After copying and filling, the tensor corresponding to this resident buffer becomes the initial tensor conforming to the fixed batch dimension. Therefore, by adapting to the input size constraints of static inference, fixed-dimensional input data is provided for subsequent computation graph instance playback inference.

[0038] In one embodiment, the truncated prediction tensor is subjected to full vectorization batch post-processing to obtain a set of detection boxes, including: adaptively decoding the truncated prediction tensor to obtain multiple prediction boxes; reorganizing the dimensions of the decoded prediction boxes and retaining the index label of the real slice image to which each prediction box belongs; performing confidence and wafer edge safety boundary filtering in parallel through GPU tensor broadcasting mechanism; performing segmented isolation based on the index label of each prediction box when performing batch nonmaximum suppression; and completing the deduplication processing of segmented batch nonmaximum suppression to obtain the detection box corresponding to each real slice image.

[0039] The detection box includes coordinates, confidence level, category, and index label.

[0040] Specifically, the server performs adaptive decoding on the truncated prediction tensor, identifies the target encoding format of the tensor output, and calculates multiple prediction boxes based on the target encoding format. Then, the decoded prediction boxes undergo dimensionality reorganization, and each prediction box is associated with the index marker of its corresponding real slice image, recording which slice the defective box originated from. The server utilizes a GPU tensor broadcasting mechanism to perform confidence threshold comparison and wafer edge safety boundary verification in parallel, filtering out prediction boxes with insufficient confidence, those falling within wafer process blind spots, and invalid boxes. During batch non-maximum suppression (NMS), the prediction boxes are grouped and segmented based on their index markers, performing intersection-union (IoU) calculations and redundant box removal only within the same slice's corresponding group; prediction boxes from different groups do not suppress each other. Finally, the segmented batch non-maximum suppression completes deduplication, yielding the set of valid detection boxes corresponding to each real slice image.

[0041] In this embodiment, to address the computational bottleneck caused by CPU image-by-image loop post-processing and the problem of erroneous removal of cross-slice defect boxes in ordinary GPU batch NMS, the performance bottleneck of traditional CPU serial post-processing is overcome by completing decoding, filtering, and NMS all in the GPU tensor domain. Adaptive decoding is compatible with multiple encoding formats, GPU tensor broadcasting is used for parallel filtering, and segmented isolated NMS is achieved by relying on index tags. Deduplication of boxes is only performed within the same slice, avoiding erroneous removal of cross-slice defect boxes. There is no need to send the detection boxes back to the CPU, thus improving the processing speed and recognition accuracy of AOI detection.

[0042] In one embodiment, adaptive decoding of the truncated prediction tensor to obtain multiple prediction boxes includes: determining the target dimension size of the last channel in the truncated prediction tensor and determining the target encoding format based on the target dimension size; and adaptively decoding each truncated prediction tensor according to the target encoding format to obtain multiple prediction boxes.

[0043] Specifically, the server first reads the truncated prediction tensor, extracts the target dimension size of the last channel of the prediction tensor, and uses this target dimension size as the criterion to determine the corresponding target encoding format, without needing to read internal metadata such as YOLO model weights and network structure. If the target dimension size matches the first threshold, such as 84, the target encoding format is determined to be center-width-height (cxcywh) encoding; if it matches the second threshold, such as 4 + number of classes, the target encoding format is determined to be xyxy encoding. Based on the determined target encoding format, the YOLO network calls the corresponding decoding logic to perform operations on the truncated prediction tensor to obtain multiple prediction boxes. For example, for cxcywh encoding, the center point and width / height parameters are converted into top-left and bottom-right corner coordinates; for xyxy encoding, the coordinate values ​​are directly read.

[0044] Therefore, this embodiment can automatically adapt to or switch the output format of different versions of the YOLO network, eliminating the need to develop and maintain multiple decoding branches for each type of model, reducing engineering iteration costs, and providing a unified format of prediction boxes for subsequent GPU parallel filtering and segmented batch NMS.

[0045] In one embodiment, when performing batch nonmaximum suppression, segmentation isolation based on the index marker of each predicted box includes: grouping multiple predicted boxes according to the index marker of each predicted box; filtering the head predicted box and multiple remaining predicted boxes from the multiple predicted boxes in the current group according to the confidence level of the predicted boxes; performing box suppression processing on the head predicted box and multiple remaining predicted boxes to obtain multiple detection boxes; and concatenating the multiple detection boxes output by each group using tensors to obtain a set of detection boxes after segmentation isolation.

[0046] In each group, multiple predicted bounding boxes correspond to a single real slice image.

[0047] Specifically, the server automatically groups all predicted bounding boxes (BWTs) based on the index tags carried by each BWT, strictly ensuring that all BWTs within each group correspond to the same real slice image, achieving physical isolation between BWTs of different slices and eliminating cross-slice interference. For each group, the BWTs are prioritized according to their confidence scores, and the top predicted bounding box with the highest confidence score and the remaining BWTs within the group are selected. Using the top predicted bounding box as a benchmark, an intersection-union (IOU) comparison is performed with each of the remaining predicted bounding boxes in the group, eliminating redundant and duplicate predicted bounding boxes with overlap exceeding a preset threshold, completing the box suppression and deduplication process within a single group, and retaining the real and valid detection boxes for each slice. After all groups have completed independent NMS deduplication, the output valid detection boxes from each group are stitched together and integrated using GPU tensor operations to obtain a segmented and isolated set of detection boxes.

[0048] In this embodiment, existing batch NMS (Network Minimum Suppression) methods are prone to cross-slice IOU calculations, mistakenly removing real defect boxes on different slices, and suffer from low CPU serial grouping efficiency. By relying on index tags to group predicted boxes, NMS suppression is performed independently within the same slice, and different slices do not interfere with each other. After deduplication by grouping, tensor concatenation and merging results are performed, with the entire process being batch-processed using GPU. This avoids the mistaken deletion of valid defect boxes and improves post-processing speed.

[0049] In one embodiment, such as Figure 3 As shown, a defect detection method based on TensorRT and CUDA Graph is provided, including an initialization phase and a loop inference phase. In the initialization phase, the server selects a specified GPU device and loads a static TensorRT engine, allocates a fixed batch of input and output tensors and binds them to a resident buffer; it performs preheating inference and captures a solidified CUDA Graph instance. Entering the loop inference phase: the server receives real slice images and asynchronously copies them to the resident buffer. If the number of real slice images is insufficient for the fixed batch, the remaining empty spaces in the resident buffer are padded with zeros; the CUDA Graph instance is replayed and high-speed inference is completed; the predicted bounding boxes output by the YOLO model are adaptively identified, and GPU batch post-processing is performed on the predicted bounding boxes to complete segmented NMS and coordinate compensation, obtaining a set of detection boxes. Finally, the wafer defect detection result after global coordinate compensation of the detection box set is output; then, the next batch of data is read, and the inference detection is continuously performed in a loop. Therefore, this invention achieves static batch zero-padding to solidify the inference form instead of dynamic shape recapture of the computation graph, one-time binding of resident buffer initialization instead of round-by-round repeated address mapping, full GPU vectorized batch computation with indexed marker isolation, replacing CPU graph-by-graph loop processing, adaptive decoding based on tensor dimension, abandoning the multi-branch manual maintenance adaptation mode, and full local binding of single-card resources instead of unconstrained cross-card resource scheduling.

[0050] In one embodiment, the test verification used an NVIDIA GeForce RTX4080, with a fixed batch size of 16; the inference image size was 640×640, and the following experimental results were achieved: 1. Significantly improved inference timing stability: Through a static inference model with fixed batches and zero padding, CUDAGraph can be permanently reused in a single capture. Data is only modified before each inference, completely eliminating the graph recapture overhead and reducing time by 20% (less than 16 graphs per inference after cropping to smaller size), fully meeting the 24 / 7 stable operation requirements of semiconductor production lines.

[0051] 2. Significantly improved overall detection throughput: The initialization phase completes the allocation of resident video memory and the binding of tensor addresses in one go, eliminating the CPU-GPU interaction overhead of round-by-round inference; combined with full GPU vectorization post-processing, the CPU loop bottleneck is broken, and the time consumption of the inference part and post-processing is reduced by 80% (based on the number of images of 4 / 16, in the case of large-scale use).

[0052] 3. Enhanced engineering versatility and deployment reliability: Adaptive compatibility with multiple versions of YOLO model output formats reduces version iteration and maintenance costs; hardware isolation mechanism with fully localized binding of single-card resources eliminates resource conflicts and memory anomalies in multi-card deployments, significantly improving the long-term operational reliability of the device.

[0053] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.

[0054] In one embodiment, a defect detection device based on a static engine and computational graph instances is provided, which corresponds one-to-one with the defect detection method based on a static engine and computational graph instances described in the above embodiments. The defect detection device based on a static engine and computational graph instances includes: The engine loading and memory management module is used to determine the inference context corresponding to the static engine file and initialize the resident buffer; the size of the fixed batch in the static engine file is aligned with the dimension of the resident buffer; the dimension of the resident buffer cannot be adjusted during the inference runtime phase.

[0055] The instance capture and inference module is used to create isolated inference tasks for CUDA streams and perform model warm-up within the CUDA stream through the inference context, capturing and saving computation graph instances in one go.

[0056] The image zero-padding and copying module is used to fill the resident buffer with zeros based on multiple real slice images to obtain the initial tensor.

[0057] The instance capture and inference module is also used to replay computation graph instances and infer from the initial tensor to obtain the predicted tensor.

[0058] The vectorization post-processing module is used to truncate the prediction tensor and perform full vectorization batch post-processing on the truncated prediction tensor to obtain a set of detection boxes. The full vectorization batch post-processing includes at least adaptive decoding, confidence and wafer edge security boundary filtering, and batch nonmaximum suppression processing.

[0059] The batch global coordinate compensation module is used to perform global coordinate compensation on the detection box set to obtain the defect location in the wafer coordinate system.

[0060] Specific limitations regarding the defect detection device based on static engines and computational graph instances can be found in the limitations of the defect detection method based on static engines and computational graph instances described above, and will not be repeated here. Each module in the aforementioned defect detection device based on static engines and computational graph instances can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the corresponding operations of each module.

[0061] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 4 As shown, the computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and the database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores computational graph instances. The network interface communicates with external terminals via a network connection. When executed by the processor, the computer program implements a defect detection method based on a static engine and computational graph instances.

[0062] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the defect detection method based on a static engine and computational graph instances described in the above embodiment. To avoid repetition, it will not be described again here.

[0063] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When executed by a processor, the computer program implements the defect detection method based on a static engine and computational graph instances described in the above embodiments. To avoid repetition, further details are omitted here. The computer-readable storage medium can be non-volatile or volatile.

[0064] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0065] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0066] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.

Claims

1. A defect detection method based on a static engine and computational graph instances, characterized in that, include: Determine the inference context corresponding to the static engine file and initialize the resident buffer; the size of the fixed batch in the static engine file is aligned with the dimension of the resident buffer; the dimension of the resident buffer cannot be adjusted during the inference runtime phase; Create isolated inference tasks for the CUDA stream and perform model warm-up within the CUDA stream through the inference context, capturing and saving computation graph instances all at once; Based on the acquired multiple real slice images, the resident buffer is padded with zeros to obtain the initial tensor; The computation graph instance is replayed and inference is performed based on the initial tensor to obtain the predicted tensor, and the predicted tensor is truncated. The truncated prediction tensor is fully vectorized and batch post-processed to obtain a set of detection boxes. Global coordinate compensation is then performed on the set of detection boxes to obtain the defect location in the wafer coordinate system. The fully vectorized batch post-processing includes at least adaptive decoding, confidence and wafer edge security boundary filtering, and batch nonmaximum suppression processing.

2. The method as described in claim 1, characterized in that, Determine the inference context corresponding to the static engine file and initialize the resident buffer, including: By compiling static engine files of a fixed batch size, the static TensorRT engine object is determined and bound to the specified GPU device; An inference context is created based on the static TensorRT engine object; Resident buffers are allocated to the video memory of the specified GPU device according to the preset maximum batch size. During the initialization phase, the input and output tensors of the inference context are bound to the resident buffer.

3. The method as described in claim 1, characterized in that, Based on the acquired multiple real slice images, the resident buffer is padded with zeros to obtain an initial tensor, including: The real slice image is asynchronously copied to the front segment in the resident buffer; the number of dimensions of the front segment is the same as the number of real slice images. The subsequent segment in the resident buffer that is located after the preceding segment is zeroed out; The initial tensor is obtained by combining the tensors in the copied and padded front and rear segments.

4. The method as described in claim 1, characterized in that, The truncated prediction tensors are subjected to full vectorization and batch post-processing to obtain a set of detection boxes, including: Adaptive decoding is performed on the truncated prediction tensor to obtain multiple prediction boxes; The dimensions of the decoded prediction boxes are reorganized, and the index label of the real slice image to which each prediction box belongs is retained; The filtering of confidence and wafer edge security boundaries is performed in parallel using the GPU tensor broadcast mechanism; When performing batch nonmaximum suppression, segmentation is performed based on the index marker of each prediction box; The deduplication process of segmented batch nonmaximum suppression is completed to obtain the detection box corresponding to each real slice image; the detection box includes coordinates, confidence score, category, and index label.

5. The method as described in claim 4, characterized in that, Adaptive decoding is performed on the truncated prediction tensor to obtain multiple prediction boxes, including: Determine the target dimension size of the last channel in the truncated prediction tensor, and determine the target encoding format based on the target dimension size; According to the target encoding format, each truncated prediction tensor is adaptively decoded to obtain multiple prediction boxes.

6. The method as described in claim 4, characterized in that, When performing batch nonmaximum suppression, segmentation is performed based on the index marker of each prediction box, including: Multiple prediction boxes are grouped according to the index label of each prediction box; the multiple prediction boxes in each group correspond to a real slice image; Based on the confidence level of the predicted boxes, the head predicted box and multiple remaining predicted boxes are selected from multiple predicted boxes in the current group; Based on the head predicted bounding box and multiple remaining predicted bounding boxes, box suppression processing is performed to obtain multiple detection boxes; The multiple detection boxes output by each group are concatenated using tensors to obtain a set of detection boxes after segmentation and isolation.

7. The method according to any one of claims 1 to 6, characterized in that, The fixed batch size is determined based on at least the maximum number of slice images that the production line block camera can produce in a single run, the available video memory size of the GPU device, and the maximum allowable inference latency per frame; the number of the fixed batch size is greater than the number of actual slice images; during the inference run phase, the fixed batch size cannot be dynamically modified and the dimension of the resident buffer cannot be adjusted.

8. A defect detection device based on a static engine and computational graph instances, characterized in that, include: The engine loading and video memory management module is used to determine the inference context corresponding to the static engine file and initialize the resident buffer; the size of the fixed batch in the static engine file is aligned with the dimension of the resident buffer; the dimension of the resident buffer cannot be adjusted during the inference runtime phase; The instance capture and inference module is used to create isolated inference tasks for CUDA streams and perform model warm-up within the CUDA stream through the inference context, capturing and saving computation graph instances in one go. The image zero-padding and copying module is used to fill the resident buffer with zeros based on multiple real slice images obtained to obtain an initial tensor; The instance capture and inference module is also used to replay the computation graph instance and infer based on the initial tensor to obtain the predicted tensor; The vectorization post-processing module is used to truncate the prediction tensor and perform full vectorization batch post-processing on the truncated prediction tensor to obtain a set of detection boxes; the full vectorization batch post-processing includes at least adaptive decoding, confidence and wafer edge security boundary filtering, and batch nonmaximum suppression processing. The batch global coordinate compensation module is used to perform global coordinate compensation on the detection box set to obtain the defect location in the wafer coordinate system.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the defect detection method based on a static engine and computational graph instance as described in any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the defect detection method based on a static engine and computational graph instance as described in any one of claims 1 to 7.