A method, device, equipment and medium for collecting pictures

By combining industrial pictures with token bucket algorithms at the data acquisition end, the image reading and uploading speed is dynamically controlled, and the problem of insufficient storage capacity and network bandwidth limitation at the data acquisition end is solved, data upload efficiency is improved and data accumulation is avoided.

CN119767056APending Publication Date: 2025-04-04DAWNING INFORMATION IND (BEIJING) CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411816389.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-11
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

In an industrial production environment, data collection ends lose data or produces paralyzed due to insufficient storage capacity, and due to network bandwidth limitations, data upload efficiency is low, resulting in data accumulation.

Method used

By obtaining industrial pictures in the data pool, loading them into memory after the target compression rate, and setting the token update speed of the token bucket according to the network speed limit value, controlling the size of the industrial picture read from memory each time to control the upload speed.

Benefits of technology

Effectively manage the size of industrial pictures, optimize the use of bandwidth and storage resources, avoid data accumulation and loss, and improve the efficiency of data upload.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119767056A_ABST
    Figure CN119767056A_ABST
Patent Text Reader

Abstract

The present application relates to the field of industrial data processing technology, and in particular to a method, device, equipment and medium for collecting images, which are used to improve the storage resource utilization rate of the data collection terminal. The method includes: obtaining at least one industrial image to be processed in a data pool; for each industrial image, compressing the industrial image to a target compression ratio and loading it into the memory; setting the token update speed of the token bucket according to the current network speed limit value, and the token update speed is positively correlated with the network speed limit value; controlling the size of the industrial image read from the memory each time according to the token update speed, so as to control the upload speed of uploading the industrial image to the storage terminal.
Need to check novelty before this filing date? Find Prior Art

Description

Background Art

[0002] With the advancement of intelligent manufacturing technology, a large amount of thermal image data will accumulate in the industrial production environment every day. This data will be stored in the data pool on each production line and uploaded to the storage end manually on a daily basis. However, there are problems of data loss and data leakage in this process.

[0003] To address this problem, a data collector can be used to upload data in the production environment to cloud storage. However, in the actual production process, due to the limitation or instability of network bandwidth, the data collector will face competition for bandwidth resources during the upload process, thus affecting the upload efficiency.

[0004] In the related technology, the upload request speed of image data is limited by limiting the number of threads. Limiting the number of threads of the data collector task is equivalent to limiting the input / output operations per second (IOPS) of the uploaded data, which in turn causes the data production speed to be greater than the data upload speed, ultimately causing the data to accumulate in the memory of the data collector and unable to be uploaded to the storage end in time.

[0005] Obviously, the above method ignores the problem of insufficient storage capacity at the data collection end. When data is produced in large quantities, insufficient storage resources will occur, which will lead to data loss or data production paralysis.

[0006] To sum up, how to improve the storage resource utilization rate of the data collection end has become a technical problem that needs to be solved urgently. Summary of the invention

[0007] The embodiments of the present application provide a picture acquisition method, device, electronic device and storage medium for improving storage resource utilization of a data acquisition terminal.

[0008] An image acquisition method provided in an embodiment of the present application includes:

[0009] Obtain at least one industrial image to be processed in the data pool;

[0010] For each industrial image, compress the industrial image to a target compression ratio and then load it into a memory;

[0011] Setting a token update speed of a token bucket according to a current network speed limit value, wherein the token update speed is positively correlated with the network speed limit value;

[0012] The size of the industrial image read from the memory each time is controlled according to the token update speed to control the upload speed of uploading the industrial image to the storage end.

[0013] Optionally, if the industrial image reaches the target compression rate, the industrial image is directly loaded into the memory;

[0014] If the industrial image does not reach the target compression rate, and the number of quality compressions does not reach the upper limit of quality compression, the industrial image is quality compressed until the industrial image reaches the target compression rate, and then the industrial image is loaded into the memory;

[0015] If the industrial image does not reach the target compression rate and the number of quality compressions reaches the upper limit of quality compression, the industrial image is resolution compressed until the industrial image reaches the target compression rate or the number of resolution compressions reaches the upper limit of resolution compression, and then the industrial image is loaded into the memory.

[0016] Through the above process, it is ensured that industrial images are loaded into memory after reaching the target compression rate, avoiding excessive memory usage. The phased processing method of quality compression (prioritizing the visual quality of the image) and resolution compression (further reducing the image size after the quality compression upper limit) can dynamically adjust the compression method according to the actual situation of the image, improving processing flexibility and efficiency. Quality compression can maintain the key information of the image, and after reaching the upper limit of quality compression, it turns to resolution compression to further optimize the image size, thereby saving bandwidth and storage resources.

[0017] Optionally, performing an n-th quality compression on the industrial image includes:

[0018] The current first quality of the industrial image is obtained, and the desired second quality is obtained through a first feedback control algorithm according to the first quality and the target compression rate; wherein n is a positive integer; when n=1, the first quality is obtained by sampling the original industrial image; when n>1, the first quality is the second quality obtained when the industrial image is subjected to the n-1th quality compression process;

[0019] According to the second quality, the industrial image is subjected to an n-th quality compression process.

[0020] Through the above process, the target compression rate can be gradually approached in multiple quality compressions, thereby effectively controlling the compression effect and quality loss of the image. During each quality compression, the current image quality is evaluated through the first feedback control algorithm, and the compression target is adjusted according to the target compression rate to ensure that the image file size is gradually reduced while ensuring sufficient quality. When n=1, the first quality comes from the original image, and when n>1, the first quality is the quality obtained based on the previous compression result, ensuring that the quality and size of the image can be accurately controlled each time it is compressed. This method can maintain the visual effect of the image during multiple compression processes, and gradually achieve the target compression rate, avoiding unacceptable loss of image quality due to excessive compression.

[0021] Optionally, performing an m-th resolution compression on the industrial image includes:

[0022] The current first resolution of the industrial image is obtained, and the desired second resolution is obtained through a second feedback control algorithm according to the first resolution and the target compression rate; wherein m is a positive integer; when m=1, the first resolution is obtained by sampling the original industrial image; when m>1, the first resolution is the second resolution obtained when the industrial image is subjected to the m-1th resolution compression process;

[0023] According to the second resolution, the industrial image is compressed at an m-th resolution.

[0024] Through the above process, the resolution of the image can be gradually adjusted in multiple resolution compressions to achieve the target compression rate. Each time the resolution is compressed, the resolution of the current image is evaluated by the second feedback control algorithm, and the compression target is adjusted according to the target compression rate to ensure that the resolution of the image is gradually reduced while maintaining the usability and visual effect of the image as much as possible. When m=1, the first resolution comes from the original industrial image, and when m>1, the first resolution is based on the result of the previous resolution compression. This method can effectively control the quality of the image after each resolution compression, avoid image distortion caused by over-compression, and gradually approach the target compression rate, ensuring that the resolution of the final image is adapted to the required transmission and storage requirements.

[0025] Optionally, the current network speed limit value is obtained dynamically.

