A hierarchical visual inspection method and system based on adaptive model selection

By employing a hierarchical visual detection method with adaptive model selection, combining image feature similarity and multi-level cascaded residual regression structure, the problems of misjudgment risk and feature interference in existing technologies are solved, achieving highly stable and accurate secure detection.

CN122157086APending Publication Date: 2026-06-05SHANDONG OBEL SOFTWARE TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
SHANDONG OBEL SOFTWARE TECH CO LTD
Filing Date
2026-01-30
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

Existing deep learning models pose a risk of misjudgment in safety inspections in education and industrial manufacturing. Furthermore, general-purpose models suffer from severe feature interference in specific scenarios, leading to a decrease in recognition accuracy and failing to meet the requirement of 100% correct recognition.

Method used

A hierarchical visual detection method with adaptive model selection is adopted. Based on image feature similarity discrimination, a first recognition sub-model and a multi-layer cascaded second recognition sub-model group are selectively used for detection. The first recognition sub-model is used for images with large differences, and the second recognition sub-model group is used for layer-by-layer residual correction for similar images.

Benefits of technology

It improves the stability and consistency of detection results, reduces the risk of misjudgment, adapts to the key sample requirements of specific scenarios, reduces the amount of computation, and improves the real-time performance and deployment flexibility of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122157086A_ABST
    Figure CN122157086A_ABST
Patent Text Reader

Abstract

The application provides a hierarchical visual detection method and system based on adaptive model selection, and relates to the technical field of image detection.The method comprises the following steps: acquiring an image to be detected; constructing a visual recognition model, including a first recognition sub-model and a second recognition sub-model group; inputting the image to be detected into the visual recognition model to extract an image feature vector; calculating the similarity between the extracted image feature vector and an image feature vector in a preset image feature library, and determining whether the calculated similarity is greater than a preset similarity threshold; if yes, inputting the image feature of the image to be detected into the second recognition sub-model group to output an image recognition result; and if no, inputting the image feature of the image to be detected into the first recognition sub-model to output an image recognition result.The application realizes high-precision, stable and easy-to-deploy visual detection under the condition of a small amount of high-quality samples through an adaptive model selection and hierarchical residual correction mechanism.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image detection technology, and in particular to a hierarchical visual detection method and system based on adaptive model selection. Background Technology

[0002] With the development of artificial intelligence technology, computer vision-based target detection methods have been widely applied in education, safety production, and industrial manufacturing. In these fields, real-time or post-event monitoring of students' or workers' operations is often necessary to prevent accidents caused by improper procedures such as not wearing safety helmets or protective gloves.

[0003] In existing technologies, a common approach is to have users record videos of the operation process in the target usage scenario, extract images from the videos, manually label the targets of interest, and thus construct a training dataset. Subsequently, open-source deep learning target recognition models such as YOLO, SSD, and Faster R-CNN are used as the base models. Based on the pre-training on the open-source dataset, the model is fine-tuned by combining the data collected by the user to obtain a new recognition model, which is then deployed for actual detection.

[0004] However, the existing technical solutions still have the following shortcomings: Safety detection in teaching or safe production processes is highly constrained. Misjudgment can directly lead to teaching accidents or management risks. Existing deep learning models typically aim to minimize the overall average error during training, allowing for a small number of incorrect predictions. This fundamentally conflicts with the requirement in educational scenarios that "training data must be 100% correctly identified." Secondly, existing target recognition models are usually pre-trained on large-scale, general datasets, and the features they learn contain a large amount of information irrelevant to specific application scenarios. For example, in general datasets, safety helmets may appear in various colors and shapes, while in specific scenarios, the color, shape, and wearing method of safety helmets are highly consistent. General models are prone to introducing unnecessary feature interference during transfer learning, thereby reducing the accuracy of recognition based on user training data. Summary of the Invention

[0005] To overcome the above shortcomings, this application provides a hierarchical visual detection method and system based on adaptive model selection.

