Dynamic adaptive adjustment method, system, device and medium for camera usb communication

By dynamically and adaptively adjusting the camera's frame rate and resolution, the problem of insufficient data transmission in USB industrial cameras when bandwidth changes is solved, achieving efficient bandwidth utilization and improved detection efficiency.

CN122138034APending Publication Date: 2026-06-02HEFEI I TEK OPTOELECTRONICS CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HEFEI I TEK OPTOELECTRONICS CO LTD
Filing Date
2026-02-24
Publication Date
2026-06-02

Smart Images

  • Figure CN122138034A_ABST
    Figure CN122138034A_ABST
Patent Text Reader

Abstract

This application discloses a dynamic adaptive adjustment method, system, device, and medium for camera USB communication, relating to the field of machine vision. The method includes: acquiring the real-time available communication bandwidth of the camera; calculating the parameter information corresponding to the maximum value of an objective function based on a preset parameter search algorithm, using this as the target parameter; and adjusting the camera's frame rate and resolution according to the target parameter. Based on the aforementioned processing, by using a parameter search algorithm to detect camera bandwidth, the optimal resolution and frame rate of the objective function are calculated, and an efficient dynamic parameter adjustment method is designed, which can maximize bandwidth utilization while ensuring image quality. Therefore, dynamic adaptive adjustment of the camera's resolution and frame rate is achieved, which can fully utilize communication bandwidth while avoiding frame loss, thereby improving the camera's detection efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of machine vision, and particularly relates to a dynamic adaptive adjustment method, system, device and medium for camera USB communication. Background Technology

[0002] USB industrial cameras, as core equipment for industrial automation inspection, are widely used in various fields such as electronics manufacturing, automobile assembly, and food and pharmaceutical testing. With the advancement of Industry 4.0, the performance requirements for industrial cameras are constantly increasing, including higher resolution, faster frame rates, and more stable data transmission.

[0003] Currently, mainstream USB industrial cameras use the USB 3.0 / 3.1 / 3.2 standards, with theoretical bandwidths of 5Gbps, 10Gbps, and 20Gbps respectively. However, in practical applications, existing USB industrial cameras typically use fixed frame rates and resolutions, unable to dynamically adjust according to actual bandwidth conditions, and data transfer rates need further improvement.

[0004] For example, the USB 3.0 CMOS line scan industrial camera disclosed in Chinese patent CN106454023B automatically enumerates USB 2.0 and USB 3.0 devices after powering on, and sets a fixed transmission bandwidth of 5Gb / s or 480Mb / s based on the enumeration results. Although this solution can adapt to different USB standards, it cannot be dynamically adjusted once configured.

[0005] International patent application WO2022007300A2 proposes a frame rate control method that determines the target transmission bitstream by obtaining the packet loss rate at the current moment, and then determines the target sampling frame rate based on the sampling frame rate and the encoding bit rate. This method is mainly aimed at network transmission scenarios and does not adequately consider the special requirements of USB local communication.

[0006] For scenarios involving multiple USB cameras, Chinese patent CN115118601A proposes a transmission bandwidth allocation method. When a new USB camera is detected, the method obtains the camera's transmission bandwidth requirement and determines whether the remaining USB bus bandwidth meets the requirement. If not, it reduces the image acquisition parameters. While the aforementioned solution primarily addresses bandwidth allocation when multiple devices are connected, it lacks real-time dynamic adjustment capabilities. Summary of the Invention

[0007] This application proposes a dynamic adaptive adjustment method, system, device, and medium for camera USB communication, which is used to dynamically adjust the communication bandwidth of a USB industrial camera to improve data transmission efficiency.