[0026] Through the above process, the capacity of the token bucket and the token update speed can be adjusted according to the network speed limit value. Since the network speed limit value is obtained dynamically, the parameters of the token bucket can be automatically adjusted according to the current network speed limit value. When the network speed limit value is low, the capacity of the token bucket and the token update speed will be reduced accordingly, thereby limiting the reading rate of the data collector, avoiding excessive bandwidth occupation, and maintaining network stability; when the network speed limit value is high, the capacity and update speed of the token bucket will increase, allowing the data collector to read data at a higher rate, thereby improving upload efficiency.

[0027] Optionally, at each unit reading time, a first number of tokens is added to the token bucket, wherein the unit reading time is obtained by dividing a preset unit time according to a preset step length; the first number is: the product of the preset step length and the token update speed;

[0028] A second number of tokens is obtained from the token bucket, and according to the second number, an industrial image of a corresponding size is read from the memory; wherein the second number is: the number of tokens currently contained in the token bucket.

[0029] Through the above process, the rate of reading pictures is controlled through the token bucket mechanism, thereby indirectly controlling the rate of uploading files. The token bucket dynamically adds tokens to the token bucket according to the preset token update speed and the step size per unit time. The data collector determines the amount of data to be read from the memory each time based on the number of tokens remaining in the token bucket, thereby controlling the reading rate. In this way, the reading rate and the upload rate are limited synchronously, thereby ensuring the automatic regulation of the network speed limit value, avoiding excessive bandwidth occupation or waste, and ensuring smooth data transmission.

[0030] An image acquisition device provided in an embodiment of the present application includes:

[0031] An acquisition unit, used for acquiring at least one industrial image to be processed in a data pool;

[0032] A compression unit, used for compressing each industrial image to a target compression ratio and then loading the industrial image into a memory;

[0033] A token bucket configuration unit, used to set a token update speed of the token bucket according to a current network speed limit value, wherein the token update speed is positively correlated with the network speed limit value;

[0034] The reading unit controls the size of the industrial image read from the memory each time according to the token update speed, so as to control the upload speed of uploading the industrial image to the storage end.

[0035] An embodiment of the present application provides a computer-readable storage medium, which includes a computer program. When the computer program is run on an electronic device, the computer program is used to enable the electronic device to perform the steps of any one of the above-mentioned image acquisition methods.

[0036] An embodiment of the present application provides a computer program product, which includes a computer program, and the computer program is stored in a computer-readable storage medium; when a processor of an electronic device reads the computer program from the computer-readable storage medium, the processor executes the computer program, so that the electronic device performs the steps of any one of the above-mentioned image acquisition methods.

[0037] The beneficial effects of this application are as follows:

[0038] The embodiments of the present application provide a method, device, electronic device and storage medium for image acquisition. First, the present application obtains the industrial images to be processed from the data pool through a data collector, automatically collects the data to be uploaded, avoids manual intervention, and thus improves the efficiency of data acquisition. Secondly, these industrial images are processed through a compression mechanism, and the compression ensures the volume control of the industrial image files, so that the upload process will not occupy too much bandwidth or storage resources due to the large files, thereby effectively reducing the pressure on the storage resources of the data acquisition end and avoiding the problem of data accumulation caused by the large files.

[0039] Finally, the industrial images in the memory can enter the subsequent reading process and be uploaded to the storage end. Specifically, this application sets the token update speed that matches the network speed limit value, and the number of tokens generated by the token bucket is adjusted as the network speed limit value changes, thereby controlling the image reading speed, and then controlling the speed of the data collector uploading to the storage end, avoiding the problem of unstable upload speed or data accumulation caused by fluctuations in the network speed limit value or insufficient storage resources.

[0040] In summary, this application dynamically controls the reading speed of industrial images through image compression combined with the token bucket algorithm, and then controls the upload speed, thereby improving the storage resource utilization of the data collection end, addressing the problem of data accumulation, and improving the efficiency of image upload.

[0041] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or be understood by practicing the present application. The purpose and other advantages of the present application can be realized and obtained by the structures specifically pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0043] Figure 1 A schematic diagram of an application scenario of an embodiment of the present application;

[0044] Figure 2 An implementation flow chart of a picture acquisition method provided in an embodiment of the present application;

[0045] Figure 3 This is a flowchart of an implementation of industrial image compression in an embodiment of the present application;

[0046] Figure 4 A schematic diagram of reading an image through a token bucket provided in an embodiment of the present application;

[0047] Figure 5 An overall flow chart of a picture acquisition method provided in an embodiment of the present application;

[0048] Figure 6 This is a schematic diagram of the structure of a picture acquisition device in an embodiment of the present application;

[0049] Figure 7 The figure is a schematic diagram of the structure of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION

[0050] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the technical solution of the present application, rather than all of the embodiments. Based on the embodiments recorded in the application documents, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the technical solution of the present application.

[0051] The preferred embodiments of the present application are described below in conjunction with the drawings in the specification. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present application, and are not used to limit the present application. In addition, the embodiments and features in the embodiments of the present application may be combined with each other if there is no conflict.

[0052] like Figure 1 As shown, it is a schematic diagram of an application scenario of an embodiment of the present application. The application scenario diagram includes a data pool 110, a data collector 120 and a storage terminal 130.

[0053] Among them, the data pool is used to centrally store the industrial image data on the production line, so that the data collector can obtain the images to be processed from it; the data collector is used to obtain the image data from the data pool. The data collector first loads the image data to be uploaded into the memory, and the memory plays a temporary storage role to provide fast data access and processing. When the image data is ready, the data collector will put it into the buffer. The buffer acts as a temporary storage area. The data collector can transfer the image data from the memory to the buffer, and then upload the data to the storage end according to the network speed limit or upload rate control; the storage end is used to receive, store and manage the uploaded data to ensure the long-term preservation and convenient access of the data. The storage end can be based on the cloud storage architecture, and the industrial image data can be stored and managed in the cloud environment. Cloud storage can ensure the long-term preservation and retrieval of data at any time.

[0054] The following describes the image acquisition method provided by the exemplary embodiment of the present application in combination with the application scenarios described above and with reference to the accompanying drawings. It should be noted that the above application scenarios are only shown to facilitate understanding of the spirit and principles of the present application, and the implementation methods of the present application are not limited in this regard.

[0055] See also Figure 2 As shown, it is an implementation flow chart of a picture acquisition method provided in an embodiment of the present application. Taking a data collector as an execution subject as an example, the specific implementation process of the method is as follows:

[0056] S21: Acquire at least one industrial image to be processed in the data pool;

[0057] In industrial production environments, cameras on production lines continuously capture products, generating a large number of thermal image data sets. Thermal images refer to industrial images captured in real time during the production process. These industrial images usually contain key information such as the status and appearance of the product, and can reflect changes or anomalies in the production process. Thermal images are real-time and frequently updated. They are usually generated continuously while the production line is in continuous operation and contain large-scale, unfiltered industrial image data.

