Barrier correction method and system based on machine vision
Through real-time data acquisition based on machine vision and multi-step adaptive adjustment algorithm, the gate motion state is dynamically analyzed and the deviation correction speed is optimized, which solves the motion instability caused by changes in the deviation correction speed in the prior art, and the balance between efficient and smoothness of the gate correction process is achieved.
Patent Information
- Application Number
- CN202510152753.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-12
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2045-02-12
AI Technical Summary
The existing gate correction technology is difficult to ensure the correction efficiency while avoiding motion instability caused by changes in the correction speed. Frequent adjustment of the correction speed will increase the instability of the system.
Using real-time data acquisition based on machine vision and multi-step adaptive adjustment algorithm, dynamic analysis of the gate motion state, combined with PID control and pre-trained motion control model, the deviation correction speed is optimized, and the balance between efficiency and smoothness of the deviation correction process is achieved.
The stability and accuracy of the gate operation are improved, the unstable problems caused by changes in the correction speed are avoided, and the efficiency and smoothness of the correction process are balanced.
Smart Images

Figure CN119620595B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information technology, and in particular to a barrier deviation correction method and system based on machine vision. Background Art
[0002] In the barrier system, the goal of the correction operation is to ensure that the barrier pole can accurately and smoothly return to the predetermined position. However, due to the inertia and mechanical characteristics of the barrier during operation, how to ensure the smooth and coherent correction action while dynamically adjusting the correction speed according to the position deviation of the barrier pole and the correction requirements has always been a technical challenge.
[0003] At present, in the prior art, the correction speed is often adjusted by detecting the current position deviation of the barrier pole. For larger position deviations, the system will select a faster correction speed to improve the correction efficiency, while for smaller deviations, a slower correction speed will be used to ensure the smoothness of the action. Such a method helps to achieve the correction goal to a certain extent, but when the correction speed is too fast, although the deviation can be corrected quickly, it will cause a sudden change in the movement of the barrier pole, causing unstable jitter and vibration, affecting the stability of the barrier pole; and when the correction speed is too slow, although it helps to maintain the smoothness of the movement, it will reduce the correction efficiency, resulting in a prolonged correction process, and even failure to respond to position changes in a timely manner. In addition, due to the inertia and mechanical characteristics of the barrier, frequent adjustment of the correction speed will increase the instability of the system and cause discontinuous correction actions.
[0004] The existing technology has a problem of how to ensure the correction efficiency while avoiding the instability of the gate movement caused by the change of the correction speed. Summary of the invention
[0005] The present invention provides a barrier gate deviation correction method and system based on machine vision, so as to achieve a balance between the high efficiency and smoothness of barrier gate pole position correction, thereby improving the stability and accuracy of barrier gate operation.
[0006] In the first aspect, in order to solve the above technical problems, the present invention provides a gate deviation correction method based on machine vision, comprising:
[0007] S11, obtaining the gate pole position deviation data and acceleration in real time through the machine vision system;
[0008] S12, comparing the deviation data with a preset smoothness threshold, and when the deviation data is greater than the smoothness threshold, calculating based on the inertia characteristics of the gate combined with the deviation data to obtain an initial deviation correction speed;
[0009] S13, performing a gate motion state analysis operation on the initial deviation correction speed based on a dynamic model combined with the deviation data and the acceleration to obtain a deviation correction speed;
[0010] S14, using an adaptive adjustment algorithm based on PID control, performing an adaptive adjustment operation according to the correction speed and the preset smoothness threshold, to obtain a dynamic correction speed;
[0011] S15, based on the inertial characteristics of the barrier and the machine vision accuracy, the dynamic deviation correction speed and the deviation data are input into a pre-trained barrier motion control model to obtain an execution time and an execution amplitude;
[0012] S16, based on the optimization target of the deviation correction efficiency, performing an optimal deviation correction speed determination operation on the dynamic deviation correction speed in combination with the deviation data to obtain an optimal deviation correction speed;
[0013] S17, based on the deviation data, the optimal deviation correction speed, the execution time and the execution amplitude combined with the smoothness threshold, perform a deviation correction process completion status judgment operation to obtain a judgment result, and end the deviation correction process or re-execute steps S12-S17 based on the judgment result.
[0014] Preferably, the calculation formula of the initial deviation correction speed is:
[0015]
[0016] In the formula, is the initial correction speed; is the absolute value of the deviation data; is the mass of the barrier pole; is the proportionality coefficient.
[0017] Preferably, the gate motion state analysis operation is performed on the initial deviation correction speed based on the dynamic model in combination with the deviation data and the acceleration to obtain the deviation correction speed, including:
[0018] Based on the dynamic model, the motion state of the gate is analyzed in combination with the deviation data, the initial deviation correction speed and the acceleration to obtain the motion state result of the gate;
[0019] Comparing the gate motion state result with the preset historical motion state result;
[0020] When the gate motion state result is within the preset historical motion state result range, a correction speed reduction operation is performed to obtain a correction speed;
[0021] When the gate movement state result exceeds the preset historical movement state result range, the correction speed is increased to obtain the correction speed.
[0022] Preferably, the adaptive adjustment algorithm based on PID control is used to perform an adaptive adjustment operation according to the correction speed and the preset smoothness threshold to obtain a dynamic correction speed, including:
[0023] The deviation correction speed and the preset smoothness threshold are used as input parameters of a controller of an adaptive adjustment algorithm based on PID control, and a PID control adjustment amount is obtained through adaptive adjustment of the controller;
[0024] The PID control adjustment amount is used as a control signal of the actuator to drive the actuator to perform a speed correction operation to obtain a dynamic correction speed.
[0025] Preferably, the training process of the barrier motion control model is:
[0026] Obtain historical dynamic correction speed and historical deviation data;
[0027] Based on the inertia characteristics of the barrier, an initial barrier motion control model is constructed, and the initial barrier motion control model is trained based on the dynamic correction speed and the deviation data as input data to obtain a trained barrier motion control model.
[0028] Preferably, the initial barrier motion control model is constructed based on the barrier inertia characteristics, and the initial barrier motion control model is trained based on the dynamic deviation correction speed and the deviation data as input data to obtain a trained barrier motion control model, including:
[0029] Initializing the dynamic correction speed and deviation data in the gate motion control model;
[0030] Calculate the execution time and the execution amplitude;
[0031] Based on the machine vision accuracy, a smoothness evaluation index is set, and a fuzzy control algorithm is used to adjust the execution time and the execution amplitude;
[0032] When the execution time and the execution amplitude meet the smoothness evaluation index, the training is determined to be completed, and a trained gate motion control model is obtained.
[0033] Preferably, the optimal correction speed determination operation is performed on the dynamic correction speed based on the correction efficiency optimization target in combination with the deviation data to obtain the optimal correction speed, including:
[0034] According to the deviation data, a dynamic analysis operation is performed to obtain operating state parameters;
[0035] Based on the optimization target of the deviation correction efficiency and the operating state parameters, the optimal deviation correction speed is calculated by using a gradient descent algorithm;
[0036] Calculating the difference between the dynamic deviation correction speed and the optimal deviation correction speed to obtain a speed difference;
[0037] When the speed difference is less than a preset difference threshold, the dynamic deviation correction speed is determined as the optimal deviation correction speed;
[0038] When the speed difference is greater than a preset difference threshold, the speed difference is superimposed on the dynamic deviation correction speed to obtain a new deviation correction speed, and the new deviation correction speed is determined as the optimal deviation correction speed.
[0039] Preferably, the operation of judging the completion of the correction process is performed according to the deviation data, the optimal correction speed, the execution time and the execution amplitude in combination with the smoothness threshold, and a judgment result is obtained. The correction process is terminated or steps S12 to S17 are re-executed according to the judgment result, including:
[0040] When the execution time exceeds the maximum allowed time, an adjustment time operation is performed to obtain an adjusted execution time;
[0041] When the execution range exceeds the maximum allowable range, an adjustment range operation is performed to obtain an adjusted execution range;
[0042] Determine the correction efficiency objective function based on the optimization algorithm, solve the deviation data in combination with the motion state stability as constraint conditions, and obtain the optimal correction control parameters;
[0043] Performing a mutation detection operation on the optimal deviation correction speed;
[0044] When a sudden change occurs in the optimal deviation correction speed, a sudden change suppression operation is performed to obtain an adjusted deviation correction speed, and a real-time deviation correction operation of the gate pole position is performed according to the optimal deviation correction control parameters, the adjusted deviation correction speed, the adjusted execution time and the adjusted execution amplitude to obtain a deviation correction completion result;
[0045] When the optimal deviation correction speed does not suddenly change, the gate pole position is corrected in real time according to the optimal deviation correction control parameters, the optimal deviation correction speed, the adjustment execution time and the adjustment execution amplitude to obtain a deviation correction completion result;
[0046] When the correction result meets the target correction result, the correction process ends;
[0047] When the correction result does not meet the target correction result, step S12 to step S17 are executed again.
[0048] Preferably, when the optimal deviation-correcting speed undergoes a sudden change, a sudden change suppression operation is performed to adjust the deviation-correcting speed, including:
[0049] Based on the Kalman filter algorithm, a smoothing operation is performed on the optimal deviation correction speed to obtain a smooth motion speed curve;
[0050] Based on the PID control algorithm, according to the smooth motion speed curve, the deviation correction speed adjustment operation is performed to obtain a stable deviation correction speed;
[0051] The stable deviation correction speed is fed back to the motion control system, and a vibration suppression operation is performed on the stable deviation correction speed to obtain an adjusted deviation correction speed.
[0052] In a second aspect, the present invention provides a barrier gate deviation correction system based on machine vision, comprising: a data acquisition module, for acquiring barrier gate pole position deviation data and acceleration in real time through a machine vision system;
[0053] A deviation correction speed calculation module, used for comparing the deviation data with a preset smoothness threshold, and when the deviation data is greater than the smoothness threshold, performing calculation based on the inertia characteristics of the gate combined with the deviation data to obtain an initial deviation correction speed;
[0054] A motion state analysis module performs a gate motion state analysis operation on the initial deviation correction speed based on a dynamic model combined with the deviation data and the acceleration to obtain a deviation correction speed;
[0055] A speed adjustment module, configured to adopt an adaptive adjustment algorithm based on PID control, perform an adaptive adjustment operation according to the deviation correction speed and the preset smoothness threshold, and obtain a dynamic deviation correction speed;
[0056] A training model module is used to input the dynamic correction speed and the deviation data into a pre-trained barrier motion control model based on the barrier inertia characteristics and machine vision accuracy to obtain an execution time and an execution amplitude;
[0057] An optimal speed module, used for performing an optimal correction speed determination operation on the dynamic correction speed based on the correction efficiency optimization target and in combination with the deviation data to obtain an optimal correction speed;
[0058] The correction process judgment module is used to perform a correction process completion judgment operation based on the deviation data, the optimal correction speed, the execution time and the execution amplitude combined with a smoothness threshold, obtain a judgment result, and end the correction process or return to the correction speed calculation module based on the judgment result.
[0059] In a third aspect, the present invention further provides an electronic device comprising a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein when the processor executes the computer program, it implements any one of the above-mentioned methods for correcting a barrier error based on machine vision.
[0060] In a fourth aspect, the present invention further provides a computer-readable storage medium, the computer-readable storage medium including a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute any one of the above-mentioned methods for correcting the deviation of a gate based on machine vision. The technical solution provided by the embodiment of the present invention may have the following beneficial effects:
[0061] The present invention discloses a gate pole position correction control method. Compared with the prior art, the method can effectively solve the contradiction between efficiency and smoothness in gate correction through real-time data acquisition based on machine vision and a multi-step adaptive adjustment algorithm.
[0062] First, the present invention obtains the position deviation data and acceleration of the gate pole in real time through the machine vision system, and calculates the initial correction speed based on the comparison of the deviation data with the preset smoothness threshold and the inertial characteristics of the gate. Secondly, the initial correction speed is analyzed for the motion state of the gate based on the dynamic model. While ensuring that the correction speed matches the motion state of the gate, the adaptive PID control algorithm is adopted to further adjust the correction speed so that the correction action can achieve a balance between high efficiency and smoothness. Through the pre-trained gate motion control model, the dynamic correction speed is input into the model, and the execution time and amplitude are optimized in combination with historical data and machine vision accuracy. Finally, the correction efficiency optimization target is optimized based on the deviation data to obtain the optimal correction speed. Furthermore, the present invention also uses the Kalman filter and smoothing algorithm to adjust the correction speed for the sudden changes in the correction speed through the mutation suppression operation, avoiding sudden abnormal states and ensuring the stability and stability of the correction process.
[0063] In summary, the present invention provides a correction method that can be adaptively adjusted, which can dynamically optimize the correction speed according to real-time deviation data and motion status, achieve a balance between the high efficiency and smoothness of the gate pole position correction, improve the stability and accuracy of the gate operation, and solve the instability problem caused by the correction speed adjustment in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS
[0064] Figure 1 It is a schematic flow chart of a barrier deviation correction method based on machine vision provided by the first embodiment of the present invention;
[0065] Figure 2 It is a schematic diagram of the structure of a barrier correction system based on machine vision provided in the second embodiment of the present invention. DETAILED DESCRIPTION
[0066] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this specification.
[0067] Reference Figure 1 The first embodiment of the present invention provides a gate deviation correction method based on machine vision, comprising the following steps:
[0068] S11, obtains the gate pole position deviation data and acceleration in real time through the machine vision system, including:
[0069] First, the motion state of the barrier is monitored in real time through a machine vision system. The machine vision system includes a high-precision camera or multiple cameras installed at appropriate locations on the barrier pole to ensure that the position changes of the barrier pole during movement can be captured. The system uses image processing algorithms to capture the image of the barrier pole in real time and calculate the current position of the barrier pole. Using computer vision technology, the system can measure the position of the barrier pole with high precision and transmit the measured position data to the subsequent control system.
[0070] Specifically, the machine vision system calculates the current gate pole position deviation data by tracking the changes in the gate during movement. These deviation data reflect the difference between the current actual position of the gate pole and the expected target position. The acquisition of deviation data is crucial for subsequent correction operations, which determines the adjustment of the correction speed and other control parameters. By acquiring the position deviation data of the gate pole in real time, the machine vision system can provide accurate input to the correction control system to ensure that the correction operation can be adjusted according to the real-time status of the gate at any time.
[0071] In a specific embodiment, the machine vision system not only obtains the position deviation data of the barrier pole in real time, but also needs to collect the acceleration data of the barrier pole. Acceleration is an important parameter to describe the motion state of the barrier pole, which can reflect the changing trend of the barrier pole motion. Through high-precision sensors or accelerometers, the system can measure the acceleration changes of the barrier pole in real time. Acceleration data helps to determine the current motion state of the barrier pole, including whether there are problems such as inertial lag or excessive vibration, thereby providing necessary information for the subsequent calculation of the deviation correction speed.
[0072] In a specific embodiment, a machine vision hardware system and sensor need to be configured. The machine vision system consists of a high-resolution camera, a laser radar (LiDAR) or other distance sensors, which need to be installed near the gate to capture the position and state changes of the gate pole during movement. In order to improve the measurement accuracy, multiple cameras can be used to shoot the same object at different angles, perform image fusion, and reduce occlusion errors. The camera should be installed above or on the side of the gate to fully obtain the movement trajectory of the gate and ensure the accuracy of the data.
[0073] During the movement of the barrier pole, the machine vision system collects images of the barrier in real time. Through a high-speed camera or camera array, the system can capture clear images of the barrier pole at every time point. Each frame of the image collected is analyzed by image processing algorithms (such as edge detection, target tracking, etc.) to extract the key features of the barrier (such as the edge or identification point of the barrier). Through the relationship model between image coordinates and physical coordinates, the machine vision system can convert image coordinates into actual positions, thereby calculating the exact position of the barrier pole in space.
[0074] Specifically, the deviation of the current position is calculated by the preset target position and the real-time position obtained by the machine vision system. In addition to the position deviation, the system also needs to obtain the acceleration data of the gate pole. An acceleration sensor can be installed on the gate, or the motion estimation method in the machine vision system can be used for inference. The acceleration sensor is installed on the main support part of the gate and can accurately measure the acceleration of the gate pole in m / s². The acceleration data can be obtained by real-time sampling of the motion state of the gate. If machine vision inference is used, the acceleration can be calculated by estimating the speed change during the motion and combining the time interval.
[0075] All collected gate pole position deviation and acceleration data will be transmitted to the control system through a real-time communication network (such as CAN bus, Ethernet or wireless module). In order to ensure the real-time and accuracy of the system response, all sensor data must be processed quickly and transmitted to the control system for further calculation and feedback. The control system calculates the initial correction speed based on this data and performs dynamic control of the gate to ensure that the gate can perform accurate correction operations based on the actual deviation.
[0076] In addition, in order to improve the accuracy and stability of data, the system will also use data fusion technology, such as Kalman filtering or particle filtering. Through these filtering algorithms, sensor noise can be effectively removed, data accuracy can be improved, and the system can respond based on the most accurate status information.
[0077] S12, comparing the deviation data with a preset smoothness threshold, and when the deviation data is greater than the smoothness threshold, calculating based on the inertia characteristics of the gate combined with the deviation data to obtain an initial deviation correction speed, including:
[0078] First, the real-time gate pole position deviation data is compared with the preset smoothness threshold. When the deviation data is detected to exceed the set smoothness threshold, the system will consider that the gate pole position has been abnormally offset and trigger the correction control program. The smoothness threshold is a key parameter for determining whether the gate needs to be corrected. Its setting is based on the accuracy requirements of the gate system and the specific needs of the application scenario. For example, for some high-precision control scenarios, such as smart parking lots or automated toll collection systems, the smoothness threshold is very small, and only a few millimeters or degrees of deviation can trigger correction; while in some ordinary scenarios, such as some low-speed access control systems, the threshold can be set relatively large, such as 1-2 cm or 2-3 degrees. The choice of this threshold has an important impact on the response sensitivity of the correction system and the frequency of correction operations.
[0079] Specifically, when the deviation data exceeds the preset smoothness threshold, the system will enter the stage of calculating the initial correction speed. The initial correction speed is the key to starting the correction process, which determines the strength and speed of the correction action. In order to achieve efficient and stable correction, the initial correction speed needs to comprehensively consider the deviation size of the gate and its inertial characteristics. The inertial characteristics of the gate are closely related to its mass. The greater the mass, the stronger the inertia of the gate, and a greater force is required to change its motion state. The calculation formula for the initial correction speed is:
[0080]
[0081] In the formula, is the initial correction speed; is the absolute value of the deviation data; is the mass of the barrier (barrier inertia characteristics); is the proportionality coefficient.
[0082] It should be noted that the proportional coefficient is adjusted through experiments and debugging to meet the control requirements of different types of barriers. The proportional coefficient directly affects the efficiency and stability of the correction. The specific value of the proportional coefficient is between 0.1 and 1.0. Smaller values (such as 0.1) are suitable for high-precision control, and larger values (such as 1.0) are suitable for fast-response systems. For example, in some high-precision barriers, the proportional coefficient needs to be set smaller to ensure more precise correction operations; while in some ordinary barrier systems, the proportional coefficient can be relatively large to ensure fast response operations.
[0083] Specifically, the initial correction speed will be used as the starting speed for the gate to return to the standard position. As the correction process proceeds, the system will continue to monitor the position changes of the gate and dynamically adjust the correction speed to ensure that the gate does not overshoot or oscillate when returning to the preset position.
[0084] In a specific embodiment, the calculation of the initial deviation correction speed depends not only on the values of deviation and mass, but also on the working characteristics and environmental factors of the gate. For example, the gate has different inertia characteristics in different working states (such as closed, half-open, and fully open). Therefore, when calculating the initial deviation correction speed, the system needs to dynamically adjust the inertia parameters according to the current state of the gate. In order to improve the accuracy of the deviation correction control, the system can introduce an adaptive control algorithm to adjust the proportional coefficient kk according to the real-time feedback data to achieve more accurate deviation correction.
[0085] In a specific embodiment, the control of the initial deviation correction speed also needs to consider the dynamic response characteristics of the gate. For example, during the deviation correction process, the gate may oscillate or become unstable due to excessive speed, especially when the mechanical structure of the gate system has certain elasticity or large inertia. To avoid this situation, the system can gradually reduce the deviation correction speed by introducing a smoothing control algorithm to ensure that the gate is in place smoothly. For example, when the actual position of the gate gradually approaches the target position, the system will reduce the deviation correction speed according to the deviation change rate to avoid unnecessary oscillations caused by excessively fast movement.
[0086] S13, based on the dynamic model combined with the deviation data and the acceleration, performing a gate motion state analysis operation on the initial deviation correction speed to obtain the deviation correction speed, including:
[0087] First, the system needs to understand the motion state and deviation of the gate based on the real-time acquisition of the gate's deviation data, acceleration data, and initial correction speed, and provide input for subsequent dynamic modeling. The system will analyze the motion state of the gate based on the gate's dynamic model. The dynamic model is based on the classical Newtonian mechanics principle and involves the relationship between force, mass, and acceleration. Assuming that the mass and inertia of the gate are known, the dynamic model will calculate the actual speed and position of the gate based on the acceleration data and the initial correction speed, and then infer the future motion trajectory of the gate. Specifically, the dynamic model calculates the acceleration and speed of the gate by inputting the deviation data, acceleration data, and initial correction speed using the formula F=ma (where F is the applied external force, m is the mass of the gate, and a is the acceleration). In this way, the system can predict the movement trend of the gate in real time, calculate the current motion state of the gate, such as instantaneous speed, position, acceleration, etc., and then determine whether there is deviation or abnormality in the movement of the gate. This step not only relies on the current instantaneous data, but also models and predicts the behavior of the gate based on historical data, thereby providing a reference for correction.
[0088] Specifically, after obtaining the results of the gate movement state, the system will compare these results with the preset historical movement state. The preset historical movement state is obtained by accumulating and analyzing the long-term operation data of the gate, reflecting the typical movement mode of the gate under normal conditions without external interference. The acquisition of historical movement data is based on long-term experimental data or monitoring data in actual operation, covering the acceleration, speed, position and other related movement parameters of the gate. These data will be statistically analyzed based on the performance of the gate under different working conditions to obtain the upper and lower limits of the normal movement range of the gate. In order to ensure that the gate can operate stably in different environments, a certain tolerance is set for the range of historical movement states, for example, the deviation is within ±2mm, the speed fluctuation is within ±0.5m / s, etc. These historical data are not only an important basis for judging whether the gate movement is stable, but also a standard for judging whether the correction speed needs to be adjusted.
[0089] In a specific embodiment, after the barrier motion state result is compared with the preset historical motion state result, the system will decide whether to adjust the deviation correction speed according to the comparison result. If the current barrier motion state result is within the preset range of the historical motion state result, it means that the movement of the barrier is within the normal range and the deviation correction process does not produce excessive adjustment. At this time, the system will reduce the deviation correction speed to avoid unnecessary motion adjustment.
[0090] Specifically, the correction speed is gradually reduced through a control algorithm (such as a PID control algorithm). When the system detects that the barrier has approached a predetermined position or reached a stable state, the correction speed will be gradually reduced to a minimum to ensure that the barrier can stop smoothly at the target position without causing vibration or impact due to excessive speed. This deceleration process helps to extend the service life of the barrier and ensure smooth operation.
[0091] Specifically, when the result of the motion state of the gate exceeds the range of the preset historical motion state result, it means that the motion of the gate has deviated from the predetermined trajectory, which is an abnormal situation caused by external disturbances, system failures, uneven friction and other factors. At this time, the system must promptly increase the correction speed to correct the deviation of the gate as soon as possible. The purpose of increasing the correction speed is to quickly restore the normal motion state of the gate and prevent the deviation from continuing to increase, causing further motion errors or failures. In specific implementation, the system will adjust the correction speed according to the current deviation and acceleration changes. For example, if the deviation value is greater than the preset threshold (such as the deviation is greater than 5mm), or the acceleration change exceeds a certain critical value (such as the acceleration is greater than 0.5m / s²), the system will determine that the gate deviation is too large and the correction speed must be increased. At this time, the system will increase the correction speed by adjusting the PID control parameters or using other algorithms (such as fuzzy control, robust control, etc.). In this way, the system can ensure that the gate is quickly corrected when a large deviation occurs, avoiding further increase in deviation or system out of control.
[0092] It should be noted that when increasing the deviation correction speed, the system will make dynamic adjustments based on the actual situation. For example, the system can set a maximum deviation correction speed. When the gate has a large deviation, the control system will increase the deviation correction speed through a dynamic adjustment algorithm. However, once the set maximum value is reached, the system will stop accelerating to prevent excessive adjustment from causing damage to the gate or too fast movement. During the acceleration process, the system will also continuously monitor the acceleration and speed of the gate to ensure that the amplitude and speed of the acceleration will not cause system instability.
[0093] S14, using an adaptive adjustment algorithm based on PID control, performing an adaptive adjustment operation according to the correction speed and the preset smoothness threshold to obtain a dynamic correction speed, including:
[0094] First, the system uses the correction speed and the preset smoothness threshold as input parameters of the PID controller. The correction speed is the result obtained by analyzing the motion state of the barrier in the aforementioned step S3, which indicates the correction speed of the current barrier. The preset smoothness threshold is a threshold pre-set according to the specific working environment and requirements of the barrier, which is used to limit the speed fluctuation range of the barrier to prevent excessive fluctuations from affecting the stability of the system. The smoothness threshold is set based on factors such as the load condition, motion friction, and control accuracy of the barrier, and is set to a value with a certain tolerance. For example, when the correction speed during the barrier correction process reaches or exceeds a certain value, the system will automatically adjust to ensure the stability and comfort of the barrier during movement.
[0095] In a specific embodiment, the correction speed and the preset smoothness threshold are adaptively adjusted by a PID controller. The PID control algorithm mainly consists of three parts: proportional (P), integral (I) and differential (D), which correspond to the instantaneous error, cumulative error and error change rate of the system respectively. During the adaptive adjustment process, the PID controller dynamically adjusts its control parameters according to the real-time feedback data to optimize the speed adjustment during the correction process.
[0096] Specifically, the PID controller first calculates the error value between the current correction speed and the preset smoothness threshold. The proportional part (P) will output a corresponding adjustment amount based on the current error value to adjust the speed of the gate. If the error is large, the P part will provide a larger adjustment amount; if the error is small, the adjustment amount will be reduced accordingly. The integral part (I) will accumulate past errors and make adjustments based on the accumulation of errors to prevent the system from having long-term small errors that cannot be corrected. The differential part (D) will predict the future error trend based on the rate of change of the error, and make forward-looking adjustments to reduce system overshoot or oscillation. The characteristic of adaptive adjustment is that the PID controller can adjust each parameter (P, I, D) in real time according to the actual situation, avoiding inflexibility and over-adjustment under fixed parameters.
[0097] For example, when the current correction speed of the gate is 5 mm / s and the preset smoothness threshold is 3 mm / s, the PID controller will calculate the current error to be 2 mm / s. The proportional part will output an adjustment amount based on this error, which is the value of reducing the current speed. The integral part will make further corrections based on the accumulated errors in the past, and the differential part will further predict future errors based on the trend of error changes to avoid large fluctuations.
[0098] In a specific embodiment, the output adjustment amount of the PID controller is transmitted to the actuator as a control signal. The actuator is composed of a motor, a driver and a control system, which act together on the movement of the gate. Here, the control signal is used to adjust the movement speed of the gate, driving the gate to perform precise speed correction according to the PID adjustment amount.
[0099] Specifically, the adjustment amount of the PID controller indicates the adjustment direction and amplitude of the gate movement. For example, when the adjustment amount indicates that deceleration is required, the actuator will reduce the speed of the gate according to the control signal. Conversely, if the adjustment amount indicates that acceleration is required, the actuator will increase the speed by increasing power. The control signal is feedback controlled through the motor drive system to ensure that the movement speed of the gate is gradually adjusted to the appropriate dynamic correction speed.
[0100] In a specific embodiment, the control accuracy and response speed of the actuator are very critical. In order to achieve precise speed regulation, the actuator drive system needs to have sufficient accuracy and real-time response capabilities. There should be a fast signal transmission and response mechanism between the actuator feedback system and the PID controller to ensure that the correction of the deviation speed is completed in a short time. For example, if the system calculates that the speed needs to be adjusted from 5 mm / s to 3 mm / s, the actuator should respond quickly and make the movement of the gate gradually and smoothly reach the target speed.
[0101] It should be noted that, through the adaptive adjustment of the above-mentioned PID control, the dynamic correction speed finally obtained can ensure that the correction process of the gate is both smooth and accurate. This dynamic correction speed not only meets the preset smoothness requirements, but also can effectively deal with various external interferences and system errors. Through real-time feedback adjustment, the system can maintain the stable operation of the gate at any time, avoiding operational errors or instability caused by excessive fluctuations or untimely corrections. For example, when a vehicle passes by on the road, it will affect the movement of the gate, causing the movement speed of the gate to fluctuate. The PID control system can respond to such external interference in a timely manner by adjusting the correction speed in real time, and adjust the movement speed of the gate to restore its stable state.
[0102] S15, based on the inertial characteristics of the gate and the machine vision accuracy, the dynamic deviation correction speed and the deviation data are input into a pre-trained gate motion control model to obtain an execution time and an execution amplitude, including:
[0103] First, historical dynamic correction speed and historical deviation data are collected through long-term running gate equipment. These historical data include but are not limited to: dynamic correction speed (for example: 5mm / s, 10mm / s, 20mm / s, etc.) and deviation data (such as: the deviation value range is 0-10mm). These data can be obtained through log files recorded in actual operation or experimental data acquisition systems. When initializing the gate motion control model, the inertial characteristics of the gate (for example, the acceleration and deceleration time of the gate is 1 to 2 seconds) are combined for modeling. For example, the model should take into account the inertia of the gate when performing an action, such as the slow response of the gate's movement, and it takes a while to fully adjust to the set position. Based on these historical data, the initial setting of the model will focus on how to smoothly control the movement of the gate while ensuring accuracy.
[0104] Specifically, after the model is initialized, the system uses the historical dynamic correction speed and deviation data as input to start the training process of the gate motion control model. In this process, the model is continuously optimized using machine learning algorithms or statistical methods, so that it can accurately calculate the execution time and execution amplitude based on the input dynamic correction speed and deviation data. Specifically, the system inputs a specific dynamic correction speed (such as 10mm / s) and deviation data (for example, 5mm deviation), and the model will calculate the most suitable execution time and amplitude based on historical data. For example, suppose that in the historical data, when the correction speed is 10mm / s, the gate takes 0.5 seconds to reach the target position, and the execution amplitude is 5mm. After a lot of training, the model will gradually optimize the calculation parameters according to these rules to ensure that the model can more accurately reflect the inertial characteristics and dynamic response of the gate.
[0105] Specifically, after model training, the system inputs the dynamic correction speed and deviation data into the barrier motion control model, and the execution time and execution amplitude are calculated through the model. These two parameters are the core factors that the barrier needs to control during the correction process. The execution time is the time required for the barrier to adjust from the current state to the target state, and the execution amplitude is the distance the barrier needs to move. For example, when the dynamic correction speed input by the system is 10mm / s and the deviation is 4mm, the model outputs an execution time of 0.4 seconds and an execution amplitude of 4mm. The execution time and execution amplitude are key control quantities to ensure the precise adjustment of the barrier, and can effectively guide the speed and position adjustment during the movement of the barrier.
[0106] It should be noted that in order to ensure the smoothness of the gate during the correction process, the system introduces a smoothness evaluation index. This index is mainly defined by machine vision accuracy to evaluate the stability of the gate during the correction process. Specifically, the smoothness evaluation index includes two main aspects, the deviation between the actual position of the gate and the target position, and the rate of change of the execution time and the execution amplitude. For example, the set smoothness evaluation standard stipulates that when the execution time exceeds 1 second, the rate of change of the execution amplitude shall not exceed 5mm / s, otherwise the movement of the gate is too violent, resulting in an unstable correction process. In this way, the system can ensure that the movement process of the gate meets the preset stability requirements, thereby avoiding excessive oscillation or jitter, and ensuring the smooth operation of the gate under various working conditions.
[0107] It should be noted that in order to further optimize the movement process of the barrier, the system adjusts the execution time and execution amplitude through the fuzzy control algorithm. The fuzzy control algorithm processes the input variables by setting a series of fuzzy rules, and then adjusts the movement state of the barrier. For example, assuming that the currently calculated execution time is 1.2 seconds and the execution amplitude is 25mm, and according to the preset smoothness evaluation index, the execution time should not exceed 1 second, and the execution amplitude should be less than 20mm. At this time, the fuzzy control algorithm will adjust the execution time and execution amplitude according to the input deviation (for example, the time deviation is 0.2 seconds and the amplitude deviation is 5mm) to ensure that both meet the preset standards. During the adjustment process, the fuzzy control algorithm will gradually adjust the output according to the size and direction of the deviation, so that the correction process of the barrier gradually tends to be smooth, avoiding sharp speed changes or excessive adjustments.
[0108] In a specific embodiment, after adjustment, the system checks again whether the execution time and execution amplitude meet the smoothness evaluation index. If the adjusted parameters meet the smoothness requirements, for example: the execution time is within 1 second and the execution amplitude is within 20 mm, the training is determined to be completed, and the trained barrier gate motion control model is considered valid and put into use. At this point, the model can automatically adjust the execution behavior of the barrier gate according to the real-time dynamic correction speed and deviation data, and ensure the accuracy and stability of the barrier gate movement. The completion of this step means that the barrier gate control system has achieved the expected accuracy and performance, and can automatically adjust the motion state according to different input data, and complete the correction task with minimal error and optimal smoothness.
[0109] S16, based on the optimization target of the deviation correction efficiency, performing an optimal deviation correction speed determination operation on the dynamic deviation correction speed in combination with the deviation data to obtain the optimal deviation correction speed, including:
[0110] First, the system uses the deviation data as input to perform dynamic analysis operations to calculate the current operating state parameters of the gate. Deviation data refers to the error value between the current position of the gate and the predetermined target position, which can be obtained from sensors or positioning devices. For example, if the current switch position of the gate deviates from the target position by 5mm, the system will input this error into the dynamic model as deviation data. Through model calculation, the dynamic characteristics of the gate (such as inertia, acceleration, speed, etc.) will be accurately calculated. In this process, the system will consider the physical characteristics of the gate, such as motor speed, acceleration and deceleration curves, etc., to calculate the current speed, acceleration, torque and other operating state parameters. The purpose of this step is to provide detailed operating data and parameter support for the subsequent optimal correction speed determination.
[0111] Specifically, based on the optimization goal of the correction efficiency and the operating state parameters obtained in step 1, the system uses the gradient descent algorithm to calculate the optimal correction speed. The gradient descent algorithm is an algorithm commonly used in optimization problems. It minimizes the error function by continuously adjusting parameters to find the best solution. In this step, the goal of the gradient descent algorithm is to adjust the correction speed so that the correction process of the gate reaches the highest efficiency. First, the system sets an initial dynamic correction speed, then calculates the error based on the speed, and updates the speed based on the gradient of the error. The core of gradient descent is to gradually approach the optimal solution by adjusting the feedback of the error. For example, when the initial dynamic correction speed is 10mm / s, and the optimal correction speed should be 9mm / s, the system will adjust the speed according to the gradient descent algorithm until the error is reduced to the minimum value, thereby obtaining the optimal correction speed. This process not only optimizes the correction speed, but also improves the response speed and accuracy of the correction.
[0112] Specifically, after calculating the optimal correction speed, the system will calculate the difference between the dynamic correction speed and the optimal correction speed. This speed difference reflects the deviation between the current correction speed and the optimal correction speed, and is a key factor in determining whether the correction speed needs to be further adjusted. If the speed difference is small, it means that the current dynamic correction speed is close enough to the optimal correction speed and the next step can be performed; if the speed difference is large, it means that the correction speed needs to be further adjusted to get closer to the optimal value. For example, if the currently calculated dynamic correction speed is 9.5mm / s, and the optimal correction speed should be 9mm / s, then the speed difference is 0.5mm / s. If this difference exceeds the preset threshold, the system will make further adjustments to the correction speed.
[0113] In a specific embodiment, when the calculated speed difference is less than the preset difference threshold, the system determines the dynamic correction speed as the optimal correction speed, and the correction process ends. The size of the preset difference threshold directly affects the accuracy and optimization efficiency of the correction speed. The difference threshold can be set according to the inertial characteristics, application scenarios and accuracy requirements of the gate. For example, for high-precision correction requirements, the difference threshold can be set to 0.1mm / s; for lower-precision applications, the difference threshold can be set to 1mm / s. The specific setting of the preset difference threshold is determined according to actual needs, and is optimized through experimental data and empirical rules to ensure that the correction speed can stabilize at the optimal value within a reasonable time. For example, when the difference threshold is set to 0.5mm / s, when the difference between the calculated dynamic correction speed and the optimal correction speed is less than 0.5mm / s, the system will determine that the current dynamic correction speed is the optimal correction speed and complete the correction process.
[0114] In a specific embodiment, when the speed difference is greater than a preset difference threshold, the system will superimpose the current speed difference with the dynamic correction speed to obtain a new correction speed. The purpose of this operation is to quickly narrow the gap between the dynamic correction speed and the optimal correction speed by accelerating or decelerating. In specific implementation, the system will adjust the correction speed by taking corresponding addition and subtraction operations according to the size of the speed difference. For example, if the current dynamic correction speed is 9.5mm / s and the speed difference is 0.7mm / s, the system will adjust the dynamic correction speed to 9.8mm / s, or reversely adjust it to 9.2mm / s. The specific adjustment range is determined according to the algorithm rules and the system response speed. Through superimposed adjustment, the system can respond quickly, narrow the gap with the optimal correction speed, and thus optimize the correction efficiency.
[0115] It should be noted that the setting of the preset difference threshold is crucial to the entire correction process. If the threshold is too small, the system will frequently adjust the speed and increase the calculation burden, while if the threshold is too large, the correction process will be too slow and the correction efficiency will be reduced. The preset difference threshold should be set according to the motion characteristics of the gate, the target accuracy, and the responsiveness of the system. For example, in a high-precision application, the threshold can be set to 0.2mm / s, while in an environment with lower accuracy requirements, it can be set to 1mm / s. Through the feedback of experimental data, the difference threshold is adjusted to the optimal range to achieve the best correction efficiency.
[0116] S17, judging the completion of the correction process according to the deviation data, the optimal correction speed, the execution time and the execution amplitude in combination with the smoothness threshold, obtaining a judgment result, and ending the correction process or re-executing steps S12 to S17 according to the judgment result, including:
[0117] First, the system obtains information such as deviation data, optimal correction speed, execution time, and execution amplitude, and combines it with the smoothness threshold to determine the completion of the correction. The deviation data reflects the deviation between the current and target positions of the gate. The optimal correction speed is the ideal correction speed calculated through the previous steps. The execution time indicates the duration of the correction process. The execution amplitude is the actual amount of the gate deviation. The smoothness threshold is a reference value for judging whether the movement is smooth. For example, the smoothness threshold is set to 0.2mm / s. When the changes in the deviation data and the execution amplitude exceed this value, it means that the current movement is not smooth enough and the correction has not been completed. At this point, the system will continue to adjust the dynamic control parameters to ensure that the gate completes the correction process under optimal conditions. If these parameters indicate that the gate is close to the target position and the movement is smooth, the system can decide to end the correction process.
[0118] In a specific embodiment, when the execution time during the correction process exceeds the preset maximum allowed time, the system will decide whether to adjust the execution time based on the real-time deviation data and the correction progress. At this time, the system will adjust the time to ensure that the gate can complete the correction within a reasonable time range to avoid excessive deviation due to insufficient time.
[0119] Specifically, assuming that the maximum allowed time is set to 30 seconds, if the system detects that the correction process has exceeded this time but has not been completed, the system will start the time adjustment operation, re-evaluate the deviation data, and calculate the additional time required. For example, if the current deviation is 50mm, the system will dynamically adjust the remaining time according to the size and speed of the deviation to ensure that the gate can stably reach the target position.
[0120] It should be noted that if the execution amplitude of the gate exceeds the preset maximum allowable amplitude during the correction process, the system will start the adjustment amplitude operation. The main goal of this operation is to avoid excessive deviation of the gate, which may lead to over-correction or unstable results. The system will determine whether the execution amplitude needs to be reduced based on the real-time deviation and execution amplitude data. For example, if the set maximum allowable amplitude is 100mm, if the system detects that the actual amplitude of the gate reaches 110mm, it is necessary to slow down the correction speed through the control system, reduce the execution amplitude, and ensure that the gate is smoothly adjusted to the target position.
[0121] In a specific embodiment, the system uses an optimization algorithm to determine the objective function of the correction efficiency. The design of the objective function not only considers the minimization of the deviation data, but also needs to comprehensively consider the execution time, amplitude and stability of the motion state of the correction. By solving the objective function, the system can determine the optimal correction parameters according to the stability of the motion state and the size of the deviation. For example, the objective function is set to "minimize the weighted sum of deviation and execution time", and the motion stability is set as a constraint. The optimization algorithm will combine multiple indicators such as deviation, execution time, execution amplitude, etc. to calculate an optimal control strategy to ensure that the gate completes the adjustment in the least time and amplitude and remains stable.
[0122] It should be noted that in the process of deviation correction, mutation detection is an important step to ensure the stability of the system. The system monitors the optimal deviation correction speed in real time to detect whether there is a drastic change (i.e. mutation). Mutations can cause the gate to move unsteadily, resulting in substandard accuracy or abnormalities. If a mutation is detected, the system will activate the corresponding mutation suppression mechanism. For example, if the mutation threshold is set to 5mm / s, when the optimal deviation correction speed changes drastically (such as a rapid change from 5mm / s to 20mm / s), the system immediately determines it as a mutation and triggers the mutation suppression operation.
[0123] Specifically, if the system detects a sudden change in the optimal deviation correction speed, the system will perform a sudden change suppression operation. This operation includes Kalman filter smoothing, PID control algorithm to adjust the deviation correction speed and jitter suppression operation. The Kalman filter algorithm is used to smooth the optimal deviation correction speed. The algorithm can effectively extract the real signal of the movement from the noise, smooth the speed curve, and eliminate the impact of sudden changes. Through smoothing, the system can generate a smooth motion speed curve to reduce the instability caused by sudden changes. Based on the speed curve after Kalman filtering, the PID (proportional-integral-differential) control algorithm is used to adjust the deviation correction speed. The PID algorithm dynamically adjusts the proportional, integral and differential parameters to make the deviation correction speed smoother and avoid overreaction or instability caused by sudden changes. Based on the adjusted smooth speed curve, feedback is given to the motion control system to suppress jitter. This operation is intended to reduce the motion vibration caused by sudden change suppression and ensure the smoothness of the gate movement process. For example, when the system finds that the optimal correction speed suddenly increases from 5mm / s to 15mm / s, it first smoothes the mutation through Kalman filtering, and then uses PID control to adjust the correction speed, ultimately achieving smooth movement and eliminating jitter.
[0124] In a specific embodiment, when the system detects that the optimal correction speed has not changed suddenly, the system will continue to perform real-time correction operations according to the optimal correction speed, execution time and execution amplitude. At this time, the system will accurately adjust the movement of the gate according to these control parameters calculated in real time to ensure that the correction process is completed efficiently and stably. For example, if the optimal correction speed is 5mm / s, the execution time is 20 seconds, and the execution amplitude is 100mm, the system will continue to adjust the gate rod position according to these parameters to ensure that the gate reaches the target position accurately and moves smoothly.
[0125] In a specific embodiment, when the position of the barrier reaches the preset target and the deviation from the target position is within the tolerance range, the system determines that the correction process has been completed and enters the end stage. At this stage, the system will confirm that the target has been reached and stop further correction operations. For example, the target position is set to 100mm and the tolerance error is 0.5mm. If the position of the barrier is 99.8mm, the system considers that the correction has been completed and ends the correction process.
[0126] It should be noted that if after the correction is completed, the system finds that the position of the gate has not reached the target position or the deviation exceeds the preset tolerance range, the system will re-execute steps 2 to 7 and continue to adjust the correction process. This process will continue until the correction result meets the expected goal. For example, if the target position of the gate is 100mm and the actual position is 99.2mm, the system will consider the correction incomplete and restart the correction operation until the gate reaches the target position accurately.
[0127] Reference Figure 2 The second embodiment of the present invention provides a gate deviation correction system based on machine vision, comprising:
[0128] A data acquisition module is used to obtain the gate pole position deviation data and acceleration in real time through a machine vision system;
[0129] A deviation correction speed calculation module, used for comparing the deviation data with a preset smoothness threshold, and when the deviation data is greater than the smoothness threshold, performing calculation based on the inertia characteristics of the gate combined with the deviation data to obtain an initial deviation correction speed;
[0130] A motion state analysis module performs a gate motion state analysis operation on the initial deviation correction speed based on a dynamic model combined with the deviation data and the acceleration to obtain a deviation correction speed;
[0131] A speed adjustment module, configured to adopt an adaptive adjustment algorithm based on PID control, perform an adaptive adjustment operation according to the deviation correction speed and the preset smoothness threshold, and obtain a dynamic deviation correction speed;
[0132] A training model module is used to input the dynamic correction speed and the deviation data into a pre-trained barrier motion control model based on the barrier inertia characteristics and machine vision accuracy to obtain an execution time and an execution amplitude;
[0133] An optimal speed module, used for performing an optimal correction speed determination operation on the dynamic correction speed based on the correction efficiency optimization target and in combination with the deviation data to obtain an optimal correction speed;
[0134] The correction process judgment module is used to perform a correction process completion judgment operation based on the deviation data, the optimal correction speed, the execution time and the execution amplitude combined with a smoothness threshold, obtain a judgment result, and end the correction process or return to the correction speed calculation module based on the judgment result.
[0135] It should be noted that the barrier correction system based on machine vision provided in an embodiment of the present invention is used to execute all the process steps of the barrier correction method based on machine vision in the above-mentioned embodiment. The working principles and beneficial effects of the two correspond one to one, and thus will not be elaborated on.
[0136] The embodiment of the present invention further provides an electronic device. The electronic device includes: a processor, a memory, and a computer program stored in the memory and executable on the processor, such as a speed adjustment program. When the processor executes the computer program, the steps in the above-mentioned embodiments of the gate deviation correction method based on machine vision are implemented, such as Figure 1Alternatively, when the processor executes the computer program, the functions of the modules / units in the above-mentioned device embodiments are realized, such as the deviation correction process determination module.
[0137] Exemplarily, the computer program may be divided into one or more modules / units, which are stored in the memory and executed by the processor to implement the present invention. The one or more modules / units may be a series of computer program instruction segments capable of implementing specific functions, which are used to describe the execution process of the computer program in the electronic device.
[0138] The electronic device may be a computing device such as a desktop computer, a notebook, a PDA, and a smart tablet. The electronic device may include, but is not limited to, a processor and a memory. Those skilled in the art will appreciate that the above components are merely examples of electronic devices and do not constitute a limitation on the electronic device. The electronic device may include more or fewer components than the above components, or may combine certain components, or different components. For example, the electronic device may also include input and output devices, network access devices, buses, etc.
[0139] The processor may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the electronic device, and uses various interfaces and lines to connect various parts of the entire electronic device.
[0140] The memory can be used to store the computer program and / or module, and the processor realizes various functions of the electronic device by running or executing the computer program and / or module stored in the memory, and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory can include a high-speed random access memory, and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0141] Wherein, if the module / unit integrated in the electronic device is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Wherein, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0142] It should be noted that the device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, in the accompanying drawings of the device embodiments provided by the present invention, the connection relationship between the modules indicates that there is a communication connection between them, which may be specifically implemented as one or more communication buses or signal lines. A person of ordinary skill in the art may understand and implement it without paying any creative effort.
[0143] The specific embodiments described above further illustrate the purpose, technical solutions and beneficial effects of the present invention. It should be understood that the above description is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. It is particularly pointed out that for those skilled in the art, any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of protection of the present invention.
Claims
1. A gate deviation correction method based on machine vision, characterized in that: The method comprises: S11, obtaining the gate pole position deviation data and acceleration in real time through the machine vision system; S12, comparing the deviation data with a preset smoothness threshold, and when the deviation data is greater than the smoothness threshold, calculating based on the inertia characteristics of the gate combined with the deviation data to obtain an initial deviation correction speed; S13, performing a gate motion state analysis operation on the initial deviation correction speed based on a dynamic model combined with the deviation data and the acceleration to obtain a deviation correction speed; S14, using an adaptive adjustment algorithm based on PID control, performing an adaptive adjustment operation according to the correction speed and the preset smoothness threshold, to obtain a dynamic correction speed; S15, based on the inertial characteristics of the barrier and the machine vision accuracy, the dynamic deviation correction speed and the deviation data are input into a pre-trained barrier motion control model to obtain an execution time and an execution amplitude; S16, based on the optimization target of the deviation correction efficiency, performing an optimal deviation correction speed determination operation on the dynamic deviation correction speed in combination with the deviation data to obtain an optimal deviation correction speed; S17, based on the deviation data, the optimal deviation correction speed, the execution time and the execution amplitude combined with the smoothness threshold, perform a deviation correction process completion status judgment operation to obtain a judgment result, and end the deviation correction process or re-execute steps S12-S17 based on the judgment result.
2. The method according to claim 1, characterized in that: The calculation formula of the initial deviation correction speed is: In the formula, is the initial correction speed; is the absolute value of the deviation data; is the mass of the barrier pole; is the proportionality coefficient.
3. The method according to claim 1, characterized in that The method of performing a gate motion state analysis operation on the initial deviation correction speed based on the dynamic model in combination with the deviation data and the acceleration to obtain the deviation correction speed includes: Based on the dynamic model, the motion state of the gate is analyzed in combination with the deviation data, the initial deviation correction speed and the acceleration to obtain the motion state result of the gate; Comparing the gate motion state result with the preset historical motion state result; When the gate motion state result is within the preset historical motion state result range, a correction speed reduction operation is performed to obtain a correction speed; When the gate movement state result exceeds the preset historical movement state result range, the correction speed is increased to obtain the correction speed.
4. The method according to claim 1, characterized in that The adaptive adjustment algorithm based on PID control is used to perform an adaptive adjustment operation according to the correction speed and the preset smoothness threshold to obtain a dynamic correction speed, including: The deviation correction speed and the preset smoothness threshold are used as input parameters of a controller of an adaptive adjustment algorithm based on PID control, and a PID control adjustment amount is obtained through adaptive adjustment of the controller; The PID control adjustment amount is used as a control signal of the actuator to drive the actuator to perform a speed correction operation to obtain a dynamic correction speed.
5. The method according to claim 1, characterized in that: The training process of the gate motion control model is as follows: Obtain historical dynamic correction speed and historical deviation data; Based on the inertia characteristics of the barrier, an initial barrier motion control model is constructed, and the initial barrier motion control model is trained based on the dynamic correction speed and the deviation data as input data to obtain a trained barrier motion control model.
6. The method according to claim 5, characterized in that The initial barrier motion control model is constructed based on the barrier inertia characteristics, and the initial barrier motion control model is trained based on the dynamic deviation correction speed and the deviation data as input data to obtain a trained barrier motion control model, including: Initializing the dynamic correction speed and deviation data in the gate motion control model; Calculate the execution time and the execution amplitude; Based on the machine vision accuracy, a smoothness evaluation index is set, and a fuzzy control algorithm is used to adjust the execution time and the execution amplitude; When the execution time and the execution amplitude meet the smoothness evaluation index, the training is determined to be completed, and a trained gate motion control model is obtained.
7. The method according to claim 1, characterized in that The optimal correction speed determination operation is performed on the dynamic correction speed based on the correction efficiency optimization target in combination with the deviation data to obtain the optimal correction speed, including: According to the deviation data, a dynamic analysis operation is performed to obtain operating state parameters; Based on the optimization target of the deviation correction efficiency and the operating state parameters, the optimal deviation correction speed is calculated by using a gradient descent algorithm; Calculating the difference between the dynamic deviation correction speed and the optimal deviation correction speed to obtain a speed difference; When the speed difference is less than a preset difference threshold, the dynamic deviation correction speed is determined as the optimal deviation correction speed; When the speed difference is greater than a preset difference threshold, the speed difference is superimposed on the dynamic deviation correction speed to obtain a new deviation correction speed, and the new deviation correction speed is determined as the optimal deviation correction speed.
8. The method according to claim 1, characterized in that: The operation of judging the completion of the correction process is performed according to the deviation data, the optimal correction speed, the execution time and the execution amplitude in combination with the smoothness threshold, and a judgment result is obtained. The correction process is terminated or steps S12 to S17 are re-executed according to the judgment result, including: When the execution time exceeds the maximum allowed time, an adjustment time operation is performed to obtain an adjusted execution time; When the execution range exceeds the maximum allowable range, an adjustment range operation is performed to obtain an adjusted execution range; Determine the correction efficiency objective function based on the optimization algorithm, solve the deviation data in combination with the motion state stability as constraint conditions, and obtain the optimal correction control parameters; Performing a mutation detection operation on the optimal deviation correction speed; When a sudden change occurs in the optimal deviation correction speed, a sudden change suppression operation is performed to obtain an adjusted deviation correction speed, and a real-time deviation correction operation of the gate pole position is performed according to the optimal deviation correction control parameters, the adjusted deviation correction speed, the adjusted execution time and the adjusted execution amplitude to obtain a deviation correction completion result; When the optimal deviation correction speed does not suddenly change, the gate pole position is corrected in real time according to the optimal deviation correction control parameters, the optimal deviation correction speed, the adjustment execution time and the adjustment execution amplitude to obtain a deviation correction completion result; When the correction result meets the target correction result, the correction process ends; When the correction result does not meet the target correction result, step S12 to step S17 are executed again.
9. The method according to claim 8, characterized in that When the optimal deviation correction speed suddenly changes, performing a sudden change suppression operation to adjust the deviation correction speed includes: Based on the Kalman filter algorithm, a smoothing operation is performed on the optimal deviation correction speed to obtain a smooth motion speed curve; Based on the PID control algorithm, according to the smooth motion speed curve, the deviation correction speed adjustment operation is performed to obtain a stable deviation correction speed; The stable deviation correction speed is fed back to the motion control system, and a vibration suppression operation is performed on the stable deviation correction speed to obtain an adjusted deviation correction speed.
10. The gate correction system based on machine vision is characterized by: The system comprises: A data acquisition module is used to obtain the gate pole position deviation data and acceleration in real time through a machine vision system; A deviation correction speed calculation module, used for comparing the deviation data with a preset smoothness threshold, and when the deviation data is greater than the smoothness threshold, performing calculation based on the inertia characteristics of the gate combined with the deviation data to obtain an initial deviation correction speed; A motion state analysis module performs a gate motion state analysis operation on the initial deviation correction speed based on a dynamic model combined with the deviation data and the acceleration to obtain a deviation correction speed; A speed adjustment module, configured to adopt an adaptive adjustment algorithm based on PID control, perform an adaptive adjustment operation according to the deviation correction speed and the preset smoothness threshold, and obtain a dynamic deviation correction speed; A training model module is used to input the dynamic correction speed and the deviation data into a pre-trained barrier motion control model based on the barrier inertia characteristics and machine vision accuracy to obtain an execution time and an execution amplitude; An optimal speed module, used for performing an optimal correction speed determination operation on the dynamic correction speed based on the correction efficiency optimization target and in combination with the deviation data to obtain an optimal correction speed; The correction process judgment module is used to perform a correction process completion judgment operation based on the deviation data, the optimal correction speed, the execution time and the execution amplitude combined with a smoothness threshold, obtain a judgment result, and end the correction process or return to the correction speed calculation module based on the judgment result.
Citation Information
Patent Citations
Paper-plastic composite bag differential deviation rectifying method and system based on visual positioning
CN112079154A
Patrol camera preset position automatic deviation correction technology based on image recognition and fuzzy PID (Proportion Integration Differentiation) control
CN118055221A