[0006] Firstly, this application provides a hierarchical visual detection method based on adaptive model selection, employing the following technical solution: A hierarchical visual detection method based on adaptive model selection, the method comprising: Data acquisition: Acquire the video to be tested and extract the image to be tested from the video to be tested; Model Construction: Construct a visual recognition model, which includes a first recognition sub-model and a group of second recognition sub-models; Model recognition includes feature recognition and image recognition; Feature recognition: Input the image to be detected into the visual recognition model to extract the image feature vector of the image to be detected; Image recognition: Calculate the similarity between the image feature vector of the image to be detected and the image feature vectors in the image feature library, and determine whether the calculated similarity is greater than a preset similarity threshold. If so, the image features of the image to be detected are input into the second recognition sub-model group, and the image recognition result is output. If not, the image features of the image to be detected are input into the first recognition sub-model, and the image recognition result is output.

[0007] Optionally, the second identification sub-model group includes several layers of second identification sub-models.

[0008] Optionally, after performing the model building step and before performing the model recognition step, the following steps are also included: First model training: Acquire historical detection videos, obtain historical detection images and corresponding detection results from the historical detection videos, label the historical detection images based on the detection results, construct a sample training set based on the labeled historical detection images, define a first loss function, input the sample training set into the first recognition sub-model for iterative training, calculate the model loss of the first recognition sub-model according to the first loss function during iterative training, update the model gradient of the first recognition sub-model based on the calculated model loss, and use the gradient descent algorithm to iteratively optimize the model parameters of the first recognition sub-model to obtain the trained first recognition sub-model, and record the trained first recognition sub-model as the new first recognition sub-model.

[0009] Optionally, the first loss function is: ; in, This indicates the number of historically detected images in the training set. Indicates the first The true label value of a historical detected image. Indicates the first Predicted values ​​for historical detected images.

[0010] Optionally, after performing the model building step and before performing the model recognition step, the following steps are also included: Second model training: includes first training and layer-by-layer training; First training: acquire historical detection videos, acquire historical detection images and corresponding detection results from historical detection videos, annotate historical detection images based on detection results, construct a sample training set based on annotated historical detection images, define a second loss function, input the sample training set into the second recognition sub-model of the first layer for training, output the first prediction result, calculate the residual between the first prediction result and the sample training set, and construct the residual sample set of the second recognition sub-model of the current layer. Layer-by-layer training: The residual sample set of the second recognition sub-model of the previous layer is used as the training target and input into the second recognition sub-model of the next layer for training. The prediction result of the current layer is output, and the residual between the prediction result of the current layer and the residual sample set of the previous layer is calculated. The residual sample set of the current layer is constructed. The above steps are repeated to train the second recognition sub-model of the next layer in turn until the calculated residual is less than the preset residual threshold. The training is completed, and the trained multi-layer second recognition sub-model is used as a new group of second recognition sub-models.

[0011] Optionally, the second loss function is: ; in, This indicates the number of historically detected images in the training set. Indicates the first The true label value of a historical detected image. This indicates that the first layer second recognition sub-model is related to the first... Predicted values ​​for historical detected images, Indicates the layer number of the second identification sub-model group. Indicates the first The second identification sub-model of the layer is for the first The predicted residual values ​​of a historical detection image.

[0012] Optionally, the steps for obtaining the image feature library are as follows: obtaining historical detection videos, obtaining historical detection images from the historical detection videos, extracting image feature vectors from each historical detection image, and constructing an image feature library.

[0013] Optionally, the image recognition steps include: Calculate the similarity between the image feature vector of the image to be detected and each image feature vector in the image feature library. Sort all the calculated similarities in descending order, select the first-ranked similarity as the target similarity, and determine whether the target similarity is greater than a preset similarity threshold. If so, the image features of the image to be detected are input into the second recognition sub-model group, and the image recognition result is output. If not, the image features of the image to be detected are input into the first recognition sub-model, and the image recognition result is output.