[0058] Thermal images will be stored in the data pool corresponding to each production line. The data pool is used as a centralized storage area to store all industrial image data to be processed, ensuring centralized management and timely processing of data. The data collector will continuously monitor the newly added image data in the data pool and regularly check the update status of the data pool to detect and process these newly generated image data as soon as possible.

[0059] When obtaining the industrial images to be processed, the data collector will extract the industrial image data to be processed from the data pool, organize and package the image information, and prepare for the next processing operation.

[0060] S22: For each industrial image, compress the industrial image to a target compression ratio and then load it into the memory.

[0061] In an embodiment of the present application, for each industrial image, it is analyzed whether the industrial image reaches the target compression rate; wherein: if the industrial image reaches the target compression rate, the industrial image is directly loaded into the memory; if the industrial image does not reach the target compression rate, the industrial image is compressed at least once until the compressed industrial image reaches the target compression rate or the number of compressions reaches an upper limit, and the compressed industrial image is loaded into the memory.

[0062] The compression rate refers to the ratio of the size of the compressed industrial image to the original industrial image, that is, the ratio of the compressed image size to the original image size. The target compression rate refers to the compression rate that is expected to be achieved, which means the ratio between the expected compressed image size and the original image size. For example, a target compression rate of 50% means that the image size is expected to be compressed to half of the original size.

[0063] It should be noted here that the target compression rate can be set according to multiple factors, including but not limited to storage space, transmission bandwidth, image content complexity and application requirements. When the storage space is limited or the network speed limit is low, the target compression rate can be set lower, such as 50% or lower, to reduce the file size. In some application scenarios that have high requirements for image quality, the target compression rate may be set higher, such as 80% or 90%, to ensure that the visual quality of the compressed image will not be greatly lost. In general, the setting of the target compression rate is determined according to the needs of the specific application scenario, and this application does not make specific limitations on the setting of the specific target compression rate.

[0064] The upper limit of the number of compression times refers to the maximum number of compression times allowed for the same image during the image processing process, referred to as the upper limit of the number of compression times. In the embodiment of the present application, the upper limit of the number of compression times includes two aspects: the upper limit of quality compression and the upper limit of resolution compression.

[0065] The upper limit of quality compression refers to the maximum number of compressions allowed when compressing the image quality. Quality compression generally reduces the details and precision of the image, so setting an upper limit of the number of compressions is to avoid over-compression, which may lead to loss of readability and key visual information of the image.

[0066] Image quality compression refers to reducing the image quality by reducing the color information, brightness information or other visual details of the image, thereby reducing the size of the image file.

[0067] The resolution compression limit refers to the maximum number of compressions allowed when compressing the image resolution. Resolution compression will reduce the resolution of the image, thereby reducing the size of the image, but excessive compression may cause the image to be blurred or lose important details.

[0068] Image resolution compression refers to reducing the resolution of an image by reducing the number of pixels in the image (i.e. the width and height of the image), thereby reducing the size of the image file.

[0069] In the embodiment of the present application, after receiving at least one industrial image to be processed in the data pool, the data collector transmits the images to the image processing module of the data collector. The image processing module first analyzes whether each industrial image has reached the target compression rate.

[0070] For an industrial image, if the industrial image currently meets the target compression rate, the image is directly loaded into the memory for subsequent processing and uploading.

[0071] If the industrial image fails to reach the target compression rate, the image processing module will compress the industrial image until the compressed industrial image reaches the target compression rate or reaches the upper limit of the number of compressions. The purpose of the compression operation is to reduce the bandwidth usage during the upload process by reducing the file size of the image, while avoiding the waste of storage resources caused by the image being too large.

[0072] In an embodiment of the present application, the image processing module of the data collector performs compression operations on each industrial image to ensure that the images reach a target compression rate, thereby effectively managing the size of the images and optimizing the use of bandwidth and storage resources.

[0073] The key to the process is to first use quality compression, and if quality compression cannot effectively reduce the size of the image, then further compress the image through resolution compression. The reason why quality compression takes precedence over resolution compression is that quality compression mainly reduces the file size by removing less significant details or reducing color accuracy while keeping the resolution of the image unchanged, so it can minimize the size of the image without affecting the clarity of the image.

[0074] If resolution compression is performed directly, the clarity of the image will decrease, especially for some industrial images that require higher resolution, important information may be lost. Therefore, quality compression can be performed first to reduce the file size as much as possible without affecting the details of the image. Resolution compression will only be performed when the quality compression reaches the upper limit or the effect is not obvious. The latter further compresses the image file size by reducing the pixel size of the image, but it will also affect the clarity and details of the image, so it is usually used as a last resort.

[0075] The following is a detailed description of the compression process of the image processing module of the data collector. Figure 3 As shown, it is a flowchart of an implementation of industrial image compression in an embodiment of the present application. The specific steps are as follows:

[0076] S30: Obtain at least one industrial picture, and for each industrial picture, perform the following steps S31 to S37 respectively:

[0077] S31: Analyze whether the industrial image reaches the target compression rate. If yes, execute S32; otherwise, execute S33.

[0078] It should be noted here that each time quality compression or resolution compression is performed, the file size and quality of the industrial image will change, but its core visual information (such as product shape, color, identification information, etc.) will not change substantially.

[0079] In S31, the latest industrial image is analyzed. For the initial industrial image, the data collector will analyze it according to its original size. If the target compression rate has been reached, it will be directly loaded into the memory for uploading. If the target compression rate has not been reached, the next compression process will be entered. When the industrial image is compressed and enters the S31 step for analysis again, the image analyzed is actually the compressed image, that is, the latest industrial image, not the original industrial image.

[0080] S32: If the industrial image reaches the target compression rate, the industrial image is loaded into the memory.

[0081] S33: If the industrial image does not reach the target compression rate, analyze whether the number of quality compression times reaches the upper limit of quality compression. If so, execute S35; otherwise, execute S34.

[0082] S34: If the number of quality compression times does not reach the upper limit of quality compression, perform a quality compression on the industrial image and return to S31.

[0083] It should be noted here that the initial value of the number of quality compressions is 0, and each time a quality compression is performed, the number of quality compressions will increase by 1. When performing a quality compression operation, the data collector will first analyze the current image. If the target compression rate is not reached, a quality compression will be performed and the number of quality compressions will increase by 1. S35: If the number of quality compressions reaches the upper limit of the quality compression, analyze whether the number of quality compressions reaches the upper limit of the resolution compression. If so, execute S36, otherwise, execute S37.

[0084] S36: If the number of resolution compression times reaches the upper limit of resolution compression, the industrial image is loaded into the memory.

[0085] S37: If the number of resolution compression times does not reach the upper limit of resolution compression, the industrial image is subjected to resolution compression, once for each resolution, and the process returns to step S31.

[0086] As with the above-mentioned quality compression, in S37, the initial value of the number of resolution compressions is 0, and each time a resolution compression is performed, the number of resolution compressions increases by 1. When performing the resolution compression operation, if the image does not reach the target compression rate and the quality compression has reached the upper limit, a resolution compression is performed, and the number of resolution compressions increases by 1.

