Methods and apparatus for determining bubble characteristic parameters, storage media and electronic equipment
By combining machine vision and deep learning, high-precision detection of bubbles and determination of characteristic parameters in the process of hydrogen production by water electrolysis were achieved, solving the problem of bubble detection under working conditions and improving detection accuracy and parameter analysis capabilities.
Patent Information
- Application Number
- CN202411418968.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-11
- Publication Date
- 2025-10-28
- Estimated Expiration
- 2044-10-11
AI Technical Summary
In the process of hydrogen production by water electrolysis, existing technologies struggle to achieve high-precision and robust detection of bubbles, especially when the size, shape, and distribution of bubbles are uneven, their movement speed is fast, and factors such as current and voltage change frequently under operating conditions. Deciphering the complex coupling relationship between bubble behavior characteristics and operating parameters remains a challenge.
A machine vision approach is adopted, which uses a camera device to acquire bubble video streams. Image preprocessing and segmentation are performed using the producer-consumer design pattern. Deep learning models such as MaskTransfiner and UREtinex-Net are combined for bubble detection and enhancement. Kalman filters and Hungarian algorithms are used for bubble tracking, and bubble feature parameters are calculated.
It significantly improves the accuracy of bubble detection, enabling accurate acquisition of static characteristic parameters of bubbles such as number and volume, and motion characteristic parameters such as flow velocity, thus solving the problem of difficult bubble detection on both sides of the electrolytic water electrode.
Smart Images