[0008] To achieve the above objectives, this application proposes the following technical solutions: In a first aspect of this application, a dynamic adaptive adjustment method for camera USB communication is provided, including... Obtain the camera's real-time available communication bandwidth; Based on a preset parameter search algorithm, the parameter information corresponding to the maximum value of the objective function is calculated and used as the objective parameter; The parameter search algorithm includes a greedy algorithm or a genetic algorithm; the parameter information includes resolution and frame rate; the objective function is S = W1 × Q + W2 × A; S represents the function value; W1 represents the first weight coefficient; Q represents the image quality score, determined by the resolution; W2 represents the second weight coefficient; A represents the real-time score, determined by the frame rate; 0 < W1 < 1, 0 < W2 < 1, and W1 + W2 = 1; the constraints of the parameter search algorithm include: a pre-calibrated relationship model between communication bandwidth, frame rate, and resolution; the communication bandwidth does not exceed a preset bandwidth threshold, and the bandwidth threshold is obtained by multiplying the camera bandwidth by a preset coefficient, where the preset coefficient is a positive number not exceeding 1; the frame rate is not lower than a preset frame rate threshold; and the resolution is not lower than a preset resolution threshold. Adjust the camera's frame rate and resolution according to the target parameters.

[0009] Optionally, the relationship model between communication bandwidth and frame rate and resolution is obtained through pre-calibration and is B=α×f(F,R); Where B represents the communication bandwidth; F represents the frame rate; R represents the resolution; f(F,R) represents the theoretical bandwidth under the frame rate F and resolution R; and α represents the correction coefficient obtained through pre-training.

[0010] Optionally, obtaining the real-time available communication bandwidth of the USB industrial camera includes: The camera's communication bandwidth is obtained based on a preset time period; After acquiring the camera's communication bandwidth, the dynamic adaptive adjustment method further includes: Determine whether the difference between the current communication bandwidth and the previous communication bandwidth exceeds the preset fluctuation threshold; if yes, calculate the target parameter; if no, retain the current parameter information.

[0011] Optionally, before obtaining the camera's real-time available communication bandwidth, the following may also be included: Monitor whether the USB industrial camera is experiencing frame drops; if so, obtain the camera's real-time available communication bandwidth; if not, maintain the monitoring status.

[0012] Optionally, the first and second weighting coefficients of the objective function are numerically adjusted according to the application scenario of the camera; Specifically, if the detection accuracy requirement of the application scenario is higher than the preset accuracy threshold, the first weighting coefficient is increased; if the data transmission real-time requirement of the application scenario is higher than the preset transmission threshold, the second weighting coefficient is increased; the accuracy threshold and the transmission threshold are preset according to the type of application scenario.

[0013] Optionally, the camera's frame rate and resolution can be adjusted based on target parameters, including: The original frame rate and resolution of the camera are gradually adjusted according to the preset parameter step size or proportionally to form the frame rate and resolution of the target parameters.

[0014] Optionally, adjusting the camera's frame rate and resolution based on target parameters also includes: The camera's frame rate and resolution are adjusted sequentially, from largest to smallest, according to the weighting coefficients.

[0015] In a second aspect of this application, a dynamic adaptive adjustment system for camera USB communication is provided, including... The bandwidth acquisition module is used to acquire the real-time available communication bandwidth of the camera according to a preset clock cycle or when frame loss is detected. The parameter calculation module is used to calculate the parameter information corresponding to the maximum value of the objective function based on a preset parameter search algorithm, and use it as the target parameter. The parameter search algorithm includes a greedy algorithm or a genetic algorithm; the parameter information includes resolution and frame rate; the objective function is S = W1 × Q + W2 × A; S represents the function value; W1 represents the first weight coefficient; Q represents the image quality score, determined by the resolution; W2 represents the second weight coefficient; A represents the real-time score, determined by the frame rate; 0 < W1 < 1, 0 < W2 < 1, and W1 + W2 = 1; the constraints of the parameter search algorithm include: a pre-calibrated relationship model between communication bandwidth, frame rate, and resolution; the communication bandwidth does not exceed a preset bandwidth threshold, and the bandwidth threshold is obtained by multiplying the camera bandwidth by a preset coefficient, where the preset coefficient is a positive number not exceeding 1; the frame rate is not lower than a preset frame rate threshold; and the resolution is not lower than a preset resolution threshold. The parameter adjustment module is used to adjust the camera's frame rate and resolution according to the target parameters.