[0087] The processes of quality compression and resolution compression are introduced in detail below.

[0088] The steps for performing the n-th quality compression on the industrial image are as follows:

[0089] The current first quality of the industrial image is obtained, and the desired second quality is obtained through a first feedback control algorithm according to the first quality and the target compression rate; wherein n is a positive integer; when n=1, the first quality is obtained by sampling the original industrial image; when n>1, the first quality is the second quality obtained when the industrial image is subjected to the n-1th quality compression process.

[0090] According to the second quality, the industrial image is compressed for the nth time.

[0091] The first quality refers to the quality of the current industrial image, and the second quality refers to the target quality after feedback adjustment, indicating the quality level that is expected to be achieved after compression.

[0092] Specifically, when the industrial image is to undergo the first quality compression, the first quality is obtained by sampling information on the original industrial image; when the industrial image is to undergo subsequent quality compression processing, the first quality during the nth (n>1) quality compression processing is the second quality obtained during the n-1th quality compression processing (i.e., the previous quality compression).

[0093] In an optional implementation, an industrial image is obtained from the data pool, which is recorded as the original industrial image A0. The size of A0 is 10MB, the target compression rate is 50%, and the compressed image size is expected to be 50% of the original size, that is, 5M. The current compression rate is:

[0094] R0=A0 / A0=100%.

[0095] After the analysis in step S31, if the compression rate of the original industrial image A0 does not reach the target compression rate, then step S33 is entered to analyze whether the number of quality compression times reaches the upper limit of quality compression.

[0096] In an optional implementation, the upper limit f of quality compression is set to 3 times. That is, each picture can be quality compressed 3 times at most. It should be noted here that the number of quality compressions is determined according to the complexity of the image content, the expected visual quality, the use requirements, and the storage or transmission requirements. That is, the specific number is determined by the actual application requirements. 3 times is just a simple example. This application does not make any specific restrictions on the specific number of quality compressions.

[0097] The number of compressions of the industrial image A0 is 0, that is, n=0, and the upper limit of quality compression is not reached, so the process jumps to step S34 to perform quality compression on the industrial image A0.

[0098] When the industrial image is compressed for the first time, information sampling is performed on the industrial image A0 to obtain the size and the first quality Q0 of the industrial image.

[0099] Information sampling refers to obtaining the file size and current quality value of the image by making a preliminary assessment of the image content and quality before the compression process begins.

[0100] After information sampling, it is assumed that the first quality Q0 of the industrial image A0 is 95.

[0101] Then, according to the first quality Q0=95 and the target compression ratio R=50%, the desired second quality Q1 of A0 is obtained through the first feedback algorithm.

[0102] In the embodiment of the present application, the first feedback algorithm formula is as follows:

[0103]

[0104] Where Q2 is the desired second quality, Q1 is the first quality, i.e. the quality before each compression starts), e(t) is the error between the current compression rate and the target compression rate, is the accumulation of error e(t), is the rate of change of the error e(t).

[0105] K p , K i and K d They are the proportional coefficient, integral coefficient and differential coefficient of the PID intelligent control algorithm. The proportional coefficient is used to adjust the desired second quality according to the current error value, and the proportional term K p e(t) is used to reduce the impact of the current error on the compression rate. The integral coefficient is used to calculate the cumulative value of the error, that is, the sum of the historical errors, the integral term It can effectively eliminate the long-term accumulated error and ensure that the desired second quality gradually approaches the ideal value. The differential coefficient is used to make adjustments based on the rate of change of the error (i.e., the speed of change of the error). It helps to reduce error fluctuations, predict error trends in advance, and respond to upcoming changes.

[0106] It should be noted here that the first feedback algorithm is to adjust the target quality according to the current error, so as to continuously approach the target compression rate. As an example of the first feedback algorithm, the PID algorithm can gradually optimize the compression effect of the image by adjusting the quality. This application takes the PID algorithm as an example, and the first feedback algorithm can also be other feedback control algorithms, such as the PI algorithm, the PD algorithm, etc. As long as the target quality can be adjusted according to the error, the accumulation of the error and the rate of change of the error, it can be used as an effective first feedback algorithm. The specific first feedback algorithm can be selected and adjusted according to the application requirements and the specific system characteristics.

[0107] This application does not make any specific limitation on the first feedback algorithm, which means that in practical applications, different control algorithms can be used according to different system requirements and compression strategies, and PID is just an example.

[0108] Still taking the target compression rate R = 50%, the size of A0 is 10MB, and the first mass Q0 of A0 is 95 as an example, the compression rate error e(0) = 50%-100% = -50%. In an optional implementation, the following PID control parameters are used, the proportional coefficient K p Equal to 0.5, integral coefficient K i Equal to 0.1, differential coefficient K d =0.2. According to Formula 1, the second mass Q1 of A0 is calculated as follows:

[0109] The proportional term P = 0.5 × error -50, which is equal to -25. Before the first compression, the initial value of the integral term is 0. The current error is -50%, then the integral term is 0.1 × (-50) = -5. The error change rate is 0 during the first calculation (no historical data), so the differential term is 0, then Q1 = 95 + (-25) + (-5) + 0 = 95 - 30 = 65. The original industrial image A0 is compressed according to the second mass 65 of A0 to obtain the compressed industrial image A1.

[0110] After sampling the information of the industrial image A1, the size of A1 is obtained. For example, the size of A1 is 6.84MB. Then A1 is input as follows Figure 3The step S31 shown is used to analyze whether the industrial image A1 has reached the target compression rate. The current compression rate is 68.4%, which still has not reached the target compression rate. The process goes to step S33 to analyze whether the number of quality compression times has reached the upper limit of quality compression. Taking the upper limit of quality compression as 3 times as an example, at this time n=1, which is less than f, a second quality compression can be performed.

[0111] When the industrial image is subjected to a second quality compression, the industrial image is an industrial image A1 compressed from the original industrial image A0, and the first quality of A1 is Q1, that is, the second quality obtained when the first quality compression is performed.

[0112] According to Q1 being 65 and the target compression rate being 50%, the desired second quality Q2 of A1 is obtained through the first feedback algorithm. Still taking the above as an example, the calculation process of the second quality Q2 of A1 is as follows:

[0113] Proportional term: P = 0.5 (-18.4) = -9.2

[0114] Integral term: The integral term is the accumulation of the previous error. The error is -50% + -18.4%, so I = 0.1 (-50 + -18.4) = 0.1 (-68.4) = -6.84

[0115] Differential term: D equals

[0116] Then the second mass Q2 of A1 is equal to 55.28

[0117] A1 may be quality compressed according to the second quality Q2 to obtain a compressed industrial image A2.

[0118] After sampling the information of the industrial image A2, the size of A2 is obtained. For example, the size of A2 is 5.82MB. Then A2 is input as follows Figure 3 The step S31 shown is used to analyze whether the industrial image A2 has reached the target compression rate. The current compression rate is 58.2%, which still has not reached the target compression rate. The process proceeds to step S33 to analyze whether the number of quality compressions has reached the upper limit of quality compression. Taking the upper limit of quality compression as 3 times as an example, at this time n=2, which is less than f, the third quality compression can be performed.