[0014] Optionally, the image features of the image to be detected are input into the second recognition sub-model group, and the image recognition result is output, specifically including: The image features of the image to be detected are input into the second recognition sub-model group. The first-layer second recognition sub-model outputs an initial detection result based on the image features of the image to be detected. The image features of the image to be detected and the initial detection result are input into the second-layer second recognition sub-model. The second-layer second recognition sub-model outputs the corresponding residual correction amount. The initial detection result of the first layer is corrected based on the residual correction amount of the second layer to obtain the detection result of the second-layer second recognition sub-model. The image features of the image to be detected and the detection result of the previous layer second recognition sub-model are input into the next layer second recognition sub-model in sequence, and the corresponding residual correction amount is output. The detection result of the previous layer is corrected based on the output residual correction amount. The above steps are repeated until the correction of all the second recognition sub-models in the second recognition sub-model group is completed, and the final detection result is output. The final detection result is used as the image recognition result.

[0015] Secondly, this application provides a hierarchical visual detection system based on adaptive model selection, the system being applicable to the method described in any one of the first aspects above, the system comprising: The data acquisition module is used to acquire the video to be detected and to extract the image to be detected from the video. A model building module is used to build a visual recognition model, wherein the visual recognition model includes a first recognition sub-model and a second recognition sub-model group; The model recognition module communicates with the data acquisition module and the model construction module, and includes a feature recognition unit and an image recognition unit. The feature recognition unit is used to input the image to be detected into the visual recognition model and extract the image feature vector of the image to be detected. The image recognition unit is used to calculate the similarity between the image feature vector of the image to be detected and the image feature vector in the preset image feature library, and to determine whether the calculated similarity is greater than the preset similarity threshold. If the calculated similarity is greater than the preset similarity threshold, the image features of the image to be detected are input into the second recognition sub-model group, and the image recognition result is output. If the calculated similarity is not greater than the preset similarity threshold, the image features of the image to be detected are input into the first recognition sub-model, and the image recognition result is output.

[0016] In summary, this application includes at least one of the following beneficial technical effects: 1. This application introduces an adaptive model selection mechanism based on image feature similarity, using the similarity between the image to be detected and the training samples in the feature space as the basis for model selection. This allows for the simultaneous integration of a first recognition sub-model and a second recognition sub-model group within the same detection process. For images highly similar to the training samples, the second recognition sub-model group, based on residual layer-by-layer correction, is preferentially used for detection. This ensures the model closely matches the training data distribution, achieving near-zero tolerance for key samples in specific scenarios. Conversely, for images significantly different from the training samples, the first recognition sub-model is used to avoid misjudgment risks caused by overfitting. Based on this setup, without sacrificing the accuracy of training sample detection, the model's adaptability to non-training samples is effectively balanced, solving the technical problem of "high overall accuracy but uncontrollable key samples" in existing technologies.

[0017] 2. This application sets up a second recognition sub-model group with a multi-layered cascaded residual regression structure. Each layer of the second recognition sub-model does not directly repeat the complete detection task; instead, it outputs the corresponding residual correction amount based on the detection results of the previous layer, performing layer-by-layer correction on the detection results. This transforms the detection process from a "one-time prediction" to a progressive optimization process of "layer-by-layer approximation," significantly reducing the error accumulation problem caused by feature shifts, pose changes, or local occlusion in complex scenes when using a single model. Simultaneously, since each layer only needs to learn local residual relationships, the model structure is simpler, the training process is more stable, and it avoids the convergence difficulties that easily occur when deep models directly learn complex mapping relationships. Through this layered residual correction mechanism, the detection results gradually approach the true annotations after multi-layer correction, improving the stability and consistency of the overall detection results. This is particularly suitable for educational and industrial scenarios where the reliability of detection results is highly critical.