[0016] In a third aspect of this application, an electronic device is provided, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus. Memory, used to store computer programs; When a processor executes a program stored in memory, it implements the dynamic adaptive adjustment method described in any of the first aspects.

[0017] In a fourth aspect of this application, a computer-readable storage medium is provided, wherein a computer program is stored therein, and when the computer program is executed by a processor, it implements the dynamic adaptive adjustment method described in any of the first aspects.

[0018] The beneficial effects of this application are as follows: This application provides a dynamic adaptive adjustment method for camera USB communication, including obtaining the camera's real-time available communication bandwidth; calculating the parameter information corresponding to the maximum value of the objective function based on a preset parameter search algorithm, and using it as the objective parameter; and adjusting the camera's frame rate and resolution according to the objective parameter.

[0019] The parameter search algorithm includes a greedy algorithm or a genetic algorithm; the parameter information includes resolution and frame rate; the objective function is S = W1 × Q + W2 × A; S represents the function value; W1 represents the first weight coefficient; Q represents the image quality score, determined by the resolution; W2 represents the second weight coefficient; A represents the real-time score, determined by the frame rate; 0 < W1 < 1, 0 < W2 < 1, and W1 + W2 = 1; the constraints of the parameter search algorithm include: a pre-calibrated relationship model between communication bandwidth, frame rate, and resolution; the communication bandwidth does not exceed a preset bandwidth threshold, and the bandwidth threshold is obtained by multiplying the camera bandwidth by a preset coefficient, where the preset coefficient is a positive number not exceeding 1; the frame rate is not lower than a preset frame rate threshold; and the resolution is not lower than a preset resolution threshold.

[0020] Based on the above processing, this application provides a dynamic adaptive adjustment scheme for camera USB communication. By using a parameter search algorithm to detect camera bandwidth, the optimal resolution and frame rate of the objective function are calculated. An efficient dynamic parameter adjustment method is designed to maximize bandwidth utilization while ensuring image quality. Thus, dynamic adaptive adjustment of the camera's resolution and frame rate can be achieved, fully utilizing communication bandwidth while avoiding frame loss and improving camera detection efficiency. Attached Figure Description

[0021] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings: Figure 1 This is a flowchart illustrating a dynamic adaptive adjustment method provided in this application; Figure 2 This is a schematic diagram of the structure of a dynamic adaptive adjustment system provided in this application; Figure 3 This is a structural diagram of an electronic device provided in this application. Detailed Implementation

[0022] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are some embodiments of this application, but not all embodiments.

[0023] In camera communication transmission, existing technologies typically rely on static bandwidth detection during device enumeration, which cannot monitor bandwidth changes in real time during actual transmission. When system load changes or other devices consume bandwidth, the camera cannot detect and adjust parameters in a timely manner, thus requiring further improvement in data transmission rate.

[0024] Taking Chinese patent CN106454023B as an example, it mainly involves automatic identification of USB interface versions and fixed bandwidth configuration to solve basic interface compatibility issues, but lacks dynamic adjustment capabilities. Chinese patent CN115118601A solves the initial bandwidth allocation problem when multiple devices are connected, focusing on resource allocation strategies during device access rather than dynamic optimization during operation. It is evident that existing patents have not yet solved how to achieve dynamic adaptive adjustment based on real-time bandwidth detection in USB industrial camera communication scenarios.

[0025] To address the aforementioned problems, this application provides a dynamic adaptive adjustment method for camera USB communication, such as... Figure 1 As shown, the dynamic adaptive adjustment method includes the following steps: S1. Obtain the camera's real-time available communication bandwidth.

[0026] Specifically, the camera bandwidth is obtained based on a preset bandwidth detection strategy. This bandwidth detection strategy includes: calling API functions, transmitting test data packets, and reading camera port information.

[0027] S2. Based on the preset parameter search algorithm, calculate the parameter information corresponding to the maximum value of the objective function, and use it as the objective parameter.

