Image detection, model training method and device, and electronic equipment
By combining computer vision features and multimodal large models, quality detection of inspection images is achieved, solving the problem of inspection image quality, avoiding resource waste and false alarms, improving the recognition rate, and making it suitable for edge computing node deployment.
Patent Information
- Application Number
- CN202611198321.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-07
- Publication Date
- 2026-11-20
AI Technical Summary
In existing security systems, image quality issues during inspections lead to wasted backend computing resources and false alarms, making it difficult to effectively identify complex coding errors such as 'partial screen distortion' and 'mosaic'.
The system employs computer vision features for primary coarse screening, combines a trained multimodal large model for secondary fine screening, utilizes a visual language model for quality detection, and outputs structured detection results.
It implements funnel-style filtering of inspection images, avoiding waste of backend computing resources and false alarms caused by bad images, improving the recognition rate of damaged codes, and is suitable for deployment on edge computing nodes.
Smart Images

Figure CN123141318A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of artificial intelligence technology, and in particular relates to an image detection, model training method, apparatus and electronic device. Background Technology
[0002] In scenarios such as industrial parks, factories, and large shopping malls, hundreds or even thousands of surveillance cameras are typically deployed. To intelligently manage these scattered surveillance images, security systems often adopt an "automatic inspection" mode: the central service periodically pulls real-time monitoring frames from different cameras (achieved through screenshots) according to a predetermined inspection strategy (such as polling, event triggering, and prioritizing key areas), and transmits them to the backend artificial intelligence (AI) analysis server for scene content analysis (such as smoke detection, personnel intrusion detection, and helmet wearing recognition).
[0003] However, in actual operation, due to network packet loss, aging camera equipment, codec failure, or abnormal ambient lighting (such as overexposure or underexposure), the captured monitoring frames often have serious quality problems, leading to a waste of backend computing resources. Furthermore, bad images can cause the analysis model to generate numerous false alarms (e.g., screen stripes are misidentified as flames), interfering with the normal alarm system. Therefore, the industry urgently needs a solution to perform quality checks on inspection images before they enter the backend analysis process. Summary of the Invention
[0004] The purpose of this application is to provide an image detection and model training method, apparatus, and electronic device to achieve quality detection of inspection images.
[0005] To achieve the above objectives, the embodiments of this application adopt the following technical solutions: In a first aspect, embodiments of this application provide an image detection method, comprising: acquiring multiple inspection images to be detected; performing quality screening on the multiple inspection images based on computer vision features to obtain candidate inspection images that pass the screening; inputting each of the candidate inspection images into a trained multimodal large model for quality detection to obtain each detection result output by the multimodal large model, wherein the detection result includes the quality detection conclusion and severity level of the candidate inspection image; and determining a target inspection image that passes the quality detection based on the detection results of each of the candidate inspection images.
[0006] Secondly, embodiments of this application provide a model training method, comprising: acquiring multiple sample inspection images and corresponding multiple sample detection results, wherein the sample detection results include the sample quality detection conclusion and sample severity level of the sample inspection images; training a multimodal large model to be trained based on the multiple sample inspection images and the multiple sample detection results to obtain a trained multimodal large model, wherein the multimodal large model is used to perform quality detection on an input image, such that the output predicted detection result includes the predicted quality detection conclusion and predicted severity level of the input image.
[0007] Thirdly, embodiments of this application provide an image detection device, comprising: a first acquisition module for acquiring multiple inspection images to be detected; a screening module for performing quality screening on the multiple inspection images based on computer vision features to obtain candidate inspection images that pass the screening; a detection module for inputting each of the candidate inspection images into a trained multimodal large model for quality detection to obtain each detection result output by the multimodal large model, wherein the detection result includes the quality detection conclusion and severity level of the candidate inspection image; and a determination module for determining a target inspection image that passes the quality detection based on the detection results of each of the candidate inspection images.
[0008] Fourthly, embodiments of this application provide a model training apparatus, comprising: a second acquisition module, configured to acquire multiple sample inspection images and corresponding multiple sample detection results, wherein the sample detection results include the sample quality detection conclusion and sample severity level of the sample inspection images; and a training module, configured to train a multimodal large model to be trained based on the multiple sample inspection images and the multiple sample detection results, thereby obtaining a trained multimodal large model, wherein the multimodal large model is used to perform quality detection on an input image, such that the output predicted detection result includes the predicted quality detection conclusion and predicted severity level of the input image.
[0009] Fifthly, embodiments of this application provide an electronic device, including: a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein when the program or instructions are executed by the processor, they implement the steps of the method described in the first aspect of this application, or implement the steps of the method described in the second aspect of this application.
[0010] The above-described technical solutions adopted in the embodiments of this application can achieve the following beneficial effects: In this embodiment of the application, when performing quality inspection on multiple inspection images to be inspected, a first-level coarse screening is performed based on computer vision features, and a second-level fine screening is performed based on a trained multimodal large model. This realizes the quality inspection of inspection images by funnel-style filtering before the inspection images enter the back-end analysis process, intercepting bad images and thus avoiding the waste of back-end computing resources caused by bad images, as well as the interference of a large number of false alarms with the normal alarm system. Attached Figure Description
[0011] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings: Figure 1 A schematic flowchart of an image detection method provided for one embodiment of this application; Figure 2 A schematic diagram of the overall process of an image detection method provided for another embodiment of this application; Figure 3 A schematic flowchart illustrating a model training method provided in one embodiment of this application; Figure 4 A schematic diagram of the structure of an image detection device provided in one embodiment of this application; Figure 5 A schematic diagram of the structure of a model training device provided in one embodiment of this application; Figure 6 This is a schematic diagram of the structure of an electronic device provided in one embodiment of this application. Detailed Implementation
[0012] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0013] The terms "first," "second," etc., used in this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein. Furthermore, "and / or" in this application indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship. It should be noted that all data involved in this application was obtained with the user's authorization.
[0014] The technical solutions provided by the various embodiments of this application are described in detail below with reference to the accompanying drawings.
[0015] Figure 1 This is a schematic flowchart illustrating an image detection method according to one embodiment of this application. Figure 1 As shown, the image detection method of this application embodiment may specifically include the following steps: S101, acquire multiple inspection images to be inspected.
[0016] In this embodiment of the application, the image detection method is implemented by an image detection device, which can be installed in an electronic device. This electronic device can be a terminal device or a server. The terminal device can be a mobile phone, tablet computer, desktop computer, laptop, in-vehicle device, etc.; the server can be a standalone server or a server cluster composed of multiple servers.
[0017] In inspection scenarios, based on preset inspection strategies, such as polling, event triggering, and prioritizing key areas, the system can periodically send screenshot requests to different cameras to obtain multiple monitoring frames (i.e., multiple inspection images to be detected) to be analyzed.
[0018] S102, Based on computer vision features, multiple inspection images are screened for quality to obtain candidate inspection images that pass the screening.
[0019] In this embodiment of the application, based on high-confidence computer vision (CV) features, the multiple inspection images obtained in step S101 are subjected to quality screening (i.e., first-level coarse screening), and the inspection images that pass the screening are determined as candidate inspection images for subsequent second-level fine screening.
[0020] The computer vision features of inspection images, namely the non-natural statistical features of the inspection images in the spatial and frequency domains, are used for quality screening of inspection images. This allows for the rapid interception of obvious damage, achieving a first-level coarse screening. The core principle of this step is "high accuracy," meaning that only images with extremely significant bad features are intercepted, ensuring that normal images are not mistakenly rejected.
[0021] Furthermore, step S102, "based on computer vision features, performs quality screening on multiple inspection images to obtain candidate inspection images that pass the screening," may specifically include the following steps: performing at least one of the following screenings on multiple inspection images: solid color screening, vertical shadow screening, and frequency domain noise and exposure anomaly screening to obtain candidate inspection images that pass the screening.
[0022] The process of performing solid color screening on multiple inspection images may include the following steps: For any inspection image, calculate the pixel variance and main color proportion of the entire region and / or each segment of the inspection image; if the pixel variance is less than the preset pixel variance threshold and the average main color proportion is within the target color space, determine that the inspection image has failed the screening.
[0023] Specifically, solid color filtering (or large color block filtering) is applied to scenarios such as the lower half of an inspection image being pure green, pure blue, or completely black. The filtering logic is as follows: For any inspection image, calculate the pixel variance (denoted by σ²) and the proportion of the dominant color tone for the entire region and / or each segmented region (the area of the segmented region can be greater than 30% of the total area of the entire region). If the pixel variance σ² of the entire region or any segmented region is less than the pixel variance threshold ε (ε is close to 0), and the mean proportion of the dominant color tone μ is within the target color space (i.e., the chromaticity components U and V in YUV are constant), then the inspection image is determined to be a corrupted image with a lost decoding signal, and the filtering fails.
[0024] The process of vertical trailing screening for multiple inspection images may include the following steps: For any inspection image, calculate each vertical gradient and each horizontal gradient of the inspection image; calculate the difference between the sum of each horizontal gradient and the sum of each vertical gradient; if the difference is greater than a preset difference threshold and each vertical gradient meets the preset column pixel continuity condition, determine that the inspection image has failed the screening.
[0025] Specifically, vertical ghosting filtering (or vertical streaking filtering) targets scenarios such as vertical color stripe stretching in inspection images. This is a decoding anomaly that occurs during digital video stream transmission. When keyframe (I-frame) data is lost or a slice is damaged, the decoder executes an error hiding strategy, infinitely copying or stretching pixels downwards, creating a vertical pixel "drag" effect. The filtering logic is as follows: For any inspection image, calculate each vertical gradient Gy and each horizontal gradient Gx. Calculate the difference between the sum of horizontal gradients Gx (∑|Gx|) and the sum of vertical gradients Gy (∑|Gy|) (∑|Gx|-∑|Gy|). If the difference (∑|Gx|-∑|Gy|) is greater than a preset difference threshold α (α is much greater than 0), i.e., ∑|Gy| is considered a "streaked" pixel. If ∑|Gx| and the vertical gradient Gy exhibits high column pixel coherence (i.e., each vertical gradient Gy satisfies the preset column pixel coherence condition), then the inspected image is determined to be a vertical ghosting damage caused by decoding, and the screening fails.
[0026] The process of filtering multiple inspection images for frequency domain noise and exposure anomalies may include the following steps: If the proportion of dark areas in an inspection image is greater than a preset dark area proportion threshold, the inspection image is determined to have failed the filtering process; dark areas are regions with brightness below a preset lower brightness limit. If the proportion of bright areas in an inspection image is greater than a preset bright area proportion threshold, and the pixel variance of the inspection image is extremely low, the inspection image is determined to have failed the filtering process; bright areas are regions with brightness above a preset upper brightness limit. If the brightness of an inspection image is below a preset brightness threshold, and the signal frequency of the inspection image is greater than a preset frequency threshold, the inspection image is determined to have failed the filtering process.
[0027] Specifically, the frequency domain noise and exposure anomaly screening targets the following scenarios: night vision failure (i.e., too dark), overexposure, or sensor noise (i.e., high-frequency sensor noise). The screening logic for too dark is as follows: if the proportion of dark areas in the inspection image is greater than the preset dark area proportion threshold (e.g., 95%), then the inspection image is determined to be black and the screening fails.
[0028] The overexposure screening logic is as follows: if the proportion of the bright area in the inspected image is greater than the preset bright area proportion threshold (e.g., 90%), and the pixel variance σ² of the inspected image is extremely low (i.e., σ² < pixel variance threshold ε, ε is close to 0), then the inspected image is determined to be an overexposed white screen, and the screening fails.
[0029] The filtering logic for sensor noise (i.e., high-frequency noise) is as follows: if the high-frequency energy is abnormally high (i.e., the signal frequency of the inspection image is greater than the preset frequency threshold) under low brightness (i.e., the brightness of the inspection image is lower than the preset brightness threshold), then the inspection image is determined to be a sensor gain noise image and the filtering fails.
[0030] S103, input each candidate inspection image into the trained multimodal large model for quality detection, and obtain the detection results output by the multimodal large model. The detection results include the quality detection conclusion and severity level of the candidate inspection images.
[0031] In this embodiment, a multimodal large model is pre-trained. Specifically, the model can be trained by fine-tuning through instructions. The training process can be found in the relevant description in the subsequent embodiments, and will not be repeated here. The multimodal large model can specifically be a Vision Language Model (VLM).
[0032] The candidate inspection images that have not been found to have significant damage, obtained in step S102, are input into the trained multimodal large model. The multimodal large model performs quality detection on the input candidate inspection images and outputs structured detection results.
[0033] The structured detection results may include, but are not limited to, the quality detection conclusions of the candidate inspection images: for example, {normal, damaged} and severity level (e.g., {0-5}).
[0034] The structured detection results can also include the damage type of the candidate inspection image: such as Distortion, Blocking, Color Error, None, and / or damage description: a concise and objective description of the damage location and features. That is, the structured detection results are structured text including four-dimensional information: [Conclusion] | [Type] | [Grade] | [Description].
[0035] Furthermore, the step S103 above, "inputting each candidate inspection image into the trained multimodal large model for quality detection", may specifically include the following steps: obtaining a preset prompt word template, the prompt word template including a preset output format of the detection result; inputting each candidate inspection image and the prompt word template into the multimodal large model for quality detection.
[0036] Specifically, the prompt template can be as follows: "Analyze the image quality. Output format: [Conclusion]: {Status} | [Type]: {Category} | [Level]: {0-5} | [Description]: {Details}", which means "Analyze the quality of this image. Output format: [Conclusion: {Status} | [Type]: {Category} | [Level]: {0-5} | [Description]: {Details}".
[0037] The candidate inspection images that have not been found to have significant damage, obtained in step S102, and the above-mentioned prompt word template are input into the trained multimodal large model. The multimodal large model performs quality detection on the input candidate inspection images and outputs structured detection results.
[0038] The embodiments of this application have been verified in actual multi-camera inspection projects. The relevant technical indicators are as follows: First-level CV detection time: <5ms / frame, Second-level model inference time: <50ms / frame (NVIDIA L20).
[0039] S104. Based on the detection results of each candidate inspection image, determine the target inspection image that passes the quality inspection.
[0040] In this embodiment, for example, if the quality inspection conclusion of a candidate inspection image is that it is damaged and the severity level is ≥3, then the quality inspection of the candidate inspection image is determined to have failed. In the inspection scenario, the CircuitBreaker interface can be triggered to directly terminate the subsequent analysis process of the inspection image.
[0041] For example, if the quality inspection result of a candidate inspection image is normal, or if the quality inspection result is damaged and the severity level is <3, then the candidate inspection image is determined to have passed the quality inspection and is designated as the target inspection image. In the inspection scenario, the target inspection image can be transmitted to the backend Artificial Intelligence (AI) analysis server for scene content analysis (such as smoke detection, personnel intrusion detection, safety helmet wearing recognition, etc.).
[0042] Furthermore, embodiments of this application may also adopt a dynamic strategy feedback mechanism: bad image information is fed back to the inspection scheduling system in real time, dynamically reducing the inspection frequency of cameras with high bad image rates.
[0043] To clearly describe the flow of the image detection method according to the embodiments of this application, the following is combined with... Figure 2 The overall flow of the image detection method according to the embodiments of this application will be described in detail. For example... Figure 2 As shown, the image detection method of this application embodiment specifically includes the following steps: acquiring inspection images; performing first-level CV filtering on the inspection images: solid color filtering, ghosting filtering, and frequency domain noise and exposure anomaly filtering; if any of the inspection images hits one of the above bad image filtering criteria, then the inspection image is intercepted; if all the inspection images pass one of the above bad image filtering criteria, then the inspection images are subjected to second-level AI filtering based on the VLM model, and the structured detection result is output; gating decision is made on the inspection images based on the structured detection result; if the severity level of the inspection image is ≥3, then a circuit breaker alarm is triggered; if the severity level of the inspection image is <3, then the inspection image is allowed to proceed for subsequent scene content analysis.
[0044] In summary, the image detection method of this application performs a first-level coarse screening based on computer vision features and a second-level fine screening based on a trained multimodal large model when conducting quality inspection on multiple inspection images. This achieves funnel-style filtering of inspection images before they enter the backend analysis process, intercepting bad images and thus avoiding the waste of backend computing resources caused by bad images and the interference of a large number of false alarms with the normal alarm system. Utilizing the powerful generalization ability of the multimodal large model, it solves the problem of traditional methods struggling to identify complex coding errors such as "partial screen distortion" and "mosaic," improving the coding corruption recognition rate. The use of a lightweight visual language model as the multimodal large model is suitable for deployment on edge computing nodes, allowing for more flexible deployment. The model output is an interpretable structured output, including four-dimensional information of conclusion, type, level, and description, facilitating differentiated processing by downstream systems.
[0045] Figure 3 This is a flowchart illustrating a model training method provided in one embodiment of this application. Figure 3 As shown, the training method for the model in this embodiment of the application may specifically include the following steps: S301, acquire multiple sample inspection images and corresponding multiple sample detection results. The sample detection results include the sample quality detection conclusion and sample severity level of the sample inspection images.
[0046] In this embodiment of the application, the execution entity of the model training method is a model training device, which can be located in an electronic device. This electronic device can be a terminal device or a server. The terminal device can be a mobile phone, tablet computer, desktop computer, laptop, in-vehicle device, etc.; the server can be a standalone server or a server cluster composed of multiple servers.
[0047] Sample inspection image, i.e., the inspection image used for training multimodal large models. Sample detection result, i.e., the actual detection result corresponding to the sample inspection image.
[0048] Multiple sample inspection images can include multiple positive sample inspection images labeled as bad images and multiple negative sample inspection images labeled as normal images. For example, a total of 7,000 sample inspection images can be obtained, including 5,000 positive sample inspection images and 2,000 negative sample inspection images.
[0049] Multiple positive sample inspection images include inspection images with multiple damage types. That is, by introducing global multi-scale features of the visual encoder and combining them with the scene semantic reasoning ability of the large model for joint correction, the problem that local features such as specular reflection and complex lighting are easily misjudged can be solved.
[0050] Multiple negative sample inspection images include multiple hard sample inspection images, such as multiple inspection images with mosaic-like geometric textures. For example, the aforementioned 2000 negative sample inspection images may include 1000 hard sample inspection images.
[0051] S302, the multimodal large model to be trained is trained based on multiple sample inspection images and multiple sample detection results to obtain the trained multimodal large model. The multimodal large model is used to perform quality detection on the input image, so that the output prediction detection result includes the prediction quality detection conclusion and the prediction severity level of the input image.
[0052] In this embodiment, the first batch of sample inspection images and prompt word templates are input into the multimodal large model to be trained. The multimodal large model to be trained performs quality detection on the input sample inspection images and outputs structured predicted detection results. Based on the predicted detection results and the corresponding sample detection results, the model parameters in the multimodal large model to be trained are fine-tuned. The next batch of sample inspection images and prompt word templates are input into the multimodal large model to be trained, and the above steps are repeated until the training termination condition is met (e.g., the number of iterations reaches a preset number, or the loss function reaches a preset value). The training ends, and the multimodal large model to be trained obtained in the last iteration is determined as the trained multimodal large model.
[0053] A multimodal large model can specifically be a Vision Language Model (VLM), which includes a visual encoder and a language decoder.
[0054] Furthermore, the step S302 above, "training the multimodal large model to be trained, may specifically include the following steps: performing low-rank adaptive adjustment on the model parameters of the language decoder in the multimodal large model to be trained; freezing other model parameters in the multimodal large model to be trained except for the model parameters of the language decoder; setting the initial value of the rank in the model parameters of the language decoder to be higher than a preset rank threshold, and setting the initial value of the alpha in the model parameters of the language decoder to be higher than a preset alpha threshold."
[0055] Specifically, a Parameter Efficient Fine Tuning (PEFT) strategy can be used to adjust the model parameters of the multimodal large model to be trained. This can be achieved using a "double freeze + full-link language fine-tuning" strategy. Low-rank adaptive tuning is performed only on the language decoder model parameters in the multimodal large model to be trained. That is, low-rank adaptive tuning (LoRA) is injected only into the language decoder: target_modules=all-linear. That is, the model parameters other than the language decoder model parameters in the multimodal large model to be trained are frozen, that is, the visual encoder and alignment layer are frozen: freeze_vit=True, freeze_aligner=True.
[0056] The initial value of the rank parameter in the language decoder model is set to be higher than the preset first rank threshold and lower than the preset second rank threshold. The initial value of the alpha parameter in the language decoder model is set to be higher than the preset alpha threshold. This low-rank configuration prevents overfitting: for example, Rank=16, Alpha=32.
[0057] Furthermore, the step S302 above, "training the multimodal large model to be trained, may specifically include the following steps: setting the initial value of the focusing parameter γ in the loss function (Focal Loss) of the multimodal large model to be trained to be equal to or greater than a preset focusing parameter threshold, such as 2.0, that is, setting Focal Loss (γ≥2.0), for example, setting γ=3.0.
[0058] Specifically, since mosaic-like geometric textures and real coding corruption have high similarity in frequency domain features, Focal Loss (γ≥2.0) can be used for targeted training and optimization to improve the ability to distinguish easily confused negative samples and avoid false alarms.
[0059] In summary, the training method of the model in this application training method trains the multimodal large model to be trained based on multiple sample inspection images and multiple sample detection results, resulting in a trained multimodal large model. This multimodal large model is used for quality detection of the input image, ensuring that the output predicted detection result includes the predicted quality detection conclusion and the predicted severity level of the input image. This achieves the training of the multimodal large model, making the detection results more accurate when the trained model performs image quality detection. Through hard example mining, the high false positive problem of traditional methods in complex scenes is effectively solved. To address the issue of high similarity in frequency domain features between mosaic-like geometric textures and real coding corruption, Focal Loss (γ≥2.0) is used for targeted training and optimization, improving the ability to distinguish easily confused negative samples and avoiding false positives. To address the problem of local features such as specular reflection and complex lighting being easily misjudged, global multi-scale features of the visual encoder are introduced, combined with the scene semantic reasoning ability of the large model for joint correction, avoiding false positives.
[0060] Figure 4 This is a schematic diagram of the structure of an image detection device provided in one embodiment of this application. Figure 4 As shown, the image detection device 400 of this application embodiment may specifically include: a first acquisition module 401, a filtering module 402, a detection module 403, and a determination module 404. Wherein: The first acquisition module 401 is used to acquire multiple inspection images to be detected; The filtering module 402 is used to perform quality filtering on multiple inspection images based on computer vision features to obtain candidate inspection images that pass the filtering. The detection module 403 is used to input each candidate inspection image into the trained multimodal large model for quality detection, and obtain the detection results output by the multimodal large model. The detection results include the quality detection conclusion and severity level of the candidate inspection image. The determination module 404 is used to determine the target inspection image that passes the quality inspection based on the detection results of each candidate inspection image.
[0061] In the embodiments of this application, the specific process by which each module and unit in the image detection device of this application implements its function can be found in the relevant descriptions in the above-described image detection method embodiments, and will not be repeated here.
[0062] In summary, the image detection device of this application performs a first-level coarse screening based on computer vision features and a second-level fine screening based on a trained multimodal large model when conducting quality inspection on multiple inspection images. This achieves funnel-style filtering of inspection images before they enter the backend analysis process, intercepting bad images and thus avoiding the waste of backend computing resources caused by bad images and the interference of a large number of false alarms with the normal alarm system. Utilizing the powerful generalization ability of the multimodal large model, it solves the problem of traditional methods struggling to identify complex coding errors such as "partial screen distortion" and "mosaic," improving the coding corruption recognition rate. The use of a lightweight visual language model as the multimodal large model is suitable for deployment on edge computing nodes, allowing for more flexible deployment. The model output is an interpretable structured output, including four-dimensional information of conclusion, type, level, and description, facilitating differentiated processing by downstream systems.
[0063] Figure 5 This is a schematic diagram of the structure of a model training device provided in one embodiment of this application. Figure 5 As shown, the training device 500 for the model in this embodiment may specifically include: a second acquisition module 501 and a training module 502. Wherein: The second acquisition module 501 is used to acquire multiple sample inspection images and corresponding multiple sample detection results. The sample detection results include the sample quality detection conclusion and sample severity level of the sample inspection images. The training module 502 is used to train the multimodal large model to be trained based on multiple sample inspection images and multiple sample detection results, so as to obtain the trained multimodal large model. The multimodal large model is used to perform quality detection on the input image, so that the output prediction detection result includes the prediction quality detection conclusion and the prediction severity level of the input image.
[0064] In the embodiments of this application, the specific process by which each module and unit in the training device of the model of this application implements its function can be found in the relevant description in the above-mentioned model training method embodiments, and will not be repeated here.
[0065] In summary, the training device of the model in this embodiment trains the multimodal large model to be trained based on multiple sample inspection images and multiple sample detection results, resulting in a trained multimodal large model. This multimodal large model is used for quality detection of the input image, ensuring that the output predicted detection result includes the predicted quality detection conclusion and the predicted severity level of the input image. This achieves the training of the multimodal large model, making the detection results more accurate when the trained model performs image quality detection. Through hard example mining, the high false positive problem of traditional methods in complex scenes is effectively solved. To address the issue of high similarity in frequency domain features between mosaic-like geometric textures and real coding corruption, Focal Loss (γ≥2.0) is used for targeted training and optimization, improving the ability to distinguish easily confused negative samples and avoiding false positives. To address the problem of local features such as specular reflection and complex lighting being easily misjudged, global multi-scale features of the visual encoder are introduced, combined with the scene semantic reasoning ability of the large model for joint correction, avoiding false positives.
[0066] This application also provides an electronic device. For example... Figure 6 As shown, the electronic device 600 includes: a processor 601, a memory 602, and a program or instructions stored in the memory 602 and executable on the processor 601. When the program or instructions are executed by the processor 601, they implement the steps of the image detection method as described in any of the above embodiments, or implement the steps of the model training method as described in any of the above embodiments.
[0067] The electronic device in this application performs a first-level coarse screening based on computer vision features and a second-level fine screening based on a trained multimodal large model when conducting quality inspection on multiple inspection images. This achieves funnel-style filtering of inspection images before they enter the backend analysis process, intercepting bad images and thus avoiding the waste of backend computing resources caused by bad images and the interference of a large number of false alarms with the normal alarm system. Utilizing the powerful generalization ability of the multimodal large model, it solves the problem of traditional methods struggling to identify complex coding errors such as "partial screen distortion" and "mosaic," improving the coding corruption recognition rate. A lightweight visual language model is selected as the multimodal large model, suitable for deployment on edge computing nodes, allowing for more flexible deployment. The model output is an interpretable structured output, including four-dimensional information: conclusion, type, level, and description, facilitating differentiated processing by downstream systems. The successful training of the multimodal large model results in more accurate image quality detection after training. Through hard example mining, it effectively solves the high false alarm problem of traditional methods in complex scenarios. To address the issue of high similarity in frequency domain features between mosaic-like geometric textures and genuine coding corruption, Focal Loss (γ≥2.0) is employed for targeted training and optimization, improving the ability to distinguish easily confused negative samples and avoiding false positives. To address the problem of local features such as specular reflection and complex lighting being easily misjudged, global multi-scale features from the visual encoder are introduced, combined with the scene semantic reasoning capabilities of a large model for joint correction, thus avoiding false positives.
[0068] This application also proposes a readable storage medium storing one or more computer programs, the one or more computer programs including instructions, which, when executed by a processor in an electronic device including multiple applications, enable the processor in the electronic device to perform the various steps of the above-described image detection method embodiments or model training method embodiments.
[0069] The readable storage medium of this application embodiment performs a first-level coarse screening based on computer vision features and a second-level fine screening based on a trained multimodal large model when performing quality inspection on multiple inspection images to be detected. This achieves funnel-style filtering of inspection images before they enter the back-end analysis process, intercepting bad images and thus avoiding the waste of back-end computing resources caused by bad images and the interference of a large number of false alarms with the normal alarm system. Utilizing the powerful generalization ability of the multimodal large model, it solves the problem of traditional methods struggling to identify complex coding errors such as "partial screen distortion" and "mosaic," improving the coding corruption recognition rate. A lightweight visual language model is selected as the multimodal large model, suitable for deployment on edge computing nodes, allowing for more flexible deployment. The model output is an interpretable structured output, including four-dimensional information of conclusion, type, level, and description, facilitating differentiated processing by downstream systems. The successful training of the multimodal large model makes the detection results more accurate when the trained model performs image quality inspection. Through hard example mining, it effectively solves the problem of high false alarms in complex scenarios using traditional methods. To address the issue of high similarity in frequency domain features between mosaic-like geometric textures and genuine coding corruption, Focal Loss (γ≥2.0) is employed for targeted training and optimization, improving the ability to distinguish easily confused negative samples and avoiding false positives. To address the problem of local features such as specular reflection and complex lighting being easily misjudged, global multi-scale features from the visual encoder are introduced, combined with the scene semantic reasoning capabilities of a large model for joint correction, thus avoiding false positives.
[0070] It should be understood that the training and prediction processes of the AI models involved in the various embodiments of this specification all adhere to multiple legal and compliant principles, including legal data sources, compliant data content, compliant data governance, compliant training objectives and schemes, compliant training processes, compliant training environments and tools, and compliant ethical verification of training results, and comply with the requirements of Article 5 of the Patent Law. Among them: Data source legitimacy: All datasets used for AI model training were obtained through legal means, covering three categories: publicly authorized data, data authorized by partners, and self-collected compliant data. Publicly authorized data originates from compliant data sources that comply with relevant open-source agreements, with complete copyright attribution and authorization scope clearly marked, and no unauthorized open-source code or data reuse. Data authorized by partners has been subject to formal data usage agreements, clearly defining the scope, duration, and confidentiality obligations, and possessing a complete authorization chain. For self-collected data involving personal information, strict informed consent procedures have been followed, and anonymization processes (including but not limited to field masking, feature anonymization, and differential privacy technology) have been implemented to remove personally identifiable information, fully complying with relevant laws and regulations.
[0071] Data content compliance: The AI model's dataset undergoes multiple screenings and cleaning processes to remove all non-compliant information and ensures that there is no illegal acquisition or use of genetic resources. For data in sensitive fields (such as healthcare and finance), an additional privacy-preserving computation module (including federated learning and secure multi-party computation technologies) is used to ensure that the data is "usable but not visible," avoiding compliance risks during the original data transmission process and ensuring that the data application scenarios and uses comply with public order and good morals and industry regulatory requirements.
[0072] Data governance norms: A complete data traceability system is established during the AI model training process to automatically record the source, collection time, annotation process, cleaning rules, and permission allocation of training data, generating traceable compliance reports to ensure that the data is verifiable throughout its entire lifecycle. The dataset annotation process for AI models is completed by a professional human R&D team, clearly defining the proportion of human creative contributions and avoiding reliance on AI-generated data that has not undergone substantial human modification, thus meeting the examination requirements for "human main contributions" in AI patent applications.
[0073] Training objectives and plans are compliant: The AI model training objectives focus on image quality detection, etc. The training scheme and the final output results do not violate any mandatory provisions of laws and administrative regulations, do not harm the public interest or the legitimate rights and interests of others, and do not pose any potential risks of being used for illegal activities, infringing on privacy, or undermining public safety. It strictly adheres to the ethical principle of "intelligent for good".
[0074] Training process compliance: A closed-loop training framework is adopted to ensure compliance and controllability of the training process. The specific process is as follows: First, training samples are obtained through compliant data sources. After the aforementioned data cleaning and desensitization, they are input into the neural network model to generate preliminary training results. Second, an expert system is introduced to verify the preliminary results. Based on preset rules and human expert experience, the feasibility of the results is evaluated, and outputs that may pose ethical risks or compliance hazards are corrected (such as removing decision-making logic that violates public order and good morals, and adjusting model parameters that do not comply with safety regulations). Finally, the loss function weights are dynamically optimized based on expert system feedback to strengthen the model's learning of compliant results, avoid overfitting errors or non-compliant labels, and form a closed-loop control of "data input - model training - expert verification - parameter optimization - result feedback" to ensure that the entire training process complies with the ethical review requirements of relevant laws.
[0075] Training environment and tool compliance: AI model training is implemented using nationally licensed chips and a compliant training platform. All open-source frameworks and components used in the training process have obtained their corresponding licenses, and copyright statements and patent citation information are fully retained, with no instances of infringement or reuse. The training environment is built using virtual devices (containers / virtual machines) with fixed random seeds and initial parameter configurations to ensure the reproducibility of the training process. Furthermore, through access control and operation log recording, risks such as data leakage and parameter tampering during training are prevented, ensuring the security and compliance of the training process.
[0076] Training results ethical verification compliance: After the model is trained, it undergoes additional third-party ethical compliance assessment and algorithm filing review to verify that the model output does not violate social morality or harm public interests. For potentially sensitive scenarios, a dedicated result verification mechanism is established to ensure that the model always complies with relevant laws and regulations in practical applications.
[0077] In summary, the data and training process used in the AI model in this specification strictly comply with relevant regulations and do not violate any laws, social ethics, public interests, or regulations on the use of genetic resources. Therefore, it fully meets the compliance requirements for patent authorization.
[0078] The systems, devices, modules, or units described in the above embodiments can be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, a computer can be, for example, a personal computer, laptop computer, cellular phone, camera phone, smartphone, personal digital assistant, media player, navigation device, email device, game console, tablet computer, wearable device, or any combination of these devices.
[0079] For ease of description, the above devices are described separately by function as various units. Of course, in implementing this application, the functions of each unit can be implemented in one or more software and / or hardware.
[0080] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0081] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0082] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0083] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0084] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0085] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0086] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0087] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0088] This application can be described in the general context of computer-executable instructions, such as program modules, that are executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform a specific task or implement a specific abstract data type. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0089] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to interchangeably. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.
[0090] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. An image detection method, characterized in that, include: Acquire multiple inspection images to be inspected; The multiple inspection images are screened for quality based on computer vision features to obtain candidate inspection images that pass the screening. Each of the candidate inspection images is input into the trained multimodal large model for quality detection, and the detection results output by the multimodal large model are obtained. The detection results include the quality detection conclusion and severity level of the candidate inspection image. Based on the detection results of each candidate inspection image, the target inspection image that passes the quality detection is determined.
2. The method according to claim 1, characterized in that, The process of quality screening of the multiple inspection images based on computer vision features to obtain candidate inspection images that pass the screening includes: The multiple inspection images are subjected to at least one of the following screening methods: solid color screening, vertical ghosting screening, and frequency domain noise and exposure anomaly screening, to obtain the candidate inspection images that pass the screening.
3. The method according to claim 2, characterized in that, Performing the solid color filtering on the multiple inspection images includes: For any of the inspection images, calculate the pixel variance and dominant color proportion of the entire region and / or each segment of the inspection image; If the pixel variance is less than a preset pixel variance threshold and the average proportion of the main color tone is within the target color space, the inspection image is determined to have failed the screening.
4. The method according to claim 2, characterized in that, The vertical trailing image filtering process for the multiple inspection images includes: For any of the inspection images, calculate each vertical gradient and each horizontal gradient of the inspection image; Calculate the difference between the sum of the horizontal gradients and the sum of the vertical gradients; If the difference is greater than a preset difference threshold and each of the vertical gradients satisfies a preset column pixel continuity condition, the inspection image is determined to have failed the screening.
5. The method according to claim 2, characterized in that, The frequency domain noise and exposure anomaly screening of the multiple inspection images includes at least one of the following steps: If the proportion of dark areas in the inspected image is greater than a preset threshold for the proportion of dark areas, the inspected image is determined to have failed the screening. The dark areas are regions where the brightness is lower than a preset lower limit for brightness. If the proportion of the highlighted area in the inspection image is greater than a preset threshold for the proportion of the highlighted area, and the pixel variance of the inspection image is lower than a preset threshold for the pixel variance, then the inspection image is determined to have failed the screening. The highlighted area is the region whose brightness is higher than a preset upper limit value for brightness. If the brightness of the inspected image is lower than a preset brightness threshold and the signal frequency of the inspected image is greater than a preset frequency threshold, the inspected image is determined to have failed the screening.
6. The method according to claim 1, characterized in that, The multimodal large model is a visual language model. The step of inputting each candidate inspection image into the trained multimodal large model for quality detection includes: Obtain a preset prompt word template, wherein the prompt word template includes a preset output format for the detection result; The candidate inspection images and the prompt word templates are input into the multimodal large model for quality detection.
7. A method for training a model, characterized in that, include: Multiple sample inspection images and corresponding multiple sample detection results are obtained, wherein the sample detection results include the sample quality detection conclusion and sample severity level of the sample inspection images; The multimodal large model to be trained is trained based on the multiple sample inspection images and the multiple sample detection results to obtain the trained multimodal large model. The multimodal large model is used to perform quality detection on the input image, so that the output prediction detection result includes the prediction quality detection conclusion and the prediction severity level of the input image. The multimodal large model is a visual language model, and the training of the multimodal large model to be trained includes: The model parameters of the language decoder in the multimodal large model to be trained are adaptively adjusted in a low-rank manner. Freeze all model parameters in the multimodal large model to be trained except for the model parameters of the language decoder; The initial value of the rank in the model parameters of the language decoder is set to be higher than a preset first rank threshold and lower than a preset second rank threshold, and the initial value of the alpha in the model parameters of the language decoder is set to be higher than a preset alpha threshold.
8. The method according to claim 7, characterized in that, The training of the multimodal large model to be trained also includes: The initial value of the focusing parameter in the loss function of the multimodal large model to be trained is set to be equal to or greater than a preset focusing parameter threshold. The multiple sample inspection images include multiple positive sample inspection images labeled as bad images and multiple negative sample inspection images labeled as normal images; The multiple positive sample inspection images include multiple inspection images of multiple damage types, and the multiple negative sample inspection images include multiple inspection images of mosaic-like geometric textures.
9. An image detection device, characterized in that, include: The first acquisition module is used to acquire multiple inspection images to be detected; The filtering module is used to perform quality filtering on the multiple inspection images based on computer vision features to obtain candidate inspection images that pass the filtering. The detection module is used to input each of the candidate inspection images into the trained multimodal large model for quality detection, and obtain the detection results output by the multimodal large model. The detection results include the quality detection conclusion and severity level of the candidate inspection image. The determining module is used to determine the target inspection image that passes the quality inspection based on the detection results of each of the candidate inspection images.
10. An electronic device, characterized in that, It includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the method as claimed in any one of claims 1-6, or implement the steps of the method as claimed in any one of claims 7-8.