[0018] 3. This application combines a shallow recognition model with a residual regression model, enabling the system to fully utilize the user's limited, high-quality training data for model construction and optimization. Furthermore, the second recognition sub-model group employs a layer-by-layer training and residual fitting strategy, gradually approaching the ideal detection effect under limited data conditions, reducing reliance on large-scale labeled data and high-computing-power training environments. Simultaneously, the model selection mechanism based on image feature similarity eliminates the need to process all data using a uniformly high-complexity model during actual operation, thereby reducing inference computation and improving system real-time performance and deployment flexibility. This technical solution is particularly suitable for educational and industrial applications where camera positions are fixed, detection targets are clear, and scene changes are controllable, demonstrating good engineering feasibility and promotional value. Attached Figure Description

[0019] Figure 1 This is a flowchart of Embodiment 1 of this application; Figure 2 This is a flowchart of the S3 model training in Embodiment 1 of this application; Figure 3 This is a flowchart of S32, the second model training, in Embodiment 1 of this application. Figure 4 This is a flowchart of the S4 model recognition in Embodiment 1 of this application. Detailed Implementation

[0020] The following combination Figures 1 to 2 This application will be described in further detail.

[0021] Example 1: This example discloses a hierarchical visual detection method based on adaptive model selection, such as... Figure 1 As shown, the method includes: acquiring an image to be detected; constructing a visual recognition model, including a first recognition sub-model and a second recognition sub-model group; inputting the image to be detected into the visual recognition model to extract image feature vectors; calculating the similarity between the extracted image feature vectors and image feature vectors in a preset image feature library, and determining whether the calculated similarity is greater than a preset similarity threshold: if yes, then inputting the image features of the image to be detected into the second recognition sub-model group and outputting the image recognition result; if no, then inputting the image features of the image to be detected into the first recognition sub-model and outputting the image recognition result. This embodiment includes the following steps: S1 Data Acquisition: Acquire the video to be detected and extract the image to be detected from the video. Specifically, acquire the video to be detected, extract video frames, generate a sequence of images to be detected, perform image preprocessing on the sequence of images to be detected, and obtain the image to be detected.

[0022] In this embodiment, image preprocessing includes data cleaning, data augmentation, data normalization, and size unification. Data cleaning includes removing duplicate frames, blurry images, or abnormal images. Data augmentation includes operations such as rotating, scaling, cropping, adjusting brightness or contrast, flipping, and adding noise to the image. Data normalization includes standardizing the image pixel values ​​to the range of [0,1] or [-1,1]. Size unification includes scaling or cropping the image to ensure that all images are of the same size when input into the model.

[0023] S2 Model Construction: A visual recognition model is constructed, comprising a first recognition sub-model and a group of second recognition sub-models. The first recognition sub-model includes a feature enhancement layer, a feature fusion layer, and a feature output layer. The second recognition sub-model group comprises several layers of second recognition sub-models, each of which is a regression model. In this embodiment, a convolutional neural network is used as the basic network architecture to construct the first recognition sub-model.

[0024] S3 model training consists of S31 first model training and S32 second model training. S32 second model training includes S321 first training and S322 layer-by-layer training, such as... Figure 2 and Figure 3 As shown.

[0025] S31 First Model Training: Historical detection videos are acquired, and historical detection images and corresponding detection results are obtained from these videos. The historical detection images are then labeled based on the detection results, and a sample training set is constructed based on these labeled historical detection images. This sample training set is input into the first recognition sub-model for iterative training. During training, the feature enhancement layer performs multi-scale feature extraction and feature enhancement processing on the input historical detection images to obtain enhanced features for the sample training set. The feature fusion layer fuses the obtained enhanced features to generate fused features, which are then output through the feature output layer to output the current prediction result. A first loss function is defined, and the model loss of the first recognition sub-model is calculated based on the difference between the output prediction result and the corresponding detection result in the sample training set. Based on the model loss, the model gradient of the first recognition sub-model is calculated using the backpropagation algorithm, and the model parameters in the feature enhancement layer, feature fusion layer, and feature output layer are iteratively updated using the gradient descent algorithm until the preset training conditions are met, resulting in a trained first recognition sub-model, denoted as the new first recognition sub-model.