[0028] The parameter search algorithm includes a greedy algorithm or a genetic algorithm; the parameter information includes resolution and frame rate; the objective function is S = W1 × Q + W2 × A; S represents the function value; W1 represents the first weight coefficient; Q represents the image quality score, determined by the resolution; W2 represents the second weight coefficient; A represents the real-time score, determined by the frame rate; 0 < W1 < 1, 0 < W2 < 1, and W1 + W2 = 1; the constraints of the parameter search algorithm include: a pre-calibrated relationship model between communication bandwidth, frame rate, and resolution; the communication bandwidth does not exceed a preset bandwidth threshold, and the bandwidth threshold is obtained by multiplying the camera bandwidth by a preset coefficient, where the preset coefficient is a positive number not exceeding 1; the frame rate is not lower than a preset frame rate threshold; and the resolution is not lower than a preset resolution threshold.

[0029] S3. Adjust the camera's frame rate and resolution according to the target parameters.

[0030] Based on the above processing, this application provides a dynamic adaptive adjustment scheme for camera communication bandwidth. By using a parameter search algorithm to detect camera bandwidth, the optimal resolution and frame rate for the objective function are calculated. An efficient dynamic parameter adjustment method is designed to maximize bandwidth utilization while ensuring image quality. Thus, dynamic adaptive adjustment of the camera's resolution and frame rate can be achieved, improving camera detection efficiency while avoiding frame loss.

[0031] Regarding step S1, this application can identify the actual available bandwidth under different host environments by real-time detection of camera communication bandwidth.

[0032] The strategy for calling API (Application Programming Interface) functions can be as follows: Utilize the standard interfaces provided by the USB protocol stack to obtain bus status information, including the current connection speed (USB 2.0 / 3.0 / 3.1 / 3.2), bus load rate, and remaining bandwidth. In practice, the camera bandwidth is obtained by periodically querying the real-time bus status by calling the API functions provided by the USB host controller driver.

[0033] The strategy for transmitting test data packets can be to measure the actual transmission rate (i.e., camera bandwidth) by sending test data packets of a specific format. Specifically, this includes sending fixed-size data blocks (e.g., 1MB) and recording the transmission time to calculate the instantaneous camera bandwidth. Alternatively, multiple sets of data blocks can be sent continuously, and the average rate within a sliding window can be used as the camera bandwidth. Furthermore, transmission delay and jitter can be detected by analyzing the arrival time intervals of the test data packets.

[0034] Reading camera ports can be described as follows: For cameras that support multiple USB interfaces, time-division multiplexing or parallel probing methods can be used to directly probe the bandwidth of multiple ports to ensure that normal data transmission is not affected. The probe results can include not only the camera bandwidth of each port, but also latency characteristics, stability indicators, etc.

[0035] In some embodiments, the bandwidth detection strategy in step S1 can also be replaced by the following detection method. Specifically, A detection method based on deep analysis of the USB protocol stack: Unlike standard API calls, this approach directly obtains bandwidth usage from the protocol layer by deeply analyzing the underlying data packets of the USB protocol stack. In practice, hook functions can be added to the USB host controller driver to intercept and analyze the transmission timestamps and data lengths of all USB data packets, and calculate the actual bandwidth utilization through statistical analysis. This method offers higher detection accuracy and can detect low-level transmission details that standard APIs cannot access.

[0036] Direct measurement based on hardware performance counters: This method utilizes the performance counters built into modern CPUs and USB controllers to directly read the clock cycles and data volume information of USB transmissions. For example, the PMU (Performance Monitoring Unit) of Intel processors can record the number of occurrences of specific events, including the number of USB transactions and the number of bytes transferred. By periodically reading the values ​​of these counters, USB bandwidth usage can be accurately calculated. This method offers extremely high measurement accuracy, but it is dependent on specific hardware platforms. The counter interfaces are not standardized across different CPU architectures, requiring the development of corresponding drivers for each platform.

[0037] Indirect measurement method based on network traffic analysis: By drawing on the technical ideas of network traffic analysis, specific tagging information is embedded in USB data packets. At the data receiving end, the arrival time interval and packet size distribution of data packets are analyzed to indirectly deduce the actual transmission bandwidth.