[0119] The calculation process of the third mass compression is as shown above, and will not be listed here one by one. The error at this time = 50% - 58.2% = -8.2%, the proportional term P = 0.5 (-8.2) = -4.1, the integral term = 0.1 (-50 + -18.4 + -8.2) = 0.1 (-76.6) = -7.66, The second quality Q2 of the industrial image A2 is obtained to be 45.56. The industrial image A2 is compressed according to the second quality Q2 to obtain the compressed industrial image A3. If the industrial image A3 reaches the target compression rate after information sampling, the compressed industrial image is loaded into the memory. If the industrial image A3 still does not reach the target compression rate after this compression, the step S33 is entered to analyze whether the number of quality compressions reaches the upper limit of the quality compression. Taking the upper limit of the quality compression as 3 times as an example, at this time n = 3, which is less than f, the upper limit of the quality compression is reached, and the resolution compression step is entered.

[0120] The steps for compressing the industrial image at the mth resolution are as follows:

[0121] The current first resolution of the industrial image is obtained, and the desired second resolution is obtained through a second feedback control algorithm according to the first resolution and the target compression rate; wherein m is a positive integer; when m=1, the first resolution is obtained by sampling the original industrial image; when m>1, the first resolution is the second resolution obtained when the industrial image is subjected to the m-1th resolution compression process;

[0122] According to the second resolution, the industrial image is compressed at an m-th resolution.

[0123] Among them, the first resolution refers to the resolution of the current industrial image. When the industrial image is to be compressed for the first time, the first resolution is obtained by sampling the information of the industrial image before resolution compression. When the industrial image is to be compressed for the nth time, the first resolution is the second resolution obtained when the n-1th resolution compression is performed (i.e., the last resolution compression). The second resolution refers to the target resolution after feedback adjustment, indicating the resolution level to be achieved after compression.

[0124] The second feedback control algorithm is as follows:

[0125]

[0126] It should be noted here that the meaning of the parameters of the second feedback algorithm is the same as that of the first feedback algorithm mentioned above, but the second feedback algorithm is to obtain the desired resolution under the target compression rate. Specifically, the second feedback algorithm is used to adjust the resolution of the image according to the target compression rate to achieve the target compression rate requirement. In this process, the settings of the proportional coefficient, integral coefficient and differential coefficient can be the same as those of the first feedback algorithm, or they can be set differently according to the specific resolution adjustment requirements. The core purpose of the second feedback algorithm is to further compress the file size of the image by adjusting the image resolution to meet the target compression rate. Unlike the first feedback algorithm, which mainly compresses images through quality adjustment, the second feedback algorithm mainly achieves the target compression rate through resolution compression. Specifically, the second feedback algorithm calculates the error between the current resolution and the expected resolution, and dynamically adjusts the resolution based on the error, so that the compression rate of the image finally meets the predetermined target.

[0127] In an optional implementation, still taking the above-mentioned industrial picture as an example, the industrial picture is A3 at this time, and the industrial picture A3 still does not reach the target compression rate, and reaches the upper limit of quality compression, that is, enters step S37 to perform resolution compression on the industrial picture A3.

[0128] A3 is compressed once, and the size is 8MB. The first resolution is 1920x1080, and the compression rate does not meet the target compression rate of 50% (the target size is 5MB). At this time, assuming that the upper limit of resolution compression is 5 times, the number of resolution compressions at this time is 1 time, and the resolution compression upper limit is not reached. Go to the next step and continue to perform resolution compression on the industrial picture A3.

[0129] Then, according to the first compression rate C1=95% and the target compression rate R=50%, the desired second resolution C2 of A3 is obtained through the second feedback algorithm. Taking the proportional coefficient Kp=0.6, the integral coefficient Ki=0.1 and the differential coefficient Kd=0.2 as an example, the calculation is as follows:

[0130] Error = target compression rate - current compression rate = 50% - 95% = -45

[0131] Proportional term = 0.6·(-45) = -27

[0132] The integral term is = 0.1·(-45) = -4.5

[0133] Differential term = 0.2·0 = 0, the expected resolution C2 obtained by the second feedback algorithm is: -31.5

[0134] Assuming that the first resolution is 1920x1080 (width 1920 pixels, height 1080 pixels), the resolution can be adjusted according to the feedback value calculated by the feedback algorithm (here a ratio is used to represent the degree of adjustment).

[0135] First, calculate the expected ratio of the second resolution, second resolution ratio = 100% + feedback value

[0136] =100%+(-31.5%)=68.5, therefore, the expected second resolution ratio is 68.5%, that is, the image resolution should be reduced to 68.5%. Assuming the first resolution is 1920x1080, we can calculate the specific pixel value of the second resolution: second resolution width = 1920×0.685 = 1319 pixels, second resolution height

[0137] =1080×0.685=740 pixels

[0138] Therefore, the desired second resolution is 1319x740 pixels, meaning that after resolution compression, the image's resolution should be reduced to 1319x740.

[0139] According to this resolution, the industrial image A3 can be compressed to obtain the industrial image A4 after resolution compression, and then A4 can be input as follows: Figure 3 The step S31 shown is to analyze whether the industrial image A4 reaches the target compression rate. If the current compression rate is 51.2%, it still has not reached the target compression rate, and then enter the step S35 to analyze whether the number of resolution compression times reaches the upper limit of quality compression. Taking the resolution compression upper limit k as 5 times as an example, at this time n=1, which is less than the resolution compression upper limit, a second resolution compression can be performed. The calculation method for the second resolution compression is as above, and will not be repeated here. If the resolution compression reaches the target compression rate after the analysis of S31, the industrial image Ak is loaded into the memory, and m is the number of resolution compression times to reach the target compression rate. There is also a situation where the target compression rate is still not reached after the resolution compression upper limit k, then the industrial image Am is loaded into the memory, which is the step S36.

[0140] Through the above quality compression and resolution compression, the network speed limit consumption problem caused by directly uploading the original image is solved, thereby improving the IOPS of the uploaded object and avoiding data accumulation. Before uploading the image file, the high-quality compression method is used, which can not only retain the key information of the image, but also reduce the occupation of the network speed limit, thereby improving the upload speed and solving the problem of hot data accumulation.

[0141] The above process uses quality compression and resolution compression to effectively reduce the size of the image before loading it into the memory, thus avoiding excessive consumption of the network speed limit. Next, we will introduce how to control the size of the image read from the memory to ensure that the upload rate matches the network speed limit.

[0142] S23: Setting the token update speed of the token bucket according to the current network speed limit value. The token update speed is positively correlated with the network speed limit value.

[0143] Among them, the token bucket is a flow control algorithm used to manage the use of network bandwidth. The working principle of the token bucket is: a certain number of "tokens" are added to the "bucket" regularly, and each token represents a certain size of data that can be uploaded. When uploading data, you need to take out a sufficient number of tokens from the token bucket first. If there are not enough tokens, data upload will be delayed or temporarily stopped until there are enough tokens in the bucket.