Figure CN119229126B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of hydrogen production by water electrolysis, and more specifically, to a method and apparatus for determining bubble characteristic parameters, a storage medium, and an electronic device. Background Technology
[0002] Electrolysis of water is a clean and efficient method for producing hydrogen, which can promote the development of hydrogen energy, reduce dependence on fossil fuels, improve the environment, increase energy efficiency, and also contribute to the development of emerging industries. Real-time and precise detection and control of bubbles under operating conditions are crucial to ensuring the safety and efficiency of the hydrogen production process.
[0003] However, real-time high-precision bubble detection under operating conditions faces several key challenges: (1) Due to the potentially highly non-uniform size, shape, and distribution of bubbles, high-precision and robust detection methods are required; (2) Under operating conditions, the bubbles move very quickly, necessitating fast-responding detection equipment and software algorithms; (3) During electrolysis, factors such as current, voltage, and temperature may change frequently, directly affecting bubble generation and behavior. Deciphering the complex coupling relationship between bubble behavior characteristics and operating parameters is also a challenge for the rational and efficient control of these parameters.
[0004] There is still no effective solution to the problem of difficulty in detecting air bubbles on both sides of the electrodes in the electrolysis of water. Summary of the Invention
[0005] This application provides a method and apparatus for determining bubble characteristic parameters, a storage medium, and an electronic device, to at least solve the problem of difficulty in detecting bubbles on both sides of the electrodes in water electrolysis in the prior art.
[0006] According to one embodiment of this application, a method for determining bubble feature parameters is provided, comprising: inputting a first bubble image into a segmentation model for processing to obtain position information of multiple bubbles at a first moment and a bubble segmentation mask, wherein the bubble image includes the multiple bubbles, and the first moment is the time when the first bubble image was captured; dynamically tracking the multiple bubbles in the multiple first bubble images to obtain the motion path of the multiple bubbles, wherein the multiple first bubble images are captured at different times, and the motion path is used to indicate the position information of the bubbles at different times; determining the bubble segmentation mask of the multiple bubbles at different times based on the motion path, and determining the bubble feature parameters of the multiple bubbles based on the motion path and the bubble segmentation mask at different times, wherein the bubble feature parameters include static feature parameters and dynamic feature parameters.
[0007] In an exemplary embodiment, before inputting the first bubble image into the segmentation model for processing, the method further includes: acquiring a video stream of the target area using a camera device to obtain a bubble video stream; reading a first number of second bubble images from the bubble video stream using a producer thread and adding them to a cache queue; and reading the first number of second bubble images from the cache queue using a consumer thread and preprocessing the second bubble images to obtain the first bubble image.
[0008] In one exemplary embodiment, preprocessing the second bubble image to obtain the first bubble image includes: calculating the transmittance of the second bubble image to obtain a transmittance value of the second bubble image; if it is determined that the transmittance value of a third bubble image in the second bubble image is lower than a first preset threshold, performing histogram equalization on the third bubble image according to a standard bubble image to obtain a processed third bubble image, wherein the second bubble image includes the standard bubble image; and inputting the processed third bubble image into a low-light enhancement model for processing to obtain the first bubble image.
[0009] In an exemplary embodiment, a first bubble image is input into a segmentation model for processing to obtain position information of multiple bubbles at a first time and a bubble segmentation mask. This includes: segmenting the first bubble image using a first segmentation model and extracting results from the segmented first bubble image to obtain first position information and a first bubble segmentation mask for a large bubble, wherein the multiple bubbles include the large bubble, and the volume of the large bubble is greater than a second preset threshold; segmenting the first bubble image using a second segmentation model and performing bubble detection on the segmented first bubble image to obtain second position information and a second bubble segmentation mask for small bubbles, wherein the multiple bubbles include the small bubbles, and the volume of the small bubbles is less than the second preset threshold; the segmentation model includes the first segmentation model and the second segmentation model; and generating a fourth bubble image based on the first position information, the first bubble segmentation mask, the second position information, and the second bubble segmentation mask, wherein the fourth bubble image includes the position information of the multiple bubbles at the first time and the bubble segmentation mask.
[0010] In an exemplary embodiment, before inputting the first bubble image into the segmentation model for processing, the method further includes: establishing a bubble dataset, wherein the bubble dataset includes multiple bubble images carrying bubble segmentation masks; determining a loss function according to the type of the segmentation model, wherein the loss function is used to train the segmentation model; and training the segmentation model based on the bubble dataset and the loss function.
[0011] In an exemplary embodiment, dynamic tracking of the plurality of bubbles in a plurality of first bubble images to obtain the motion paths of the plurality of bubbles includes: extracting appearance features from the first bubbles in the plurality of bubbles to obtain a first appearance feature; extracting appearance features from the plurality of second bubbles in a fifth bubble image to obtain a plurality of second appearance features; calculating the cosine distance between the first appearance feature and the plurality of second appearance features to obtain a plurality of cosine distance values, wherein the fifth bubble image is captured at the time following the first time; and predicting the motion trajectory of the first bubble using a Kalman filter to calculate a first index value between the predicted future position of the first bubble and the plurality of second bubbles, wherein the first index value is used to indicate the motion of the first bubble. The overlap between the position of the first bubble at the next time step and the second bubble is calculated; the average absolute difference in the motion velocity directions of the first bubble and the plurality of second bubbles is calculated to obtain multiple directional absolute differences; the absolute difference in the confidence scores of the first bubble and the plurality of second bubbles is calculated to obtain multiple confidence score absolute differences, wherein the confidence scores are determined by the segmentation model; a cost matrix is constructed based on the plurality of cosine distance values, the plurality of first index values, the plurality of directional absolute differences, and the plurality of confidence score absolute differences, and the cost matrix is processed by the Hungarian algorithm to determine the third bubble among the plurality of second bubbles, wherein the third bubble is the bubble corresponding to the first bubble at the next time step after the first time step; the motion path of the first bubble is determined based on the plurality of third bubbles.
[0012] In an exemplary embodiment, determining the bubble feature parameters of the plurality of bubbles based on the motion path and the bubble segmentation mask at different times includes at least one of the following: counting the number of bubbles in the first bubble image based on the bubble segmentation mask; determining the equivalent volume of the plurality of bubbles based on the cross-sectional area of the bubble segmentation mask and the size information of the reference object in the first bubble image; determining the real-time radius of the plurality of bubbles at the first time based on the plurality of equivalent volumes; calculating the gas holdup of the liquid flowing through the target area during a target time period based on the liquid flow velocity in the target area and the equivalent volume, wherein the start time of the target time period is the time when the target bubble enters the target area, and the end time of the target time period is the time when the target bubble leaves the target area, and the static feature parameters include: the number of bubbles, the equivalent volume, the real-time radius, and the gas holdup; determining the average flow velocity of the plurality of bubbles based on the actual height information of the target area and the time length of the target time period; and counting the motion behavior of the plurality of bubbles in the target area based on the motion path and the bubble segmentation mask at different times, wherein the motion behavior includes the direction of bubble movement, and the dynamic feature parameters include the average flow velocity and the motion behavior.
[0013] According to another embodiment of the present application, a device for determining bubble feature parameters is also provided, comprising: a processing module, configured to input a first bubble image into a segmentation model for processing to obtain position information of multiple bubbles at a first moment and a bubble segmentation mask, wherein the bubble image includes the multiple bubbles, and the first moment is the time when the first bubble image was captured; a tracking module, configured to dynamically track the multiple bubbles in the multiple first bubble images to obtain the motion path of the multiple bubbles, wherein the multiple first bubble images are captured at different times, and the motion path is used to indicate the position information of the bubbles at different times; and a determining module, configured to determine the bubble segmentation mask of the multiple bubbles at different times based on the motion path, and determine the bubble feature parameters of the multiple bubbles based on the motion path and the bubble segmentation mask at different times, wherein the bubble feature parameters include static feature parameters and dynamic feature parameters.
[0014] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer-readable storage medium, and the computer program is configured to execute the focusing method of the target region at runtime.
[0015] According to another aspect of the embodiments of this application, an electronic device is also provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the above-described focusing method for the target region through the computer program.
[0016] In this embodiment, a first bubble image is first input into a segmentation model for processing to obtain the position information of different bubbles at a first moment and a bubble segmentation mask. The bubble image contains multiple bubbles, and the first moment is the time when the first bubble image was captured. Then, the multiple bubbles are dynamically tracked in multiple first bubble images to obtain their motion paths. The first bubble images are captured at different times, and the motion paths are used to indicate the position information of the bubbles at different times. Based on the motion paths, bubble segmentation masks for multiple bubbles at different times are determined. Then, based on the motion paths and the bubble segmentation masks at different times, bubble feature parameters are determined. The bubble feature parameters include static feature parameters and dynamic feature parameters. By adopting the above scheme and combining it with a high-precision segmentation model, the accuracy of bubble detection is significantly improved, thereby obtaining accurate bubble feature parameters. This solves the problem of difficult bubble detection on both sides of the electrodes in the related technology of water electrolysis. Attached Figure Description
[0017] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments of this application and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0018] Figure 1 This is a hardware structure block diagram of a computer terminal for an optional method of determining bubble feature parameters according to an embodiment of this application.
[0019] Figure 2 This is a flowchart of a method for determining bubble feature parameters according to an embodiment of this application;
[0020] Figure 3 This is a schematic diagram of an optional producer-consumer design pattern according to an embodiment of this application;
[0021] Figure 4 This is a schematic diagram of an optional bubble image preprocessing flow according to an embodiment of this application;
[0022] Figure 5 This is a schematic diagram of an optional U-Retinex model structure according to an embodiment of this application;
[0023] Figure 6 This is a schematic diagram of an optional MaskTransfiner detection process according to an embodiment of this application;
[0024] Figure 7 This is a schematic diagram of an optional bubble image segmentation process according to an embodiment of this application;
[0025] Figure 8 This is a schematic diagram of the overall process of an optional high-precision bubble detection method according to an embodiment of this application.
[0026] Figure 9 This is a structural block diagram of a device for determining bubble characteristic parameters according to an embodiment of this application. Detailed Implementation
[0027] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0028] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus; "a plurality" means two or more.
[0029] The methods and embodiments provided in this application can be executed on a computer terminal or similar computing system. Taking running on a computer terminal as an example, Figure 1 This is a hardware structure block diagram of a computer terminal for a method of determining bubble feature parameters according to an embodiment of this application. For example... Figure 1 As shown, a computer terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 (which may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data are also shown. In one exemplary embodiment, the computer terminal may further include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that... Figure 1The structure shown is for illustrative purposes only and does not limit the structure of the computer terminal described above. For example, the computer terminal may also include components that are more complex than those described above. Figure 1 The more or fewer components shown, or having the same Figure 1 Equivalent functions or ratios shown Figure 1 The functions shown have more different configurations.
[0030] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to the method for determining bubble feature parameters in this embodiment. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, thus implementing the above-described method. The memory 104 may include high-speed random access memory and non-volatile memory, such as one or more magnetic storage systems, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to a secure text network via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0031] The transmission device 106 is used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider for the computer terminal. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet.
[0032] Among the related technologies, two bubble detection methods have been proposed: resistivity tomography and laser scattering.
[0033] Electrical resistance tomography (ERT) is an online real-time detection technique that analyzes the medium distribution in a measured field by the correlation between electrical conductivity and the medium. This technique was used to study the effect of liquid rheological properties on gas holdup by providing two-dimensional images of the gas phase distribution across the cross-section of a bubble reaction column. Experimental results showed that as liquid viscosity increases, the gas holdup decreases, reaching a minimum or plateau value. However, due to its relatively low resolution, ERT cannot measure gas holdup in all cases.
[0034] However, resistance tomography faces several challenges when detecting sub-millimeter-level bubbles under operating conditions: First, small or sparsely distributed bubbles may exhibit minute resistance changes, making them difficult to detect. Furthermore, insufficient spatial resolution in tomographic imaging makes bubble count identification extremely difficult. Second, resistance tomography requires complex electrode arrays and circuit systems to measure resistance, increasing equipment complexity and cost. Data processing demands sophisticated algorithms for parsing and interpreting the data, requiring significant computational resources and impacting real-time feedback speed. Third, resistance tomography cannot directly provide quantifiable indicators such as liquid gas content, bubble size, shape, and velocity.
[0035] Laser scattering, based on Mie scattering theory and Maxwell's equations for electromagnetic waves, is a rigorous mathematical solution derived from the diffraction of a plane-polarized monochromatic wave by a uniform sphere of arbitrary diameter and composition within a homogeneous medium. Compared to acoustic methods, laser scattering does not damage the bubble structure and can identify submillimeter-sized bubbles, thus becoming one of the important methods for bubble detection.
[0036] Laser scattering for bubble detection under operating conditions also presents several major challenges: First, regarding sensitivity and accuracy, the low opacity of submillimeter-sized bubbles can affect laser diffraction and scattering, resulting in weak scattered signals and difficulty in accurate detection. Second, environmental factors can affect bubble detection, such as temperature, humidity, and illumination, requiring specific environmental conditions for accurate detection. Third, safety is a concern, as laser scattering equipment can generate intense light, necessitating safety precautions to prevent eye injury to operators.
[0037] Therefore, in order to further improve detection efficiency and achieve direct acquisition of bubble morphology characteristics under working conditions, this application utilizes machine vision methods for research.
[0038] This embodiment provides a method for determining bubble characteristic parameters, applied to a computer terminal. Figure 2 This is a flowchart of a method for determining bubble feature parameters according to an embodiment of this application, such as... Figure 2 As shown, the process includes the following steps:
[0039] Step S202: Input the first bubble image into the segmentation model for processing to obtain the position information of multiple bubbles at the first moment and the bubble segmentation mask, wherein the bubble image includes the multiple bubbles, and the first moment is the time when the first bubble image was captured;
[0040] Step S204: Dynamically track the multiple bubbles in multiple first bubble images to obtain the motion path of the multiple bubbles, wherein the multiple first bubble images are captured at different times, and the motion path is used to indicate the position information of the bubbles at different times;
[0041] Step S206: Determine the bubble segmentation mask of the plurality of bubbles at different times according to the motion path, and determine the bubble feature parameters of the plurality of bubbles according to the motion path and the bubble segmentation mask at different times, wherein the bubble feature parameters include static feature parameters and dynamic feature parameters.
[0042] Using the above steps, the first bubble image is first input into the segmentation model for processing to obtain the position information of different bubbles at the first moment and the bubble segmentation mask. The bubble image contains multiple bubbles, and the first moment is the time when the first bubble image was captured. Then, the multiple bubbles are dynamically tracked in multiple first bubble images to obtain the motion paths of these bubbles. The first bubble images are captured at different times, and the motion paths are used to indicate the position information of the bubbles at different times. Based on the motion paths, the bubble segmentation masks of multiple bubbles at different times are determined. Then, based on the motion paths and the bubble segmentation masks at different times, the bubble feature parameters are determined. The bubble feature parameters include static feature parameters and dynamic feature parameters. Using the above scheme, combined with a high-precision segmentation model, the accuracy of bubble detection is significantly improved, thereby obtaining accurate bubble feature parameters. This solves the problem of difficult bubble detection on both sides of the electrodes in related technologies.
[0043] Optionally, before performing step S202 above: inputting the first bubble image into the segmentation model for processing, the method further includes: acquiring a video stream of the target area using a camera device to obtain a bubble video stream; reading a first number of second bubble images from the bubble video stream through a producer thread and adding them to a cache queue; reading the first number of second bubble images from the cache queue through a consumer thread and preprocessing the second bubble images to obtain the first bubble image.
[0044] In this embodiment, a high-speed shadow imaging system is constructed for data acquisition. This system mainly includes a high-speed camera, a host computer control system, an illumination source, a light-diffusing plate, and a hydrogen production device. The high-speed camera is located directly in front of the electrodes, and the light source is located directly behind the electrodes. Figure 3As shown, the producer-consumer design pattern decouples video stream reading and video stream inference. This design model consists of two parts: the producer and the consumer. The producer is responsible for reading a specified number of bubble images (i.e., the second bubble image mentioned above) from the camera for inference. In actual deep learning model inference, inference is performed according to the batch size of images to achieve the optimal throughput of the GPU. This producer-consumer design model also satisfies the model's requirement to read batches of images from the cache queue each time.
[0045] Further, the second bubble image is preprocessed to obtain the first bubble image, including: calculating the transmittance of the second bubble image to obtain the transmittance value of the second bubble image; if it is determined that the transmittance value of the third bubble image in the second bubble image is lower than a first preset threshold, performing histogram equalization on the third bubble image according to the standard bubble image to obtain the processed third bubble image, wherein the second bubble image includes the standard bubble image; and inputting the processed third bubble image into a low-light enhancement model for processing to obtain the first bubble image.
[0046] like Figure 4 As shown, as the electrolysis time increases, the processing method for bubble images with transmittance lower than the first preset threshold (i.e., the third bubble image mentioned above) is as follows after the transmittance index is calculated: First, the first image in the training image is used as the benchmark (i.e., the standard bubble image mentioned above) to perform histogram equalization, thereby improving the contrast and brightness of the image; Second, the transformation from low transmittance to high transmittance is regarded as a low-light enhancement problem, and the bubble image is simultaneously input into the low-light enhancement model UREtinex-Net to complete the further enhancement of the image.
[0047] Optionally, other methods can be used to select the standard bubble image. For example, the machine can identify the image whose image parameters are closest to a certain preset threshold and use it as the standard bubble image. Alternatively, it can be selected manually. This application does not limit this.
[0048] It should be noted that URetinex-Net, as an innovative framework for image enhancement in low-light environments, combines traditional Retinex theory with deep neural networks, providing a completely new solution for enhancing low-light images. Its deep unfolded network can more accurately estimate the brightness distribution of an image, thus preserving the original color information and details while improving image brightness. Figure 5 The diagram shows the network structure of URetinex-Net. By applying advanced methods for low-light enhancement tasks to address the problem of reduced image transmittance during water electrolysis, we effectively improved the accuracy of bubble detection and significantly reduced the false negative rate.
[0049] Optionally, the first bubble image is input into a segmentation model for processing to obtain the position information of multiple bubbles at a first time and a bubble segmentation mask, including: segmenting the first bubble image using a first segmentation model and performing bubble detection on the segmented first bubble image to obtain the first position information and first bubble segmentation mask of a large bubble, wherein the multiple bubbles include the large bubble, and the bubble volume of the large bubble is greater than a second preset threshold; segmenting the first bubble image using a second segmentation model and performing bubble detection on the segmented first bubble image to obtain the second position information and second bubble segmentation mask of a small bubble, wherein the multiple bubbles include the small bubble, and the bubble volume of the small bubble is less than the second preset threshold, and the segmentation model includes the first segmentation model and the second segmentation model; generating a fourth bubble image based on the first position information, the first bubble segmentation mask, the second position information, and the second bubble segmentation mask, wherein the fourth bubble image includes the position information of the multiple bubbles at the first time and the bubble segmentation mask.
[0050] In this application, for larger bubbles (i.e., the aforementioned large bubbles), the changes in light and dark relationships between their center and surrounding area are clearly observable, exhibiting distinct features. However, due to scale limitations, large bubbles are prone to mutual occlusion. If they cannot be accurately segmented, it will severely affect the accuracy of bubble detection and subsequent morphological size calculation. Therefore, this application adopts deep learning to capture these features and achieve high-precision individual bubble segmentation, thereby realizing accurate bubble detection and segmentation.
[0051] Optionally, the MaskTransfiner model based on Transformer can be used to implement the detection and segmentation of specific bubbles. For example... Figure 6 The diagram shows the detection flowchart of MaskTransfiner. It decomposes image regions into quadtrees and combines a Transformer-based method to correct error-prone tree nodes in parallel. This ultimately achieves highly accurate instance mask prediction with low computational cost, resulting in a bubble segmentation mask. Error-prone nodes existing at the detection boundaries are also segmented more precisely. This approach effectively solves the problem of low morphological size calculation accuracy caused by unclear boundary division in traditional models.
[0052] For the detection and segmentation of small bubbles (i.e., the aforementioned microbubbles), in actual high-speed bubble images, the texture features decrease as the bubble scale shrinks. Simply increasing the number of microbubble annotations to improve detection accuracy is labor-intensive and difficult. Further observation reveals that the morphology of microbubbles is similar to traditional spots. Therefore, based on this similarity, this application transfers the traditional spot detection process to microbubble detection, as detailed below. Figure 7 As shown.
[0053] To ensure that the detection of small bubbles does not affect the detection of large bubbles, we segmented the original image, dividing the original 1280*800 image into 256 blocks, each 80*50 pixels in size. Simultaneously, to ensure the detection of the smallest possible bubbles, we also magnified each individual block by a factor of 2. An adaptive contrast enhancement algorithm was also applied during the segmentation process, thereby amplifying the difference between the bubble and its surrounding environment in the highly magnified image. Finally, the segmented images were sequentially input into a speckle detector, and the constrained parameters (roundness, area, convexity) of the speckle detector were used to filter out some bubbles, thus avoiding some extremely small impurities in the gas-liquid system.
[0054] It should be noted that the above data such as 1280*800 and 256 blocks are only used as examples. In actual applications, other values can be set, which does not limit this application.
[0055] The detection of large and small bubbles is carried out simultaneously. Finally, the segmentation results of large and small bubbles are fused to generate a fourth bubble image.
[0056] Optionally, before inputting the first bubble image into the segmentation model for processing, the method further includes: establishing a bubble dataset, wherein the bubble dataset includes multiple bubble images carrying bubble segmentation masks; determining a loss function according to the type of the segmentation model, wherein the loss function is used to train the segmentation model; and training the segmentation model based on the bubble dataset and the loss function.
[0057] First, a bubble dataset was created, annotating nearly ten thousand bubble segmentation instances (i.e., bubble images labeled with bubble segmentation masks), providing a large number of learning samples for model training. Then, based on the selected segmentation model type, a loss function was determined for training the segmentation model. Finally, the bubble dataset and the loss function were used to complete the training process of the segmentation model.
[0058] Optionally, dynamic tracking of the plurality of bubbles in multiple first bubble images to obtain the motion paths of the plurality of bubbles includes: extracting appearance features from the first bubbles in the plurality of bubbles to obtain a first appearance feature, and extracting appearance features from the plurality of second bubbles in the fifth bubble image to obtain a plurality of second appearance features; calculating the cosine distance between the first appearance feature and the plurality of second appearance features to obtain a plurality of cosine distance values, wherein the fifth bubble image is captured at the time following the first time; predicting the motion trajectory of the first bubble using a Kalman filter to calculate a first index value between the predicted future position of the first bubble and the plurality of second bubbles, wherein the first index value is used to indicate the movement of the first bubble to the next time. The overlap between the current position of the first bubble and the second bubble is calculated; the average absolute difference in the motion velocity directions of the first bubble and the plurality of second bubbles is calculated to obtain multiple directional absolute differences; the absolute difference in the confidence scores of the first bubble and the plurality of second bubbles is calculated to obtain multiple confidence score absolute differences, wherein the confidence scores are determined by the segmentation model; a cost matrix is constructed based on the plurality of cosine distance values, the plurality of first index values, the plurality of directional absolute differences, and the plurality of confidence score absolute differences, and the cost matrix is processed by the Hungarian algorithm to determine the third bubble among the plurality of second bubbles, wherein the third bubble is the bubble corresponding to the first bubble at the next time step after the first time step; the motion path of the first bubble is determined based on the plurality of third bubbles.
[0059] After model detection, the output includes bubble localization information, namely the top-left and bottom-right corners of the corresponding detection box (i.e., the aforementioned position information), and the confidence score. This output is then passed to the Hybrid-SORT model as input. The Hybrid-SORT model calculates the location of the next target based on five dimensions: confidence score, velocity, position, appearance features, and height. The specific calculation process includes:
[0060] 1. Based on the SimCLR framework, extract the appearance features of each bubble to obtain the first appearance feature, and use the cosine distance as the similarity measure between the tracked bubble (i.e. the second bubble mentioned above) and the detected bubble (i.e. the first bubble mentioned above), that is, the cosine distance value mentioned above.
[0061] 2. Based on the position information of the detected bubble, the Kalman filter is used to estimate the motion of the bubble in the next frame. Combined with the height information of the bubble, the bubbles in front and behind are distinguished. The HMIOU index (i.e. the first index value mentioned above) is used as the similarity measure between the tracked bubble and the detected bubble.
[0062] 3. Combining the velocity direction information of the bubble, calculate the average absolute difference in velocity direction of the four corner points of the tracking bubble and the detection bubble, and use it as a similarity metric (i.e., the absolute difference in direction mentioned above);
[0063] 4. To address the issue of tracking loss when bubbles are occluded, the feature that the confidence level is lower when bubbles are occluded is utilized, and the absolute difference between the confidence levels (i.e., the aforementioned absolute difference in confidence level) is used as a similarity measure between the tracked bubble and the detected bubble.
[0064] Taking into account the similarity metrics across all dimensions, a total cost matrix is calculated. Using the Hungarian algorithm, the optimal one-to-one match between the tracked bubble and the detected bubble is obtained. Based on the tracking and matching results for each frame, the motion path of each individual bubble is determined.
[0065] The high-precision mask obtained through the above method can effectively calculate the bubble size distribution, count the number of individual bubbles in each frame, and calculate indicators such as gas holdup by combining operating parameters. Specifically... The bubble feature parameters of the plurality of bubbles are determined based on the motion path and the bubble segmentation mask at different times, including at least one of the following: counting the number of bubbles in the first bubble image based on the bubble segmentation mask; determining the equivalent volume of the plurality of bubbles based on the cross-sectional area of the bubble segmentation mask and the size information of the reference object in the first bubble image; determining the real-time radius of the plurality of bubbles at the first time based on the plurality of equivalent volumes; calculating the gas holdup of the liquid flowing through the target area within a target time period containing bubbles based on the liquid flow velocity in the target area and the equivalent volume, wherein the start time of the target time period is the time when the target bubble enters the target area, and the end time of the target time period is the time when the target bubble leaves the target area, and the static feature parameters include: the number of bubbles, the equivalent volume, the real-time radius, and the gas holdup; determining the average flow velocity of the plurality of bubbles based on the actual height information of the target area and the time length of the target time period; and counting the motion behavior of the plurality of bubbles in the target area based on the motion path and the bubble segmentation mask at different times, wherein the motion behavior includes the direction of bubble movement, and the dynamic feature parameters include the average flow velocity and the motion behavior.
[0066] Bubble characteristic parameter calculation includes static characteristic parameter calculation and dynamic characteristic parameter calculation:
[0067] Static feature parameters:
[0068] 1. Quantity Statistics: For each image, combining the segmentation results of large and small bubbles in the multi-process segmentation stage, the total number of bubbles found is counted, and the change curve is continuously updated as the video stream progresses.
[0069] 2. Equivalent radius source: The bubble is a near-sphere. By calculating the cross-sectional area of the front view and combining it with the dimensions of the actual reference object, the equivalent radius can be approximately calculated, and the equivalent volume of the bubble can be calculated.
[0070] 3. Real-time radius distribution: In order to observe the process of large-scale bubble size changes during electrolysis, we calculated the radius of each bubble in each frame of the image (i.e., the real-time radius mentioned above) and analyzed it in the form of a kernel density map.
[0071] 4. Gas holdup estimation: By combining the actual liquid flow rate, the volume calculated from the tracking effect bubbles and the equivalent radius, the flow rate within a certain time interval of the pipeline was determined, and the bubble volume within that interval was calculated, thereby obtaining the gas holdup of the electrolysis system within a certain time period.
[0072] Dynamic feature parameters:
[0073] 1. Airflow velocity estimation: By counting the number of frames tracked for each bubble and the height difference between the first and last frames tracked, and combining this with the real-world height information of the pipe in the image, the average flow velocity of the bubble over a period of time is calculated.
[0074] 2. Distribution of bubble motion behavior: In order to observe the upward or downward motion behavior of bubbles during electrolysis, the velocity direction of the bubbles in each frame is tracked and the motion curve is continuously updated as the video stream flows.
[0075] To accelerate the rendering process, multithreading can be used to plot various collected data indicators. Specifically, this involves plotting the changes in the number of bubble images per frame, the real-time bubble radius distribution across cumulative frames, the estimated gas holdup across cumulative frames, the estimated changes in bubble velocity, and the bubble motion behavior. Calculating these solely within the main thread would severely impact most indicators requiring real-time updates, leading to delayed updates. Therefore, this application uses Python to create multiple plotting threads, each plotting a single type of indicator. Within each thread, the image data source is obtained by periodically reading the indicator data file updated in real-time by the main thread.
[0076] This application utilizes advanced deep learning detection, segmentation, and tracking algorithms, along with image enhancement models, to achieve high-precision detection of bubbles under hydrogen production conditions via water electrolysis. This method not only acquires static parameters such as bubble size and morphology but also dynamic parameters such as bubble trajectory, effectively overcoming the challenges of detecting small targets under complex conditions, significantly reduced detection accuracy under unbalanced lighting, and high annotation costs for bubble tracking datasets. Specifically, it improves the average number of bubble detections per frame by approximately 23 (using only low-light enhancement and histogram equalization), and the number of small target detections per frame (using a speckle detection algorithm) by nearly 100. The tracking algorithm, based on a motion model, comprehensively utilizes information from five dimensions of the bubble, eliminating the problem of excessive annotation costs associated with deep learning models. It also incorporates index calculation into bubble detection, enabling the study of both static features and dynamic behavior of bubbles.
[0077] Overall, the implementation process of the above-mentioned method for determining bubble characteristic parameters is as follows: Figure 8 As shown, it includes the following steps:
[0078] Step 1: Extract the video stream from the high-speed camera using a producer-consumer concurrent design model;
[0079] Step 2: Based on the image's transmittance, determine whether to preprocess the image and enhance the low-light model;
[0080] Step 3: Input the pre-processed image into the segmentation model to obtain the bubble position and bubble segmentation mask;
[0081] Step 4: Combine bubble position and inter-frame bubble behavior features to calculate individual similarity and achieve dynamic tracking of individual positioning;
[0082] Step 5: Calculate the number of bubbles and particle size distribution in each frame, and combine this with the operating conditions to calculate bubble characteristic parameters such as gas holdup.
[0083] Step 6: Utilize multi-threading technology to process the data stream in parallel and plot the analysis results.
[0084] This application proposes an innovative method for bubble detection, segmentation, tracking, and analysis in water electrolysis based on computer vision and machine learning. It focuses on addressing the challenges of detecting bubbles on both electrodes during water electrolysis in hydrogen production and establishing a correlation between bubble detection and operating parameters. This method significantly improves bubble detection accuracy by combining a high-precision target detection and segmentation model from deep learning with an image enhancement model under dynamic unbalanced lighting conditions. Furthermore, it utilizes machine learning to establish the relationship between bubble morphology and behavior characteristics and operating parameters (current density, pressure, temperature), thereby developing an intelligent real-time control strategy. This provides a new, safe, reliable, and efficient solution for modeling and controlling hydrogen electrolysis systems.
[0085] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of this application.
[0086] Figure 9 This is a structural block diagram of a device for determining bubble characteristic parameters according to an embodiment of this application; as shown... Figure 9 As shown, it includes:
[0087] The processing module 92 is used to input the first bubble image into the segmentation model for processing to obtain the position information of multiple bubbles at the first moment and the bubble segmentation mask, wherein the bubble image includes the multiple bubbles, and the first moment is the time when the first bubble image was captured;
[0088] The tracking module 94 is used to dynamically track the plurality of bubbles in a plurality of first bubble images to obtain the motion path of the plurality of bubbles, wherein the plurality of first bubble images are captured at different times, and the motion path is used to indicate the position information of the bubbles at different times;
[0089] The determining module 96 is used to determine the bubble segmentation mask of the plurality of bubbles at different times according to the motion path, and to determine the bubble feature parameters of the plurality of bubbles according to the motion path and the bubble segmentation mask at different times, wherein the bubble feature parameters include static feature parameters and dynamic feature parameters.
[0090] Using the aforementioned device, the first bubble image is first input into a segmentation model for processing to obtain the position information of different bubbles at the first moment and bubble segmentation masks. The bubble image contains multiple bubbles, and the first moment is the time when the first bubble image was captured. Then, the multiple bubbles are dynamically tracked in multiple first bubble images to obtain their motion paths. The first bubble images are captured at different times, and the motion paths are used to indicate the position information of the bubbles at different times. Based on the motion paths, bubble segmentation masks for multiple bubbles at different times are determined. Then, based on the motion paths and the bubble segmentation masks at different times, bubble feature parameters are determined. Bubble feature parameters include static feature parameters and dynamic feature parameters. By adopting the above scheme and combining it with a high-precision segmentation model, the accuracy of bubble detection is significantly improved, thereby obtaining accurate bubble feature parameters. This solves the problem of difficult bubble detection on both sides of the electrodes in related technologies.
[0091] Optionally, the above-mentioned processing module 92 is further configured to acquire a video stream of the target area through a camera device to obtain a bubble video stream; read a first number of second bubble images from the bubble video stream through a producer thread and add them to a cache queue; and read the first number of second bubble images from the cache queue through a consumer thread and preprocess the second bubble images to obtain the first bubble image.
[0092] In this embodiment, a high-speed shadow imaging system is constructed for data acquisition. This system mainly includes a high-speed camera, a host computer control system, an illumination source, a light-diffusing plate, and a hydrogen production device. The high-speed camera is located directly in front of the electrodes, and the light source is located directly behind the electrodes. Figure 3 As shown, the producer-consumer design pattern decouples video stream reading and video stream inference. This design model consists of two parts: the producer and the consumer. The producer is responsible for reading a specified number of bubble images (i.e., the second bubble image mentioned above) from the camera for inference. In actual deep learning model inference, inference is performed according to the batch size of images to achieve the optimal throughput of the GPU. This producer-consumer design model also satisfies the model's requirement to read batches of images from the cache queue each time.
[0093] Optionally, the processing module 92 is further configured to calculate the transmittance of the second bubble image to obtain the transmittance value of the second bubble image; if it is determined that the transmittance value of the third bubble image in the second bubble image is lower than a first preset threshold, perform histogram equalization on the third bubble image according to the standard bubble image to obtain the processed third bubble image, wherein the second bubble image includes the standard bubble image; and input the processed third bubble image into a low-light enhancement model for processing to obtain the first bubble image.
[0094] like Figure 4 As shown, as the electrolysis time increases, the processing method for bubble images with transmittance lower than the first preset threshold (i.e., the third bubble image mentioned above) is as follows after the transmittance index is calculated: First, the first image in the training image is used as the benchmark (i.e., the standard bubble image mentioned above) to perform histogram equalization, thereby improving the contrast and brightness of the image; Second, the transformation from low transmittance to high transmittance is regarded as a low-light enhancement problem, and the bubble image is simultaneously input into the low-light enhancement model UREtinex-Net to complete the further enhancement of the image.
[0095] Optionally, other methods can be used to select the standard bubble image. For example, the machine can identify the image whose image parameters are closest to a certain preset threshold and use it as the standard bubble image. Alternatively, it can be selected manually. This application does not limit this.
[0096] It should be noted that URetinex-Net, as an innovative framework for image enhancement in low-light environments, combines traditional Retinex theory with deep neural networks, providing a completely new solution for enhancing low-light images. Its deep unfolded network can more accurately estimate the brightness distribution of an image, thus preserving the original color information and details while improving image brightness. Figure 5 The diagram shows the network structure of URetinex-Net. By applying advanced methods for low-light enhancement tasks to address the problem of reduced image transmittance during water electrolysis, we effectively improved the accuracy of bubble detection and significantly reduced the false negative rate.
[0097] Optionally, the processing module 92 is further configured to segment the first bubble image using a first segmentation model, and perform bubble detection on the segmented first bubble image to obtain first position information and a first bubble segmentation mask for large bubbles, wherein the plurality of bubbles includes the large bubbles, and the volume of the large bubbles is greater than a second preset threshold; segment the first bubble image using a second segmentation model, and perform bubble detection on the segmented first bubble image to obtain second position information and a second bubble segmentation mask for small bubbles, wherein the plurality of bubbles includes the small bubbles, and the volume of the small bubbles is less than the second preset threshold, the segmentation model includes the first segmentation model and the second segmentation model; and generate a fourth bubble image based on the first position information, the first bubble segmentation mask, the second position information, and the second bubble segmentation mask, wherein the fourth bubble image includes the position information of the plurality of bubbles at the first time point and the bubble segmentation mask.
[0098] In this application, for larger bubbles (i.e., the aforementioned large bubbles), the changes in light and dark relationships between their center and surrounding area are clearly observable, exhibiting distinct features. However, due to scale limitations, large bubbles are prone to mutual occlusion. If they cannot be accurately segmented, it will severely affect the accuracy of bubble detection and subsequent morphological size calculation. Therefore, this application adopts deep learning to capture these features and achieve high-precision individual bubble segmentation, thereby realizing accurate bubble detection and segmentation.
[0099] Optionally, the MaskTransfiner model based on Transformer can be used to implement the detection and segmentation of specific bubbles. For example... Figure 6 The diagram shows the detection flowchart of MaskTransfiner. It decomposes image regions into quadtrees and combines a Transformer-based method to correct error-prone tree nodes in parallel. This ultimately achieves highly accurate instance mask prediction with low computational cost, resulting in a bubble segmentation mask. Error-prone nodes existing at the detection boundaries are also segmented more precisely. This approach effectively solves the problem of low morphological size calculation accuracy caused by unclear boundary division in traditional models.
[0100] For the detection and segmentation of small bubbles (i.e., the aforementioned microbubbles), in actual high-speed bubble images, the texture features decrease as the bubble scale shrinks. Simply increasing the number of microbubble annotations to improve detection accuracy is labor-intensive and difficult. Further observation reveals that the morphology of microbubbles is similar to traditional spots. Therefore, based on this similarity, this application transfers the traditional spot detection process to microbubble detection, as detailed below. Figure 7 As shown.
[0101] To ensure that the detection of small bubbles does not affect the detection of large bubbles, we segmented the original image, dividing the original 1280*800 image into 256 blocks, each 80*50 pixels in size. Simultaneously, to ensure the detection of the smallest possible bubbles, we also magnified each individual block by a factor of 2. An adaptive contrast enhancement algorithm was also applied during the segmentation process, thereby amplifying the difference between the bubble and its surrounding environment in the highly magnified image. Finally, the segmented images were sequentially input into a speckle detector, and the constrained parameters (roundness, area, convexity) of the speckle detector were used to filter out some bubbles, thus avoiding some extremely small impurities in the gas-liquid system.
[0102] It should be noted that the above data such as 1280*800 and 256 blocks are only used as examples. In actual applications, other values can be set, which does not limit this application.
[0103] The detection of large and small bubbles is carried out simultaneously. Finally, the segmentation results of large and small bubbles are fused to generate a fourth bubble image.
[0104] Optionally, the above-mentioned processing module 92 is further configured to establish a bubble dataset, wherein the bubble dataset includes multiple bubble images carrying bubble segmentation masks; determine a loss function according to the type of the segmentation model, wherein the loss function is used to train the segmentation model; and train the segmentation model according to the bubble dataset and the loss function.
[0105] First, a bubble dataset was created, annotating nearly ten thousand bubble segmentation instances (i.e., bubble images labeled with bubble segmentation masks), providing a large number of learning samples for model training. Then, based on the selected segmentation model type, a loss function was determined for training the segmentation model. Finally, the bubble dataset and the loss function were used to complete the training process of the segmentation model.
[0106] Optionally, the tracking module 94 is further configured to extract appearance features from the first bubble in the plurality of bubbles to obtain a first appearance feature, and to extract appearance features from the plurality of second bubbles in the fifth bubble image to obtain a plurality of second appearance features, calculate the cosine distance between the first appearance feature and the plurality of second appearance features respectively to obtain a plurality of cosine distance values, wherein the shooting time of the fifth bubble image is the next time after the first time; and to predict the motion trajectory of the first bubble using a Kalman filter to calculate a first index value between the predicted future position of the first bubble and the plurality of second bubbles, wherein the first index value is used to indicate the overlap between the position of the first bubble at the next time and the second bubbles. The following steps are performed: 1) Calculate the average absolute difference in the velocity directions of the first bubble and the plurality of second bubbles, obtaining multiple absolute differences in directions; 2) Calculate the absolute difference in confidence scores between the first bubble and the plurality of second bubbles, obtaining multiple absolute differences in confidence scores, wherein the confidence scores are determined by the segmentation model; 3) Construct a cost matrix based on the plurality of cosine distance values, the plurality of first index values, the plurality of absolute differences in directions, and the plurality of absolute differences in confidence scores, and process the cost matrix using the Hungarian algorithm to determine a third bubble among the plurality of second bubbles, wherein the third bubble is the bubble corresponding to the first bubble at the next time step after the first time step; 4) Determine the motion path of the first bubble based on the plurality of third bubbles.
[0107] After model detection, the output includes bubble localization information, namely the top-left and bottom-right corners of the corresponding detection box (i.e., the aforementioned position information), and the confidence score. This output is then passed to the Hybrid-SORT model as input. The Hybrid-SORT model calculates the location of the next target based on five dimensions: confidence score, velocity, position, appearance features, and height. The specific calculation process includes:
[0108] 1. Based on the SimCLR framework, extract the appearance features of each bubble to obtain the first appearance feature, and use the cosine distance as the similarity measure between the tracked bubble (i.e. the second bubble mentioned above) and the detected bubble (i.e. the first bubble mentioned above), that is, the cosine distance value mentioned above.
[0109] 2. Based on the position information of the detected bubble, the Kalman filter is used to estimate the motion of the bubble in the next frame. Combined with the height information of the bubble, the bubbles in front and behind are distinguished. The HMIOU index (i.e. the first index value mentioned above) is used as the similarity measure between the tracked bubble and the detected bubble.
[0110] 3. Combining the velocity direction information of the bubble, calculate the average absolute difference in velocity direction of the four corner points of the tracking bubble and the detection bubble, and use it as a similarity metric (i.e., the absolute difference in direction mentioned above);
[0111] 4. To address the issue of tracking loss when bubbles are occluded, the feature that the confidence level is lower when bubbles are occluded is utilized, and the absolute difference between the confidence levels (i.e., the aforementioned absolute difference in confidence level) is used as a similarity measure between the tracked bubble and the detected bubble.
[0112] Taking into account the similarity metrics across all dimensions, a total cost matrix is calculated. Using the Hungarian algorithm, the optimal one-to-one match between the tracked bubble and the detected bubble is obtained. Based on the tracking and matching results for each frame, the motion path of each individual bubble is determined.
[0113] Optionally, the determining module 96 is further configured to perform at least one of the following steps to determine the bubble feature parameters of the plurality of bubbles: counting the number of bubbles in the first bubble image based on the bubble segmentation mask; determining the equivalent volume of the plurality of bubbles based on the cross-sectional area of the bubble segmentation mask and the size information of the reference object in the first bubble image; determining the real-time radius of the plurality of bubbles at the first moment based on the plurality of equivalent volumes; calculating the gas holdup of the liquid flowing through the target area within a target time period containing bubbles based on the liquid flow velocity in the target area and the equivalent volume, wherein the start time of the target time period is the moment when the target bubble enters the target area, and the end time of the target time period is the moment when the target bubble leaves the target area, and the static feature parameters include: the number of bubbles, the equivalent volume, the real-time radius, and the gas holdup; determining the average flow velocity of the plurality of bubbles based on the actual height information of the target area and the time length of the target time period; and counting the motion behavior of the plurality of bubbles in the target area based on the motion path and the bubble segmentation mask at different times, wherein the motion behavior includes the direction of bubble movement, and the dynamic feature parameters include the average flow velocity and the motion behavior.
[0114] Bubble characteristic parameter calculation includes static characteristic parameter calculation and dynamic characteristic parameter calculation:
[0115] Static feature parameters:
[0116] 1. Quantity Statistics: For each image, combining the segmentation results of large and small bubbles in the multi-process segmentation stage, the total number of bubbles found is counted, and the change curve is continuously updated as the video stream progresses.
[0117] 2. Equivalent radius source: The bubble is a near-sphere. By calculating the cross-sectional area of the front view and combining it with the dimensions of the actual reference object, the equivalent radius can be approximately calculated, and the equivalent volume of the bubble can be calculated.
[0118] 3. Real-time radius distribution: In order to observe the process of large-scale bubble size changes during electrolysis, we calculated the radius of each bubble in each frame of the image (i.e., the real-time radius mentioned above) and analyzed it in the form of a kernel density map.
[0119] 4. Gas holdup estimation: By combining the actual liquid flow rate, the volume calculated from the tracking effect bubbles and the equivalent radius, the flow rate within a certain time interval of the pipeline was determined, and the bubble volume within that interval was calculated, thereby obtaining the gas holdup of the electrolysis system within a certain time period.
[0120] Dynamic feature parameters:
[0121] 1. Airflow velocity estimation: By counting the number of frames tracked for each bubble and the height difference between the first and last frames tracked, and combining this with the real-world height information of the pipe in the image, the average flow velocity of the bubble over a period of time is calculated.
[0122] 2. Distribution of bubble motion behavior: In order to observe the upward or downward motion behavior of bubbles during electrolysis, the velocity direction of the bubbles in each frame is tracked and the motion curve is continuously updated as the video stream flows.
[0123] Embodiments of this application also provide a storage medium including a stored program, wherein the program executes any of the methods described above when it is run.
[0124] Optionally, in this embodiment, the storage medium may be configured to store program code for performing the following steps:
[0125] S1, the first bubble image is input into the segmentation model for processing to obtain the position information of multiple bubbles at the first moment and the bubble segmentation mask, wherein the bubble image includes the multiple bubbles, and the first moment is the time when the first bubble image was captured;
[0126] S2, dynamically track the multiple bubbles in multiple first bubble images to obtain the motion path of the multiple bubbles, wherein the multiple first bubble images are captured at different times, and the motion path is used to indicate the position information of the bubbles at different times;
[0127] S3, determine the bubble segmentation mask of the plurality of bubbles at different times according to the motion path, and determine the bubble feature parameters of the plurality of bubbles according to the motion path and the bubble segmentation mask at different times, wherein the bubble feature parameters include static feature parameters and dynamic feature parameters.
[0128] In one exemplary embodiment, the aforementioned computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard disk, magnetic disk, or optical disk.
[0129] Specific examples in this embodiment can be found in the examples described in the above embodiments and exemplary implementations, and will not be repeated here.
[0130] Embodiments of this application also provide an electronic device, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.
[0131] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:
[0132] S1, the first bubble image is input into the segmentation model for processing to obtain the position information of multiple bubbles at the first moment and the bubble segmentation mask, wherein the bubble image includes the multiple bubbles, and the first moment is the time when the first bubble image was captured;
[0133] S2, dynamically track the multiple bubbles in multiple first bubble images to obtain the motion path of the multiple bubbles, wherein the multiple first bubble images are captured at different times, and the motion path is used to indicate the position information of the bubbles at different times;
[0134] S3, determine the bubble segmentation mask of the plurality of bubbles at different times according to the motion path, and determine the bubble feature parameters of the plurality of bubbles according to the motion path and the bubble segmentation mask at different times, wherein the bubble feature parameters include static feature parameters and dynamic feature parameters.
[0135] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0136] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated here.
[0137] Obviously, those skilled in the art should understand that the modules or steps of this application described above can be implemented using general-purpose computing devices. They can be centralized on a single computing device or distributed across a network of multiple computing devices. Optionally, they can be implemented using computer-executable program code, thereby storing them in a storage device for execution by a computing device. In some cases, the steps shown or described can be performed in a different order than those presented here, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. Thus, this application is not limited to any particular combination of hardware and software.
[0138] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the principles of this application should be included within the protection scope of this application.
Claims
1. A method for determining bubble characteristic parameters, characterized in that, include: The first bubble image is input into the segmentation model for processing to obtain the position information of multiple bubbles at the first moment and the bubble segmentation mask. The bubble image includes the multiple bubbles, and the first moment is the time when the first bubble image was captured. The multiple bubbles are dynamically tracked in multiple first bubble images to obtain the motion paths of the multiple bubbles. The multiple first bubble images are captured at different times, and the motion paths are used to indicate the position information of the bubbles at different times. Based on the motion path, bubble segmentation masks of the plurality of bubbles at different times are determined, and bubble feature parameters of the plurality of bubbles are determined based on the motion path and the bubble segmentation masks at different times, wherein the bubble feature parameters include static feature parameters and dynamic feature parameters. The process involves dynamically tracking the multiple bubbles in multiple first bubble images to obtain their motion paths, including: The appearance features of the first bubble in the plurality of bubbles are extracted to obtain a first appearance feature, and the appearance features of the second bubbles in the fifth bubble image are extracted to obtain a plurality of second appearance features. The cosine distance between the first appearance feature and the plurality of second appearance features is calculated to obtain a plurality of cosine distance values. The fifth bubble image is captured at the time following the first time. The motion trajectory of the first bubble is predicted by a Kalman filter to calculate a first index value between the predicted future position of the first bubble and the plurality of second bubbles, wherein the first index value is used to indicate the degree of overlap between the position of the first bubble at the next moment and the second bubbles. Calculate the average absolute difference in the direction of motion velocity between the first bubble and the plurality of second bubbles respectively to obtain multiple absolute differences in direction; The absolute difference in confidence level between the first bubble and the plurality of second bubbles is calculated respectively to obtain a plurality of absolute difference in confidence level, wherein the confidence level is determined by the segmentation model; A cost matrix is constructed based on the plurality of cosine distance values, the plurality of first index values, the plurality of directional absolute differences, and the plurality of confidence absolute differences. The cost matrix is then processed using the Hungarian algorithm to determine a third bubble among the plurality of second bubbles. The third bubble is the bubble corresponding to the first bubble at the next time step after the first time step. The motion path of the first bubble is determined based on the plurality of third bubbles.
2. The method for determining bubble characteristic parameters according to claim 1, characterized in that, Before inputting the first bubble image into the segmentation model for processing, the method further includes: A bubble video stream is obtained by capturing video streams of the target area using camera equipment; The producer thread reads a first number of second bubble images from the bubble video stream and adds them to the cache queue. The consumer thread reads the first number of second bubble images from the cache queue and preprocesses the second bubble images to obtain the first bubble image.
3. The method for determining bubble characteristic parameters according to claim 2, characterized in that, Preprocessing the second bubble image to obtain the first bubble image includes: The transmittance of the second bubble image is calculated to obtain the transmittance value of the second bubble image; If the transmittance value of the third bubble image in the second bubble image is determined to be lower than the first preset threshold, histogram equalization is performed on the third bubble image according to the standard bubble image to obtain the processed third bubble image, wherein the second bubble image includes the standard bubble image; The processed third bubble image is input into the low-light enhancement model for further processing to obtain the first bubble image.
4. The method for determining bubble characteristic parameters according to claim 1, characterized in that, The first bubble image is input into the segmentation model for processing to obtain the position information of multiple bubbles at the first time step and the bubble segmentation mask, including: The first bubble image is segmented using a first segmentation model, and bubble detection is performed on the segmented first bubble image to obtain the first position information of the large bubble and the first bubble segmentation mask. The plurality of bubbles include the large bubble, and the volume of the large bubble is greater than a second preset threshold. The first bubble image is segmented using a second segmentation model, and bubble detection is performed on the segmented first bubble image to obtain the second position information of the small bubbles and the second bubble segmentation mask. The plurality of bubbles include the small bubbles, the volume of the small bubbles is less than the second preset threshold, and the segmentation model includes the first segmentation model and the second segmentation model. A fourth bubble image is generated based on the first position information, the first bubble segmentation mask, the second position information, and the second bubble segmentation mask, wherein the fourth bubble image includes the position information of the plurality of bubbles at the first time and the bubble segmentation mask.
5. The method for determining bubble characteristic parameters according to claim 4, characterized in that, Before inputting the first bubble image into the segmentation model for processing, the method further includes: Establish a bubble dataset, wherein the bubble dataset includes multiple bubble images carrying bubble segmentation masks; A loss function is determined based on the type of the segmentation model, wherein the loss function is used to train the segmentation model; The segmentation model is trained based on the bubble dataset and the loss function.
6. The method for determining bubble characteristic parameters according to claim 1, characterized in that, The bubble feature parameters of the plurality of bubbles are determined based on the motion path and the bubble segmentation mask at different times, including at least one of the following: The number of bubbles in the first bubble image is counted based on the bubble segmentation mask. The equivalent volume of the plurality of bubbles is determined based on the cross-sectional area of the bubble segmentation mask and the size information of the reference object in the first bubble image; The real-time radius of the plurality of bubbles at the first moment is determined based on the plurality of equivalent volumes; The gas holdup of the liquid flowing through the target area during the target time period is calculated based on the liquid flow velocity and the equivalent volume within the target area. The start time of the target time period is the time when the target bubble enters the target area, and the end time of the target time period is the time when the target bubble leaves the target area. The static characteristic parameters include: the number of bubbles, the equivalent volume, the real-time radius, and the gas holdup. The average flow velocity of the multiple bubbles is determined based on the actual height information of the target area and the duration of the target time period. The motion behavior of the multiple bubbles in the target area is statistically analyzed based on the motion path and the bubble segmentation mask at different times, wherein the motion behavior includes the direction of bubble movement, and the dynamic feature parameters include the average flow velocity and the motion behavior.
7. A device for determining bubble characteristic parameters, characterized in that, include: The processing module is used to input the first bubble image into the segmentation model for processing to obtain the position information of multiple bubbles at the first moment and the bubble segmentation mask, wherein the bubble image includes the multiple bubbles, and the first moment is the time when the first bubble image was captured; The tracking module is used to dynamically track the multiple bubbles in multiple first bubble images to obtain the motion path of the multiple bubbles, wherein the multiple first bubble images are captured at different times, and the motion path is used to indicate the position information of the bubbles at different times; The determination module is used to determine the bubble segmentation mask of the plurality of bubbles at different times according to the motion path, and to determine the bubble feature parameters of the plurality of bubbles according to the motion path and the bubble segmentation mask at different times, wherein the bubble feature parameters include static feature parameters and dynamic feature parameters; The tracking module is further configured to extract appearance features from the first bubble in the plurality of bubbles to obtain a first appearance feature, and to extract appearance features from the plurality of second bubbles in the fifth bubble image to obtain a plurality of second appearance features, and to calculate the cosine distance between the first appearance feature and the plurality of second appearance features to obtain a plurality of cosine distance values, wherein the shooting time of the fifth bubble image is the next time after the first time. The motion trajectory of the first bubble is predicted by a Kalman filter to calculate a first index value between the predicted future position of the first bubble and the plurality of second bubbles, wherein the first index value is used to indicate the degree of overlap between the position of the first bubble at the next moment and the second bubbles. Calculate the average absolute difference in the direction of motion velocity between the first bubble and the plurality of second bubbles respectively to obtain multiple absolute differences in direction; The absolute difference in confidence level between the first bubble and the plurality of second bubbles is calculated respectively to obtain a plurality of absolute difference in confidence level, wherein the confidence level is determined by the segmentation model; A cost matrix is constructed based on the plurality of cosine distance values, the plurality of first index values, the plurality of directional absolute differences, and the plurality of confidence absolute differences. The cost matrix is then processed using the Hungarian algorithm to determine a third bubble among the plurality of second bubbles. The third bubble is the bubble corresponding to the first bubble at the next time step after the first time step. The motion path of the first bubble is determined based on the plurality of third bubbles.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, wherein the program, when executed, performs the method according to any one of claims 1 to 6.
9. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to execute the method described in any one of claims 1 to 6 through the computer program.
Citation Information
Patent Citations
Deep learning-based airtight container airtightness water detection method
CN115760771A
Gas drive experiment video real-time analysis method and device based on improved YOLOv8 + DeepSORT
CN118247701A