[0038] Step S1 may include the following: The communication bandwidth of the USB industrial camera is obtained based on a preset time period.

[0039] After acquiring the camera's communication bandwidth, the dynamic adaptive adjustment method further includes: Determine whether the difference between the current communication bandwidth and the previous communication bandwidth exceeds the preset fluctuation threshold; if yes, calculate the target parameter; if no, retain the current parameter information.

[0040] In one implementation, this application can also acquire the communication bandwidth after detecting frame loss from the camera. Specifically, before step S1, this application may further include: Monitor whether the USB industrial camera is experiencing frame drops; if so, obtain the real-time available communication bandwidth of the USB industrial camera; if not, maintain the monitoring status.

[0041] For step S2, the relationship model between communication bandwidth, frame rate, and resolution is pre-calibrated and is B=α×f(F,R). Where B represents the communication bandwidth; F represents the frame rate; R represents the resolution; f(F, R) represents the theoretical bandwidth under the frame rate F and resolution R; and α represents the correction coefficient obtained through pre-training.

[0042] The relational model is calibrated using pre-acquired experimental data, thereby establishing a parameter mapping table between bandwidth, frame rate, and resolution for different cameras. The pre-calibration process can be summarized as follows: With the camera's operating mode fixed (pixel format, compression mode, etc.), the actual bandwidth B is measured under different combinations of resolution R and frame rate F. After acquiring multiple data points, the parameters within the relational model are estimated using the least squares method. Subsequently, the root mean square error and coefficient of determination of the relational model are calculated to determine the goodness of fit, thus obtaining the final relational model.

[0043] Furthermore, the value of the correction coefficient α can be determined based on factors such as coding efficiency and protocol overhead. It is obtained through fitting and training with a large amount of experimental data, thereby establishing a parameter mapping table for different camera models.

[0044] Existing dynamic adaptive adjustment methods are mainly based on packet loss rate or simple parameter reduction, lacking comprehensive optimization of the three-dimensional relationship between bandwidth, frame rate, and resolution. For example, when bandwidth is insufficient, they usually just reduce the frame rate or resolution without considering the optimal parameter combination for different application scenarios.

[0045] In this application, the first and second weighting coefficients of the objective function are numerically adjusted according to the application scenario of the camera.

[0046] Specifically, if the detection accuracy requirement of the application scenario is higher than a preset accuracy threshold, the first weighting coefficient is increased; if the real-time data transmission requirement of the application scenario is higher than a preset transmission threshold, the second weighting coefficient is increased. The accuracy threshold and the transmission threshold are preset according to the type of application scenario.

[0047] The detection accuracy is determined by the resolution, and the preset accuracy threshold corresponds to the preset resolution value. If the detection accuracy requirement of the application scenario exceeds the preset accuracy threshold, it indicates that the application scenario belongs to a high-precision detection scenario.

[0048] The real-time performance of data transmission is determined by the data transmission rate (such as the total number of image frames or pixels transmitted per unit time), and the preset transmission threshold corresponds to the preset image frame transmission rate or pixel transmission rate. If the real-time performance of data transmission in an application scenario is higher than the preset transmission threshold, it indicates that the application scenario belongs to a high-speed continuous shooting scenario.

[0049] Therefore, for high-precision detection scenarios, this application prioritizes resolution and can appropriately reduce the frame rate. For high-speed continuous shooting scenarios, to prioritize frame rate, the resolution can be appropriately reduced.

[0050] Based on the above processing, the dynamic adaptive adjustment scheme provided in this application can automatically adjust and optimize the strategy according to the specific application scenario of the camera.

[0051] For the objective function, the relationship between resolution and image quality score is established through pre-calibration. This can be achieved by pre-calibrating the functional relationship between resolution and image quality score, and then directly calculating the corresponding image quality score based on this functional relationship after obtaining the resolution. Alternatively, a mapping table between resolution and image quality score can be pre-constructed, allowing the corresponding image quality score to be directly obtained by referring to the mapping table after obtaining the resolution.

[0052] Similarly, the relationship between frame rate and real-time performance score can also be formed through a pre-defined functional relationship or mapping table.