[0144] In the embodiment of the present application, the token update speed of the token bucket is positively correlated with the network speed limit value. The network speed limit value is used to limit the upload rate. The network speed limit value can be adjusted in real time according to the network bandwidth. The network bandwidth is the maximum capacity of the network to transmit data. When the network bandwidth is large, a higher speed limit value can be supported. Conversely, when the bandwidth is small, the speed limit value also needs to be reduced accordingly to avoid network congestion. The network speed limit value can be dynamically adjusted by real-time detection of the current network bandwidth. For example, when the network bandwidth fluctuates due to the use of other devices, the speed limit value is updated in real time to reasonably utilize bandwidth resources and ensure transmission efficiency and stability. When the network speed limit value is high, the tokens in the token bucket will be generated at a faster speed, thereby uploading data faster. Conversely, if the network speed limit value is low, the speed of token update will be slower, and the upload rate will be correspondingly slowed down to avoid network congestion or bandwidth overload due to excessively high upload rates.

[0145] That is, when uploading pictures, the data collector sets the token update speed of the token bucket according to the current network bandwidth. Whenever the data collector is ready to upload pictures, it will decide the amount of data to upload based on the number of tokens in the token bucket. When there are enough tokens in the token bucket, the data collector can upload pictures at the predetermined rate; if there are insufficient tokens, the upload will be temporarily suspended, waiting for the token to be updated, to ensure that the upload rate does not exceed the carrying capacity of the network bandwidth.

[0146] In an optional implementation, if the network speed limit is very low, for example, the network bandwidth is only 1 byte / second, and the token bucket is updated at a speed of 1 byte / second with a step size of 50ms, the number of tokens added to the token bucket at each unit read time will be 0.05 bytes, which is equivalent to not being able to generate a complete token, because each token represents 1 byte of data, which means that not enough tokens will be added to the token bucket every 50ms, and the token bucket will not be able to read data. At this point, the number of tokens in the token bucket is still 0, and the read operation cannot be performed. Therefore, the upload task will enter the "waiting" state until there are enough tokens in the token bucket for reading.

[0147] In an embodiment of the present application, the data collector reads the image data from the memory. The reading operation is usually processed by multiple threads concurrently, but through the token bucket limit, the length of the image read each time will be controlled according to the number of available tokens in the token bucket. Whenever there are enough tokens in the token bucket, the data collector can read the image data of the specified length from the memory and store it in the buffer. The number of tokens will be updated over time, and the token update speed is related to factors such as the network speed limit and the system load. Only when there are enough tokens in the token bucket can the data collector continue to read data to ensure that the rate of the read operation does not exceed the bandwidth limit.

[0148] When the data is read and stored in the buffer, the next task is to upload the data in the buffer to the storage end. At this stage, the upload speed is limited by the token bucket reading speed.

[0149] The following is a detailed description of the process by which the data collector controls the size of the industrial image read from the memory each time:

[0150] First, the token bucket capacity and token update speed are set according to the current network speed limit. The current network speed limit is obtained dynamically, which means that the token bucket parameters are automatically adjusted according to the real-time network speed limit. In order to ensure that the network upload and download rates match the bandwidth conditions, the token bucket capacity and update speed will be adjusted as the network speed limit changes.

[0151] In an optional implementation, the network speed limit value can also be manually set by the user according to the usage scenario (for example, through a web interface). After the user sets it, the value will be obtained in real time and applied to the token bucket mechanism to automatically calculate and adjust the capacity of the token bucket and the token update speed. This method allows users to flexibly control the upload rate according to specific application requirements.

[0152] For example, if the network speed limit value set by the user is 2MB / s, the update speed of the token bucket will be set to update 2MB of data per second. Each token represents 1 byte of data, so 2,048,000 tokens are updated per second. At the same time, the capacity of the token bucket will be adjusted to accommodate 2MB of data to ensure that it can handle large data transmissions during peak hours. For another example, if the network speed limit value obtained in real time is 5MB / s, then the token update speed will be automatically adjusted to update 5MB of data per second based on this real-time bandwidth value, that is, 5,120,000 tokens will be updated per second. The capacity of the token bucket will also be increased to 5MB to better match the network speed limit value requirements and avoid upload delays due to insufficient tokens.

[0153] This adjustment mechanism not only ensures that the upload rate matches the real-time bandwidth, but also effectively responds to network fluctuations or bandwidth changes, ensuring the stability and smoothness of data transmission.

[0154] The above process introduces the setting of the initial value of the token bucket before reading. The specific reading process will be introduced below.

[0155] S24: Control the size of the industrial image read from the memory each time according to the token update speed, so as to control the upload speed of uploading the industrial image to the storage end.

[0156] At each unit reading time, a first number of tokens is added to the token bucket, wherein the unit reading time is obtained by dividing the preset unit time according to the preset step length; the first number is: the product of the preset step length and the token update speed;

[0157] A second number of tokens is obtained from the token bucket, and according to the second number, an industrial image of a corresponding size is read from the memory; wherein the second number is: the number of tokens currently contained in the token bucket.

[0158] Among them, the preset step size refers to the fixed time interval divided within each preset time unit. For example, within each second, if the preset step size is 50ms, the time within each second is divided into multiple small units of 50ms, and each unit read moment will perform a token bucket update operation at these time points. The preset time unit refers to the basic unit time. In an optional embodiment, the preset time unit is 1 second, that is, one cycle is one second. In this cycle, multiple updates are performed according to the preset step size (such as 50ms).

[0159] Unit read time refers to the division of time points according to a preset step size in each preset unit time, and the token bucket update operation will be performed at each moment. Unit read time is a plurality of fixed time points in each preset unit time, and in an optional implementation, it is in milliseconds. For example, the unit read time in the first second is 0ms, 50ms, 100ms, 150ms..., and the unit read time in the second second is 0ms, 50ms, 100ms, 150ms... These read times are fixed, and the time interval (such as 50ms) is constant.

[0160] The first quantity refers to the number of tokens added at each unit read moment. At each unit read moment, a certain number of tokens will be added to the token bucket according to the token update speed. The first quantity represents the number of tokens added at each unit read moment. The second quantity refers to the number of tokens obtained from the token bucket at each unit read moment. The second quantity determines the amount of data obtained from the memory for each read operation. The second quantity is the number of tokens currently contained in the token bucket. Therefore, the number of tokens obtained from the token bucket each time (i.e., the size of the read data) changes dynamically. The amount of data read each time will be controlled according to the number of tokens currently in the token bucket.

[0161] In an optional implementation, the capacity of the token bucket is 1MB, that is, 1024×1024=1048576 bytes, the token update speed is 1MB / second, and the unit reading time is 50ms.

[0162] See also Figure 4 , which is a schematic diagram of reading an image through a token bucket provided by an embodiment of the present application, the initial capacity of the token bucket is 1MB, that is, the token bucket can initially accommodate 1048576 tokens. At this time, the token bucket is full.

[0163] At 1 second:

