Machine vision detection method and system based on feature calibration
Through the machine vision detection method based on feature calibration, the lighting adaptation algorithm and multi-scale convolutional neural network are used to dynamically adjust the detection strategy, and the detection accuracy problem caused by environmental changes in the existing technology is solved, and the detection accuracy is realized in a changing environment. Efficient image processing and feature extraction improve the flexibility and accuracy of the detection system.
Patent Information
- Application Number
- CN202411245740.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-06
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2044-09-06
AI Technical Summary
Existing machine vision systems are difficult to maintain detection accuracy and response speed in variable environments, especially when light, background and target object characteristics change rapidly, lack flexible environmental adaptability and real-time data processing capabilities, resulting in a decrease in detection accuracy.
Using machine vision detection method based on feature calibration, the preset lighting adaptation algorithm and multi-scale convolutional neural network can dynamically acquire and process image sequences, adjust detection strategies in real time, and use environmental data to optimize detection accuracy and response speed, and use features to Enhancement and post-processing ensure the accuracy of the detection results.
It significantly improves the detection accuracy and response speed under variable environmental conditions, ensures that the image quality is always maintained in the optimal state, and improves the ability to recognize objects and the stability of detection results in complex scenes.
Smart Images

Figure CN118762243B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of machine vision technology, and in particular to a machine vision detection method and system based on feature calibration. Background Art
[0002] Machine vision technology plays a vital role in modern industrial applications, security monitoring and autonomous driving assistance systems. Machine vision systems capture images through cameras and then process these images through algorithms to identify, classify or measure objects. However, existing machine vision systems often face the dual challenges of how to maintain detection accuracy and response speed in changing environments, especially when the lighting, background and target object features change rapidly. Traditional visual inspection systems often find it difficult to accurately and quickly process and adapt to these changes. In addition, most systems require significant computing resources and time when processing high-resolution images or performing multi-scale feature analysis, which limits their scope of application and efficiency.
[0003] In view of the limitations of the prior art, the present invention aims to solve the problems of machine vision detection accuracy and response speed in multiple environments. Most of the current visual detection systems lack flexible environmental adaptability and real-time data processing capabilities, and are unable to effectively and dynamically adjust detection strategies to cope with environmental changes. For example, these systems often cannot adjust the parameters or processing strategies of the camera equipment according to real-time environmental data (such as changes in light intensity), resulting in a decrease in detection accuracy when encountering changes in lighting in actual applications. In addition, feature extraction and classification in the prior art are usually performed under fixed settings and lack the ability to dynamically respond to feature changes, which is particularly poor when dealing with scenes with complex backgrounds or changing features.
[0004] Therefore, developing a machine vision inspection system that can adapt to environmental changes in real time, dynamically adjust detection strategies, and efficiently process multi-scale image features is crucial to improving the performance and reliability of industrial automation, safety monitoring, and autonomous driving assistance systems. Summary of the invention
[0005] Based on the above objectives, the present invention provides a machine vision detection method and system based on feature calibration.
[0006] The machine vision detection method based on feature calibration includes the following steps:
[0007] S1: Use the preset illumination adaptation algorithm to control the camera device and dynamically obtain a continuous image sequence of the detected object under different focal lengths and illumination conditions;
[0008] S2: Scale the image sequence obtained by S1 to generate a multi-resolution image pyramid to meet the multi-level feature extraction requirements from micro to macro;
[0009] S3: Extract features from each image pyramid level in S2 through a preset multi-scale convolutional neural network, and highlight the significance of the extracted features through feature enhancement technology;
[0010] S4: perform real-time calibration on the features extracted and enhanced in S3, and identify the category and changes of the features by comparing them with the preset dynamic feature template library;
[0011] S5: Based on the feature calibration results of S4 and real-time environmental data, an adaptive decision algorithm is used to adjust the detection strategy to optimize the detection accuracy and response speed;
[0012] S6: Post-process the preliminary test results obtained in S5, including result smoothing and error correction, and finally output an accurate test report.
[0013] Furthermore, the S1 specifically includes:
[0014] S11: Deploy a highly sensitive ambient light sensor to monitor the light intensity and type of the detected area in real time. The light sensor can distinguish between natural light and artificial light, and can also measure the specific value of light intensity. The data is transmitted to the central control unit in real time;
[0015] S12: The central control unit receives the light intensity and type from S11 and calculates the optimal focal length and aperture settings through a preset light adaptation algorithm. The specific calculation formula is:
[0016] and ;in, represents the calculated optimal focal length; is the base focal length; is the focal length adjustment factor; is the change in light intensity; Indicates the calculated optimal aperture size; is the base aperture size; is the aperture adjustment factor; is the standard light intensity; is the light intensity of the current environment;
[0017] S13: automatically adjusting the lens of the camera device according to the focal length and aperture settings obtained from S12, specifically using an electric drive mechanism to accurately adjust the focal length and aperture of the lens according to the instructions of the central control unit to adapt to different image acquisition requirements;
[0018] S14: After completing the adjustment of the lens, the camera device will start to continuously collect image sequences.
[0019] Furthermore, the S2 specifically includes:
[0020] S21: receiving the original image sequence data from S1;
[0021] S22: applying an image scaling algorithm to process each frame of the image, gradually reducing the image resolution, and generating a multi-level image pyramid;
[0022] S23: Standardize each level of the image pyramid to ensure that the visual features of objects remain consistent in images at different levels.
[0023] Furthermore, the S22 specifically includes:
[0024] S221: Selecting bicubic interpolation as an image scale transformation algorithm to downsample the image. Bicubic interpolation is a technology that can keep the image edge smooth when the image is scaled.
[0025] S222: Apply the bicubic interpolation algorithm to downsample each frame of the image received in S21. First, determine the resolution of each level of the image pyramid. Specifically, each time a level is reduced, the resolution of the image is reduced to half of the previous level. The calculation formula for downsampling is:
[0026] ,in, Indicates Level image at coordinates The pixel value of Indicates Level image at coordinates The pixel value of is the weight calculated according to the bicubic function;
[0027] S223: Repeat S222 until a predetermined number of pyramid layers is reached, wherein the image of each layer is obtained by bicubic interpolation downsampling based on the image of the previous layer, thereby gradually forming an image hierarchy from high resolution to low resolution.
[0028] Furthermore, the S3 specifically includes:
[0029] S31: Deploy a preset multi-scale convolutional neural network, which includes multiple parallel convolutional layers, each layer is used to process images of different resolutions, ensuring that the network can capture image features from coarse to fine;
[0030] S32: Use independent convolutional layers for feature extraction for each level of the image pyramid, where each convolutional layer is configured with convolution kernels of different sizes;
[0031] S33: Apply nonlinear activation functions and normalization layers to enhance the extracted features. Specifically, batch normalization and ReLU activation functions are used to enhance the saliency and discrimination of the features.
[0032] S34: The features extracted and enhanced at each layer are fused, and a feature fusion technique based on a feature pyramid network is used to integrate the information at each resolution level to generate a comprehensive feature map.
[0033] Furthermore, the S34 specifically includes:
[0034] S341: receiving feature maps of each image pyramid level processed by a convolutional neural network from S33, wherein each map represents image features at different resolution levels;
[0035] S342: Using convolution and upsampling, for each layer, the following operations are performed: ,in, It is The feature map of the layer, is the feature map of the next layer, is an upsampling function used to increase the resolution of the feature map to the resolution of the previous layer, is the fused feature map;
[0036] S343: Convolution processing is performed on the fused feature map obtained in S342 to enhance the details and significance of the features. The operation formula for each layer is: ,in, Represents the convolution operation, which is used to enhance and refine features. is the enhanced feature map;
[0037] S344: Integrate the feature maps of each layer processed in S343 into a comprehensive feature map, which includes all visual feature information from the highest to the lowest resolution.
[0038] Furthermore, the S4 specifically includes:
[0039] S41: receiving a comprehensive feature map from S34, which integrates multi-scale features from different image levels;
[0040] S42: Apply the support vector machine algorithm to perform real-time calibration on the comprehensive feature map received by S41. The support vector machine model is trained to recognize and classify various visual features, which is achieved through the following calculation process:
[0041] ,in, is the comprehensive feature map, are the training parameters of the support vector machine model, is the classification result, indicating the feature category corresponding to the feature map, The function is used to perform the classification operation of the support vector machine algorithm;
[0042] S43: Dynamically update the feature template library according to the classification result in S42, by checking the matching degree between the classification result and the existing template, and deciding whether to introduce a new template or update the existing template according to the change of the classification result. The update formula is:
[0043] ,in, is the current feature template library, is the classification result, is the comprehensive feature map, It is the updated template library; The function is used to update the feature template library according to the new classification results;
[0044] S44: Use the feature template library updated in S43 to compare with the calibration result in S42 to identify and confirm the specific category of the feature to ensure accurate identification and adaptation to changes in the environment or target object. The specific formula is: ,in, is the classification result, is the updated feature template library, Indicates the identified feature category; The function is used to confirm and refine the accuracy of the classification results based on the updated feature template library.
[0045] Furthermore, the S5 specifically includes:
[0046] S51: First, collect environmental data in real time, including light intensity, temperature, and humidity, to reflect the state of the current detection environment;
[0047] S52: Based on the collected environmental data and the feature calibration results obtained in S4, an adaptive decision algorithm is applied to optimize the detection strategy. Specifically, a decision tree model is used to dynamically adjust the detection parameters by combining real-time environmental data and visual feature data through the following formula:
[0048] ,in, are the adjusted detection parameters, including the threshold and sensitivity of image processing; is the classification result; is the real-time environmental data collected from S51; and is a model parameter used to balance the impact of environmental data and feature categories on detection parameters; It is a preset function used to adjust the threshold of image processing according to environmental data; It is also a preset function used to adjust the sensitivity of detection by combining feature categories and environmental data;
[0049] S53: The adjusted detection parameters calculated according to S52 Make adjustments, including adjusting the image acquisition frequency and the parameters of the image processing algorithm to adapt to the current environment and the characteristics of the target object.
[0050] Furthermore, the S6 specifically includes:
[0051] S61: Apply a result smoothing algorithm to the detection result obtained in S5 to reduce noise and fluctuations in the detection process. Specifically, a moving average filter is used to smooth the result. The specific calculation formula is: ,in, It's at the time The original test results, is the filter window size, is the result after smoothing;
[0052] S62: Analyze the smoothed results in S61, identify and correct errors and outliers, and specifically use statistical anomaly detection technology to perform standard deviation analysis on each test result to determine whether there is a deviation and make corresponding corrections. The specific correction formula is expressed as:
[0053] ,in, Represents at a point in time The smoothed detection result; is the average detection value obtained from long-term observation; is the correction factor; Represents at a point in time The corrected test results;
[0054] S63: Integrate the corrected test results in S62 into a final test report, which includes the final test results, test conditions, algorithm parameters used, and any environmental factors that affect the results, to provide a comprehensive result analysis.
[0055] The machine vision inspection system based on feature calibration is used to implement the above-mentioned machine vision inspection method based on feature calibration, and includes the following modules:
[0056] Image acquisition module: including camera equipment and ambient light sensor, used to dynamically acquire continuous image sequences of the detected object under different focal lengths and lighting conditions;
[0057] Image processing module: receives the image sequence from the image acquisition module and applies the scale transformation algorithm to generate a multi-level image pyramid;
[0058] Feature extraction module: used to extract features from the multi-level image pyramid obtained by the image processing module. Specifically, a multi-scale convolutional neural network is used to process images of different resolutions, and feature enhancement technology is used to highlight the significance of features.
[0059] Feature calibration module: calibrates the features output by the feature extraction module in real time and compares them with the preset dynamic feature template library to identify the category and changes of the features;
[0060] Decision adjustment module: Based on the output results of the feature calibration module and real-time environmental data, the adaptive decision algorithm is used to adjust the detection strategy to optimize the detection accuracy and response speed;
[0061] Result post-processing module: Smooths and corrects errors in the preliminary test results obtained by the decision adjustment module, and generates a final test report.
[0062] Beneficial effects of the present invention:
[0063] The present invention significantly improves the detection accuracy under changing environmental conditions by introducing dynamic environmental adaptability and real-time feature calibration technology. The system can automatically adjust the settings of the camera equipment, such as focal length and aperture, and image processing parameters, to respond to environmental lighting, temperature and other changing factors in the best way. This adaptive adjustment ensures that the image quality always remains in the optimal state, thereby improving the effects of subsequent image processing and feature extraction.
[0064] The present invention adopts an advanced multi-scale convolutional neural network for feature extraction and combines it with a feature pyramid network for feature fusion to effectively process information from different image levels. This not only optimizes the hierarchical analysis of features, but also improves the ability to recognize objects in complex scenes. In this way, the system can more accurately identify and classify various objects in the image, especially when the image details and contrast vary greatly.
[0065] The present invention ensures that the output detection results have high accuracy and reliability through post-processing module smoothing and error correction, and further enhances the stability of the detection results by reducing occasional errors and eliminating noise, so that the system can provide continuous and accurate monitoring output in practical applications, such as industrial automation detection, safety monitoring and autonomous driving assistance. BRIEF DESCRIPTION OF THE DRAWINGS
[0066] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings in the following description are only for the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0067] Figure 1 A schematic diagram of a flow chart of a machine vision detection method according to an embodiment of the present invention;
[0068] Figure 2 Schematic diagram of a machine vision inspection system according to an embodiment of the present invention. DETAILED DESCRIPTION
[0069] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with specific embodiments.
[0070] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the present invention should be understood by people with ordinary skills in the field to which the present invention belongs. The words "first", "second" and similar words used in the present invention do not indicate any order, quantity or importance, but are only used to distinguish different components. The words "include" or "comprise" and similar words mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects.
[0071] like Figure 1 As shown, the machine vision detection method based on feature calibration includes the following steps:
[0072] S1: Use the preset illumination adaptation algorithm to control the camera device and dynamically obtain a continuous image sequence of the detected object under different focal lengths and illumination conditions;
[0073] S2: Scale the image sequence obtained in S1 to generate a multi-resolution image pyramid to meet the needs of multi-level feature extraction from micro to macro. This step is to create conditions for multi-level feature extraction;
[0074] S3: Extract features from each image pyramid level in S2 through a preset multi-scale convolutional neural network (CNN), and highlight the significance of the extracted features through feature enhancement technology;
[0075] S4: perform real-time calibration on the features extracted and enhanced in S3, and identify the category and changes of the features by comparing them with the preset dynamic feature template library;
[0076] S5: Based on the feature calibration results of S4 and real-time environmental data (such as lighting, background noise, etc.), an adaptive decision algorithm is used to adjust the detection strategy to optimize detection accuracy and response speed;
[0077] S6: Post-process the preliminary test results obtained in S5, including result smoothing and error correction, and finally output an accurate test report.
[0078] S1 specifically includes:
[0079] S11: Deploy a highly sensitive ambient light sensor to monitor the light intensity and type of the detected area in real time. The light sensor can distinguish between natural light and artificial light, and can also measure the specific value of light intensity. The data is transmitted to the central control unit in real time;
[0080] S12: The central control unit receives the light intensity and type from S11 and calculates the optimal focal length and aperture settings through a preset light adaptation algorithm. The specific calculation formula is:
[0081] and ;in, represents the calculated optimal focal length; is the reference focal length, i.e. the initial focal length value set under standard light intensity; is the focal length adjustment factor, determined by the sensitivity to changes in light intensity; is the change in light intensity, calculated as the difference between the current light intensity and the standard light intensity; Indicates the calculated optimal aperture size; It is the reference aperture size, that is, the initial aperture value set under standard light intensity; It is the aperture adjustment factor, which is used to adjust the aperture size according to changes in light intensity to adapt to different environments; It is the standard light intensity, which is preset to the standard ambient light intensity determined in the laboratory or design; is the light intensity of the current environment, measured in real time by the ambient light sensor in step S11;
[0082] S13: automatically adjusting the lens of the camera device according to the focal length and aperture settings obtained from S12, specifically using an electric drive mechanism to accurately adjust the focal length and aperture of the lens according to the instructions of the central control unit to adapt to different image acquisition requirements;
[0083] S14: After completing the adjustment of the lens, the camera device will start to continuously collect image sequences to ensure that the camera device can quickly adapt to and capture continuous, high-quality image sequences in any environment or when the state of the detected object changes; through the above S1 step, the focus and aperture can be automatically adjusted under different lighting conditions to ensure the acquisition of the best quality images and improve the accuracy and efficiency of subsequent image processing. The use of the lighting adaptation algorithm enables the camera device to flexibly respond to environmental changes, thereby enhancing the adaptability and practicality of the system and making it suitable for various complex application environments. In addition, the automatic adjustment mechanism reduces manual intervention and improves the automation level and operational efficiency of the detection process.
[0084] S2 specifically includes:
[0085] S21: first determine the basic resolution of the image sequence, which is determined by the highest resolution currently set by the camera device in S1, and receive the original image sequence data from S1;
[0086] S22: applying an image scaling algorithm to process each frame of the image, gradually reducing the image resolution, and generating a multi-level image pyramid;
[0087] S23: Each level of the image pyramid is standardized to eliminate the brightness and contrast differences caused by scale transformation. The standardization process ensures that the visual features of objects remain consistent in images of different levels. This provides data support for subsequent feature extraction and analysis. Through the implementation of the above S2 step, the high-resolution image sequence from S1 can be effectively processed. By constructing a multi-level image pyramid, it can not only meet the feature extraction requirements of different scales, but also greatly improve the efficiency of subsequent processing.
[0088] S22 specifically includes:
[0089] S221: Select bicubic interpolation as the image scale transformation algorithm to downsample the image. Bicubic interpolation is a technology that can keep the image edges smooth when the image is scaled.
[0090] S222: Apply the bicubic interpolation algorithm to downsample each frame of the image received in S21. First, determine the resolution of each level of the image pyramid. Specifically, each time a level is reduced, the resolution of the image is reduced to half of the previous level. The calculation formula for downsampling is:
[0091] ,in, Indicates Level image at coordinates The pixel value of , which is the pixel in the higher-level image pyramid, serves as the input of the downsampling process; Indicates Level image at coordinates The pixel value of The result obtained after bicubic interpolation downsampling of the level image, that is, the image layer with lower resolution; and These two expressions are used to locate the The image in the first level is involved in the calculation The area of a single pixel value in the level image, and It is The coordinates of the level image, and and The value range is from -1 to 2, which is used in the Select one from the surrounding images The pixel window is calculated; is the weight calculated according to the bicubic function and is used to weight the The pixel values in the first image are used to generate the The weight is dynamically calculated based on the relative position and distance between pixels to ensure smooth transition of pixel values during image scaling.
[0092] S223: Repeat S222 until a predetermined number of pyramid layers is reached, wherein each layer of images is obtained based on the previous layer of images through bicubic interpolation downsampling, thus gradually forming an image hierarchy from high resolution to low resolution; through the implementation of step S22, high-resolution image data can be effectively processed to generate a multi-level image pyramid with a clear structure. The use of bicubic interpolation not only ensures the quality of the image during the downsampling process, avoids the problem of excessive image sharpening and distortion that may be caused by common interpolation methods, but also ensures that the important features of objects at different scales are accurately retained, thereby providing a high-quality data foundation for subsequent feature extraction and image analysis.
[0093] S3 specifically includes:
[0094] S31: Deploy a preset multi-scale convolutional neural network (CNN), which is designed to adapt to image inputs of different resolutions so that it can process each layer of the multi-level image pyramid from S2. The multi-scale convolutional neural network includes multiple parallel convolutional layers, each layer is used to process images of different resolutions, ensuring that the network can capture image features from coarse to fine;
[0095] S32: Use an independent convolution layer to extract features for each level of the image pyramid. Each convolution layer is configured with convolution kernels of different sizes to match the resolution of the image pyramid layer it processes, ensuring that features can be effectively extracted from images at different levels.
[0096] S33: Apply nonlinear activation functions and normalization layers to enhance the extracted features. Specifically, batch normalization and ReLU (Rectified Linear Unit) activation functions are used to enhance the saliency and discrimination of features, which is used to enhance the network's response to important features and reduce the interference of unimportant features.
[0097] S34: The features extracted and enhanced at each layer are fused, and the feature fusion technology based on Feature Pyramid Networks (FPN) is used to integrate the information of each resolution level to generate a comprehensive feature map, which is then used in the subsequent feature calibration step S4; through the implementation of step S3, rich multi-scale features are effectively extracted from the multi-level image pyramid, and the feature recognition and reliability are significantly improved through feature enhancement technology. This multi-scale and enhanced feature processing method not only improves the efficiency and accuracy of feature extraction, but also through feature fusion technology, it can better utilize information at different levels, providing more comprehensive and accurate visual information for the machine vision system, greatly enhancing the application scope and adaptability of the system.
[0098] S34 specifically includes:
[0099] S341: receiving feature maps of each image pyramid level processed by a convolutional neural network from S33, wherein each map represents image features at different resolution levels;
[0100] S342: Using convolution and upsampling operations, upsample the feature maps of the lower resolution level to the higher resolution level. For each layer, the following operations are performed: ,in, It is The feature map of the layer, is the feature map of the next layer (lower resolution), is an upsampling function used to increase the resolution of the feature map to the resolution of the previous layer, is the fused feature map;
[0101] S343: Convolution processing is performed on the fused feature map obtained in S342 to enhance the details and significance of the features. The operation formula for each layer is: ,in, Represents the convolution operation, which is used to enhance and refine features. is the enhanced feature map;
[0102] S344: Integrate the feature maps of each layer processed in S343 into a comprehensive feature map, which includes all visual feature information from the highest to the lowest resolution. This comprehensive map is used for feature calibration in step S4 and subsequent image recognition tasks; through the implementation of the above S34 step, the feature pyramid network (FPN) technology can effectively integrate feature information from different resolution levels to generate a rich comprehensive feature map. This comprehensive feature map not only provides detailed visual information, but also enhances the system's ability to recognize features of objects of different scales and complexities. In addition, through bottom-up and top-down feature processing, the system can better capture detail information, improve recognition accuracy and reliability, and is suitable for high-demand machine vision application scenarios.
[0103] S4 specifically includes:
[0104] S41: receives the comprehensive feature map from S34, which integrates multi-scale features from different image levels and provides detailed visual information for real-time calibration;
[0105] S42: Apply the support vector machine (SVM) algorithm to perform real-time calibration on the comprehensive feature map received by S41. The support vector machine model is trained to recognize and classify various visual features. This is achieved through the following calculation process: ,in, is the comprehensive feature map, are the training parameters of the support vector machine model, is the classification result, indicating the feature category corresponding to the feature map, The function is used to perform the classification operation of the Support Vector Machine (SVM) algorithm;
[0106] S43: Dynamically update the feature template library according to the classification result in S42, by checking the matching degree between the classification result and the existing template, and deciding whether to introduce a new template or update the existing template according to the novelty or change of the classification result. The update formula is:
[0107] ,in, is the current feature template library, is the classification result obtained from S42, is the comprehensive feature map, It is the updated template library; The function is used to update the feature template library according to the new classification results; this function is used to compare and integrate the information obtained from real-time detection and classification with the existing feature templates to maintain the currentness and accuracy of the template library;
[0108] S44: Use the feature template library updated in S43 to compare with the calibration result in S42 to identify and confirm the specific category of the feature to ensure accurate identification and adaptation to changes in the environment or target object. The specific formula is: ,in, is the calibrated category result, is the updated feature template library, Indicates the identified feature category; The function is used to confirm and refine the accuracy of the classification results based on the updated feature template library. This step is the final verification in the recognition process to ensure that each type of feature is accurately recognized. By using a support vector machine for real-time calibration of feature mapping, complex visual features can be effectively recognized and classified. At the same time, by dynamically updating the feature template library, the system adaptability and flexibility are significantly improved. This method improves the accuracy of feature recognition and the response speed of the system, and is very suitable for machine vision application scenarios that require high reliability and real-time updates.
[0109] S5 specifically includes:
[0110] S51: First, collect environmental data in real time, including light intensity, temperature, and humidity, to reflect the state of the current detection environment;
[0111] S52: Based on the collected environmental data and the feature calibration results obtained in S4, an adaptive decision algorithm is applied to optimize the detection strategy. Specifically, a decision tree model is used to dynamically adjust the detection parameters by combining real-time environmental data and visual feature data through the following formula:
[0112] ,in, are the adjusted detection parameters, including the threshold and sensitivity of image processing; is the feature category result obtained from S4; is real-time environmental data collected from the S51, such as light intensity and temperature; and is a model parameter used to balance the impact of environmental data and feature categories on detection parameters; is a preset function used to adjust the threshold of image processing according to environmental data. The purpose of this function is to dynamically adjust the sensitivity or threshold of the image processing stage according to environmental conditions (such as light intensity, background noise, etc.) to optimize the detection effect and accuracy. The specific expression of the function is: ,in, As the basic threshold, ensure that there is a default threshold even when there is no environmental impact; and is the adjustment factor used to adjust the (e.g. light intensity) Flexibility and responsiveness of threshold adjustment; Environmental data, which can be light intensity or other related measurement data, It is also a preset function used to adjust the sensitivity of detection by combining feature categories and environmental data. The expression of the function is: ,in, To reflect the feature category Direct impact on sensitivity, ensuring that different categories can have different response strengths; is the environmental adjustment factor, used to adjust environmental data The effect of temperature or humidity on sensitivity, using logarithms to ensure a smooth response to extreme values; and They represent the feature categories and environmental data obtained from SVM classification respectively;
[0113] S53: The adjusted detection parameters calculated according to S52 Adjustments are made, including adjusting the image acquisition frequency and the parameters of the image processing algorithm to adapt to the current environment and the characteristics of the target object; through the implementation of the above S5 step, the system can adjust the detection strategy in real time to cope with environmental changes and different types of detection objects, thereby improving the flexibility and accuracy of detection.
[0114] S6 specifically includes:
[0115] S61: Apply a result smoothing algorithm to the detection result obtained in S5 to reduce noise and fluctuations in the detection process. Specifically, a moving average filter is used to smooth the result. The specific calculation formula is: ,in, It's at the time The original test results, is the filter window size, is the result after smoothing;
[0116] S62: Analyze the smoothed results in S61, identify and correct errors and outliers, and specifically use statistical anomaly detection technology to perform standard deviation analysis on each test result to determine whether there is a deviation and make corresponding corrections. The specific correction formula is expressed as:
[0117] ,in, Represents at a point in time The smoothed detection result; It is the average test value obtained from long-term observation and the standard test value calculated based on historical data; is the correction factor, a preset factor that adjusts the results to be closer to the average level, correcting for possible measurement errors; Represents at a point in time The corrected test results;
[0118] S63: Integrate the corrected test results in S62 into a final test report, which includes the final test results, test conditions, algorithm parameters used, and any environmental factors that affect the results, to provide a comprehensive result analysis; Through the above S6 step, the test results can be effectively smoothed and corrected, significantly improving the accuracy and reliability of the test data. The result smoothing reduces the impact of random noise, and the error correction further ensures the accuracy of the test results, thereby providing a highly accurate test report.
[0119] like Figure 2 As shown, the machine vision detection system based on feature calibration is used to implement the above-mentioned machine vision detection method based on feature calibration, and includes the following modules:
[0120] Image acquisition module: including camera equipment and ambient light sensor, used to dynamically acquire continuous image sequences of the detected object under different focal lengths and lighting conditions;
[0121] Image processing module: receives the image sequence from the image acquisition module and applies the scale transformation algorithm to generate a multi-level image pyramid;
[0122] Feature extraction module: used to extract features from the multi-level image pyramid obtained by the image processing module. Specifically, a multi-scale convolutional neural network is used to process images of different resolutions, and feature enhancement technology is used to highlight the significance of features.
[0123] Feature calibration module: calibrates the features output by the feature extraction module in real time and compares them with the preset dynamic feature template library to identify the category and changes of the features;
[0124] Decision adjustment module: Based on the output results of the feature calibration module and real-time environmental data, the adaptive decision algorithm is used to adjust the detection strategy to optimize the detection accuracy and response speed;
[0125] Result post-processing module: Smooths and corrects errors in the preliminary test results obtained by the decision adjustment module, and generates a final test report.
[0126] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present invention is limited to these examples. Under the concept of the present invention, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of the different aspects of the present invention as described above, which are not provided in detail for the sake of simplicity.
[0127] The present invention is intended to cover all such substitutions, modifications and variations that fall within the broad scope of the claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A machine vision detection method based on feature calibration, characterized in that: The following steps are involved: S1: Use the preset illumination adaptation algorithm to control the camera device and dynamically obtain a continuous image sequence of the detected object under different focal lengths and illumination conditions; S2: Scale the image sequence obtained by S1 to generate a multi-resolution image pyramid to meet the multi-level feature extraction requirements from micro to macro; S3: Extract features from each image pyramid level in S2 through a preset multi-scale convolutional neural network, and highlight the significance of the extracted features through feature enhancement technology; The S3 specifically includes: S31: Deploy a preset multi-scale convolutional neural network, which includes multiple parallel convolutional layers, each layer is used to process images of different resolutions, ensuring that the network can capture image features from coarse to fine; S32: Use independent convolutional layers for feature extraction for each level of the image pyramid, where each convolutional layer is configured with convolution kernels of different sizes; S33: Apply nonlinear activation functions and normalization layers to enhance the extracted features. Specifically, batch normalization and ReLU activation functions are used to enhance the saliency and discrimination of the features. S34: Fusing the features extracted and enhanced at each layer, using feature fusion technology based on feature pyramid network to integrate the information at each resolution level and generate a comprehensive feature map; The S34 specifically includes: S341: receiving feature maps of each image pyramid level processed by a convolutional neural network from S33, wherein each map represents image features at different resolution levels; S342: Using convolution and upsampling, for each layer, the following operations are performed: ,in, It is The feature map of the layer, is the feature map of the next layer, is an upsampling function used to increase the resolution of the feature map to the resolution of the previous layer, is the fused feature map; S343: Convolution processing is performed on the fused feature map obtained in S342 to enhance the details and significance of the features. The operation formula for each layer is: ,in, Represents the convolution operation, which is used to enhance and refine features. is the enhanced feature map; S344: Integrate the feature maps of each layer processed in S343 into a comprehensive feature map, where the comprehensive feature map includes all visual feature information from the highest to the lowest resolution; S4: perform real-time calibration on the features extracted and enhanced in S3, and identify the category and changes of the features by comparing them with the preset dynamic feature template library; The S4 specifically includes: S41: receiving a comprehensive feature map from S34, which integrates multi-scale features from different image levels; S42: Apply the support vector machine algorithm to perform real-time calibration on the comprehensive feature map received by S41. The support vector machine model is trained to recognize and classify various visual features, which is achieved through the following calculation process: ,in, is the comprehensive feature map, are the training parameters of the support vector machine model, is the classification result, indicating the feature category corresponding to the feature map, The function is used to perform the classification operation of the support vector machine algorithm; S43: Dynamically update the feature template library according to the classification result in S42, by checking the matching degree between the classification result and the existing template, and deciding whether to introduce a new template or update the existing template according to the change of the classification result. The update formula is: ,in, is the current feature template library, is the classification result, is the comprehensive feature map, It is the updated template library; The function is used to update the feature template library according to the new classification results; S44: Use the feature template library updated in S43 to compare with the calibration result in S42 to identify and confirm the specific category of the feature to ensure accurate identification and adaptation to changes in the environment or target object. The specific formula is: ,in, is the classification result, is the updated feature template library, Indicates the identified feature category; The function is used to confirm and refine the accuracy of the classification results based on the updated feature template library; S5: Based on the feature calibration results of S4 and real-time environmental data, an adaptive decision algorithm is used to adjust the detection strategy to optimize the detection accuracy and response speed; The S5 specifically includes: S51: First, collect environmental data in real time, including light intensity, temperature, and humidity, to reflect the state of the current detection environment; S52: Based on the collected environmental data and the feature calibration results obtained in S4, an adaptive decision algorithm is applied to optimize the detection strategy. Specifically, a decision tree model is used to dynamically adjust the detection parameters by combining real-time environmental data and visual feature data through the following formula: ,in, are the adjusted detection parameters, including the threshold and sensitivity of image processing; is the classification result; It is the real-time environmental data collected from S51; and is a model parameter used to balance the impact of environmental data and feature categories on detection parameters; It is a preset function used to adjust the threshold of image processing according to environmental data; It is also a preset function used to adjust the sensitivity of detection by combining feature categories and environmental data; S53: The adjusted detection parameters calculated according to S52 Make adjustments, including adjusting the image acquisition frequency and parameters of the image processing algorithm to adapt to the current environment and the characteristics of the target object; S6: Post-process the preliminary test results obtained in S5, including result smoothing and error correction, and finally output an accurate test report.
2. The machine vision detection method based on feature calibration according to claim 1, characterized in that: The S1 specifically includes: S11: Deploy a highly sensitive ambient light sensor to monitor the light intensity and type of the detected area in real time. The light sensor can distinguish between natural light and artificial light, and can also measure the specific value of light intensity. The data is transmitted to the central control unit in real time; S12: The central control unit receives the light intensity and type from S11 and calculates the optimal focal length and aperture settings through a preset light adaptation algorithm. The specific calculation formula is: and ;in, represents the calculated optimal focal length; is the base focal length; is the focal length adjustment factor; is the change in light intensity; Indicates the calculated optimal aperture size; is the base aperture size; is the aperture adjustment factor; is the standard light intensity; is the light intensity of the current environment; S13: automatically adjusting the lens of the camera device according to the focal length and aperture settings obtained from S12, specifically using an electric drive mechanism to accurately adjust the focal length and aperture of the lens according to the instructions of the central control unit to adapt to different image acquisition requirements; S14: After completing the adjustment of the lens, the camera device will start to continuously collect image sequences.
3. The machine vision detection method based on feature calibration according to claim 1, characterized in that: The S2 specifically includes: S21: receiving the original image sequence data from S1; S22: applying an image scaling algorithm to process each frame of the image, gradually reducing the image resolution, and generating a multi-level image pyramid; S23: Standardize each level of the image pyramid to ensure that the visual features of objects remain consistent in images at different levels.
4. The machine vision detection method based on feature calibration according to claim 3 is characterized in that: The S22 specifically includes: S221: Selecting bicubic interpolation as an image scale transformation algorithm to downsample the image. Bicubic interpolation is a technology that can keep the image edge smooth when the image is scaled. S222: Apply the bicubic interpolation algorithm to downsample each frame of the image received in S21. First, determine the resolution of each level of the image pyramid. Specifically, each time a level is reduced, the resolution of the image is reduced to half of the previous level. The calculation formula for downsampling is: ,in, Indicates Level image at coordinates The pixel value of Indicates Level image at coordinates The pixel value of is the weight calculated according to the bicubic function; S223: Repeat S222 until a predetermined number of pyramid layers is reached, wherein the image of each layer is obtained by bicubic interpolation downsampling based on the image of the previous layer, thereby gradually forming an image hierarchy from high resolution to low resolution.
5. The machine vision detection method based on feature calibration according to claim 1, characterized in that: The S6 specifically includes: S61: Apply a result smoothing algorithm to the detection result obtained in S5 to reduce noise and fluctuations in the detection process. Specifically, a moving average filter is used to smooth the result. The specific calculation formula is: ,in, It's at the time The original test results, is the filter window size, is the result after smoothing; S62: Analyze the smoothed results in S61, identify and correct errors and outliers, and specifically use statistical anomaly detection technology to perform standard deviation analysis on each test result to determine whether there is a deviation and make corresponding corrections. The specific correction formula is expressed as: ,in, Represents at a point in time The smoothed detection result; is the average detection value obtained from long-term observation; is the correction factor; Represents at a point in time The corrected test results; S63: Integrate the corrected test results in S62 into a final test report, which includes the final test results, test conditions, algorithm parameters used, and any environmental factors that affect the results, to provide a comprehensive result analysis.
6. A machine vision inspection system based on feature calibration, used to implement the machine vision inspection method based on feature calibration as described in any one of claims 1 to 5, characterized in that: Includes the following modules: Image acquisition module: including camera equipment and ambient light sensor, used to dynamically acquire continuous image sequences of the detected object under different focal lengths and lighting conditions; Image processing module: receives the image sequence from the image acquisition module and applies the scale transformation algorithm to generate a multi-level image pyramid; Feature extraction module: used to extract features from the multi-level image pyramid obtained by the image processing module. Specifically, a multi-scale convolutional neural network is used to process images of different resolutions, and feature enhancement technology is used to highlight the significance of features. Feature calibration module: calibrates the features output by the feature extraction module in real time and compares them with the preset dynamic feature template library to identify the category and changes of the features; Decision adjustment module: Based on the output results of the feature calibration module and real-time environmental data, the adaptive decision algorithm is used to adjust the detection strategy to optimize the detection accuracy and response speed; Result post-processing module: Smooths and corrects errors in the preliminary test results obtained by the decision adjustment module, and generates a final test report.