[0053] In step S2, based on the camera bandwidth obtained in step S1, the function value of the objective function is maximized under the premise of satisfying the constraints, thereby searching for the optimal configuration in the camera's parameter (frame rate and resolution) space.

[0054] Specifically, the bandwidth constraint is: the communication bandwidth shall not exceed a preset bandwidth threshold. Wherein, the bandwidth threshold = camera bandwidth × preset coefficient. The preset coefficient is a positive number not exceeding 1, for example, 0.8.

[0055] The frame rate constraint is: the frame rate must not be lower than a preset frame rate threshold. This frame rate threshold can be the minimum frame rate required within the camera's application scenario.

[0056] The resolution constraint is: the resolution must not be lower than a preset resolution threshold. This resolution threshold can be the minimum resolution required for detection accuracy within the camera's application scenario.

[0057] In addition, the constraints also include hardware constraints, which limit the parameter information to the range of parameters supported by the camera hardware. This can be understood as the parameter information needing to be selected from a pre-defined range of parameters within the camera.

[0058] Based on the above processing, this application establishes a parameter search algorithm for bandwidth-frame rate-resolution, which can achieve collaborative optimization of multi-dimensional parameters. Furthermore, through an efficient dynamic parameter adjustment strategy, it can maximize bandwidth utilization while ensuring image quality.

[0059] The process of obtaining the target parameters by calculating the maximum value of the objective function within the parameter search algorithm in step S2 can also be replaced by any one of the following: deep learning based on machine learning, adaptive optimization based on reinforcement learning, or intelligent decision-making based on fuzzy logic.

[0060] Specifically, deep learning based on machine learning involves using deep learning models such as Convolutional Neural Networks (CNNs) or Long Short-Term Memory (LSTMs) to establish a complex nonlinear mapping relationship between bandwidth, frame rate, and resolution. By collecting a large amount of historical data to train the model, the deep learning model can automatically learn the optimal parameter configuration for different scenarios. Compared with traditional regression models, deep learning models can handle more complex nonlinear relationships, especially performing better in situations with multivariate coupling.

[0061] The adaptive optimization scheme based on reinforcement learning involves modeling the parameter optimization problem as a Markov Decision Process (MDP) and designing an agent to learn the optimal parameter adjustment policy. The agent continuously learns through interaction with the environment, selecting the optimal parameter adjustment based on the current bandwidth status and performance feedback. The core of this method is designing a suitable reward function that maximizes long-term rewards while achieving optimal bandwidth utilization. Commonly used reinforcement learning algorithms include Q-Learning, Deep Q Networks (DQNs), and policy gradient algorithms.

[0062] The intelligent decision-making scheme based on fuzzy logic involves establishing a fuzzy rule base, fuzzifying requirements such as camera bandwidth, image quality score, and detection accuracy into linguistic variables like "high," "medium," and "low," and then deriving the optimal parameter configuration through fuzzy inference rules. The advantage of fuzzy logic lies in its ability to handle uncertainty and imprecision, making it well-suited for scenarios where precise quantification is difficult. For example, a fuzzy rule could be established such as, "If bandwidth is low and image quality requirements are high, then reduce the frame rate to maintain resolution."

[0063] In some embodiments, step S3 includes the following: S301. Adjust the camera's original frame rate and resolution gradually according to a preset parameter step size or proportionally to achieve the target parameters' frame rate and resolution. The proportion can be 5% or 10%.

[0064] Based on the above processing, this application adopts a gradual adjustment method during parameter adjustment, which can avoid image quality fluctuations caused by sudden parameter changes.

[0065] In some embodiments, step S3 may further include the following: S302. Adjust the camera's frame rate and resolution sequentially according to the weight coefficients from largest to smallest.

[0066] In practice, considering that resolution has the greatest impact on image quality, when adjusting the camera's frame rate and resolution, it's usually best to adjust the resolution first, followed by the frame rate. Of course, during parameter adjustment, parameters can also be adjusted in order from frame rate to resolution.

