Defect Detection Method and System Based on Java Distributed Architecture
Through the stream processing and rule engine under the Java distributed architecture, image data is processed in parallel, combined with OpenCV and ResNet hybrid algorithms, the problem of slow defect detection speed in the existing technology is solved, and efficient defect detection and production line quality control is achieved.
Patent Information
- Application Number
- CN202510642568.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-19
- Publication Date
- 2025-07-29
- Estimated Expiration
- 2045-05-19
AI Technical Summary
In the prior art, the product defect detection speed is low and cannot match the production line's high-speed production needs.
The defect detection method based on Java distributed architecture is adopted, and the image data is processed in parallel by using the stream processing engine and the rule engine, the defect identification result is determined through the stream processing engine, and the rule engine is used for rule matching, and image processing and defect identification are combined with OpenCV and ResNet hybrid algorithms.
The defect detection speed is improved, the production line's high-speed production needs can be met, the missed inspection and error detection rates are reduced, and the production line quality is realized.
Smart Images

Figure CN120162274B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of intelligent manufacturing technology, and particularly relates to a defect detection method and system based on a Java distributed architecture. Background Art
[0002] Currently, in the production and manufacturing process of industrial products (such as lithium batteries, electronic components, automotive parts, etc.), it is usually necessary to perform defect detection on each product to ensure the ex-factory quality of the products.
[0003] In related technologies, the defect detection of products is usually implemented using a single-machine architecture, so there is a low detection speed and it cannot meet the high-speed production requirements of the production line. Therefore, how to improve the detection speed of product defects has become an urgent technical problem to be solved. Summary of the Invention
[0004] This application provides a defect detection method and system based on a Java distributed architecture to solve the problem in related technologies that the detection speed of product defects is low and cannot meet the high-speed production requirements of the production line.
[0005] In a first aspect, an embodiment of this application provides a defect detection method based on a Java distributed architecture, which is applied to any service node in a service cluster. The service cluster is implemented based on the Java distributed architecture. The service cluster includes a plurality of dynamically scalable service nodes. Each service node is provided with a stream processing engine and a rule engine. The method includes:
[0006] Using the stream processing engine to obtain product image data from the message queue of the edge server, and calling a preset hybrid algorithm to determine a defect recognition result corresponding to the product image data. The product image data is obtained after format conversion by at least one image acquisition device. The defect recognition result is used to represent the recognized defect type and the confidence level corresponding to the defect type;
[0007] Using the rule engine to obtain a preset matching rule, and performing rule matching on the defect recognition result based on the preset matching rule to obtain a defect detection result. The preset matching rule is used to represent the confidence level threshold corresponding to the defect type.
[0008] Optionally, the calling a preset hybrid algorithm to determine a defect recognition result corresponding to the product image data includes:
[0009] Calling the preset hybrid algorithm to perform non-local means denoising and contrast enhancement on the product image data to obtain preprocessed image data;
[0010] Perform edge detection and contour analysis on the preprocessed image data to obtain the region of interest, and filter and crop the region of interest to obtain the region of interest image;
[0011] Perform defect recognition on the region of interest image to obtain the defect recognition result.
[0012] Optionally, the using the rule engine to obtain a preset matching rule and performing rule matching on the defect recognition result based on the preset matching rule to obtain a defect detection result includes:
[0013] Use the rule engine to obtain the preset matching rule, and based on the preset matching rule, determine whether the confidence level corresponding to the defect type is greater than the confidence level threshold corresponding to the defect type, where the confidence level threshold corresponding to the defect type is preset based on the material type and material thickness of the product to be detected;
[0014] When the confidence level corresponding to the defect type is greater than the confidence level threshold corresponding to the defect type, determine that the product to be detected has a defect corresponding to the defect category;
[0015] When the confidence level corresponding to the defect type is less than or equal to the confidence level threshold corresponding to the defect type, determine that the product to be detected does not have a defect corresponding to the defect category.
[0016] Optionally, after using the rule engine to obtain a preset matching rule and performing rule matching on the defect recognition result based on the preset matching rule to obtain a defect detection result, the method further includes:
[0017] Persist the defect detection result to a preset storage area of the service cluster for querying and displaying the defect detection result; and / or,
[0018] When it is determined that the product to be detected has a defect corresponding to the defect category, control the sorting device to perform a sorting action on the product to be detected.
[0019] Optionally, the method further includes:
[0020] When its own resource utilization rate is greater than a preset threshold and / or the number of product image data backlogged in the message queue is greater than a preset number, allow a new node to pull configuration parameters from the configuration center and pull container images from the image repository for the new node to join the service cluster based on the configuration parameters and the container images, where the configuration center is used to centrally manage the configuration parameters required in the service cluster, and the image repository is used to centrally manage the container images required in the service cluster.
[0021] Optionally, the method further includes:
[0022] When the preset hybrid algorithm is updated, replacing the container image started by itself with a new version of the container image, where the new version of the container image is encapsulated based on the updated preset hybrid algorithm;
[0023] When the container image started by itself is unavailable, replacing the container image started by itself with an old version of the container image, where the old version of the container image is encapsulated based on a traditional algorithm.
[0024] In a second aspect, an embodiment of the present application further provides a defect detection method based on a Java distributed architecture, which is applied to an edge server. The edge server is connected to at least one image acquisition device through a standardized interface, and the edge server is connected to a service cluster through a network. The service cluster is implemented based on the Java distributed architecture. The service cluster includes a plurality of dynamically scalable service nodes. Each service node is provided with a stream processing engine and a rule engine. The method includes:
[0025] Receiving, by using the standardized interface, the original image data collected by the at least one image acquisition device, and performing format conversion on the original image data by using a protocol middleware to obtain product image data, where the protocol middleware is pre-integrated on the edge service, and the protocol middleware is used to convert a plurality of different protocol data into unified format data;
[0026] Caching the product image data in a message queue for a service node in the service cluster to obtain the product image data from the message queue of the edge server by using the stream processing engine, calling a preset hybrid algorithm to determine a defect recognition result corresponding to the product image data, and using the rule engine to obtain a preset matching rule, and performing rule matching on the defect recognition result based on the preset matching rule to obtain a defect detection result, where the product image data is obtained after format conversion by at least one image acquisition device, the defect recognition result is used to represent the recognized defect type and the confidence level corresponding to the defect type, and the preset matching rule is used to represent the confidence level threshold corresponding to the defect type.
[0027] Optionally, the receiving, by using the standardized interface, the original image data collected by the at least one image acquisition device includes:
[0028] Obtaining metadata of the at least one image acquisition device;
[0029] Select at least one driver instance adapted to the at least one image acquisition device from a device driver pool according to the metadata of the at least one image acquisition device and a preset mapping table, where the preset mapping table stores the mapping relationship between the metadata of each image acquisition device and each manufacturer identifier, and the device driver pool stores the driver instances corresponding to each manufacturer identifier, and the driver instances corresponding to each manufacturer identifier are all defined with standardized interface methods;
[0030] Load the at least one driver instance to construct the standardized interface;
[0031] Use the standardized interface to receive the raw image data collected by the at least one image acquisition device.
[0032] Optionally, the message queue includes multiple partitions, and different partitions are used to store the product image data collected by different image acquisition devices;
[0033] The caching of the product image data into the message queue includes:
[0034] According to the identification information corresponding to each image acquisition device, cache the product image data into different partitions of the message queue, so that the service nodes in the service cluster can obtain the product image data they need from the partitions corresponding to the message queue.
[0035] In a third aspect, an embodiment of the present application provides a defect detection system based on a Java distributed architecture. The system includes: at least one image acquisition device, an edge server, and a service cluster. The edge server is connected to the at least one image acquisition device through a standardized interface, and the edge server is connected to the service cluster through a network. The service cluster is implemented based on the Java distributed architecture, and the service cluster includes a plurality of service nodes that can be dynamically expanded, and each service node is provided with a stream processing engine and a rule engine;
[0036] The at least one image acquisition device is used to collect the raw image data of the product to be detected;
[0037] The edge server is used to receive the raw image data collected by the at least one image acquisition device by using the standardized interface, perform format conversion on the raw image data by using a protocol middleware to obtain product image data, and cache the product image data into a message queue;
[0038] Each service node in the service cluster is used to obtain product image data from the message queue of the edge server by using the stream processing engine, call a preset hybrid algorithm to determine the defect recognition result corresponding to the product image data, and use the rule engine to obtain a preset matching rule, and perform rule matching on the defect recognition result based on the preset matching rule to obtain a defect detection result. Wherein, the product image data is obtained after being format-converted by at least one image acquisition device, the defect recognition result is used to represent the recognized defect type and the confidence level corresponding to the defect type, and the preset matching rule is used to represent the confidence level threshold corresponding to the defect type.
[0039] The above technical solution provided by the embodiments of the present application has the following advantages compared with the prior art: In the method provided by the embodiments of the present application, the service nodes in the service cluster can obtain product image data from the message queue of the edge server by using the stream processing engine, and call a preset hybrid algorithm to determine the defect recognition result corresponding to the product image data. Wherein, the product image data is obtained after being format-converted by at least one image acquisition device, and the defect recognition result is used to represent the recognized defect type and the confidence level corresponding to the defect type; use the rule engine to obtain a preset matching rule, and perform rule matching on the defect recognition result based on the preset matching rule to obtain a defect detection result. Wherein, the preset matching rule is used to represent the confidence level threshold corresponding to the defect type. Through the above method, multiple service nodes in the service cluster can perform defect recognition and rule matching on the product image data in the message queue of the edge server in parallel, thereby improving the defect detection speed and being able to better meet the high-speed production requirements of the production line. Description of the Drawings
[0040] The drawings here are incorporated into the specification and constitute a part of this specification, showing embodiments consistent with the present application and used together with the specification to explain the principles of the present application.
[0041] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0042] One or more embodiments are illustrated by way of example in the corresponding drawings. These illustrative descriptions do not constitute a limitation on the embodiments. Elements with the same reference numerals in the drawings are represented as similar elements, unless otherwise stated, and the drawings in the figures do not constitute a proportional limitation.
[0043] Figure 1A schematic flowchart of a defect detection method based on a Java distributed architecture provided by an embodiment of the present application;
[0044] Figure 2 A schematic flowchart of another defect detection method based on a Java distributed architecture provided by an embodiment of the present application;
[0045] Figure 3 A schematic flowchart of the working process of an SPI interface and a protocol middleware provided by an embodiment of the present application;
[0046] Figure 4 A schematic structural diagram of a defect detection system based on a Java distributed architecture provided by an embodiment of the present application;
[0047] Figure 5 A schematic structural diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners
[0048] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Apparently, the described embodiments are some but not all of the embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the protection scope of the present application.
[0049] The following disclosure provides many different embodiments or examples for implementing different structures of the present application. To simplify the disclosure of the present application, components and settings of specific examples are described below. Of course, they are only examples and are not intended to limit the present application. In addition, the present application may repeat reference numerals and / or letters in different examples. Such repetition is for the purpose of simplification and clarity and does not itself indicate the relationship between the various embodiments and / or settings discussed.
[0050] To solve the problem in the related art that the detection speed of product defects is relatively low and cannot meet the requirements of high-speed production on the production line, the present application provides a defect detection method and system based on a Java distributed architecture, which can improve the detection speed of product defects.
[0051] See Figure 1 , Figure 1 A schematic flowchart of a defect detection method based on a Java distributed architecture provided by an embodiment of the present application. As Figure 1As shown in the figure, the defect detection method based on the Java distributed architecture is applied to any service node in the service cluster. The service cluster is implemented based on the Java distributed architecture and includes multiple dynamically scalable service nodes. Each service node is provided with a stream processing engine and a rule engine. The defect detection method based on the Java distributed architecture may include the following steps:
[0052] Step S101: Use the stream processing engine to obtain product image data from the message queue of the edge server, and call a preset hybrid algorithm to determine the defect recognition result corresponding to the product image data. The product image data is obtained after format conversion by at least one image acquisition device. The defect recognition result is used to represent the recognized defect type and the confidence level corresponding to the defect type.
[0053] Specifically, the above stream processing engine may be an Akka Streams processing engine, an Apache Flink processing engine, an Apache Kafka Streams processing engine, an Apache Storm processing engine, an Apache Samza processing engine, etc. The stream processing engine can be used to build a pipeline with controllable backpressure and use the backpressure processing mechanism to process high-throughput real-time data streams. This means that when the downstream processing speed is slower than the upstream production speed, the upstream will slow down or stop production to avoid resource exhaustion and ensure that the data stream will not overflow due to insufficient downstream processing capacity. The above edge server refers to a server located at the network edge, close to users or devices. The edge server is integrated with a message queue for caching the images collected by the image acquisition device. The above image acquisition device may be an X-ray machine, a camera, etc. The number of the image acquisition devices may be one or more. When the number of image acquisition devices is more than one, the types of products to be detected corresponding to different image acquisition devices may be the same or different. The products to be detected here may be lithium batteries, electronic components, automotive parts, etc., and their defect types may include but are not limited to pores, cracks, impurities, etc. The above preset hybrid algorithm may be a hybrid algorithm of the Open Source Computer Vision Library (abbreviated as OpenCV) and the Residual Network (abbreviated as ResNet), or a hybrid algorithm obtained by improving these two algorithms, or a hybrid algorithm obtained by other algorithms. The embodiments of the present application do not make specific limitations.
[0054] Step S102: Use the rule engine to obtain a preset matching rule, and perform rule matching on the defect recognition result based on the preset matching rule to obtain a defect detection result. The preset matching rule is used to represent the confidence threshold corresponding to the defect type.
[0055] Specifically, the above-mentioned rule engine refers to rule engines such as Drools, Aviator, and QLExpress. This rule engine can liberate complex and variable business rules from hard coding and store them in the form of rule scripts in files or specific storage media (such as stored in a database), so that changes to business rules can take effect immediately in the online environment without modifying the project code or restarting the server. The above-mentioned preset matching rules are used to represent the confidence threshold corresponding to the defect type, and the confidence threshold corresponding to the defect type can be preset based on the material type and material thickness of the product to be detected. For example, when the material type of the product to be detected is aluminum alloy and the material thickness is 5mm, the confidence threshold for pores is 0.70; when the material type of the product to be detected is aluminum alloy and the material thickness is 3mm, the confidence threshold for pores is 0.90, etc.
[0056] Through the above method, multiple service nodes in the service cluster can be used to perform defect recognition and rule matching on the product image data in the message queue of the edge server in parallel, thereby improving the defect detection speed and being able to better meet the high-speed production requirements of the production line.
[0057] In an optional embodiment, the above step S101, calling the preset hybrid algorithm to determine the defect recognition result corresponding to the product image data, includes:
[0058] Call the preset hybrid algorithm to perform non-local means denoising and contrast enhancement on the product image data to obtain the preprocessed image data;
[0059] Perform edge detection and contour analysis on the preprocessed image data to obtain the region of interest, and filter and crop the region of interest to obtain the region of interest image;
[0060] Perform defect recognition on the region of interest image to obtain the defect recognition result.
[0061] In the industrial vision defect detection scenario, a single detection algorithm often faces the contradiction between efficiency and accuracy. For example, traditional computer vision (CV for short) algorithms have a fast processing speed but insufficient recognition accuracy for complex defects (such as micro cracks, internal bubbles, etc.); while deep learning algorithms (such as ResNet algorithm, etc.) have high-precision classification capabilities, but the computational overhead of full-image inference is large, making it difficult to meet the real-time requirements of high-speed production lines. Therefore, in the embodiments of the present application, an OpenCV+ResNet hybrid algorithm can be used to simultaneously balance defect detection efficiency and defect detection accuracy. Specifically, the OpenCV algorithm can be used to quickly screen the region of interest, reduce the calculation range of the deep learning model, and use the ResNet algorithm to perform refined classification on the region of interest to reduce the missed detection and false detection rates.
[0062] When calling the preset hybrid algorithm to determine the defect recognition result corresponding to the product image data, the OpenCV algorithm can be used to perform non-local means denoising and contrast enhancement on the product image data to obtain the preprocessed image data. Then, edge detection and contour analysis are performed on the preprocessed image data to obtain the region of interest, and the region of interest is filtered and cropped to obtain the region of interest image. Next, the ResNet algorithm is used to perform defect recognition on the region of interest image to obtain the defect recognition result. The purpose of performing non-local means denoising here is to eliminate high-frequency noise (such as quantum speckle noise) in the product image data (such as X-ray images) and retain details. Contrast Limited Adaptive Histogram Equalization (CLAHE for short) can be applied here for contrast enhancement to improve the gray-scale difference between the defect area and the background. The potential defect boundaries can be located through Canny edge detection, and small holes can be filled through morphological closing operations to generate continuous contours. Through contour analysis, geometric features such as contour area, perimeter, and minimum bounding rectangle can be calculated to locate key parts such as welds and packaging areas as the region of interest (ROI), reducing the detection range to 20%-30% of the original image. The energy, entropy value, and other indicators of the Gray-level Co-occurrence Matrix (GLCM for short) can be calculated through texture analysis to identify texture anomaly regions and analyze the region contours based on the Histogram of oriented gradient (HOG for short). The regions of interest that obviously do not conform to the defect morphology are filtered, and then the filtered regions of interest are cropped into a standardized grayscale image of 256×256 pixels and input into the ResNet algorithm. The ResNet algorithm here can reduce the number of channels of the original ResNet-18 (for example, the first-layer convolution channels are reduced from 64 to 32) to reduce the computational load; and an SE (short for Squeeze-and-Excitation) attention module can be added to improve the sensitivity to tiny defects; in addition, the model can be optimized through the Open Visual Inference&Neural NetworkOptimization (OpenVINO for short) tool chain and deployed on the Graphics Processing Unit (GPU for short) / Video Processing Unit (VPU for short) hardware, so that the single-frame inference time ≤ 4ms.
[0063] In this embodiment, the stream processing engine can call a preset hybrid algorithm to quickly and accurately determine the defect recognition result corresponding to the product image data, so as to meet the real-time requirements of the high-speed production line.
[0064] In an alternative embodiment, the above step S102, using a rule engine to obtain a preset matching rule and performing rule matching on the defect recognition result based on the preset matching rule to obtain a defect detection result, includes:
[0065] Using a rule engine to obtain a preset matching rule, and based on the preset matching rule, determining whether the confidence level corresponding to the defect type is greater than the confidence level threshold corresponding to the defect type, where the confidence level threshold corresponding to the defect type is preset based on the material type and material thickness of the product to be detected;
[0066] In the case where the confidence level corresponding to the defect type is greater than the confidence level threshold corresponding to the defect type, determining that the product to be detected has a defect corresponding to the defect category;
[0067] In the case where the confidence level corresponding to the defect type is less than or equal to the confidence level threshold corresponding to the defect type, determining that the product to be detected does not have a defect corresponding to the defect category.
[0068] Specifically, when using a rule engine to determine the defect detection result, the rule engine can first be used to obtain a preset matching rule, and based on the preset matching rule, determine whether the confidence level corresponding to the defect type is greater than the confidence level threshold corresponding to the defect type. If the confidence level corresponding to the defect type is greater than the confidence level threshold corresponding to the defect type, it can be determined that the product to be detected has a defect corresponding to the defect category; if the confidence level corresponding to the defect type is less than or equal to the confidence level threshold corresponding to the defect type, it can be determined that the product to be detected does not have a defect corresponding to the defect category. For example, assuming that the material type of the product to be detected is aluminum alloy, the material thickness is 5 mm, and the confidence level threshold for pores is 0.70. If the stream processing engine identifies the confidence level corresponding to pores as 0.92, it can be determined that the product to be detected has a pore defect.
[0069] It should be noted that the confidence level threshold corresponding to the defect type can be dynamically adjusted according to production line process parameters (such as the material type and material thickness of the product to be detected, etc.) to dynamically adapt to the detection requirements of different products. Of course, the confidence level threshold corresponding to the defect type can also be dynamically adjusted according to the sorting rate (the probability of being determined as a defective product) of the current production line. When updating the confidence level threshold corresponding to the defect type, the threshold mapping table in the memory can be updated first to ensure that the subsequent detection process takes effect immediately, and the new threshold is synchronously persisted to the configuration center to ensure the consistency among service nodes in the service cluster.
[0070] In this embodiment, the rule engine can perform rule matching on the defect recognition result based on a preset matching rule adjusted dynamically to meet the detection requirements of different products.
[0071] In an alternative embodiment, after the above step S102 of using the rule engine to obtain a preset matching rule and performing rule matching on the defect recognition result based on the preset matching rule to obtain a defect detection result, the method further includes:
[0072] Persisting the defect detection result to a preset storage area of the service cluster for querying and displaying the defect detection result; and / or,
[0073] When it is determined that the product to be detected has a defect corresponding to the defect category, controlling the sorting device to perform a sorting action on the product to be detected.
[0074] Specifically, after obtaining the defect detection result, the defect detection result can be persisted to a preset storage area of the service cluster for querying and displaying the defect detection result, which is convenient for quality traceability and report generation. The preset storage area here can be an open-source time series database (InfluxData Time Series Platform, abbreviated as InfluxDB) + an open-source search engine (Elastic Stack, abbreviated as Elasticsearch) in the service cluster.
[0075] After obtaining the defect detection result, when it is determined that the product to be detected has a defect corresponding to the defect category, the sorting device can also be controlled to perform a sorting action on the product to be detected to sort out the defective products. Specifically, the defect detection result can be sent to a message queue, and then the Manufacturing Execution System (MES) subscribes to these messages from the message queue and parses them into specific sorting instructions. The protocol of the sorting instructions here can be REST API, gRPC, OPC UA, etc. Then, based on the sorting instructions, an interaction is performed with the sorting device (such as a robotic arm, etc.) to complete the sorting action. In this way, it is beneficial to achieve closed-loop quality control of the production line.
[0076] In an alternative embodiment, the defect detection method based on the Java distributed architecture further includes:
[0077] When the resource utilization rate of itself is greater than a preset threshold and / or the number of product image data backlogged in the message queue is greater than a preset number, a new node is allowed to pull configuration parameters from the configuration center and pull container images from the image repository, so that the new node can join the service cluster based on the configuration parameters and container images, where the configuration center is used to centrally manage the configuration parameters required in the service cluster, and the image repository is used to centrally manage the container images required in the service cluster.
[0078] Specifically, the service cluster can dynamically expand service nodes according to the resource utilization rates of each service node (such as CPU, GPU, memory, disk utilization rate, etc.) and the number of product image data backlogged in the message queue. In this way, when the processing capacity of a single service node reaches the upper limit (such as 300 frames per second, etc.), the service cluster automatically expands, and multiple container instances process Kafka messages in different partitions in parallel.
[0079] When it is detected that the resource utilization rate of a certain service node is greater than a preset threshold and / or the number of product image data backlogged in the message queue is greater than a preset number, a new node is allowed to pull configuration parameters from the configuration center and pull container images from the image repository, so that the new node can join the service cluster based on the configuration parameters and container images. The preset threshold and preset number here can be set according to actual needs and are not specifically limited here. For example, when the CPU utilization rate of a certain service node > 80% or the message backlog in the message queue > 10,000, the service cluster can be triggered to expand.
[0080] In this way, under burst traffic, the expansion from 10 nodes to 200 nodes can be completed within 1 minute, the throughput is increased by 20 times, the GPU utilization rate is stabilized above 75%, and resource waste is avoided; moreover, the expansion action is completed within 1 minute, avoiding the production line from stagnating due to system overload.
[0081] In an optional embodiment, the defect detection method based on the Java distributed architecture further includes:
[0082] When the preset hybrid algorithm is updated, replace the container image started by itself with a new version of the container image, where the new version of the container image is encapsulated based on the updated preset hybrid algorithm;
[0083] When the container image started by itself is unavailable, replace the container image started by itself with an old version of the container image, where the old version of the container image is encapsulated based on the traditional algorithm.
[0084] It should be noted that the service cluster can be deployed through Quarkus Native Image containerization. To build lightweight and high-performance industrial containers, during the image selection phase, Quarkus Native Image can be used to compile Java applications into native machine code, eliminating the overhead of the Java Virtual Machine (JVM), reducing the startup time from seconds to milliseconds. Additionally, a security base image certified by Red Hat (Universal BaseImage, abbreviated as UBI) can be used to pre-install GraalVM 22.3 and the Java 17 runtime to meet the compliance requirements of the industrial environment. During the build artifact copying phase, an optimized executable file is generated through Maven commands and then copied into the container, decoupling from the traditional JAR package dependencies. In this way, the image size (about 80MB) is reduced by 80% compared to the traditional image size (about 400MB+), and repeated compilation within the container can be avoided, improving the build efficiency. During the container startup configuration phase, the local executable file is directly run, bypassing the JVM initialization process, and the path of the OpenCV native library is specified as -Djava.library.path= / opt / opencv to ensure that the image processing algorithm can call the GPU acceleration library. Among them, the core functions of the container image are as follows:
[0085] (1) Lightweight deployment and fast startup
[0086] Optimized resource occupancy: The executable file generated by Quarkus Native Image (about 80MB) reduces the memory occupancy by 80% compared to the traditional Spring Boot JAR package (about 400MB+), and the cold startup time is shortened from 10 seconds to 50 milliseconds.
[0087] Guaranteed environment consistency: Dependent libraries such as OpenCV and CUDA are pre-installed in the image to eliminate compatibility issues caused by "differences between development and production environments".
[0088] (2) Empowering the defect detection process
[0089] Algorithm module encapsulation: Each container instance encapsulates a complete processing chain: image preprocessing → algorithm inference → result reporting. Example: The deep learning model service image contains the ResNet model file, the OpenCV inference engine, and the GPU driver.
[0090] Support for heterogeneous hardware: Through multi-architecture building of the image, the same business logic can be deployed on edge devices (such as NVIDIA Jetson) and cloud servers.
[0091] Specifically, when the preset hybrid algorithm is updated, the container image started by itself (i.e., the container image corresponding to the preset hybrid algorithm) can be replaced with a new version of the container image (i.e., the container image corresponding to the update of the preset hybrid algorithm), achieving zero-downtime upgrade. In the case where the container image started by itself is unavailable, the container image started by itself can be replaced with an old version of the container image (such as the container image corresponding to the traditional CV algorithm) to ensure the basic detection ability.
[0092] See Figure 2 , Figure 2 which is a schematic flow diagram of a defect detection method based on a Java distributed architecture provided by an embodiment of the present application. As Figure 2 shown, the defect detection method based on the Java distributed architecture is applied to an edge server. The edge server is connected to at least one image acquisition device through a standardized interface, and the edge server is connected to a service cluster through a network. The service cluster is implemented based on the Java distributed architecture. The service cluster includes a plurality of dynamically scalable service nodes, and each service node is provided with a stream processing engine and a rule engine. The defect detection method based on the Java distributed architecture includes:
[0093] Step S201: Receive the original image data collected by at least one image acquisition device through the standardized interface, and use a protocol middleware to perform format conversion on the original image data to obtain product image data. Among them, the protocol middleware is pre-integrated on the edge service, and the protocol middleware is used to convert a variety of different protocol data into unified format data.
[0094] Specifically, the above standardized interface refers to an interface defined based on the Java SPI mechanism to achieve hardware decoupling, be compatible with image acquisition devices from multiple different manufacturers, and ensure that each image acquisition device is plug-and-play. When defining the standardized interface using the Java SPI mechanism, the captureFrame() method can be defined. This captureFrame() method is used to acquire X-ray images of a specified resolution and return a structure data containing the original byte stream, timestamp, and device serial number. The configureExposure() method can also be defined. This configureExposure() method is used to set the exposure parameters of the image acquisition device. When the exposure parameters exceed the hardware range, an InvalidParameterException will be thrown. The readSensors() method can also be defined. This readSensors() method is used to read environmental parameters such as the temperature / pressure of the sensor and return a collection containing the sensor type, value, and unit. Manufacturers of each image acquisition device implement this interface and register the driver through META-INF / services. In this way, the business layer dynamically loads the driver instance through ServiceLoader without being aware of device differences. When the device is replaced, only the driver JAR package needs to be replaced, and the adaptation time is shortened from 3 weeks to 2 hours. The above protocol middleware is used to parse the original data stream of industrial protocols such as OPC UA / Modbus, convert the protocol parsing result into a standard JSON format, and finally push the standardized data to the message queue. Among them, the OPC UA protocol implements the server / client through the Eclipse Milo library, the data is converted into the JSON format, and Modbus RTU uses Modbus4J to parse the sensor data and transmits it asynchronously through RabbitMQ. Among them, the working processes of the SPI interface and the protocol middleware are as Figure 3 shown.
[0095] Step S202: Cache the product image data in the message queue for service nodes in the service cluster to obtain the product image data from the message queue of the edge server using the stream processing engine, call a preset hybrid algorithm to determine the defect recognition result corresponding to the product image data, and use the rule engine to obtain a preset matching rule, and perform rule matching on the defect recognition result based on the preset matching rule to obtain the defect detection result. Among them, the product image data is obtained after format conversion by at least one image acquisition device. The defect recognition result is used to represent the recognized defect type and the confidence level corresponding to the defect type. The preset matching rule is used to represent the confidence level threshold corresponding to the defect type.
[0096] The above-mentioned stream processing engine can be an Akka Streams processing engine, an Apache Flink processing engine, an Apache Kafka Streams processing engine, an Apache Storm processing engine, an Apache Samza processing engine, etc. This stream processing engine can be used to build a pipeline with controllable backpressure and utilize the backpressure handling mechanism to process high-throughput real-time data streams. This means that when the downstream processing speed is slower than the upstream production speed, the upstream will slow down or stop production to avoid resource exhaustion and ensure that the data stream will not overflow due to insufficient downstream processing capabilities. The above-mentioned edge server refers to a server located at the network edge, close to users or devices. A message queue is integrated on this edge server for caching the images collected by the image acquisition device. The above-mentioned image acquisition device can be an X-ray machine, a camera, etc., and the number of the image acquisition devices can be one or multiple. When the number of image acquisition devices is multiple, the types of products to be detected corresponding to different image acquisition devices can be the same or different. The products to be detected here can be lithium batteries, electronic components, automotive parts, etc., and their defect types can include, but are not limited to, pores, cracks, impurities, etc. The above-mentioned preset hybrid algorithm can be a hybrid algorithm of the Open Source Computer Vision Library (abbreviated as OpenCV) and the Residual Network (abbreviated as ResNet), or a hybrid algorithm obtained by improving these two algorithms, or a hybrid algorithm obtained by other algorithms. The embodiments of this application do not make specific limitations.
[0097] The above-mentioned rule engine refers to rule engines such as Drools, Aviator, and QLExpress. This rule engine can liberate complex and variable business rules from hard coding and store them in the form of rule scripts in files or specific storage media (for example, stored in a database), so that changes to business rules can take effect immediately in the online environment without modifying the project code or restarting the server. The above-mentioned preset matching rule is used to represent the confidence threshold corresponding to the defect type. The confidence threshold corresponding to the defect type can be preset based on the material type and material thickness of the product to be detected. For example, when the material type of the product to be detected is aluminum alloy and the material thickness is 5mm, the confidence threshold for pores is 0.70; when the material type of the product to be detected is aluminum alloy and the material thickness is 3mm, the confidence threshold for pores is 0.90, etc.
[0098] In the above manner, the original image data collected by at least one image acquisition device can be received through a standardized interface, and the protocol middleware is used to convert the format of the original image data and then cache it in the message queue. Thus, it is convenient for the service cluster to perform defect detection on the products to be detected corresponding to at least one image acquisition device at the same time, thereby improving the efficiency of product defect detection.
[0099] In an optional embodiment, the above step S201, receiving the original image data collected by at least one image acquisition device through a standardized interface, includes:
[0100] Obtain the metadata of at least one image acquisition device;
[0101] According to the metadata of at least one image acquisition device and a preset mapping table, select at least one driver instance adapted to at least one image acquisition device from the device driver pool. Among them, the preset mapping table stores the mapping relationship between the metadata of each image acquisition device and each manufacturer identifier, and the device driver pool stores the driver instances corresponding to each manufacturer identifier. Among them, the driver instances corresponding to each manufacturer identifier are all defined with standardized interface methods;
[0102] Load at least one driver instance to construct a standardized interface;
[0103] Receive the original image data collected by at least one image acquisition device through the standardized interface.
[0104] It should be noted that in the design stage of the standardized interface, the core functions of the interface need to be abstracted. Specifically, a set of general methods for device operations needs to be defined, including but not limited to basic functions such as image acquisition, parameter configuration, and sensor data reading. For example, the captureFrame() method unifies the image acquisition instructions of X-ray machines of different brands. In addition, the input and output data structures need to be standardized. For example, image data needs to include meta-information such as resolution and timestamp, and sensor data needs to be marked with units and types. In addition, a unique manufacturer identifier needs to be assigned to each device type to achieve precise matching between the driver and the device through the interface method getVendorId().
[0105] In the driver implementation and registration stage, the hardware manufacturer needs to implement specific driver classes according to the standard interface, encapsulating device-specific communication protocols (such as OPC UA instruction sets, Modbus register addresses, etc.). Inside the driver, the device native software development kit (SDK) is called through the Java Native Interface (JNI for short), and at the same time, a unified Java API is exposed externally. A configuration file is created in the META-INF / services directory of the driver JAR package to declare the mapping relationship between the fully qualified interface name and the implementation class, realizing service declaration registration. When the edge server runs, it automatically scans all driver packages and loads the registered implementation classes.
[0106] In the dynamic loading and matching stage, the edge server can use the ServiceLoader utility class in the Java standard library to automatically load all available driver instances when the system starts. The driver instances are stored in the memory cache according to the manufacturer identifier, forming a device driver pool. Of course, the edge server can also dynamically select the appropriate driver instance through the mapping table of device metadata (such as device model, protocol type) and manufacturer identifier. The edge server supports the coexistence of multiple versions of drivers and can flexibly switch device models according to the production line requirements.
[0107] In the dynamic configuration and hot deployment stage, the hardware parameters (such as the exposure time of the X-ray machine, etc.) are uniformly managed through the configuration center. Configuration changes are pushed to the driver instances in real time to avoid production line downtime caused by system restart. When a new driver package deployment or configuration update is detected, the driver instance is dynamically replaced through the class loader isolation mechanism to ensure service continuity.
[0108] In this embodiment, a standardized interface can be used to be compatible with image acquisition devices from multiple different manufacturers, ensuring that various types of image acquisition devices are plug-and-play.
[0109] In an alternative embodiment, the message queue includes multiple partitions, and different partitions are used to store the product image data collected by different image acquisition devices;
[0110] The above step S102, caching the product image data into the message queue, includes:
[0111] According to the identification information corresponding to each image acquisition device, the product image data is cached into different partitions of the message queue, facilitating the service nodes in the service cluster to obtain the product image data they need from the partitions corresponding to the message queue.
[0112] Specifically, since different partitions of the message queue are used to store the product image data collected by different image acquisition devices, when caching the product image data into the message queue, the product image data can be cached into different partitions of the message queue according to the identification information corresponding to each image acquisition device. In this way, it is convenient for the service nodes in the service cluster to obtain the product image data they need from the partition corresponding to the message queue, and perform defect detection on the images collected by each image acquisition device in the acquisition order.
[0113] See Figure 4 , Figure 4 which is a schematic structural diagram of a defect detection system based on a Java distributed architecture provided by an embodiment of the present application. As Figure 4 shown, the defect detection system based on the Java distributed architecture includes: at least one image acquisition device, an edge server, and a service cluster. Among them, the edge server is connected to at least one image acquisition device through a standardized interface, and the edge server is connected to the service cluster through a network. The service cluster is implemented based on the Java distributed architecture. The service cluster includes multiple dynamically scalable service nodes, and each service node is provided with a stream processing engine and a rule engine;
[0114] At least one image acquisition device is used to collect the original image data of the product to be detected;
[0115] The edge server is used to receive the original image data collected by at least one image acquisition device through the standardized interface, perform format conversion on the original image data by using a protocol middleware to obtain product image data, and cache the product image data into the message queue;
[0116] Each service node in the service cluster is used to obtain the product image data from the message queue of the edge server by using the stream processing engine, call a preset hybrid algorithm to determine the defect recognition result corresponding to the product image data, and use the rule engine to obtain a preset matching rule, and perform rule matching on the defect recognition result based on the preset matching rule to obtain a defect detection result. Among them, the product image data is obtained after format conversion by at least one image acquisition device. The defect recognition result is used to represent the recognized defect type and the confidence level corresponding to the defect type. The preset matching rule is used to represent the confidence level threshold corresponding to the defect type.
[0117] For ease of understanding, the X-ray machine is taken as an example of the image acquisition device here for illustration. The defect detection system based on the Java distributed architecture may include a data acquisition layer, a protocol conversion layer, a stream processing layer, and a decision-making layer. Among them, the data acquisition layer is used to acquire high-resolution X-ray images generated by the X-ray machine. The protocol conversion layer is used to convert the high-resolution X-ray images generated by the X-ray machine into JSON format data by using a protocol middleware, and to parse sensor data by using a Modbus-RTU to MQTT gateway and publish it to a message queue, which is deployed on an edge server. The edge server accesses the service cluster through Ethernet. The stream processing layer is used to parallelly execute image preprocessing and feature calculation by using an Akka Streams processing engine, and the Akka Streams processing engine runs in a Kubernetes container. The decision-making layer is used to dynamically load defect determination rules by using a Drools rule engine. Of course, the defect detection system based on the Java distributed architecture may also include a data middle platform layer, which is used to process business logic and data, and the detection process metrics (latency, detection rate) and sensor time series data are stored in an InfluxDB time series database.
[0118] Here, the lithium battery weld detection is taken as an example to illustrate the defect detection process:
[0119] 1. Device access
[0120] Scan the device QR code to obtain vendorId = YXLON_FF35 and load the corresponding driver. Transmit images to the Kafka message queue at 200fps through the OPC UA protocol.
[0121] 2. Streaming processing
[0122] The Akka Streams stream processing engine consumes the messages in the Kafka message queue, parallelly executes denoising and ROI extraction operations, and distributes the selected ROIs to the GPU inference nodes. The GPU inference nodes perform defect recognition on the ROIs to obtain the defect type and the confidence level corresponding to the defect type.
[0123] 3. Dynamic decision-making
[0124] The Drools rule engine dynamically adjusts the detection threshold according to process parameters. Severe defects trigger MES sorting instructions, and minor defects are stored in Elasticsearch for quality traceability.
[0125] 4. Resource regulation
[0126] Prometheus detected that the number of messages backlogged in the Kafka message queue exceeded 100,000, triggering the expansion of the Horizontal Pod Autoscaler (HPA). The newly added nodes automatically pulled the preconfigured algorithm containers from the image repository and joined the processing cluster within 30 seconds.
[0127] Through the above method, the defect detection efficiency and defect detection accuracy can be improved, and the resource utilization rate can be increased through containerization, reducing the operation and maintenance costs.
[0128] As Figure 5 shown, an embodiment of the present application further provides an electronic device, including a processor 511, a communication interface 512, a memory 513, and a communication bus 514. Among them, the processor 511, the communication interface 512, and the memory 513 complete mutual communication through the communication bus 514.
[0129] The memory 513 is used to store computer programs.
[0130] In an embodiment of the present application, when the processor 511 executes the program stored on the memory 513, it implements the defect detection method based on the Java distributed architecture provided by any one of the foregoing method embodiments.
[0131] An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the defect detection method based on the Java distributed architecture provided by any one of the foregoing method embodiments.
[0132] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0133] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a general hardware platform, and of course, it can also be implemented by hardware. Based on such an understanding, the essence of the above technical solutions or the part that contributes to the related technologies can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disc, etc., including several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods of each embodiment or some parts of the embodiments.
[0134] It should be understood that the terms used herein are for the purpose of describing particular example embodiments only and are not intended to be limiting. Unless the context clearly dictates otherwise, the singular forms "a", "an", and "the" as used herein may also include the plural forms. The terms "comprising", "including", "containing", and "having" are inclusive and thus specify the presence of stated features, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, steps, operations, elements, components, and / or combinations thereof. The method steps, processes, and operations described herein are not to be construed as necessarily requiring their performance in the particular order described or illustrated, unless an order of performance is expressly stated. It should also be understood that additional or alternative steps may be used.
[0135] The foregoing are only specific embodiments of the present application, which enable those skilled in the art to understand or implement the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features claimed herein.
Claims
1. A defect detection method based on a Java distributed architecture, characterized in that, Applied to any service node in a service cluster, the service cluster is implemented based on the Java distributed architecture, the service cluster includes a plurality of service nodes that can be dynamically expanded, and each service node is provided with a stream processing engine and a rule engine. The method includes: Using the stream processing engine to obtain product image data from the message queue of the edge server, and calling a preset hybrid algorithm to determine the defect recognition result corresponding to the product image data. The product image data is obtained after format conversion by at least one image acquisition device, and the defect recognition result is used to represent the recognized defect type and the confidence level corresponding to the defect type; Using the rule engine to obtain a preset matching rule, and performing rule matching on the defect recognition result based on the preset matching rule to obtain a defect detection result. The preset matching rule is used to represent the confidence threshold corresponding to the defect type; Among them, the calling of the preset hybrid algorithm to determine the defect recognition result corresponding to the product image data includes: Calling the preset hybrid algorithm to perform non-local mean denoising and contrast enhancement on the product image data to obtain preprocessed image data; Performing edge detection and contour analysis on the preprocessed image data to obtain a region of interest, and filtering and cropping the region of interest to obtain a region of interest image; Performing defect recognition on the region of interest image to obtain the defect recognition result; Among them, the using the rule engine to obtain a preset matching rule, and performing rule matching on the defect recognition result based on the preset matching rule to obtain a defect detection result includes: Using the rule engine to obtain the preset matching rule, and based on the preset matching rule, determining whether the confidence level corresponding to the defect type is greater than the confidence threshold corresponding to the defect type. The confidence threshold corresponding to the defect type is preset based on the material type and material thickness of the product to be detected; In the case where the confidence level corresponding to the defect type is greater than the confidence threshold corresponding to the defect type, determining that the product to be detected has a defect corresponding to the defect type; In the case where the confidence level corresponding to the defect type is less than or equal to the confidence threshold corresponding to the defect type, determining that the product to be detected does not have a defect corresponding to the defect type.
2. The defect detection method based on the Java distributed architecture according to claim 1, characterized in that, After the using the rule engine to obtain a preset matching rule, and performing rule matching on the defect recognition result based on the preset matching rule to obtain a defect detection result, the method further includes: Persisting the defect detection result to a preset storage area of the service cluster for querying and displaying the defect detection result; and / or, In the case of determining that the product to be detected has a defect corresponding to the defect type, controlling a sorting device to perform a sorting action on the product to be detected.
3. The defect detection method based on the Java distributed architecture according to claim 1, characterized in that The method further includes: When its own resource utilization rate is greater than a preset threshold and / or the number of product image data backlogged in the message queue is greater than a preset number, a new node is allowed to pull configuration parameters from a configuration center and pull a container image from an image repository, so that the new node can join the service cluster based on the configuration parameters and the container image. Here, the configuration center is used to centrally manage the configuration parameters required in the service cluster, and the image repository is used to centrally manage the container images required in the service cluster.
4. The defect detection method based on the Java distributed architecture according to claim 1, wherein The method further includes: When the preset hybrid algorithm is updated, replace the container image started by itself with a new version of the container image, where the new version of the container image is encapsulated based on the updated preset hybrid algorithm; When the container image started by itself is unavailable, replace the container image started by itself with an old version of the container image, where the old version of the container image is encapsulated based on a traditional algorithm.
5. A defect detection method based on a Java distributed architecture, characterized in that, Applied to an edge server, the edge server is connected to at least one image acquisition device through a standardized interface, and the edge server is connected to a service cluster through a network. The service cluster is implemented based on the Java distributed architecture. The service cluster includes a plurality of dynamically scalable service nodes. Each service node is provided with a stream processing engine and a rule engine. The method includes: Receive the original image data collected by the at least one image acquisition device through the standardized interface, and use a protocol middleware to perform format conversion on the original image data to obtain product image data. Here, the protocol middleware is pre-integrated on the edge server, and the protocol middleware is used to convert various different protocol data into unified format data; Cache the product image data into a message queue for service nodes in the service cluster to obtain the product image data from the message queue of the edge server using the stream processing engine, call a preset hybrid algorithm to determine a defect recognition result corresponding to the product image data, and use the rule engine to obtain a preset matching rule, and perform rule matching on the defect recognition result based on the preset matching rule to obtain a defect detection result. Here, the product image data is obtained after format conversion by at least one image acquisition device. The defect recognition result is used to represent the recognized defect type and the confidence level corresponding to the defect type. The preset matching rule is used to represent the confidence level threshold corresponding to the defect type; Among them, the service nodes in the service cluster are used to call the preset hybrid algorithm to perform non-local mean denoising and contrast enhancement on the product image data to obtain preprocessed image data; perform edge detection and contour analysis on the preprocessed image data to obtain a region of interest, and filter and crop the region of interest to obtain a region of interest image; perform defect recognition on the region of interest image to obtain the defect recognition result; Among them, the service nodes in the service cluster are also used to obtain the preset matching rules by using the rule engine, and based on the preset matching rules, determine whether the confidence level corresponding to the defect type is greater than the confidence level threshold corresponding to the defect type, where the confidence level threshold corresponding to the defect type is preset based on the material type and material thickness of the product to be detected; in the case where the confidence level corresponding to the defect type is greater than the confidence level threshold corresponding to the defect type, it is determined that the product to be detected has the defect corresponding to the defect type; in the case where the confidence level corresponding to the defect type is less than or equal to the confidence level threshold corresponding to the defect type, it is determined that the product to be detected does not have the defect corresponding to the defect type.
6. The defect detection method based on the Java distributed architecture according to claim 5, wherein The receiving the original image data collected by the at least one image acquisition device by using the standardized interface includes: Obtaining the metadata of the at least one image acquisition device; According to the metadata of the at least one image acquisition device and a preset mapping table, selecting at least one driver instance adapted to the at least one image acquisition device from a device driver pool, where the preset mapping table stores the mapping relationship between the metadata of each image acquisition device and each manufacturer identifier, and the device driver pool stores the driver instances corresponding to each manufacturer identifier, and the driver instances corresponding to each manufacturer identifier are all defined with standardized interface methods; Loading the at least one driver instance to construct the standardized interface; Receiving the original image data collected by the at least one image acquisition device by using the standardized interface.
7. The defect detection method based on the Java distributed architecture according to claim 5, characterized in that The message queue includes multiple partitions, and different partitions are used to store the product image data collected by different image acquisition devices; The caching the product image data into the message queue includes: According to the identification information corresponding to each image acquisition device, caching the product image data into different partitions of the message queue, so that the service nodes in the service cluster can obtain the product image data they need from the partitions corresponding to the message queue.
8. A defect detection system based on a Java distributed architecture, characterized in that, The system includes: at least one image acquisition device, an edge server, and a service cluster, where the edge server is connected to the at least one image acquisition device through a standardized interface, and the edge server is connected to the service cluster through a network, the service cluster is implemented based on the Java distributed architecture, the service cluster includes a plurality of service nodes that can be dynamically expanded, and each service node is provided with a stream processing engine and a rule engine; The at least one image acquisition device is used to collect the original image data of the product to be detected; The edge server is used to receive the original image data collected by the at least one image acquisition device by using the standardized interface, perform format conversion on the original image data by using a protocol middleware to obtain product image data, and cache the product image data into a message queue; Each service node in the service cluster is used to obtain product image data from the message queue of the edge server by using the stream processing engine, call a preset hybrid algorithm to determine a defect recognition result corresponding to the product image data, and use the rule engine to obtain a preset matching rule, and perform rule matching on the defect recognition result based on the preset matching rule to obtain a defect detection result, where the product image data is obtained after format conversion by at least one image acquisition device, the defect recognition result is used to represent the recognized defect type and the confidence level corresponding to the defect type, and the preset matching rule is used to represent the confidence level threshold corresponding to the defect type; Among them, each service node in the service cluster is used to call the preset hybrid algorithm to perform non-local mean denoising and contrast enhancement on the product image data to obtain preprocessed image data; perform edge detection and contour analysis on the preprocessed image data to obtain a region of interest, and filter and crop the region of interest to obtain a region of interest image; perform defect recognition on the region of interest image to obtain the defect recognition result; Among them, each service node in the service cluster is further used to obtain the preset matching rule by using the rule engine, and based on the preset matching rule, determine whether the confidence level corresponding to the defect type is greater than the confidence level threshold corresponding to the defect type, where the confidence level threshold corresponding to the defect type is preset based on the material type and material thickness of the product to be detected; in the case where the confidence level corresponding to the defect type is greater than the confidence level threshold corresponding to the defect type, determine that the product to be detected has a defect corresponding to the defect type; in the case where the confidence level corresponding to the defect type is less than or equal to the confidence level threshold corresponding to the defect type, determine that the product to be detected does not have a defect corresponding to the defect type.
Citation Information
Patent Citations
Distributed product defect analysis system and method, and computer-readable storage medium
CN113632099A
Production defect identification method, distributed processing platform, equipment and storage medium
CN115526859A