[0026] The first loss function is: ; in, This indicates the number of historically detected images in the training set. Indicates the first The true label value of a historical detected image. Indicates the first Predicted values ​​for historical detected images.

[0027] S321 First Training: Acquire historical detection videos, obtain historical detection images and corresponding detection results from the historical detection videos, annotate the historical detection images based on the detection results, construct a sample training set based on the annotated historical detection images, define a second loss function, input the sample training set into the second recognition sub-model of the first layer for training, output the first prediction result, calculate the residual between the first prediction result and the sample training set, and construct the residual sample set of the second recognition sub-model of the current layer.

[0028] The second loss function is: ; in, The number of historical detection images in the sample training set. Indicates the first The true label value of a historical detected image. This indicates that the first layer second recognition sub-model is related to the first... Predicted values ​​for historical detected images, Indicates the layer number of the second identification sub-model group. Indicates the first The second identification sub-model of the layer is for the first The predicted residual values ​​of a historical detection image.

[0029] S322 Layer-by-Layer Training: The residual sample set of the second recognition sub-model of the previous layer is used as the training target and input into the second recognition sub-model of the next layer for training. The prediction result of the current layer is output, and the residual between the prediction result of the current layer and the residual sample set of the previous layer is calculated. The residual sample set of the current layer is constructed. The above steps are repeated to train the second recognition sub-model of the next layer in turn until the calculated residual is less than the preset residual threshold. The training is completed, and the multi-layer second recognition sub-model after training is used as a new group of second recognition sub-models.

[0030] S4 model recognition: includes S41 feature recognition and S42 image recognition, such as Figure 4 As shown.

[0031] S41 Feature Recognition: Input the image to be detected into the visual recognition model and extract the image feature vector of the image to be detected.

[0032] S42 Image Recognition: This process involves acquiring historical detection videos, extracting historical detection images from these videos, and extracting image feature vectors from each historical detection image to construct an image feature library. A similarity calculation method (such as cosine similarity or Euclidean distance) is used to calculate the similarity between the image feature vector of the image to be detected and each image feature vector in the image feature library. All calculated similarities are sorted in descending order, and the highest-ranked similarity is selected as the target similarity. Finally, it is determined whether the target similarity exceeds a preset similarity threshold. If the target similarity is greater than a preset similarity threshold, the image features of the image to be detected are input into the second recognition sub-model group, and the image recognition result is output. Specifically, after the image features of the image to be detected are input into the second recognition sub-model group, the first-layer second recognition sub-model outputs an initial detection result based on the image features of the image to be detected. The image features of the image to be detected and the initial detection result are input into the second-layer second recognition sub-model. The second-layer second recognition sub-model outputs the corresponding residual correction amount. Based on the residual correction amount of the second layer, the initial detection result of the first layer is corrected to obtain the detection result of the second-layer second recognition sub-model. The image features of the image to be detected and the detection result of the previous layer second recognition sub-model are input into the next layer second recognition sub-model in sequence, and the corresponding residual correction amount is output. Based on the output residual correction amount, the detection result of the previous layer is corrected. The above steps are repeated until the residual correction of all layers in the second recognition sub-model group is completed, and the final detection result is obtained. The final detection result is output as the image recognition result.

[0033] If the target similarity is not greater than the preset similarity threshold, the image features of the image to be detected are input into the first recognition sub-model, and the image recognition result is output.

[0034] In this embodiment, the historical detection images used to construct the image feature library in image recognition (S42) are completely identical to the historical detection images used to construct the sample training set in the first training (S321) and the historical detection images used to construct the sample training set in the first model training (S31), that is... .

[0035] Example 2: This example discloses a hierarchical visual inspection system based on adaptive model selection. The system is applicable to the method described in Example 1, and the system includes: The data acquisition module is used to acquire the video to be tested and to extract the image to be tested from the video.

[0036] A model building module is used to build a visual recognition model, which includes a first recognition sub-model and a second recognition sub-model group.

[0037] The model recognition module communicates with the data acquisition module and the model construction module, and includes a feature recognition unit and an image recognition unit.