[0067] Compared with existing technologies, this application can improve bandwidth utilization by real-time bandwidth detection and dynamic adjustment. Under the USB 3.0 environment, it can achieve stable transmission closer to the theoretical bandwidth limit, and fully utilize the hardware performance potential of the camera.

[0068] This application employs a predictive adjustment mechanism that can anticipate bandwidth changes and proactively adjust parameters, reducing the frame drop rate to below 0.1%, far below the industry standard requirement of 1%.

[0069] This application is mainly implemented through software algorithms, without the need for additional hardware investment. It only requires integrating the module containing the aforementioned dynamic adaptive adjustment method into the existing USB industrial camera driver or software development kit (SDK), which has a high cost-performance ratio.

[0070] The technical solution provided in this application has the advantages of low implementation cost (mainly implemented through software), wide application range (applicable to various USB industrial cameras), and high degree of intelligence (possessing self-learning and optimization capabilities), and has high practical value and market prospects.

[0071] In some embodiments, this application also provides a dynamic adaptive adjustment system for camera USB communication, such as Figure 2 As shown, the dynamic adaptive adjustment system includes: The bandwidth acquisition module is used to acquire the real-time available communication bandwidth of the USB industrial camera according to a preset clock cycle or when frame loss is detected.

[0072] The parameter calculation module is used to calculate the parameter information corresponding to the maximum value of the objective function based on a preset parameter search algorithm, and use it as the target parameter.

[0073] The parameter search algorithm includes a greedy algorithm or a genetic algorithm; the parameter information includes resolution and frame rate; the objective function is S = W1 × Q + W2 × A; S represents the function value; W1 represents the first weight coefficient; Q represents the image quality score, determined by the resolution; W2 represents the second weight coefficient; A represents the real-time score, determined by the frame rate; 0 < W1 < 1, 0 < W2 < 1, and W1 + W2 = 1; the constraints of the parameter search algorithm include: a pre-calibrated relationship model between communication bandwidth, frame rate, and resolution; the communication bandwidth does not exceed a preset bandwidth threshold, and the bandwidth threshold is obtained by multiplying the camera bandwidth by a preset coefficient, where the preset coefficient is a positive number not exceeding 1; the frame rate is not lower than a preset frame rate threshold; and the resolution is not lower than a preset resolution threshold.

[0074] The parameter adjustment module is used to adjust the frame rate and resolution according to the target parameters.

[0075] This application also provides an electronic device, such as... Figure 3 As shown, it includes a processor 301, a communication interface 302, a memory 303, and a communication bus 304, wherein the processor 301, the communication interface 302, and the memory 303 communicate with each other through the communication bus 304. Memory 303 is used to store computer programs; When the processor 301 executes the program stored in the memory 303, it implements any of the above-mentioned dynamic adaptive adjustment methods.

[0076] The communication bus mentioned in the above electronic devices can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not indicate that there is only one bus or one type of bus.

[0077] The communication interface is used for communication between the aforementioned electronic devices and other devices.

[0078] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.

[0079] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0080] In another embodiment provided in this application, a computer-readable storage medium is also provided, which stores a computer program that, when executed by a processor, implements any of the above-described dynamic adaptive adjustment method steps.

[0081] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to perform any of the dynamic adaptive adjustment method steps in the above embodiments.

[0082] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A dynamic adaptive adjustment method for camera USB communication, characterized in that, include Obtain the camera's real-time available communication bandwidth; Based on a preset parameter search algorithm, the parameter information corresponding to the maximum value of the objective function is calculated and used as the objective parameter; The parameter search algorithm includes a greedy algorithm or a genetic algorithm; the parameter information includes resolution and frame rate; the objective function is S = W1 × Q + W2 × A; S represents the function value; W1 represents the first weight coefficient; Q represents the image quality score, determined by the resolution; W2 represents the second weight coefficient; A represents the real-time score, determined by the frame rate; 0 < W1 < 1, 0 < W2 < 1, and W1 + W2 = 1; the constraints of the parameter search algorithm include: a pre-calibrated relationship model between communication bandwidth, frame rate, and resolution; the communication bandwidth does not exceed a preset bandwidth threshold, and the bandwidth threshold is obtained by multiplying the camera bandwidth by a preset coefficient, where the preset coefficient is a positive number not exceeding 1; the frame rate is not lower than a preset frame rate threshold; and the resolution is not lower than a preset resolution threshold. Adjust the camera's frame rate and resolution according to the target parameters.