[0164] 0 ms: The initial capacity of the token bucket is 1MB (i.e. 1,048,576 tokens). At this time, the token bucket is full and contains 1MB of tokens. At this time, the token bucket is ready for reading. Since the token bucket is full, the data collector can immediately read 1MB of data from the token bucket. At this time, 1,048,576 tokens are consumed from the token bucket, and the number of tokens in the token bucket returns to zero.

[0165] 50ms: 0.05MB (i.e. 51,200 tokens) is added to the token bucket. According to the token update speed (1MB / s), the token bucket will update the first number of 0.05MB bytes of tokens, i.e. 51,200 tokens, within 50ms. In other words, the current number of tokens in the token bucket is 0.05MB, equivalent to 51,200 tokens, and the data collector can read 0.05MB of data from the token bucket. At this time, the second number of 51,200 tokens is consumed from the token bucket, and the number of tokens in the token bucket returns to zero.

[0166] And so on, I will not go into details here.

[0167] At second 2:

[0168] 0ms: 0.05MB (i.e. 51,200 tokens) is added to the token bucket again. According to the token update speed, the token bucket will update the second amount of 0.05MB (i.e. 51,200 tokens) within 100ms. At this time, the current number of tokens in the token bucket is 0.05MB, which is equivalent to 51,200 tokens. The data collector can read 0.05MB of data from the token bucket. At this time, 51,200 tokens are consumed from the token bucket, and the number of tokens in the token bucket returns to zero.

[0169] Only at the 50th ms of the 1st second, the first quantity (i.e., the number of token updates) is not equal to the second quantity (i.e., the amount of data read from the token bucket). The reason is that at the 0th ms, the token bucket is full, and the data collector can immediately read the complete 1MB of data, which means that all tokens are consumed from the token bucket, and the subsequent token bucket updates are performed at the preset token update speed. Therefore, at the 50th ms, the number of token updates (the first quantity) is less than the number of tokens remaining in the token bucket (the second quantity). This is different from the subsequent moments, in each unit time, the first quantity and the second quantity will remain consistent, that is, the update speed and the size of the read data will remain consistent.

[0170] Through the above process, the length of the read image is limited by the token bucket, thereby controlling the rate of uploading images from the data collector to the storage end.

[0171] See also Figure 5 As shown, it is a flowchart of an implementation of picture collection provided by an embodiment of the present application. Figure 5 As shown in the figure, the overall process includes all aspects from the acquisition, processing, compression of industrial images to the final uploading and processing.

[0172] First, industrial images are obtained from the data pool through the data collector and enter the preliminary compression stage. In this stage, the images are processed by the quality compression algorithm, with the goal of reducing the image size and improving transmission efficiency while retaining the key information of the image as much as possible. If the compressed image does not reach the predetermined target compression rate, quality compression will continue until the compression requirements are met or the limit on the number of quality compressions is reached. If the number of quality compressions reaches the upper limit and the image still does not reach the target compression rate, it will enter the resolution compression stage and reduce the resolution of the image to further reduce the file size until the target compression rate is reached or the number of resolution compressions reaches the upper limit.

[0173] Next, the processed image is loaded into the memory and prepared for the image reading operation. Before uploading, the data reading speed is controlled by the token bucket mechanism, thereby limiting the amount of data for each upload operation and ensuring that the upload rate matches the network speed limit. The token bucket dynamically adjusts the number of tokens according to the preset token update speed and network speed limit. Only when the number of tokens is sufficient will the image of the corresponding size be read from the memory and uploaded. If the network speed limit is low, the token bucket update speed slows down, thereby reducing the amount of data uploaded each time, which can avoid network overload and bandwidth waste. The reading process transfers the image data from the memory to the buffer, and then uploads it from the buffer to the target storage end to ensure a smooth upload process. If there are not enough tokens in the token bucket, it will enter a waiting state until enough tokens are accumulated in the token bucket before continuing the upload operation.

[0174] Through this series of steps, the entire image acquisition, processing and uploading process can be carried out efficiently and stably. At the same time, the upload rate can be dynamically adjusted to cope with different network environments, ensuring the rational use of network speed limits, avoiding bandwidth overload, and ensuring the smoothness and reliability of data transmission.

[0175] Based on the same inventive concept, the embodiment of the present application also provides a picture acquisition device 600. Figure 6 As shown, it is a structural schematic diagram of a picture acquisition device in an embodiment of the present application, which may include:

[0176] An acquisition unit 601 is used to acquire at least one industrial picture to be processed in a data pool;

[0177] A compression unit 602 is used to compress each industrial image to a target compression ratio and then load the industrial image into a memory;

[0178] The token bucket configuration unit 603 is used to set the token update speed of the token bucket according to the current network speed limit value, and the token update speed is positively correlated with the network speed limit value;

[0179] The reading unit 604 controls the size of the industrial image read from the memory each time according to the token update speed, so as to control the upload speed of uploading the industrial image to the storage end.

[0180] Optionally, the compression unit 602 is specifically configured to:

[0181] If the industrial image reaches the target compression rate, the industrial image is directly loaded into the memory;

[0182] If the industrial image does not reach the target compression rate, and the number of quality compressions does not reach the upper limit of quality compression, the industrial image is quality compressed until the industrial image reaches the target compression rate, and then the industrial image is loaded into the memory;

[0183] If the industrial image does not reach the target compression rate and the number of quality compressions reaches the upper limit of quality compression, the industrial image is resolution compressed until the industrial image reaches the target compression rate or the number of resolution compressions reaches the upper limit of resolution compression, and then the industrial image is loaded into the memory.

[0184] Optionally, the industrial image is subjected to an n-th quality compression, and the compression unit 602 is specifically configured to:

[0185] The current first quality of the industrial image is obtained, and the desired second quality is obtained through a first feedback control algorithm according to the first quality and the target compression rate; wherein n is a positive integer; when n=1, the first quality is obtained by sampling the original industrial image; when n>1, the first quality is the second quality obtained when the industrial image is subjected to the n-1th quality compression process;

[0186] According to the second quality, the industrial image is compressed for the nth time.

[0187] Optionally, the industrial image is compressed at an m-th resolution, and the compression unit 602 is specifically used for:

[0188] The current first resolution of the industrial image is obtained, and the desired second resolution is obtained through a second feedback control algorithm according to the first resolution and the target compression rate; wherein m is a positive integer; when m=1, the first resolution is obtained by sampling the original industrial image; when m>1, the first resolution is the second resolution obtained when the industrial image is subjected to the m-1th resolution compression process;

[0189] According to the second resolution, the industrial image is compressed at an m-th resolution.

[0190] Optionally, the current network speed limit value is obtained dynamically.

[0191] Optionally, the reading unit 604 is specifically used for:

[0192] At each unit reading time, a first number of tokens is added to the token bucket, wherein the unit reading time is obtained by dividing the preset unit time according to the preset step length; the first number is: the product of the preset step length and the token update speed;

[0193] A second number of tokens is obtained from the token bucket, and according to the second number, an industrial image of a corresponding size is read from the memory; wherein the second number is: the number of tokens currently contained in the token bucket.