[0038] The feature recognition unit is used to input the image to be detected into the visual recognition model and extract the image feature vector of the image to be detected.

[0039] The image recognition unit is used to calculate the similarity between the image feature vector of the image to be detected and the image feature vector in the preset image feature library, and to determine whether the calculated similarity is greater than the preset similarity threshold. If the calculated similarity is greater than the preset similarity threshold, the image features of the image to be detected are input into the second recognition sub-model group, and the image recognition result is output. If the calculated similarity is not greater than the preset similarity threshold, the image features of the image to be detected are input into the first recognition sub-model, and the image recognition result is output.

[0040] This application introduces an adaptive model selection mechanism based on image feature similarity, using the similarity between the image to be detected and the training samples in the feature space as the basis for model selection. This allows for the simultaneous integration of a first recognition sub-model and a second recognition sub-model group within the same detection process. For images highly similar to the training samples, the second recognition sub-model group, based on residual layer-by-layer correction, is preferentially used for detection. This ensures the model closely matches the training data distribution, achieving near-zero tolerance for key samples in teaching scenarios. Conversely, for images significantly different from the training samples, the first recognition sub-model is used to avoid misjudgment risks caused by overfitting. Based on this setup, without sacrificing the accuracy of training sample detection, the model's adaptability to non-training samples is effectively balanced, solving the technical problem of "high overall accuracy but uncontrollable key samples" in existing technologies.

[0041] The above are all preferred embodiments of this application, and are not intended to limit the scope of protection of this application. Therefore, all equivalent changes made in accordance with the structure, shape and principle of this application should be covered within the scope of protection of this application.

Claims

1. A hierarchical visual detection method based on adaptive model selection, characterized in that, The method includes: Data acquisition: Acquire the video to be tested and extract the image to be tested from the video to be tested; Model Construction: Construct a visual recognition model, which includes a first recognition sub-model and a group of second recognition sub-models; Model recognition includes feature recognition and image recognition; Feature recognition: Input the image to be detected into the visual recognition model to extract the image feature vector of the image to be detected; Image recognition: Calculate the similarity between the image feature vector of the image to be detected and the image feature vectors in the image feature library, and determine whether the calculated similarity is greater than a preset similarity threshold. If so, the image features of the image to be detected are input into the second recognition sub-model group, and the image recognition result is output. If not, the image features of the image to be detected are input into the first recognition sub-model, and the image recognition result is output.

2. The hierarchical visual detection method based on adaptive model selection according to claim 1, characterized in that, The second identification sub-model group includes several layers of second identification sub-models.

3. The hierarchical visual detection method based on adaptive model selection according to claim 1, characterized in that, After performing the model building step and before performing the model recognition step, the following steps are also included: First model training: Acquire historical detection videos, obtain historical detection images and corresponding detection results from the historical detection videos, label the historical detection images based on the detection results, construct a sample training set based on the labeled historical detection images, define a first loss function, input the sample training set into the first recognition sub-model for iterative training, calculate the model loss of the first recognition sub-model according to the first loss function during iterative training, update the model gradient of the first recognition sub-model based on the calculated model loss, and use the gradient descent algorithm to iteratively optimize the model parameters of the first recognition sub-model to obtain the trained first recognition sub-model, and record the trained first recognition sub-model as the new first recognition sub-model.

4. The hierarchical visual detection method based on adaptive model selection according to claim 3, characterized in that, The first loss function is: ; in, This indicates the number of historically detected images in the training set. Indicates the first The true label value of a historical detected image. Indicates the first Predicted values ​​for historical detected images.