2. The dynamic adaptive adjustment method according to claim 1, characterized in that, The relationship model between communication bandwidth, frame rate, and resolution was pre-calibrated and is B = α × f(F, R). Where B represents the communication bandwidth; F represents the frame rate; R represents the resolution; f(F,R) represents the theoretical bandwidth under the frame rate F and resolution R; and α represents the correction coefficient obtained through pre-training.

3. The dynamic adaptive adjustment method according to claim 1, characterized in that, Obtaining the real-time available communication bandwidth of a USB industrial camera includes: The camera's communication bandwidth is obtained based on a preset time period; After acquiring the camera's communication bandwidth, the dynamic adaptive adjustment method further includes: Determine whether the difference between the current communication bandwidth and the previous communication bandwidth exceeds the preset fluctuation threshold; if yes, calculate the target parameter; if no, retain the current parameter information.

4. The dynamic adaptive adjustment method according to claim 1, characterized in that, Before obtaining the camera's real-time available communication bandwidth, the following steps are also included: Monitor whether the USB industrial camera is experiencing frame drops; if so, obtain the camera's real-time available communication bandwidth; if not, maintain the monitoring status.

5. The dynamic adaptive adjustment method according to claim 1, characterized in that, The first and second weighting coefficients of the objective function are adjusted numerically according to the application scenario of the camera. Specifically, if the detection accuracy requirement of the application scenario is higher than the preset accuracy threshold, the first weighting coefficient is increased; if the data transmission real-time requirement of the application scenario is higher than the preset transmission threshold, the second weighting coefficient is increased; the accuracy threshold and the transmission threshold are preset according to the type of application scenario.

6. The dynamic adaptive adjustment method according to claim 1, characterized in that, Adjusting the camera's frame rate and resolution based on target parameters, including: The original frame rate and resolution of the camera are gradually adjusted according to the preset parameter step size or proportionally to form the frame rate and resolution of the target parameters.

7. The dynamic adaptive adjustment method according to claim 1, characterized in that, Adjusting the camera's frame rate and resolution based on target parameters also includes: The camera's frame rate and resolution are adjusted sequentially, from largest to smallest, according to the weighting coefficients.

8. A dynamic adaptive adjustment system for camera USB communication, characterized in that, include The bandwidth acquisition module is used to acquire the real-time available communication bandwidth of the camera according to a preset clock cycle or when frame loss is detected. The parameter calculation module is used to calculate the parameter information corresponding to the maximum value of the objective function based on a preset parameter search algorithm, and use it as the target parameter. The parameter search algorithm includes a greedy algorithm or a genetic algorithm; the parameter information includes resolution and frame rate; the objective function is S = W1 × Q + W2 × A; S represents the function value; W1 represents the first weight coefficient; Q represents the image quality score, determined by the resolution; W2 represents the second weight coefficient; A represents the real-time score, determined by the frame rate; 0 < W1 < 1, 0 < W2 < 1, and W1 + W2 = 1; the constraints of the parameter search algorithm include: a pre-calibrated relationship model between communication bandwidth, frame rate, and resolution; the communication bandwidth does not exceed a preset bandwidth threshold, and the bandwidth threshold is obtained by multiplying the camera bandwidth by a preset coefficient, where the preset coefficient is a positive number not exceeding 1; the frame rate is not lower than a preset frame rate threshold; and the resolution is not lower than a preset resolution threshold. The parameter adjustment module is used to adjust the camera's frame rate and resolution according to the target parameters.

9. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus; Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the dynamic adaptive adjustment method according to any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, A computer-readable storage medium stores a computer program that, when executed by a processor, implements the dynamic adaptive adjustment method according to any one of claims 1-7.