Detection model training method and device, equipment detection method and device, equipment and medium
By performing personalized annotation and training on equipment images in industrial scenarios, the generated equipment detection model can accurately detect anomalies of interest to users, solving the problem of insufficient adaptability of general models and improving detection accuracy and personalized adaptability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN XIAOPAI TECHNOLOGY CO LTD
- Filing Date
- 2025-12-17
- Publication Date
- 2026-04-17
AI Technical Summary
Existing general-purpose detection models in industrial scenarios cannot adapt to the personalized anomaly detection needs of different users, resulting in low detection accuracy and high false alarm and false negative rates.
By labeling normal and abnormal device images corresponding to device identifiers, original positive and negative samples are determined, including normal and abnormal description labels for multiple regions of interest. These are then input into a neural network model for training, and the model parameters are updated until a preset accuracy is achieved, resulting in a personalized device detection model.
It achieves accurate detection of anomalies that users care about, reduces false positives and false negatives, improves the model's ability to adapt to user needs, and has high anomaly detection accuracy.
Smart Images

Figure CN121884030A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer vision inspection technology, and in particular to a detection model training method, a device inspection method, an apparatus, a device, and a medium. Background Technology
[0002] With the continuous development of artificial intelligence (AI) technology, it is increasingly being applied in various scenarios within the field of visual inspection to detect anomalies in images. For example, anomaly detection in images of equipment in industrial settings can monitor for malfunctions; anomaly detection in images of homes can enhance home security; and anomaly detection in medical settings can filter out abnormal images.
[0003] Currently, to detect equipment anomalies in industrial settings, models are typically trained within the industrial environment to obtain a general-purpose model. This model is then used to detect anomalies in equipment images within the industrial setting. For example, images of equipment collected in an industrial environment are used for model training to create a general model capable of detecting equipment anomalies. However, because different users have different detection needs for equipment in industrial settings, the general-purpose model has significant limitations. It cannot adapt to the personalized needs of different users, resulting in a high false positive and false negative rate and low detection accuracy. For instance, different companies have different focuses in equipment anomaly monitoring. Some companies focus on detecting wear on motor bearings, while others focus on detecting corrosion on the equipment casing. The general-purpose model for industrial settings cannot accurately detect both types of anomalies simultaneously, leading to low detection accuracy. Therefore, how to accurately detect anomalies that users are concerned about is a pressing technical problem that needs to be solved. Summary of the Invention
[0004] This invention provides a detection model training method, a device detection method, an apparatus, a device, and a medium to solve the technical problem of how to accurately detect anomalies that users are concerned about.
[0005] A detection model training method, comprising: The normal equipment image corresponding to the equipment identifier is labeled to determine the original positive sample corresponding to the equipment identifier. The original positive sample includes normal description labels corresponding to multiple regions of interest. The abnormal device images corresponding to the device identifier are labeled to determine the original negative samples corresponding to the device identifier. The original negative samples include abnormal description labels corresponding to multiple regions of interest. The original positive and original negative samples corresponding to the device identifier are input into the neural network model for training, and the model accuracy corresponding to the neural network model is determined. When the model accuracy is less than the preset accuracy, the model parameters of the neural network model are updated, and the original positive samples and original negative samples corresponding to the device identifier are repeatedly input into the neural network model for training to determine the model accuracy corresponding to the neural network model. When the model accuracy is not less than the preset accuracy, the neural network model with updated model parameters is determined as the device detection model corresponding to the device identifier.
[0006] A method for testing equipment, comprising: Obtain the image to be detected corresponding to the device identifier; The device detection model corresponding to the device identifier is used to identify the image to be detected, and the device detection result is determined. The device detection result includes area detection information corresponding to multiple areas of interest. The device detection model corresponding to the device identifier is the model determined by the detection model training method described above.
[0007] A detection model training device, comprising: The positive sample determination module is used to annotate the normal device image corresponding to the device identifier and determine the original positive sample corresponding to the device identifier. The original positive sample includes normal description labels corresponding to multiple regions of interest. The negative sample determination module is used to annotate the abnormal device image corresponding to the device identifier and determine the original negative sample corresponding to the device identifier. The original negative sample includes multiple abnormal description labels corresponding to multiple regions of interest. The model training module is used to input the original positive samples and original negative samples corresponding to the device identifier into the neural network model for training, and to determine the model accuracy corresponding to the neural network model. The model parameter update module is used to update the model parameters of the neural network model when the model accuracy is less than the preset accuracy, and repeatedly execute the process of inputting the original positive samples and original negative samples corresponding to the device identifier into the neural network model for training, and determine the model accuracy corresponding to the neural network model. The detection model determination module is used to determine the neural network model with updated model parameters as the device detection model corresponding to the device identifier when the model accuracy is not less than a preset accuracy.
[0008] A device for testing equipment, comprising: The image acquisition module is used to acquire the image to be detected corresponding to the device identifier; The device detection result acquisition module is used to identify the image to be detected using the device detection model corresponding to the device identifier, and determine the device detection result. The device detection result includes area detection information corresponding to multiple areas of interest. The device detection model corresponding to the device identifier is the model determined by the detection model training method described above.
[0009] 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 detection model training method described above, or implements the device detection method described above.
[0010] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described detection model training method or the above-described device detection method.
[0011] This invention provides a detection model training method, device detection method, apparatus, device, and medium. By annotating normal device images with normal descriptive labels for regions of interest and abnormal device images with abnormal descriptive labels for regions of interest, a neural network model is trained to detect anomalies corresponding to user-focused regions of interest during model training. This allows for personalized detection by the user. The model is trained using original positive samples including normal descriptive labels and original negative samples including abnormal descriptive labels to determine model accuracy. When the model accuracy is not less than a preset accuracy, a device detection model capable of accurately detecting device anomalies is obtained. This method trains a device detection model that accurately detects anomalies in regions of interest requiring anomaly detection using positive and negative samples in anomaly detection scenarios. The regions of interest for anomaly detection and the criteria for judging anomalies in these regions are highly consistent with user needs, effectively improving the model's ability to adapt to personalized user requirements. Furthermore, because the device detection model is accurately trained using positive and negative samples, it effectively reduces false positives and false negatives, resulting in high anomaly detection accuracy. Attached Figure Description
[0012] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0013] Figure 1This is a flowchart of a detection model training method according to an embodiment of the present invention; Figure 2 This is another flowchart of the detection model training method in one embodiment of the present invention; Figure 3 This is another flowchart of the detection model training method in one embodiment of the present invention; Figure 4 This is another flowchart of the detection model training method in one embodiment of the present invention; Figure 5 This is a flowchart of a device detection method according to another embodiment of the present invention; Figure 6 This is another flowchart of the device detection method in another embodiment of the present invention; Figure 7 This is a schematic diagram of a detection model training device in one embodiment of the present invention; Figure 8 This is a schematic diagram of a device detection apparatus in another embodiment of the present invention; Figure 9 This is a schematic diagram of a computer device according to an embodiment of the present invention. Detailed Implementation
[0014] To make the technical problems solved, the technical solutions, and the beneficial effects of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0015] The detection model training method provided in this invention involves annotating normal device images corresponding to device identifiers to determine original positive samples, which include normal descriptive labels corresponding to multiple regions of interest; annotating abnormal device images corresponding to device identifiers to determine original negative samples, which include abnormal descriptive labels corresponding to multiple regions of interest; inputting the original positive and negative samples corresponding to device identifiers into a neural network model for training to determine the model accuracy; if the model accuracy is less than a preset accuracy, updating the model parameters of the neural network model and repeating the process of inputting the original positive and negative samples corresponding to device identifiers into the neural network model for training to determine the model accuracy; if the model accuracy is not less than the preset accuracy, determining the neural network model with updated model parameters as the device detection model corresponding to the device identifier. This method trains a device detection model that accurately detects regions of interest requiring anomaly detection by using positive and negative samples corresponding to the regions of interest requiring anomaly detection in a device anomaly detection scenario. The anomaly detection model of this device has a high degree of consistency with user needs in terms of the region of interest for anomaly detection and the criteria for judging anomalies in the region of interest. This effectively improves the model's ability to adapt to user needs in a personalized way. Furthermore, the device detection model is trained accurately with positive and negative samples, which can effectively reduce false alarms and false negatives and has high anomaly detection accuracy.
[0016] In one embodiment, such as Figure 1 As shown, a detection model training method is provided, which is then applied to... Figure 9 Taking a computer device as an example, the explanation includes the following steps: S101: Annotate the normal equipment image corresponding to the equipment identifier to determine the original positive sample corresponding to the equipment identifier. The original positive sample includes normal description labels corresponding to multiple areas of interest. S102: Annotate the abnormal device image corresponding to the device identifier, and determine the original negative sample corresponding to the device identifier. The original negative sample includes abnormal description labels corresponding to multiple regions of interest. S103: Input the original positive samples and original negative samples corresponding to the device identifier into the neural network model for training, and determine the model accuracy corresponding to the neural network model; S104: When the model accuracy is less than the preset accuracy, update the model parameters of the neural network model, and repeatedly execute the process of inputting the original positive samples and original negative samples corresponding to the device identifier into the neural network model for training to determine the model accuracy corresponding to the neural network model. S105: When the model accuracy is not less than the preset accuracy, the neural network model with updated model parameters is determined as the device detection model corresponding to the device identifier.
[0017] Here, "device identifier" refers to the identifier used to uniquely identify a device. "Normal device image" refers to an image of a device in its normal state. "Original positive sample" refers to an image of a normal device after it has been annotated. "Region of interest" refers to the area of interest required for anomaly detection. "Normal description label" refers to the description corresponding to a normal device image, serving as a label describing the normal device image.
[0018] As an example, in step S101, the computer device acquires multiple normal equipment images in an industrial scene where the equipment corresponding to the equipment identifier is in normal working condition. It then identifies multiple regions of interest (ROIs) in each normal equipment image that require anomaly detection. Normal feature descriptions are applied to these ROIs in each normal equipment image to obtain normal description labels. These labels are then used to annotate the normal equipment image, resulting in multiple normal equipment images including normal description labels. These normal equipment images are then identified as the original positive samples. In this example, the equipment identifier includes, but is not limited to, the equipment number. For example, when performing anomaly detection on the motor of a device, the motor number is obtained and identified as the equipment identifier. In this example, the user takes photos of the normal equipment images corresponding to the equipment identifier in the industrial scene using a client (e.g., an application APP) to obtain multiple normal equipment images. These images are then uploaded to the computer device via the client, and the computer device receives the multiple normal equipment images.
[0019] Here, "abnormal equipment image" refers to an image of equipment in an abnormal state. "Original negative sample" refers to an image after the abnormal equipment image has been annotated. "Abnormal description label" refers to the description corresponding to the abnormal equipment image, serving as a label describing the abnormal equipment image.
[0020] As an example, in step S102, the computer device acquires multiple abnormal device images in an industrial scene when the device corresponding to the device identifier is in an abnormal state. It then identifies multiple regions of interest (ROIs) in each abnormal device image that require anomaly detection. These ROIs are described to obtain anomaly description tags for each image. The same anomaly description tags are used to annotate the same abnormal device image, resulting in multiple abnormal device images including these tags. These images are then identified as the original negative samples. In this example, the user captures abnormal images of the device corresponding to the device identifier in an industrial scene using a client (e.g., an application APP). Multiple abnormal device images are then uploaded to the computer device via the client, and the computer device receives these images.
[0021] Model accuracy refers to the precision with which the model detects anomalies, and can be characterized by precision and / or recall.
[0022] As an example, in step S103, the computer device inputs the normal device images from the original positive samples and the abnormal device images from the original negative samples into the neural network model to be trained for model training. After each round of training, the recognition results corresponding to the original positive samples and the recognition results corresponding to the original negative samples are output respectively. Based on the recognition results and normal description labels corresponding to the original positive samples, and the recognition results and abnormal description labels corresponding to the original negative samples, the loss function is calculated to determine the model loss function value. If the loss function value does not meet the preset convergence condition, it is determined that the model has not been trained. Steps S101 to S103 are repeated to continue model training and update the model parameters of the neural network model. When the loss function value meets the preset convergence condition, it is determined that the model has been initially trained and the updated neural network model is obtained. The computer device acquires a test image set for anomaly testing and uses the test image set to test the updated neural network model. The accuracy or recall of the updated neural network model for anomaly recognition on the test images in the test image set is obtained, and the accuracy or recall is determined as the model precision. In this example, the loss function value can be calculated by performing cross-entropy loss function on the recognition results and normal description labels corresponding to the original positive samples, and the recognition results and abnormal description labels corresponding to the original negative samples. Preset convergence conditions include, but are not limited to, the loss function value being less than a preset loss function value threshold, and the difference between the loss function values of two adjacent model training iterations being less than a preset difference threshold.
[0023] Among them, preset accuracy refers to the preset threshold used to judge the accuracy of the model.
[0024] As an example, in step S104, the computer device determines the difference between the model's accuracy and the preset accuracy. If the model's accuracy is less than the preset accuracy, it determines that the model's precision is low and requires further training using original positive and negative samples from the industrial scenario. That is, the computer device continues to execute steps S101 to S103 to continue model training and update the neural network model's parameters to obtain a model that accurately detects the abnormal conditions corresponding to industrial equipment in the industrial scenario. In this example, the preset accuracy is 95%.
[0025] Among them, the equipment detection model refers to a model that can accurately detect the abnormal conditions that need to be detected in the equipment.
[0026] As an example, in step S105, the computer device determines the difference between the model accuracy and the preset accuracy. When it is determined that the model accuracy is not less than the preset accuracy (e.g., 95%), the model accuracy is determined to be high. The neural network model with updated parameters is then determined as the device detection model corresponding to the device identifier, so that the abnormal conditions of the area of interest corresponding to the device identifier can be accurately detected through the device detection model.
[0027] In this embodiment, normal description labels are used to annotate the regions of interest in normal device images, and abnormal description labels are used to annotate the regions of interest in abnormal device images. This facilitates the training of a neural network model during model training to detect anomalies corresponding to the regions of interest that users are interested in, thus fulfilling users' personalized detection needs. The model is trained using original positive samples including normal description labels and original negative samples including abnormal description labels to determine model accuracy. When the model accuracy is not less than a preset accuracy, a device detection model capable of accurately detecting device anomalies is obtained. This method trains a model using positive and negative samples corresponding to the regions of interest requiring anomaly detection in a device anomaly detection scenario, resulting in a device detection model that accurately detects the regions of interest requiring anomaly detection. The regions of interest for anomaly detection and the criteria for judging anomalies in these regions are highly consistent with user needs, effectively improving the model's ability to adapt to personalized user requirements. Furthermore, this device detection model is accurately trained using positive and negative samples, effectively reducing false positives and false negatives, and achieving high anomaly detection accuracy.
[0028] In this embodiment, the detection model training method in steps S101 to S105 is integrated into the detection model training device. The user logs into the application (APP) on the client side. The client obtains images of normal and abnormal equipment corresponding to equipment with device identifiers in the industrial scene uploaded by the user through the application (APP). Steps S101 to S105 are then executed to achieve the goal of obtaining a device detection model capable of accurately detecting anomalies in areas of interest with user detection needs through the detection model training method, thus achieving personalized and accurate detection of device anomalies. After training the device detection model corresponding to the device identifier, the device identifier and its corresponding device detection model are stored in the system database to facilitate real-time personalized anomaly detection for different areas of interest corresponding to different device identifiers.
[0029] In one embodiment, such as Figure 2 As shown, step S101, which involves labeling the normal equipment image corresponding to the equipment identifier and determining the original positive sample corresponding to the equipment identifier, includes: S201: Perform target detection on the normal equipment image corresponding to the equipment identifier to determine multiple regions of interest corresponding to the normal equipment image; S202: Obtain the normal description tags corresponding to multiple regions of interest; S203: Based on normal device images and normal description labels corresponding to multiple regions of interest, determine the original positive samples corresponding to the device identifier.
[0030] As an example, in step S201, after the computer equipment acquires multiple normal equipment images corresponding to the equipment identifiers of the equipment requiring anomaly detection in the industrial scene, it performs target detection on each normal equipment image corresponding to the equipment identifier according to the user's anomaly detection requirements. This determines multiple regions of interest in each normal equipment image that require anomaly detection, so that the corresponding normal description label can be determined based on these regions of interest. For example, if the user's anomaly detection requirement is the corrosion status of the equipment's casing, the region of interest is the area corresponding to the equipment's casing in the normal equipment image. If the user's anomaly detection requirement is whether the equipment's components are abnormal, the region of interest is the area corresponding to the equipment's components in the normal equipment image.
[0031] As an example, in step S202, the computer device determines normal description labels corresponding to multiple regions of interest in each normal device image based on each normal device image. These normal description labels need to clearly define the normal features of the regions of interest. For example, when the computer device determines that the user's detection requirement is to perform anomaly detection on the device's motor, for the i-th normal device image corresponding to the device identifier... The computer equipment uses a system annotation tool to select multiple regions of interest corresponding to the motor, including "motor bearings" and "motor terminals." A pre-trained large language model is then used to generate textual descriptions for these regions, such as "no cracks or rust on the outer ring of the motor bearing, and no abnormal vibration during rotation" and "no burn marks on the motor terminals, and the wiring is secure and not loose." These textual descriptions are then identified as normal equipment images. The corresponding normal description tags. For example, when a user's detection requirement is to detect anomalies in the motor of a device, the client obtains multiple areas of interest selected by the user using the system's annotation toolbox for each normal device image, including "motor bearings" and "motor terminals." The client also obtains the text descriptions provided by the user for these selected areas, resulting in normal description tags, such as "no cracks or rust on the outer ring of the motor bearing, no abnormal vibration during rotation" and "no burn marks on the motor terminals, secure and not loose." These normal description tags and the corresponding normal device images are then transmitted to the computer device, which obtains multiple normal device images and the corresponding normal description tags for each image.
[0032] As an example, in step S203, the computer device annotates each normal device image with a normal description tag, forming an original positive sample including the normal description tag for each normal device image. For example, when the user's detection requirement for the device is whether the motor is abnormal, for the i-th normal device image... The corresponding normal description labels are "No cracks or rust on the outer ring of the motor bearing, and no abnormal vibration during rotation" and "No burn marks on the motor terminals, and the wiring is secure and not loose." The normal description labels are used for the i-th normal equipment image. Annotate the image to obtain the i-th normal device image. The corresponding original positive samples include those with normal description labels. Specifically, the i-th normal device image is labeled with a normal description label. The annotation methods include, but are not limited to, adding text descriptions corresponding to normal description tags to each normal device image.
[0033] In this embodiment, target detection is performed on multiple regions of interest in a normal device image, and normal descriptive labels are obtained for each normal device image corresponding to multiple regions of interest. Based on the normal device image and the normal descriptive labels of multiple regions of interest, original positive samples focusing on the regions of interest are obtained. This method determines the normal descriptive labels corresponding to multiple regions of interest in a normal device image according to the user's detection requirements, and then determines the original positive samples including the normal descriptive labels. Reasonably determining the original positive samples facilitates the subsequent training of a device detection model that performs anomaly detection on multiple regions of interest in the device image, thus meeting the user's personalized detection needs.
[0034] In one embodiment, such as Figure 3 As shown, step S102, which involves labeling the abnormal device image corresponding to the device identifier and determining the original negative sample corresponding to the device identifier, includes: S301: Perform target detection on the abnormal device image corresponding to the device identifier to determine multiple regions of interest corresponding to the abnormal device image; S302: Obtain the anomaly description tags corresponding to multiple regions of interest; S303: Based on the abnormal device image and the abnormal description labels corresponding to multiple regions of interest, determine the original negative sample corresponding to the device identifier.
[0035] As an example, in step S301, after the computer equipment acquires multiple abnormal equipment images corresponding to the equipment identifiers of the equipment requiring anomaly detection in the industrial scene, it performs target detection on each abnormal equipment image corresponding to the equipment identifier according to the user's anomaly detection requirements. This determines multiple regions of interest in each abnormal equipment image that require anomaly detection, so that the corresponding anomaly description label can be determined based on these regions of interest. For example, if the user's anomaly detection requirement is the corrosion status of the equipment's casing, the region of interest is the area corresponding to the equipment's casing in the abnormal equipment image. If the user's anomaly detection requirement is whether the equipment's components are abnormal, the region of interest is the area corresponding to the equipment's components in the abnormal equipment image.
[0036] As an example, in step S302, the computer device determines anomaly description tags corresponding to multiple regions of interest in each abnormal device image. These anomaly description tags need to clearly define the abnormal characteristics of the regions of interest and the criteria for judging these characteristics. For example, when the computer device determines that the user's detection requirement is to perform anomaly detection on the motor of a device, for the i-th abnormal device image corresponding to the device identifier... The computer equipment used a system annotation tool to select multiple regions of interest corresponding to the motor, including "motor bearings" and "motor terminals." A pre-trained large language model was then used to generate textual descriptions for these regions, such as "The outer ring of the motor bearing has a crack longer than 3mm, and the inner ring has obvious wear and dents," and "Black ablation marks appear on the surface of the motor terminals, with melting of the surrounding insulation layer." These textual descriptions were then identified as abnormal equipment images. The corresponding anomaly description tags. For example, when a user's detection requirement is to detect anomalies in the motor of a device, the client obtains multiple areas of interest selected by the user using the system's annotation toolbox for each image of an abnormal device, including "motor bearings" and "motor terminals." The client also obtains the user's text descriptions of these selected areas, resulting in anomaly description tags, such as "The outer ring of the motor bearing has a crack longer than 3mm, and the inner ring has obvious wear and dents" and "The surface of the motor terminals shows black burning marks, and the surrounding insulation layer has melted." These anomaly description tags and the corresponding images of the abnormal device are then transmitted to the computer. The computer then obtains multiple images of the abnormal device and the corresponding anomaly description tags for each image.
[0037] As an example, in step S303, the computer device annotates each abnormal device image with an anomaly description tag, forming an original negative sample including the anomaly description tag for each abnormal device image. For example, when the user's detection requirement for the device is whether the motor is abnormal, for the i-th abnormal device image... The corresponding anomaly description tags are "The outer ring of the motor bearing has a crack longer than 3mm, and the inner ring has obvious wear and dents" and "Black burning marks appear on the surface of the motor terminals, and the surrounding insulation layer shows signs of melting." These anomaly description tags are used to describe the i-th image of the abnormal device. Annotation is performed to obtain the i-th image of the abnormal device. The corresponding original negative samples include those with anomaly description labels. Specifically, the anomaly description labels are used for the i-th image of the anomalous device. The annotation methods include, but are not limited to, adding an anomaly description label and corresponding text description to each abnormal device image.
[0038] In this embodiment, target detection is performed on multiple regions of interest in an abnormal device image, and anomaly description labels are obtained for each abnormal device image corresponding to multiple regions of interest. Based on the abnormal device image and the anomaly description labels of multiple regions of interest, original negative samples focusing on the regions of interest are obtained. This method determines the anomaly description labels corresponding to multiple regions of interest in an abnormal device image according to the user's detection requirements, and then determines the original negative samples including the anomaly description labels. Reasonably determining the original negative samples facilitates the subsequent training of a device detection model that detects anomalies in multiple regions of interest in the device image, thus meeting the user's personalized detection needs.
[0039] In one embodiment, such as Figure 4 As shown, step S103 involves inputting the original positive and negative samples corresponding to the device identifier into the neural network model for training, and determining the model accuracy of the neural network model, including: S401: Preprocess the normal equipment image in the original positive sample corresponding to the equipment identifier to determine the target positive sample corresponding to the equipment identifier; S402: Preprocess the abnormal device images in the original negative samples corresponding to the device identifier to determine the target negative sample corresponding to the device identifier; S403: Input the target positive sample and target negative sample corresponding to the device identifier into the neural network model for training, and determine the model accuracy of the neural network model.
[0040] Among them, the target positive sample refers to the image obtained after preprocessing the normal device image in the original positive sample.
[0041] As an example, in step S401, the computer device, after acquiring the normal device image in each original positive sample corresponding to the device identifier, performs preprocessing operations such as image size normalization, noise removal, and data augmentation to obtain a preprocessed normal device image. The preprocessed normal device image and the normal descriptive label are then identified as the target positive sample corresponding to the device identifier, facilitating subsequent model training based on the target positive sample and improving the model's generalization ability. In this example, the computer device performs image size normalization adjustment on the normal device images in multiple original positive samples according to a preset pixel count, obtaining multiple resized normal device images. For example, all resized normal device images are 1280 pixels. 720 pixels. The computer equipment performs denoising processing on each resized normal device image, removing noise such as dust and light interference, to obtain a denoised normal device image. The computer equipment further performs data augmentation on the denoised normal device image by horizontal flipping, rotation, and brightness adjustment, to obtain a data-enhanced normal device image. For example, the computer equipment rotates the denoised normal device image by ±15° and adjusts the brightness by ±20%. The computer equipment identifies the data-enhanced normal device image as the preprocessed normal device image, and identifies the preprocessed normal device image and its corresponding normal description label as the target positive sample corresponding to the device identifier.
[0042] The target negative sample refers to the image obtained after preprocessing the abnormal device image in the original negative sample.
[0043] As an example, in step S402, the computer device, after acquiring the abnormal device image in each original negative sample corresponding to the device identifier, performs preprocessing operations such as image size normalization, noise removal, and data augmentation to obtain a preprocessed abnormal device image. The preprocessed abnormal device image and the abnormal description label are then identified as the target negative sample corresponding to the device identifier, facilitating subsequent model training based on the target negative sample and improving the model's generalization ability. In this example, the computer device performs image size normalization on the abnormal device images in multiple original negative samples according to a preset pixel count, obtaining multiple resized abnormal device images. For example, all resized abnormal device images are 1280 pixels. 720 pixels. The computer equipment performs denoising processing on each resized image of the abnormal device, removing noise such as dust and light interference, to obtain a denoised abnormal device image. The computer equipment further performs data augmentation on the denoised abnormal device image by horizontal flipping, rotation, and brightness adjustment, to obtain a data-augmented abnormal device image. For example, the computer equipment rotates the denoised abnormal device image by ±15° and adjusts the brightness by ±20%. The computer equipment identifies the data-augmented abnormal device image as the preprocessed abnormal device image, and identifies the preprocessed abnormal device image and its corresponding abnormal description label as the target negative sample corresponding to the device identifier.
[0044] As an example, in step S403, the computer device calls the PyTorch framework, sets the model training learning rate (e.g., 0.001) and the number of model training iterations (e.g., 100 rounds), takes the preprocessed normal device images in the target positive samples as positive samples, and the preprocessed normal device images in the target negative samples as negative samples, and inputs them into the neural network model for training. After each round of model training, the model recognition result corresponding to the target positive sample and the model result corresponding to the target negative sample are obtained. Based on the difference between the model recognition result and the normal description label corresponding to the target positive sample, and the model recognition result and the abnormal description label corresponding to the target negative sample, the model training loss function value is determined. Based on the model training loss function value, the neural network model is updated to obtain the neural network model with updated parameters after this round of training. The neural network model with updated parameters is tested using a preset image test set in the industrial scenario, and the accuracy or recall corresponding to the image test set is calculated. The accuracy or recall is determined as the model precision.
[0045] In this embodiment, by preprocessing the normal device images in the original positive samples corresponding to the device identifier and the abnormal device images in the original negative samples corresponding to the device identifier, the target positive samples and target negative samples corresponding to the device identifier are obtained. Based on the target positive samples and target negative samples corresponding to the device identifier, the neural network model is accurately trained to improve the model's generalization ability.
[0046] In another embodiment, such as Figure 5 As shown, a device testing method is provided, which is applied to... Figure 9 Taking a computer device as an example, the explanation includes the following steps: S501: Obtain the image to be detected corresponding to the device identifier; S502: The device detection model corresponding to the device identifier is used to identify the image to be detected and determine the device detection result. The device detection result includes the area detection information corresponding to multiple areas of interest. The device detection model corresponding to the device identifier is a model determined using the detection model training method described in the above embodiments.
[0047] The image to be detected refers to the image of the device that needs to be detected, corresponding to the device identifier.
[0048] As an example, in step S501, the computer device acquires an image to be detected related to the device corresponding to the device identifier in an industrial scene. For instance, in an industrial scene, it is necessary to detect whether the motor in the device corresponding to the device identifier is abnormal. The computer device acquires an image of the motor in the device corresponding to the device identifier and identifies this image as the image to be detected.
[0049] Among them, the device detection result refers to the result obtained after performing anomaly detection on the image to be detected. The region detection information refers to the information output by the device detection model corresponding to the identifier after detecting the image to be detected, which describes the specific condition of the device.
[0050] As an example, in step S502, the computer device inputs the image to be detected corresponding to a device identifier into the device detection model corresponding to the same device identifier. The device detection model is used to perform anomaly detection on multiple regions of interest in the image to be detected. When at least one region of interest in the image to be detected is detected to be abnormal, the device detection result is determined to be a device abnormality, and the region detection information corresponding to multiple regions of interest is output. When each region of interest in the image to be detected is detected to be normal, the device detection result is determined to be a device normality, and the region detection information corresponding to multiple regions of interest is output. In this example, in an industrial scenario, when a computer determines that it needs to detect whether a motor in a device corresponding to a device identifier is abnormal, it inputs the image of the relevant motor to be detected into the device detection model corresponding to the same device identifier. The device detection model then performs anomaly detection on multiple regions of interest in the image of the relevant motor. When at least one region of interest in the image is detected to be abnormal, the device detection result is determined to be abnormal, and the region detection information corresponding to multiple regions of interest is output, such as "the outer ring of the motor bearing has a crack longer than 3mm, and the inner ring has obvious wear and dents" and "black burning marks appear on the surface of the motor terminal block, and the surrounding insulation layer has melted." When each region of interest in the image is detected to be normal, the device detection result is determined to be normal, and the region detection information corresponding to multiple regions of interest is output, such as "the outer ring of the motor bearing has no cracks or rust, and there is no abnormal vibration when rotating" and "the motor terminal block has no burning marks, and the wiring is firm and not loose." This method can accurately detect regions of interest in the image of the same device identifier using the trained device detection model corresponding to the device identifier, meeting the personalized detection needs for detecting regions of interest.
[0051] In this embodiment, after acquiring the image to be detected corresponding to the device identifier, multiple regions of interest in the image can be accurately detected using the device detection model corresponding to the same device identifier. The system outputs device detection results including region detection information for each region of interest. This not only fulfills the personalized detection needs of targeting specific regions of interest but also provides real-time output of device detection results. Furthermore, this method only requires outputting the image to be detected to the device detection model corresponding to the device identifier to detect whether equipment in industrial scenarios is abnormal. It is simple to operate, has a low technical threshold, and has broad application prospects.
[0052] In one embodiment, such as Figure 6 As shown, after step S502, that is, after using the device detection model corresponding to the device identifier to identify the image to be detected and determining the device detection result, the device detection method further includes: S601: Regions of interest whose region detection information is anomaly description information are identified as anomalous regions; S602: Based on all abnormal areas, generate target alarm information and push the target alarm information to the target terminal.
[0053] Among them, the anomaly description information refers to the information used to describe the specific abnormal condition of the equipment. The anomaly area refers to the area where the equipment is in an abnormal state.
[0054] As an example, in step S601, the computer device identifies the area detection information corresponding to multiple areas of interest output by the device detection model corresponding to the device identifier, and determines whether there is abnormal description information. If abnormal description information exists, the area of interest corresponding to the abnormal description information is identified as an abnormal area, so as to push the abnormal area in real time and notify the user of the specific abnormal situation of the device in a timely manner. For example, in an industrial scenario, when the computer device detects whether the image to be detected of the motor in the device is abnormal through the device detection model corresponding to the device identifier, and determines that there are abnormal description information in the area detection information such as "the outer ring of the motor bearing has a crack with a length of more than 3mm and the inner ring has obvious wear and dents" and "the surface of the motor terminal shows black burning marks and the insulation layer around it has melted", the corresponding areas of interest of the motor bearing, the inner ring of the motor, the motor terminal, and the area around the motor terminal are identified as abnormal areas, so as to push more accurate target alarm information based on the abnormal area.
[0055] Target alarm information refers to abnormal information from the device used to alert the user. Target terminal refers to the terminal used to alert the user.
[0056] As an example, in step S602, after determining the abnormal area, the computer device identifies the abnormal description information corresponding to the abnormal area, determines the device abnormality type, and captures the abnormal image corresponding to the abnormal area in the image to be detected, obtaining an abnormal image screenshot. The device identifier, device detection time, device abnormality type, and abnormal image screenshot are then pushed as target alarm information to the target terminal used to alarm the user. The target terminal can be an application bound to the user's PC or an app bound to the user's mobile phone. For example, when a computer device detects anomalies in the image of a motor using a device detection model corresponding to the device identifier, it identifies the abnormal areas as the motor bearing, inner ring, terminals, and surrounding areas of interest. Then, it segments these areas within the image to be detected, identifying corresponding abnormal image screenshots. Based on the abnormal descriptions in the area detection information, such as "a crack longer than 3mm on the outer ring of the motor bearing and obvious wear marks on the inner ring" and "black ablation marks on the surface of the motor terminals with melting insulation around them," the device anomaly type is determined. The device identifier, detection time, anomaly type, and abnormal image screenshots are then pushed as target alarm information to the target terminal for user alerts, allowing users to promptly address the anomaly.
[0057] In this embodiment, when it is determined that there is abnormal description information in the area detection information, the area of interest in which the area detection information has abnormal description information is identified as an abnormal area, and a target alarm information is generated based on the abnormal area and pushed to the target terminal, so as to notify the user of the abnormal status of the device in real time, so that the user can deal with the abnormal status in a timely manner, improve the real-time performance and pertinence of the device abnormality detection, and realize personalized abnormality detection of the area of interest.
[0058] 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.
[0059] In one embodiment, a detection model training apparatus is provided, which corresponds one-to-one with the detection model training methods in the above embodiments. For example... Figure 7 As shown, the detection model training device includes a positive sample determination module 701, a negative sample determination module 702, a model training module 703, a model parameter update module 704, and a detection model determination module 705. Detailed descriptions of each functional module are as follows: Positive sample determination module 701 is used to annotate the normal equipment image corresponding to the equipment identifier and determine the original positive sample corresponding to the equipment identifier. The original positive sample includes normal description labels corresponding to multiple regions of interest. The negative sample determination module 702 is used to annotate the abnormal device image corresponding to the device identifier and determine the original negative sample corresponding to the device identifier. The original negative sample includes abnormal description labels corresponding to multiple regions of interest. The model training module 703 is used to input the original positive samples and original negative samples corresponding to the device identifier into the neural network model for training, and to determine the model accuracy of the neural network model. The model parameter update module 704 is used to update the model parameters of the neural network model when the model accuracy is less than the preset accuracy. It repeatedly executes the process of inputting the original positive samples and original negative samples corresponding to the device identifier into the neural network model for training, and determines the model accuracy corresponding to the neural network model. The detection model determination module 705 is used to determine the neural network model with updated model parameters as the device detection model corresponding to the device identifier when the model accuracy is not less than the preset accuracy.
[0060] In one embodiment, the positive sample determination module 701 includes: The first region of interest determination submodule is used to perform target detection on the normal device image corresponding to the device identifier and determine multiple regions of interest corresponding to the normal device image. The normal description tag acquisition submodule is used to acquire normal description tags corresponding to multiple regions of interest; The original positive sample determination submodule determines the original positive sample corresponding to the device identifier based on the normal device image and the normal description labels corresponding to multiple regions of interest.
[0061] In one embodiment, the negative sample determination module 702 includes: The second region of interest determination submodule is used to perform target detection on the abnormal device image corresponding to the device identifier and determine multiple regions of interest corresponding to the abnormal device image. The anomaly description tag acquisition submodule is used to acquire anomaly description tags corresponding to multiple regions of interest. The original negative sample determination submodule determines the original negative sample corresponding to the device identifier based on the abnormal device image and the abnormal description labels corresponding to multiple regions of interest.
[0062] In one embodiment, the model training module 703 includes: The target positive sample determination submodule is used to preprocess the normal device images in the original positive samples corresponding to the device identifier and determine the target positive samples corresponding to the device identifier. The target negative sample determination submodule is used to preprocess the abnormal device images in the original negative samples corresponding to the device identifier and determine the target negative sample corresponding to the device identifier. The model training submodule is used to input the target positive samples and target negative samples corresponding to the device identifier into the neural network model for training, and to determine the model accuracy of the neural network model.
[0063] In another embodiment, a device testing apparatus is provided, which corresponds one-to-one with the device testing methods described in the above embodiments. For example... Figure 8 As shown, the equipment detection device includes a module 801 for acquiring the image to be detected and a module 802 for acquiring the equipment detection result. Detailed descriptions of each functional module are as follows: The image acquisition module 801 is used to acquire the image to be detected corresponding to the device identifier; The equipment detection result acquisition module 802 is used to identify the image to be detected using the equipment detection model corresponding to the equipment identifier, and determine the equipment detection result. The equipment detection result includes regional detection information corresponding to multiple regions of interest. The device detection model corresponding to the device identifier is the model determined by the detection model training method in the above embodiments.
[0064] In another embodiment, the device detection apparatus further includes: The abnormal region determination module is used to identify regions of interest whose region detection information corresponds to abnormal description information as abnormal regions. The target alarm information push module generates target alarm information based on all abnormal areas and pushes the target alarm information to the target terminal.
[0065] The modules in the aforementioned detection model training device and equipment detection device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, 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.
[0066] For specific limitations regarding the aforementioned detection model training device, please refer to the limitations on the detection model training method above. For specific limitations regarding the aforementioned device detection device, please refer to the limitations on the device detection method above, and will not be repeated here. Each module in the aforementioned detection model training device and device detection device can be implemented entirely or partially through software, hardware, or a combination thereof. Each module can be embedded in hardware or independently of the processor in the computer device, or it can be stored in software in the memory of the computer device, so that the processor can call and execute the operations corresponding to each module.
[0067] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 9 As shown. The computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computing 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 database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database stores data used or generated during the execution of detection model training methods and device detection methods. The network interface communicates with external terminals via a network connection. When executed by the processor, the computer program implements a detection model training method, or, when executed by the processor, implements a device detection method.
[0068] 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 detection model training method described in the above embodiment, for example... Figure 1 As shown in S101-S105, or Figures 2 to 4 As shown, to avoid repetition, it will not be described again here. Alternatively, when the processor executes the computer program, it implements the functions of each module / unit in this embodiment of the detection model training device, for example... Figure 7 The functions of the positive sample determination module 701, negative sample determination module 702, model training module 703, model parameter update module 704, and detection model determination module 705 shown are not described again here to avoid repetition.
[0069] 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 device detection method described in the above embodiment, for example... Figure 5 As shown in S501-S502, or Figure 6 As shown, to avoid repetition, it will not be described again here. Alternatively, when the processor executes the computer program, it implements the functions of each module / unit in this embodiment of the device detection device, for example... Figure 8 The functions of the image acquisition module 801 and the device detection result acquisition module 802 shown are not described again here to avoid repetition.
[0070] 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 detection model training method described in the above embodiment, for example... Figure 1As shown in S101-S105, or Figures 2 to 4 As shown, to avoid repetition, it will not be described again here. Alternatively, when the computer program is executed by the processor, it implements the functions of each module / unit in this embodiment of the detection model training device, for example... Figure 7 The functions of the positive sample determination module 701, negative sample determination module 702, model training module 703, model parameter update module 704, and detection model determination module 705 shown are not described again here to avoid repetition. The computer-readable storage medium can be non-volatile or volatile.
[0071] 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 device detection method described in the above embodiment, for example... Figure 5 As shown in S501-S502, or Figure 6 As shown, to avoid repetition, it will not be described again here. Alternatively, when the computer program is executed by the processor, it implements the functions of each module / unit in this embodiment of the device detection apparatus, for example... Figure 8 The functions of the image acquisition module 801 and the device detection result acquisition module 802 shown are not described again here to avoid repetition. The computer-readable storage medium can be non-volatile or volatile.
[0072] The above-described 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 method for training a detection model, characterized in that, include: The normal equipment image corresponding to the equipment identifier is labeled to determine the original positive sample corresponding to the equipment identifier. The original positive sample includes normal description labels corresponding to multiple regions of interest. The abnormal device images corresponding to the device identifier are labeled to determine the original negative samples corresponding to the device identifier. The original negative samples include abnormal description labels corresponding to multiple regions of interest. The original positive and original negative samples corresponding to the device identifier are input into the neural network model for training, and the model accuracy corresponding to the neural network model is determined. When the model accuracy is less than the preset accuracy, the model parameters of the neural network model are updated, and the original positive samples and original negative samples corresponding to the device identifier are repeatedly input into the neural network model for training to determine the model accuracy corresponding to the neural network model. When the model accuracy is not less than the preset accuracy, the neural network model with updated model parameters is determined as the device detection model corresponding to the device identifier.
2. The detection model training method according to claim 1, characterized in that, The step of labeling the normal equipment image corresponding to the equipment identifier and determining the original positive sample corresponding to the equipment identifier includes: Target detection is performed on the normal device image corresponding to the device identifier to determine multiple regions of interest corresponding to the normal device image; Obtain normal description tags corresponding to multiple regions of interest; Based on the normal device image and the normal description labels corresponding to the multiple regions of interest, the original positive sample corresponding to the device identifier is determined.
3. The detection model training method according to claim 1, characterized in that, The step of labeling the abnormal device image corresponding to the device identifier and determining the original negative sample corresponding to the device identifier includes: Target detection is performed on the abnormal device image corresponding to the device identifier to determine multiple regions of interest corresponding to the abnormal device image; Obtain anomaly description tags corresponding to multiple regions of interest; Based on the abnormal device image and the abnormal description labels corresponding to the multiple regions of interest, the original negative sample corresponding to the device identifier is determined.
4. The detection model training method according to claim 1, characterized in that, The step of inputting the original positive samples and original negative samples corresponding to the device identifier into the neural network model for training, and determining the model accuracy corresponding to the neural network model, includes: The normal device image in the original positive sample corresponding to the device identifier is preprocessed to determine the target positive sample corresponding to the device identifier; The abnormal device images in the original negative samples corresponding to the device identifier are preprocessed to determine the target negative samples corresponding to the device identifier; The target positive samples and target negative samples corresponding to the device identifier are input into the neural network model for training, and the model accuracy of the neural network model is determined.
5. A method for testing equipment, characterized in that, include: Obtain the image to be detected corresponding to the device identifier; The device detection model corresponding to the device identifier is used to identify the image to be detected, and the device detection result is determined. The device detection result includes area detection information corresponding to multiple areas of interest. Wherein, the device detection model corresponding to the device identifier is the model determined by the detection model training method according to any one of claims 1-4.
6. The equipment testing method according to claim 5, characterized in that, The equipment testing method also includes: The regions of interest whose detection information is anomaly description information are identified as anomalous regions; Based on all the aforementioned abnormal regions, target alarm information is generated and pushed to the target terminal.
7. A detection model training device, characterized in that, include: The positive sample determination module is used to annotate the normal device image corresponding to the device identifier and determine the original positive sample corresponding to the device identifier. The original positive sample includes normal description labels corresponding to multiple regions of interest. The negative sample determination module is used to annotate the abnormal device image corresponding to the device identifier and determine the original negative sample corresponding to the device identifier. The original negative sample includes multiple abnormal description labels corresponding to multiple regions of interest. The model training module is used to input the original positive samples and original negative samples corresponding to the device identifier into the neural network model for training, and to determine the model accuracy corresponding to the neural network model. The model parameter update module is used to update the model parameters of the neural network model when the model accuracy is less than the preset accuracy, and repeatedly execute the process of inputting the original positive samples and original negative samples corresponding to the device identifier into the neural network model for training, and determine the model accuracy corresponding to the neural network model. The detection model determination module is used to determine the neural network model with updated model parameters as the device detection model corresponding to the device identifier when the model accuracy is not less than a preset accuracy.
8. A device for testing equipment, characterized in that, include: The image acquisition module is used to acquire the image to be detected corresponding to the device identifier; The device detection result acquisition module is used to identify the image to be detected using the device detection model corresponding to the device identifier, and determine the device detection result. The device detection result includes area detection information corresponding to multiple areas of interest. Wherein, the device detection model corresponding to the device identifier is the model determined by the detection model training method according to any one of claims 1-4.
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 detection model training method according to any one of claims 1 to 4, or the device detection method according to any one of claims 5 to 6.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the detection model training method according to any one of claims 1 to 4, or the device detection method according to any one of claims 5 to 6.