[0194] For the convenience of description, the above parts are divided into modules (or units) according to their functions and described separately. Of course, when implementing this application, the functions of each module (or unit) can be implemented in the same or multiple software or hardware.

[0195] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.

[0196] After introducing the picture acquisition method and device according to the exemplary embodiment of the present application, next, an electronic device according to another exemplary embodiment of the present application is introduced.

[0197] Those skilled in the art will appreciate that various aspects of the present application may be implemented as a system, method or program product. Therefore, various aspects of the present application may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to as "circuit", "module" or "system" herein.

[0198] Based on the same inventive concept as the above method embodiment, an electronic device is also provided in the embodiment of the present application. In one embodiment, the electronic device may be a data collector, such as Figure 1 The data collector 120 shown in FIG. 1 is a schematic diagram of a data collector 120. In this embodiment, the structure of the electronic device can be as follows: Figure 7 As shown, it includes a memory 701 , a communication module 703 and one or more processors 702 .

[0199] The memory 701 is used to store computer programs executed by the processor 702. The memory 701 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and programs required for running the instant messaging function, etc.; the data storage area may store various instant messaging information and operation instruction sets, etc.

[0200] The memory 701 may be a volatile memory, such as a random-access memory (RAM); the memory 701 may also be a non-volatile memory, such as a read-only memory, a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD); or the memory 701 may be any other medium that can be used to carry or store a desired computer program in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 701 may be a combination of the above memories.

[0201] The processor 702 may include one or more central processing units (CPU) or a digital processing unit, etc. The processor 702 is used to implement the above-mentioned image acquisition method when calling the computer program stored in the memory 701 .

[0202] The communication module 703 is used to communicate with terminal devices and other servers.

[0203] The specific connection medium between the memory 701, the communication module 703 and the processor 702 is not limited in the embodiment of the present application. Figure 7 In the embodiment, the memory 701 and the processor 702 are connected via a bus 704. The bus 704 is connected to the processor 702 via a bus 704. Figure 7 The connections between the other components are only for illustration and are not intended to be limiting. The bus 704 can be divided into an address bus, a data bus, a control bus, etc. For ease of description, Figure 7 The diagram shows that only one thick line is used, but this does not mean that there is only one bus or only one type of bus.

[0204] The memory 701 stores a computer storage medium, and the computer storage medium stores computer executable instructions, and the computer executable instructions are used to implement the image acquisition method of the embodiment of the present application. The processor 702 is used to execute the above-mentioned image acquisition method, such as Figure 2 shown.

[0205] In some possible implementations, various aspects of the image acquisition method provided by the present application may also be implemented in the form of a program product, which includes a computer program. When the program product is run on an electronic device, the computer program is used to enable the electronic device to perform the steps of the image acquisition method according to various exemplary implementations of the present application described above in this specification. For example, the electronic device may perform the following steps: Figure 2 or Figure 3Follow the steps shown in .

[0206] It should be noted that, although several units or subunits of the device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to the embodiments of the present application, the features and functions of two or more units described above can be embodied in one unit. Conversely, the features and functions of one unit described above can be further divided into multiple units to be embodied.

[0207] In addition, although the operations of the method of the present application are described in a specific order in the drawings, this does not require or imply that the operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps.

[0208] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain a computer-usable computer program.

[0209] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program commands. These computer program commands can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the commands executed by the processor of the computer or other programmable data processing device generate commands for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0210] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.

[0211] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A method for collecting pictures, characterized in that: The method comprises: Obtain at least one industrial image to be processed in the data pool; For each industrial image, compress the industrial image to a target compression ratio and then load it into a memory; Setting a token update speed of a token bucket according to a current network speed limit value, wherein the token update speed is positively correlated with the network speed limit value; The size of the industrial image read from the memory each time is controlled according to the token update speed to control the upload speed of uploading the industrial image to the storage end.

2. The method according to claim 1, characterized in that After compressing the industrial image to a target compression rate, the industrial image is loaded into a memory, including: If the industrial image reaches the target compression rate, the industrial image is directly loaded into the memory; If the industrial image does not reach the target compression rate, and the number of quality compressions does not reach the upper limit of quality compression, the industrial image is quality compressed until the industrial image reaches the target compression rate, and then the industrial image is loaded into the memory; If the industrial image does not reach the target compression rate and the number of quality compressions reaches the upper limit of quality compression, the industrial image is resolution compressed until the industrial image reaches the target compression rate or the number of resolution compressions reaches the upper limit of resolution compression, and then the industrial image is loaded into the memory.

3. The method according to claim 2, characterized in that The industrial image is compressed for the nth time, including: The current first quality of the industrial image is obtained, and the desired second quality is obtained through a first feedback control algorithm according to the first quality and the target compression rate; wherein n is a positive integer; when n=1, the first quality is obtained by sampling the original industrial image; when n>1, the first quality is the second quality obtained when the industrial image is subjected to the n-1th quality compression process; According to the second quality, the industrial image is subjected to an n-th quality compression process.

4. The method according to claim 2, characterized in that The industrial image is compressed at an m-th resolution, including: The current first resolution of the industrial image is obtained, and the desired second resolution is obtained through a second feedback control algorithm according to the first resolution and the target compression rate; wherein m is a positive integer; when m=1, the first resolution is obtained by sampling the original industrial image; when m>1, the first resolution is the second resolution obtained when the industrial image is subjected to the m-1th resolution compression process; According to the second resolution, the industrial image is compressed at an m-th resolution.

5. The method according to claim 1, characterized in that The current network speed limit value is obtained dynamically.

6. The method according to any one of claims 1 to 5, characterized in that: The controlling the size of the industrial image read from the memory per unit time according to the token update speed includes: At each unit reading time, a first number of tokens is added to the token bucket, wherein the unit reading time is obtained by dividing a preset unit time according to a preset step length; the first number is: the product of the preset step length and the token update speed; A second number of tokens is obtained from the token bucket, and according to the second number, an industrial image of a corresponding size is read from the memory; wherein the second number is: the number of tokens currently contained in the token bucket.

7. A picture acquisition device, characterized in that: include: An acquisition unit, used for acquiring at least one industrial image to be processed in a data pool; A compression unit, used for compressing each industrial image to a target compression ratio and then loading the industrial image into a memory; A token bucket configuration unit, used to set a token update speed of the token bucket according to a current network speed limit value, wherein the token update speed is positively correlated with the network speed limit value; The reading unit controls the size of the industrial image read from the memory each time according to the token update speed, so as to control the upload speed of uploading the industrial image to the storage end.

8. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of any one of the methods of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: It includes a computer program. When the computer program is run on an electronic device, the computer program is used to enable the electronic device to execute the steps of any method described in claims 1 to 6.

10. A computer program product, characterized in that The method comprises a computer program stored in a computer-readable storage medium; when a processor of an electronic device reads the computer program from the computer-readable storage medium, the processor executes the computer program, so that the electronic device executes the steps of any one of the methods described in claims 1 to 6.