5. The hierarchical visual detection method based on adaptive model selection according to claim 2, characterized in that, After performing the model building step and before performing the model recognition step, the following steps are also included: Second model training: includes first training and layer-by-layer training; First training: acquire historical detection videos, acquire historical detection images and corresponding detection results from historical detection videos, annotate historical detection images based on detection results, construct a sample training set based on annotated historical detection images, define a second loss function, input the sample training set into the second recognition sub-model of the first layer for training, output the first prediction result, calculate the residual between the first prediction result and the sample training set, and construct the residual sample set of the second recognition sub-model of the current layer. Layer-by-layer training: The residual sample set of the second recognition sub-model of the previous layer is used as the training target and input into the second recognition sub-model of the next layer for training. The prediction result of the current layer is output, and the residual between the prediction result of the current layer and the residual sample set of the previous layer is calculated. The residual sample set of the current layer is constructed. The above steps are repeated to train the second recognition sub-model of the next layer in turn until the calculated residual is less than the preset residual threshold. The training is completed, and the trained multi-layer second recognition sub-model is used as a new group of second recognition sub-models.

6. The hierarchical visual detection method based on adaptive model selection according to claim 5, characterized in that, The second loss function is: ; in, The number of historical detection images in the sample training set. Indicates the first The true label value of a historical detected image. This indicates that the first layer second recognition sub-model is related to the first... Predicted values ​​for historical detected images, Indicates the layer number of the second identification sub-model group. Indicates the first The second identification sub-model of the layer is for the first The predicted residual values ​​of a historical detection image.

7. The hierarchical visual detection method based on adaptive model selection according to claim 1, characterized in that, The steps for obtaining the image feature library are as follows: obtain historical detection videos, obtain historical detection images from the historical detection videos, extract image feature vectors from each historical detection image, and construct the image feature library.

8. The hierarchical visual detection method based on adaptive model selection according to claim 1, characterized in that, The image recognition steps include: Calculate the similarity between the image feature vector of the image to be detected and each image feature vector in the image feature library. Sort all the calculated similarities in descending order, select the first-ranked similarity as the target similarity, and determine whether the target similarity is greater than a preset similarity threshold. If so, the image features of the image to be detected are input into the second recognition sub-model group, and the image recognition result is output. If not, the image features of the image to be detected are input into the first recognition sub-model, and the image recognition result is output.

9. The hierarchical visual detection method based on adaptive model selection according to claim 2, characterized in that, The image features of the image to be detected are input into the second recognition sub-model group, and the image recognition result is output, specifically including: The image features of the image to be detected are input into the second recognition sub-model group. The first-layer second recognition sub-model outputs an initial detection result based on the image features of the image to be detected. The image features of the image to be detected and the initial detection result are input into the second-layer second recognition sub-model. The second-layer second recognition sub-model outputs the corresponding residual correction amount. The initial detection result of the first layer is corrected based on the residual correction amount of the second layer to obtain the detection result of the second-layer second recognition sub-model. The image features of the image to be detected and the detection result of the previous layer second recognition sub-model are input into the next layer second recognition sub-model in sequence, and the corresponding residual correction amount is output. The detection result of the previous layer is corrected based on the output residual correction amount. The above steps are repeated until the correction of all the second recognition sub-models in the second recognition sub-model group is completed, and the final detection result is output. The final detection result is used as the image recognition result.

10. A hierarchical visual inspection system based on adaptive model selection, characterized in that, The system is applicable to the method as described in any one of claims 1-9, the system comprising: The data acquisition module is used to acquire the video to be detected and to extract the image to be detected from the video. A model building module is used to build a visual recognition model, wherein the visual recognition model includes a first recognition sub-model and a second recognition sub-model group; The model recognition module communicates with the data acquisition module and the model construction module, and includes a feature recognition unit and an image recognition unit. The feature recognition unit is used to input the image to be detected into the visual recognition model and extract the image feature vector of the image to be detected. The image recognition unit is used to calculate the similarity between the image feature vector of the image to be detected and the image feature vector in the preset image feature library, and to determine whether the calculated similarity is greater than the preset similarity threshold. If the calculated similarity is greater than the preset similarity threshold, the image features of the image to be detected are input into the second recognition sub-model group, and the image recognition result is output. If the calculated similarity is not greater than the preset similarity threshold, the image features of the image to be detected are input into the first recognition sub-model, and the image recognition result is output.