Leak detection method, device, equipment and storage medium
By processing video stream data through the target network model and convolution module, high-accuracy detection of leakage detection objects such as smoke, gas, and flame is achieved, solving the problem of low detection accuracy in the existing technology and enhancing facility safety.
Patent Information
- Application Number
- CN202410109625.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-25
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2044-01-25
AI Technical Summary
It is difficult to accurately detect leakage detection objects such as smoke, gas, and flame with the existing technology, resulting in low leakage detection accuracy and potential safety hazards.
Using the target network model, trained through video stream data, combined with the two-dimensional spatial convolution module, one-dimensional time convolution module and component processing module, it detects whether there are leakage detection objects in the video stream data, and realizes detection of smoke, gas, flame, etc. high accuracy detection.
It improves the detection accuracy of leakage detection objects such as smoke, gas, and flame, enhances the real-time monitoring capability of gas leakage events, reduces the misjudgment rate, and improves facility safety.
Smart Images

Figure CN118155127B
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to infrared technology, and relate to but are not limited to a leakage detection method, device, equipment and storage medium. Background Art
[0002] A large number of natural gas, liquefied petroleum gas oil and gas pipelines, compressor stations and other facilities are involved in the production work design of gas leakage. The safe operation of these facilities is crucial to ensure the stability of energy supply. However, in the production process of these facilities, gas leakage has become a serious problem. Gas leakage not only leads to waste of resources, but also poses a huge threat to the environment and public safety. Once a serious gas leakage accident occurs, it may cause catastrophic consequences such as fire and explosion, causing serious losses to people's lives and property. Gas leakage detection work is of great significance in the production work of these facilities. However, the leakage detection objects of gas leakage detection work are mostly targets such as smoke, gas, and flames. They have irregular shapes, unclear spatial features, and are difficult to distinguish from the environment. It is impossible to accurately locate the leakage detection object from a single picture based on the semantic information contained in a single picture, thereby failing to improve the accuracy of the detection of the leakage detection object. Therefore, how to achieve high-accuracy detection of leakage detection objects such as smoke, gas, and flames is an urgent problem to be solved in this field. Summary of the invention
[0003] In view of this, the leakage detection method, device, equipment and storage medium provided in the embodiments of the present application can achieve high-accuracy detection of leakage detection objects such as smoke, gas, flame, etc.
[0004] In a first aspect, an embodiment of the present application provides a leakage detection method, the method comprising: obtaining video stream data for a target space, the video stream data comprising at least two consecutive frames of images; inputting the video stream data into a preset target network model, and outputting a leakage detection result of the target space through the target network model, the leakage detection result being used to indicate whether there is a leakage detection object in the target space; wherein the target network model is obtained by training an initial network model using a training data set, the training data set comprising a sample video set having the leakage detection object, and the spatial component of the leakage detection object varies in the time dimension of the sample video set.
[0005] In the above leakage detection method, the video stream data is input into the target network model so that the target network model outputs the leakage detection result corresponding to the video stream data according to the video stream data. Since the target network model is obtained by training the initial network model using the training data set, and the training data set includes a sample video set with a leakage detection object, and the spatial component of the leakage detection object changes in the time dimension of the sample video set, the target network model can detect whether there is a leakage detection object in the video stream data according to the change of the spatial component of the leakage detection object in the time dimension of the sample video set, thereby achieving high-accuracy detection of leakage detection objects such as smoke, gas, and flame.
[0006] In some embodiments, the target network model includes a two-dimensional spatial convolution module, a one-dimensional temporal convolution module, a component processing module and a result output module connected in series, wherein: the two-dimensional spatial convolution module is used to convolve the at least two frames of images to obtain the initial spatial component corresponding to at least one image feature of the at least two frames of images in the video stream data; the one-dimensional temporal convolution module is used to convolve the video stream data to obtain the initial time component of the video stream data; the component processing module is used to convolve the initial spatial component and the initial time component according to a preset convolution strategy to obtain the target spatial component and the target time component; the result output module , which is used to output a leakage detection result indicating that a leakage detection object exists in the target space when the difference between the target variation and the preset variation is less than a threshold value; and to output a leakage detection result indicating that no leakage detection object exists in the target space when the difference between the target variation and the preset variation is greater than or equal to the threshold value; wherein the target variation is the variation of the target spatial component of the target image feature relative to the target temporal component, the preset variation is the variation of the spatial component of the leakage detection object in the temporal dimension of the sample video set, and the target image feature is one or more of at least one image feature of the at least two frames of images.
[0007] In some embodiments, the component processing module includes a serially connected inverse residual convolution submodule and a convolution processing submodule, wherein: the inverse residual convolution submodule is used to first perform channel expansion on the initial spatial component and the initial time component, and then obtain and convolve the expanded spatial component and the expanded time component to obtain the deep spatial component and the deep time component; the convolution processing submodule is used to perform convolution processing on the deep spatial component and the deep time component to obtain the target spatial component and the target time component.
[0008] In some embodiments, the convolution processing submodule includes a plurality of cascaded atrous convolution units, and different atrous convolution units have different atrous rates, wherein: the plurality of cascaded atrous convolution units are used to perform atrous convolution processing on the deep spatial component and the deep temporal component to obtain a processed deep spatial component and a processed deep temporal component, the processed deep spatial component has the same resolution as the deep spatial component, and the processed deep temporal component has the same resolution as the deep temporal component; the convolution processing submodule is specifically used to obtain the target spatial component and the target temporal component according to the processed deep spatial component and the processed deep temporal component.
[0009] In some embodiments, the number of the inverse residual convolution submodules is at least two, at least two inverse residual convolution submodules are connected in series, the first partial inverse residual convolution submodule is connected to the one-dimensional time convolution module, and the second partial inverse residual convolution submodule is connected to the convolution processing submodule, wherein: the first partial inverse residual convolution submodule is used to first perform channel expansion on the initial spatial component and the initial time component, obtain and convolve the expanded spatial component and the expanded time component, so as to obtain and output the shallow spatial component and the shallow time component to the second partial inverse residual convolution submodule; the second partial inverse residual The convolution submodule is used to first perform channel expansion on the shallow spatial component and the shallow time component, and then obtain and convolve the expanded spatial component and the expanded time component to obtain the deep spatial component and the deep time component; accordingly, the convolution processing submodule is specifically used to: fuse the shallow spatial component, the shallow time component, the processed deep spatial component and the processed deep time component to obtain the fused spatial component and the fused time component; obtain the target spatial component and the target time component based on the fused spatial component and the fused time component.
[0010] In some embodiments, when the leakage detection result is used to indicate the presence of a leakage detection object in the target space, the leakage detection result is a target image marked with the leakage detection object, and the target image is any one or more frames of the at least two frames of images in which the leakage detection object exists.
[0011] In some embodiments, the training data set also includes a sample image set, and the sample image set includes one or more frames of images of the leakage detection object in the sample video set. Before the video stream data is input into a preset target network model and the leakage detection result of the target space is output through the target network model, the method also includes: training the initial network model according to the sample video set and the sample image set to obtain a trained network model; calculating a target loss value of the trained network model when detecting the sample video set according to the trained network model and the target loss function, and the target loss value is used to indicate the leakage The difference between the true value and the detection value of the detection object in the corresponding sample image frame, wherein the sample image frame is any one or more frames of the sample image set; according to the target loss value, the trained network model is re-trained to obtain the target network model; wherein, when the proportion of the leakage detection object in the sample image frame is less than a first threshold and greater than a second threshold, the target loss function is any one or more of at least two preset loss functions; when the proportion of the leakage detection object in the sample image frame is less than the second threshold, the target loss function is a loss function whose corresponding loss value among the at least two loss functions is within a preset threshold range.
[0012] In a second aspect, an embodiment of the present application provides a leakage detection device, the device comprising: a video stream acquisition module, used to obtain video stream data for a target space, the video stream data comprising at least two consecutive frames of images; a detection result acquisition module, used to input the video stream data into a preset target network model, and output a leakage detection result of the target space through the target network model, the leakage detection result being used to indicate whether there is a leakage detection object in the target space; wherein the target network model is obtained by training an initial network model using a training data set, the training data set comprising a sample video set having the leakage detection object, and the spatial component of the leakage detection object varies in the time dimension of the sample video set.
[0013] In a third aspect, a computer device provided in an embodiment of the present application includes a memory and a processor, wherein the memory stores a computer program executable on the processor, and the processor implements the method described in the embodiment of the present application when executing the program.
[0014] In a fourth aspect, the computer-readable storage medium provided in the embodiments of the present application has a computer program stored thereon, and when the computer program is executed by a processor, the method provided in the embodiments of the present application is implemented.
[0015] It should be understood that the second to fourth aspects of the embodiments of the present application are consistent with the technical solutions of the first aspect of the embodiments of the present application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation methods are similar and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present application and are used together with the specification to illustrate the technical solution of the present application.
[0017] Figure 1 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0018] Figure 2 A schematic diagram of a flow chart of a leakage detection method provided in an embodiment of the present application;
[0019] Figure 3 A schematic diagram of a leak detection result provided in an embodiment of the present application;
[0020] Figure 4 A schematic diagram of a flow chart of a leakage detection method provided in an embodiment of the present application;
[0021] Figure 5 A schematic diagram of the structure of the target network model provided in the embodiment of the present application;
[0022] Figure 6 A schematic diagram of the structure of the target network model provided in the embodiment of the present application;
[0023] Figure 7 A schematic diagram of the structure of the result output module provided in the embodiment of the present application;
[0024] Figure 8 A schematic diagram of the structure of a component processing module provided in an embodiment of the present application;
[0025] Fig. 9A A schematic diagram of the structure of an inverted residual convolution submodule provided in an embodiment of the present application;
[0026] Fig. 9B A schematic diagram of the structure of another inverted residual convolution submodule provided in an embodiment of the present application;
[0027] Fig.10 A schematic diagram of the structure of the convolution processing submodule provided in an embodiment of the present application;
[0028] Fig.11 A schematic diagram of the structure of the inverted residual convolution submodule provided in an embodiment of the present application;
[0029] Fig.12 A schematic diagram of the structure of the target network model provided in the embodiment of the present application;
[0030] Fig.13 A schematic diagram of the structure of a leakage detection device provided in an embodiment of the present application;
[0031] Fig.14 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0032] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the specific technical solution of the present application will be further described in detail below in conjunction with the drawings in the embodiments of the present application. The following embodiments are used to illustrate the present application, but are not used to limit the scope of the present application.
[0033] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0034] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0035] It should be pointed out that the terms "first\second\third" involved in the embodiments of the present application are used to distinguish similar or different objects, and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged in a specific order or sequence where permitted, so that the embodiments of the present application described here can be implemented in an order other than that illustrated or described here.
[0036] The embodiment of the present application provides a leakage detection method, which is applied to an electronic device, which can be various types of devices with information processing capabilities during implementation. For example, the electronic device can include a personal computer, a laptop computer, a PDA or a server, etc.; the electronic device can also be a mobile terminal, for example, the mobile terminal can include a mobile phone, a car computer, a tablet computer or a projector, etc. The function implemented by the method can be implemented by calling the program code by the processor in the electronic device, and of course the program code can be stored in a computer storage medium. It can be seen that the electronic device at least includes a processor and a storage medium.
[0037] For example, Figure 1 As shown, the electronic device 10 may include a processor 101 , an external memory interface 102 , an internal memory 103 , a universal serial bus (USB) interface 104 , a camera module 105 , a display screen 106 and buttons 107 .
[0038] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 10. In other embodiments of the present application, the electronic device 10 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0039] The processor 101 may include one or more processing units, for example: the processor 101 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and / or a neural network processor (neural-network processing unit, NPU), etc. Among them, different processing units can be independent devices or integrated into one or more processors. Exemplarily, the processor 101 can be a smart terminal CPU, such as a Snapdragon series processor, etc. In some embodiments, the processor 101 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0040] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device 10. In other embodiments of the present application, the electronic device 10 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0041] The electronic device 10 implements the display function through a GPU, a display screen 106, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 106 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 101 may include one or more GPUs, which execute program instructions to generate or change display information. The display screen 106 is used to display images, videos, etc.
[0042] The external memory interface 102 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 10. The external memory card communicates with the processor 101 through the external memory interface 102 to implement a data storage function, such as storing music, video and other files in the external memory card.
[0043] The internal memory 103 can be used to store computer executable program codes, which include instructions. The internal memory 103 can include a program storage area and a data storage area. The program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area can store data created during the use of the electronic device 10 (such as audio data, a phone book, etc.), etc.
[0044] In addition, the electronic device involved in the embodiments of the present application may also be installed with an operating system, and application programs may be installed and run on the operating system, which is not limited in the embodiments of the present application.
[0045] Figure 2 A schematic diagram of a leakage detection method provided in an embodiment of the present application. Figure 2 As shown, the method may include the following steps:
[0046] Step S101, obtaining video stream data for a target space, where the video stream data includes at least two consecutive frames of images;
[0047] Step S102, inputting the video stream data into a preset target network model, and outputting the leakage detection result of the target space through the target network model, wherein the leakage detection result is used to indicate whether there is a leakage detection object in the target space; wherein the target network model is obtained by training an initial network model using a training data set, and the training data set includes a sample video set with a leakage detection object, and the spatial component of the leakage detection object changes in the time dimension of the sample video set.
[0048] During the implementation process, after obtaining the video stream data for the target space, the electronic device can input the video stream data into a preset target network model so that the target network model outputs a corresponding leakage detection result according to whether the video stream data includes a leakage detection object whose spatial component changes in the time dimension, thereby determining whether there is a leakage detection object in the target space and completing the detection of the leakage detection object whose spatial component changes in the time dimension in the video stream data.
[0049] Optionally, the above-mentioned method for detecting whether there is a leakage detection object in the target space can be to determine a target change amount of a target spatial component of a certain image feature in at least two frames of images relative to a target time component, and when the difference between the target change amount and a preset change amount is less than a threshold value, output a leakage detection result indicating that there is a leakage detection object in the target space; when the difference between the target change amount and the preset change amount is greater than or equal to the threshold value, output a leakage detection result indicating that there is no leakage detection object in the target space; wherein the preset change amount is the change amount of the spatial component of the leakage detection object in the time dimension of the sample video set, and the target image feature is one or more of at least one image feature of at least two frames of images.
[0050] Optionally, the video stream data may be the video capture device that is captured in real time and output to the electronic device, or may be partial video data obtained by technicians in this field after cropping the original video data. The specific settings are made by those skilled in the art according to actual conditions, and this application does not limit this. In some embodiments, the video capture device may be a camera or an infrared image capture device.
[0051] Optionally, the above-mentioned leakage detection result may be result information that only indicates whether there is a leakage detection object in the target space, that is, when the leakage detection result is used to indicate that there is a leakage detection object in the target space, the leakage detection result is information that "there is a leakage detection object in the target space"; when the leakage detection result is used to indicate that there is no leakage detection object in the target space, the leakage detection result is information that "there is no leakage detection object in the target space", wherein the display method of the leakage detection result information is any conventional method, such as pop-up window display, etc., which is specifically set by technical personnel in this field according to actual conditions, and this application does not impose any limitation.
[0052] Optionally, the above-mentioned leakage detection result can also be any one or more frames of the above-mentioned at least two frames of images. When the leakage detection result is used to indicate that there is a leakage detection object in the target space, the leakage detection result is any one or more frames of the at least two frames of images marked with the leakage detection object; when the leakage detection result is used to indicate that there is no leakage detection object in the target space, the leakage detection result is any one or more frames of the at least two frames of images, that is, the original image in at least two frames of images, and there is no identification information, wherein the identification method of the leakage detection object in the leakage detection result is any conventional method, such as contour identification, etc., which is specifically set by technical personnel in this field according to actual conditions, and this application does not impose any limitation.
[0053] Among them, the above-mentioned method of identifying the leakage detection object in the image can be to determine the target image feature whose difference between the target change amount and the preset change amount is less than a threshold, cluster the target image feature to obtain multiple target image features belonging to the same object, and determine the object as a leakage detection object.
[0054] For example, taking the leak detection object as leaking gas, after inputting the video stream data with 8 frames of images into the target network model, the target network model will identify the leaking gas in the last frame of the 8 frames. If there is leaking gas in the last frame of the image, the target network model will identify the image area corresponding to the leaking gas in the last frame of the image, such as Figure 3 As shown; if there is no leaking gas in the last frame of the image, the target network model directly outputs the last frame of the image without any identification. The image area corresponding to the leaking gas can be marked by covering the image area corresponding to the leaking gas with a specific color, or by selecting the image area corresponding to the leaking gas with an identification frame, which is set by those skilled in the art according to the actual situation and is not limited in this application. Figure 3 This is just one example.
[0055] In the above leakage detection method, the video stream data is input into the target network model so that the target network model outputs the leakage detection result corresponding to the video stream data according to the video stream data. Since the target network model is obtained by training the initial network model using the training data set, and the training data set includes a sample video set with a leakage detection object, and the spatial component of the leakage detection object changes in the time dimension of the sample video set, the target network model can detect whether there is a leakage detection object in the video stream data according to the change of the spatial component of the leakage detection object in the time dimension of the sample video set, thereby achieving high-accuracy detection of leakage detection objects such as smoke, gas, and flame.
[0056] In some embodiments, Figure 4 As shown, if the leakage detection result is a target image marked with the leakage detection object, before executing step S102, the method may further include the following steps:
[0057] Step S103, training the initial network model according to the sample video set and the sample image set to obtain a trained network model;
[0058] Step S104, according to the trained network model and the target loss function, calculate the target loss value of the trained network model when detecting the sample video set, the target loss value is used to indicate the difference between the true value and the detection value of the leakage detection object in the corresponding sample image frame, and the sample image frame is any one or more frames of the sample image set;
[0059] Step S105, retraining the trained network model according to the target loss value to obtain a target network model;
[0060] Among them, when the proportion of the leakage detection object in the sample image frame is less than the first threshold and greater than the second threshold, the target loss function is any one or more of at least two preset loss functions; when the proportion of the leakage detection object in the sample image frame is less than the second threshold, the target loss function is a loss function whose corresponding loss value among at least two loss functions is within the preset threshold range.
[0061] Optionally, the at least two preset loss functions mentioned above can adopt the calculation method of commonly used loss functions, such as diceloss and ce loss. By selecting the corresponding loss value of the target network model from at least two loss functions to calculate the loss value, the detection accuracy of the target network model can be further improved.
[0062] Among them, when the proportion of the leakage detection object in the sample image frame is less than the first threshold and greater than the second threshold, the intersection form of dice loss can ensure that the loss value will not be reduced due to the low proportion of the leakage detection object, and ce loss will fairly treat the positive and negative samples of the sample image frame. When the positive sample proportion is small, it will be overwhelmed by more negative samples. When the proportion of the leakage detection object in the sample image frame is less than the second threshold, continuing to use dice loss will cause some pixels to be predicted incorrectly, and the calculated loss value will change significantly, and its value will be outside the preset threshold range. Therefore, it is necessary to stop using dice loss at this time, that is, only use ce loss to calculate the loss value of the target network model.
[0063] Exemplarily, taking at least two loss functions including dice loss and ce loss as an example, when the proportion of the leakage detection object in the sample image frame is less than the initial threshold and greater than the second threshold, the loss value of the network model calculated by any one or more of the diceloss and ce loss loss functions can ensure the accuracy of the loss value, but when the proportion of the leakage detection object in the sample image frame is less than the second threshold, some loss functions will think that the detection object is too small, resulting in inaccurate calculation results, and the calculated loss value is within the preset threshold range, so it is necessary to eliminate this part of the loss function, that is, turn off the dice loss, so as to prevent the calculated diceloss value from changing drastically due to partial pixel prediction errors, thereby reducing the network model training effect.
[0064] The above step S101 and step S103 to step S105 may be performed simultaneously or in sequence, for example, step S101 is performed first, and then step S103 to step S105, or step S103 to step S105 is performed first, and then step S101 is performed. The specific configuration is made by those skilled in the art according to the actual situation, and this application does not limit it. Figure 8 These are examples only.
[0065] It is understandable that the intersection form of dice loss for the case where the gas foreground accounts for a small proportion can ensure that the loss will not be reduced due to the low proportion of foreground, while ce loss will treat positive and negative samples fairly. When the positive sample accounts for a small proportion, it will be overwhelmed by more negative samples. For the case where the foreground accounts for a very small proportion or is pure background, dice loss is turned off to prevent some pixels from being predicted incorrectly, resulting in a large change in the dice loss value. That is, the applicable conditions of the target loss function can be adjusted in real time according to the proportion of the leakage detection object in the sample image frame to improve the output accuracy of the target network model.
[0066] In some embodiments, the structural diagram of the target network model is as follows: Figure 5 As shown, the target network model may include a two-dimensional spatial convolution module 201, a one-dimensional temporal convolution module 202, a component processing module 203 and a result output module 204 connected in series, wherein:
[0067] A two-dimensional spatial convolution module 201 is used to convolve at least two frames of images to obtain an initial spatial component corresponding to at least one image feature of the at least two frames of images in the video stream data;
[0068] A one-dimensional time convolution module 202, used to convolve the video stream data to obtain an initial time component of the video stream data;
[0069] The component processing module 203 is used to convolve the initial spatial component and the initial temporal component according to a preset convolution strategy to obtain a target spatial component and a target temporal component;
[0070] The result output module 204 is used to output a leakage detection result indicating that a leakage detection object exists in the target space when the difference between the target change amount and the preset change amount is less than a threshold value; and to output a leakage detection result indicating that no leakage detection object exists in the target space when the difference between the target change amount and the preset change amount is greater than or equal to the threshold value;
[0071] Among them, the target change is the change of the target spatial component of the target image feature relative to the target time component, the preset change is the change of the spatial component of the leakage detection object in the time dimension of the sample video set, and the target image feature is one or more of at least one image feature of at least two frames of images.
[0072] It should be understood that convolution processing of the video stream data through the two-dimensional spatial convolution module 201 and the one-dimensional temporal convolution module 202 respectively reduces the dimensional limitation of data processing during the execution stage. Compared with the three-dimensional convolution processing of video stream data in the prior art, the data processing amount of the target network model can be reduced, making the training optimization process of the target network model easier, thereby reducing the training error.
[0073] Among them, because the video stream data includes at least two frames of images arranged in a time series, each frame of the image includes multiple image features, and the target image features among the multiple image features in the time series have changes in spatial position, that is, the spatial features of the target image features in the time series have changes, and the changes can be characterized by the change amount of the target spatial component of each image feature relative to the target time component. Among them, the target spatial component can be used to represent the position change of each image feature in at least two frames of images; the target time component can be used to represent the time change of each image feature in at least two frames of images, that is, the time series of the video stream data itself.
[0074] Optionally, the above-mentioned two-dimensional spatial convolution module 201 may include a convolution kernel 2011 with a convolution kernel size of (1, D, D), where D is an arbitrary integer, and the above-mentioned one-dimensional time convolution module 202 may be a convolution kernel with a convolution kernel size of (D, 1, 1), where D is an arbitrary integer.
[0075] Alternatively, if Figure 6 As shown, the above-mentioned two-dimensional spatial convolution module 201 may further include an activation function unit in addition to the above-mentioned convolution kernel 2011. The activation function unit may include a three-dimensional batch normalization subunit 2012 and an activation function subunit 2013. The three-dimensional batch normalization subunit 2012 is used to uniformly normalize the input data and map the corresponding output to a normal distribution with a mean of 0 and a variance of 1; the activation function subunit 2013 is used to map the input data to a nonlinear relationship to increase the number of nonlinear functions existing between the input and output, thereby increasing the complexity of the functional relationship between the input and output.
[0076] Alternatively, if Figure 7As shown, the above-mentioned result output module 204 may include a first convolution unit 2041, a second convolution unit 2042, a mean calculation unit T-Mean2043, a standard convolution unit Class-conv2044 and an upsampling unit Upsample2045 connected in series, and the first convolution unit 2041 and the second convolution unit 2042 have the same structure as the two-dimensional spatial convolution module 201 and the one-dimensional temporal convolution module 202, and are used to convolve the target spatial component and the target temporal component, and output the convolution component, which includes the convolved target spatial component and the convolved target temporal component. The mean calculation unit T-Mean2043 is used to calculate the mean of the convolution component in each dimension and output the mean component; the standard convolution unit Class-conv2044 is used to convolve the mean component again with the unit convolution kernel, so as to further obtain the target change, and output the mean convolution component, wherein the leakage detection result is indicated in the mean convolution component; the upsampling unit Upsample2045 is used to map the mean convolution component from a small resolution to a large resolution, so as to restore the feature map size corresponding to the mean convolution component to the size corresponding to the video stream data, so as to output the leakage detection result.
[0077] It can be understood that by using the two-dimensional spatial convolution module 201 and the one-dimensional temporal convolution module 202 to extract the initial spatial component and the initial temporal component of the video stream data in turn, compared with directly obtaining them through three-dimensional convolution, forcing the three-dimensional convolution to be converted into separate two-dimensional convolution and one-dimensional convolution can reduce the complexity of optimization.
[0078] In some embodiments, Figure 8 As shown, the component processing module 203 includes a serially connected inverse residual convolution submodule 2031 and a convolution processing submodule 2032, wherein:
[0079] The inverse residual convolution submodule 2031 is used to first perform channel expansion on the initial spatial component and the initial time component, obtain and convolve the expanded spatial component and the expanded time component to obtain a deep spatial component and a deep time component, wherein the number of channels of the deep spatial component is smaller than that of the expanded spatial component, and the number of channels of the deep time component is smaller than that of the expanded time component;
[0080] The convolution processing submodule 2032 is used to perform convolution processing on the deep spatial component and the deep temporal component to obtain the target spatial component and the target temporal component.
[0081] Optionally, the number of the inverse residual convolution submodule 2031 may be at least one, and the specific value is set by those skilled in the art according to actual conditions, and is not limited in this application.
[0082] It should be understood that the above-mentioned inverted residual convolution submodule 2031 will first perform a lightweight expansion convolution on the input feature map to expand the channel, and then perform a depthwise separable convolution and a pointwise convolution to reduce the number of channels of the feature map of the input convolution processing submodule, and finally add it to the original input feature map to obtain the output. Among them, the lightweight expansion convolution will first use a convolution operation with a small number of output channels to expand the number of channels of the input feature map to provide more information for subsequent feature map processing.
[0083] Optionally, the above-mentioned inverse residual convolution submodule 2031 performs lightweight dilated convolution by sequentially performing two-dimensional convolution and one-dimensional convolution on the input feature map, or first performing three-dimensional convolution on the input feature map using a convolution kernel with a convolution kernel size of 1x1x1, and then performing two-dimensional convolution and one-dimensional convolution, or the above-mentioned two methods may be used in sequence for processing, which may be specifically set by a technician in this field and is not limited in this application.
[0084] Optionally, the inverse residual convolution submodule 2031 may reduce the number of channels by convolving a feature map obtained after lightweight dilated convolution with a preset three-dimensional convolution kernel, thereby reducing the number of channels.
[0085] For example, Fig. 9A As shown, the inverse residual convolution submodule 2031 may include a first convolution unit ConvBN for performing two-dimensional convolution and one-dimensional convolution in sequence, a second convolution unit Conv3D for reducing the number of channels, a mean calculation unit BatchNomm3d for calculating the mean, and a fusion unit for fusing input features with output features output by the mean calculation unit.
[0086] For example, Fig. 9B As shown, the inverse residual convolution submodule 2031 may include a third convolution unit Conv1x1BN, which is connected in series and performs three-dimensional convolution on the input feature map using a convolution kernel with a convolution kernel size of 1x1x1, the first convolution unit ConvBN, the second convolution unit Conv3D, the mean calculation unit BatchNomm3d and the fusion unit.
[0087] It can be understood that by first increasing the dimension and then reducing the dimension of the initial spatial component and the initial time component, the number of parameters of the target network model can be increased while reducing the network depth, thereby increasing the generalization ability of the target network model.
[0088] In some embodiments, Fig.10As shown, the convolution processing submodule 2032 may include a plurality of cascaded dilated convolution units, and different dilated convolution units have different dilated rates, wherein:
[0089] A plurality of cascaded atrous convolution units are used to perform atrous convolution processing on the deep spatial component and the deep temporal component to obtain a processed deep spatial component and a processed deep temporal component, wherein the processed deep spatial component has the same resolution as the deep spatial component, and the processed deep temporal component has the same resolution as the deep temporal component;
[0090] The convolution processing submodule is specifically used to obtain a target spatial component and a target temporal component according to the processed deep spatial component and the processed deep temporal component.
[0091] It should be understood that in the prior art, a cascaded downsampling pooling structure or a strided convolution structure is usually used when processing deep spatial components to obtain deeper global information by reducing the resolution of the feature map. However, this method can only obtain some details in the original feature map, and the receptive field is low. However, after adopting the cascaded multiple hole convolution units in the present application, compared with the cascaded downsampling pooling structure or the strided convolution structure in the prior art, the receptive field can be expanded while maintaining the resolution, more details are retained, and denser feature responses can be obtained, so that the result output module 204 has better details when using the target spatial component and the target time component to restore the original image, thereby improving the detection efficiency of the leakage detection object.
[0092] Optionally, the above-mentioned cascaded multiple dilated convolution units can respectively use different dilated convolution units to perform dilated convolution processing on the deep spatial component and the deep temporal component respectively. After obtaining the respective multiple dilated convolution results, the multiple dilated convolution results are correspondingly spliced, and the spliced multiple dilated convolution results are output as the processed deep temporal component and the processed deep temporal component.
[0093] It can be understood that the use of cascaded multi-atrous rate dilated convolutions instead of downsampling pooling or strided convolutions in the prior art can expand the receptive field while maintaining the resolution, retain more details, and obtain denser feature responses, compared to the way of obtaining deeper global information by reducing the resolution of feature maps through the cascaded downsampling pooling structure. This preserves more details and obtains denser feature responses, so that the details are better when the original image is restored.
[0094] In some embodiments, Fig.11As shown, the number of the inverse residual convolution submodules 2031 is at least two, and at least two inverse residual convolution submodules 2031 are connected in series with each other, the first part of the inverse residual convolution submodule 2031A is connected to the one-dimensional time convolution module 202, and the second part of the inverse residual convolution submodule 2031B is connected to the convolution processing submodule 2032, wherein:
[0095] The first partial inverse residual convolution submodule 2031A is used to first perform channel expansion on the initial spatial component and the initial time component, obtain and convolve the expanded spatial component and the expanded time component, so as to obtain and output the shallow spatial component and the shallow time component to the second partial inverse residual convolution submodule 2031B;
[0096] The second part of the inverse residual convolution submodule 2031B is used to first perform channel expansion on the shallow spatial component and the shallow temporal component, obtain and convolve the expanded spatial component and the expanded temporal component to obtain the deep spatial component and the deep temporal component;
[0097] Accordingly, the convolution processing submodule 2032 is specifically used for:
[0098] Fusing the shallow spatial component, the shallow temporal component, the processed deep spatial component, and the processed deep temporal component to obtain a fused spatial component and a fused temporal component;
[0099] According to the fused spatial component and the fused temporal component, a target spatial component and a target temporal component are obtained.
[0100] It should be understood that since leakage detection objects often have large shape variations in reality, the size of the leakage detection object in the video stream data varies greatly in any two adjacent frames of at least two frames of images. Excessive changes will make it difficult for the receptive field after processing by a single convolution depth to simultaneously take into account the detection of leakage detection objects of different sizes in a single video stream data. Therefore, it is necessary to consider the feature maps of different convolution depths.
[0101] During the implementation process, after the first partial inverse residual convolution submodule 2031A performs the convolution processing, a shallow feature component will be obtained, and then the second partial inverse residual convolution submodule 2031B will continue to process according to the shallow feature component to obtain a deep spatial component and a deep temporal component, so that the shallow spatial component, the shallow temporal component, the processed deep spatial component and the processed deep temporal component can be fused to obtain a fused spatial component and a fused temporal component, and finally, based on the fused spatial component and the fused temporal component, the target spatial component and the target temporal component are obtained to satisfy the effect that the receptive field can simultaneously take into account the segmentation of objects of different sizes.
[0102] It is understandable that by fusing shallow features with deep features, the problem that the receptive field is difficult to simultaneously take into account the segmentation effects of objects of different sizes due to the large scale difference before and after the diffusion of the leakage detection object in at least two frames of images can be solved.
[0103] The following describes an exemplary application of the embodiments of the present application in a practical application scenario.
[0104] Fig.12 A schematic diagram of the structure of a target network model provided in an embodiment of the present application. Fig.12 As shown, taking the leakage detection result as an image with a leakage detection object as an example, the target network model may include a two-dimensional spatial convolution module 201, a one-dimensional temporal convolution module 202, a component processing module 203 and a result output module 204 connected in series, and the component processing module 203 includes a series of inverse residual convolution submodules and convolution processing submodules. The convolution processing submodule includes a plurality of cascaded dilated convolution units and a feature fusion unit, and the cascaded plurality of dilated convolution units and feature fusion units are connected in series, and the dilated rates of different dilated convolution units are different.
[0105] Among them, the two-dimensional spatial convolution module 201 includes a two-dimensional convolution kernel with a size of (1,3,3), a step size of 1 and padding of (0,1,1), a three-dimensional batch normalization processing kernel BatchNorm3d and an activation function processing kernel ReLU, and the one-dimensional temporal convolution module 202 is a convolution kernel with a size of (3,1,1), a step size of 1 and padding of (1,0,0). Here, the structure including the two-dimensional spatial convolution module 201 and the one-dimensional temporal convolution module 202 is collectively referred to as the convolution processing block ConvBN.
[0106] The number of inverted residual convolution sub-modules is at least two, including a first inverted residual convolution kernel InvertedResidualBlock0 connected in series and 6 second inverted residual convolution kernels InvertedResidualBlock1 connected in series in sequence, the 6 second inverted residual convolution kernels InvertedResidualBlock1 are convolution kernels with the number of convolution kernels being 2, 3, 4, 3, 3 and 1 respectively, and the output end of the second inverted residual convolution kernel InvertedResidualBlock1 with the number of convolution kernels being 2 is connected to the feature fusion unit. The first inverted residual convolution kernel InvertedResidualBlock0 and the six second inverted residual convolution kernels InvertedResidualBlock1 connected in series are both inverted residual structures. The first inverted residual convolution kernel InvertedResidualBlock0 includes a series of convolution processing blocks ConvBN, three-dimensional convolution subunit Conv3D, a mean calculation subunit BatchNomm3d for calculating the mean, and a fusion subunit; each second inverted residual convolution kernel InvertedResidualBlock1 includes a series of standard convolution subunits Conv1x1BN, convolution processing blocks ConvBN, three-dimensional convolution subunits Conv3D, a mean calculation subunit BatchNomm3d for calculating the mean, and a fusion subunit.
[0107] The cascaded multiple dilated convolution units include a dilated convolution kernel Atrous conv, and a three-dimensional convolution kernel Conv3D with a dilation rate of 1, three three-dimensional convolution kernels Conv2p1 with a dilation rate of 6, and a pooling layer Image Pooling, which are respectively connected in parallel with the dilated convolution kernel Atrousconv. Among them, the three-dimensional convolution kernel Conv3D with a dilation rate of 1, the three three-dimensional convolution kernels Conv2p1 with a dilation rate of 6, and the pooling layer Image Pooling can output feature maps of the same resolution. After splicing the feature maps output by the three-dimensional convolution kernel Conv3D with a dilation rate of 1, the three three-dimensional convolution kernels Conv2p1 with a dilation rate of 6, and the pooling layer Image Pooling, the convolution processing submodule then convolves them with a convolution kernel Conv1x1BN of size 1x1x1 in turn, converts them into a large resolution through an upsampling unit Upsample, and obtains the processed deep spatial component after the dimension is expanded by the dimension expansion unit T-Repeat.
[0108] The feature fusion unit includes a shallow convolution subunit Conv1x1BN and a connection function subunit Concat. The shallow convolution subunit Conv1x1BN is used to convolve the shallow time component and the shallow space component and output them to the connection function subunit Concat. The connection function subunit Concat is used to fuse the processed shallow time component and shallow space component as well as the processed deep time component and deep space component to obtain the fused spatial component and the fused time component.
[0109] The result output module 204 includes a convolution processing block ConvBN, a mean calculation unit T-Mean, a standard convolution unit Class-conv and an upsampling unit Upsample. The convolution unit ConvBN is used to convolve the target spatial component and the target temporal component, and output the convolution component, which includes the convolved target spatial component and the convolution target temporal component; the mean calculation unit T-Mean is used to calculate the mean of the convolution component in each dimension and output the mean component; the standard convolution unit Class-conv is used to convolve the mean component again using a unit convolution kernel and output the mean convolution component; the upsampling unit Upsample is used to map the mean convolution component from a small resolution to a large resolution, thereby restoring the feature map size corresponding to the mean convolution component to the size of the video stream data, so as to further output the leakage detection result.
[0110] During the implementation process, after the video stream data with 8 frames of resolution, size of 320*320 and dimension of 1 is input into the target network model, the target network model can obtain a feature map of 8*320*320*1 according to the video stream data. After being processed by the two-dimensional spatial convolution module and the one-dimensional temporal convolution module, a feature map of 4*160*160*32 will be obtained. After the first inverted residual convolution kernel InvertedResidual After the convolution processing of Block0, a feature map of 4*160*160*16 can be obtained; after convolution processing by the second inverted residual convolution kernel InvertedResidualBlock1 with the number of convolution kernels being 2, a feature map of 2*80*80*24 can be obtained; at this time, the feature map of 2*80*80*24 is output to the shallow convolution subunit Conv1x1BN and the second inverted residual convolution kernel InvertedResidualBlock1 with the number of convolution kernels being 3 respectively. The shallow convolution subunit Conv1x1BN will output a feature map of 2*80*80*48 to the connection function subunit Concat, and the second inverted residual convolution kernel InvertedResidualBlock1 with the number of convolution kernels being 3 will output a feature map of 1*40*40*32 to the second inverted residual convolution kernel InvertedResid with the number of convolution kernels being 4. In AtrousBlock1, the second inverted residual convolution kernel InvertedResidualBlock1 with 4 convolution kernels will output a feature map of 1*40*40*32 after processing to the second inverted residual convolution kernel InvertedResidualBlock1 with 3 convolution kernels for processing. The second inverted residual convolution kernel InvertedResidualBlock1 with 3 convolution kernels will output a feature map of 1*40*40*96 to the third inverted residual convolution kernel InvertedResidualBlock1 with 3 convolution kernels for processing, and then output a feature map of 1*40*40*160 to the second inverted residual convolution kernel InvertedResidualBlock1 with 1 convolution kernel for processing, and then output a feature map of 1*40*40*320 to the void convolution kernel AtrousBlock1. At conv, after processing, the atrous convolution kernel Atrous conv will be output to the three-dimensional convolution kernel Conv3D with a dilation rate of 1, the three-dimensional convolution kernel Conv2p1 with a dilation rate of 6, and the pooling layer Image Pooling for convolution processing. The three-dimensional convolution kernel Conv3D with a dilation rate of 1, the three-dimensional convolution kernel Conv2p1 with a dilation rate of 6, and the pooling layer Image Pooling will all output a 1*40*40*256 feature map.After splicing multiple 1*40*40*256 feature maps, a 1*40*40*1280 feature map can be obtained, and the 1*40*40*1280 feature map is output to the shallow convolution subunit Conv1x1BN for processing to output a 1*40*40*256 feature map, and then the upsampling unit Upsample outputs a 1*80*80*256 feature map. At this time, the feature map output by the upsampling unit Upsample is different from the feature map (2*80*80*48) output by the shallow convolution subunit Conv1x1BN processing in terms of the number of channels. Therefore, it is necessary to first output the feature map output by the upsampling unit Upsample to the expansion subunit T-Repeat for channel expansion to output The feature map of 2*80*80*256 is then connected by the function subunit Concat, which can fuse the feature map (2*80*80*48) output by the shallow convolution subunit Conv1x1BN with the feature map (2*80*80*256) output by the expansion subunit T-Repeat to output a feature map of 2*80*80*304. After being processed by the two-dimensional spatial convolution module, the one-dimensional temporal convolution module, the mean calculation unit T-Mean, the standard convolution unit Class-conv, and the upsampling unit Upsample in sequence, a 1*320*320*2 image is output according to the target change amount and the preset change amount, that is, the image includes the original image and the image area marked with the leakage detection object. ,
[0111] It should be understood that although Figure 2-12 The steps in the schematic diagram are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-12 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0112] Based on the foregoing embodiments, an embodiment of the present application provides a leakage detection device, which includes the modules included and the units included in the modules, which can be implemented by a processor; of course, it can also be implemented by a specific logic circuit; in the implementation process, the processor can be a central processing unit (CPU), a microprocessor (MPU), a digital signal processor (DSP) or a field programmable gate array (FPGA), etc.
[0113] Fig.13 A schematic diagram of the structure of the leakage detection device provided in the embodiment of the present application is shown in FIG. Fig.13 As shown, the device comprises:
[0114] The video stream acquisition module 1301 is used to obtain video stream data for the target space, where the video stream data includes at least two consecutive frames of images;
[0115] The detection result obtaining module 1302 is used to input the video stream data into a preset target network model, and output the leakage detection result of the target space through the target network model, and the leakage detection result is used to indicate whether there is a leakage detection object in the target space;
[0116] The target network model is obtained by training the initial network model using a training data set, where the training data set includes a sample video set with a leakage detection object, and the spatial component of the leakage detection object changes in the time dimension of the sample video set.
[0117] In one embodiment, when the leakage detection result is used to indicate the presence of a leakage detection object in the target space, the leakage detection result is a target image marked with the leakage detection object, and the target image is any one or more frames of the at least two frames of images in which the leakage detection object exists.
[0118] In one embodiment, the training data set further includes a sample image set, the sample image set includes one or more frames of images of the leakage detection object in the sample video set, and the above-mentioned device may further include:
[0119] A model training module is used to input the video stream data into a preset target network model, and before outputting the leakage detection result of the target space through the target network model, train the initial network model according to the sample video set and the sample image set to obtain a trained network model;
[0120] A loss calculation module, used to calculate the target loss value of the trained network model when detecting the sample video set according to the trained network model and the target loss function, wherein the target loss value is used to indicate the difference between the true value and the detection value of the leakage detection object in the corresponding sample image frame, and the sample image frame is any one or more frames of the sample image set;
[0121] The model acquisition module is used to retrain the trained network model according to the target loss value to obtain the target network model;
[0122] Among them, when the proportion of the leakage detection object in the sample image frame is less than the first threshold and greater than the second threshold, the target loss function is any one or more of at least two preset loss functions; when the proportion of the leakage detection object in the sample image frame is less than the second threshold, the target loss function is a loss function whose corresponding loss value among at least two loss functions is within the preset threshold range.
[0123] The description of the above device embodiment is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the device embodiment of the present application, please refer to the description of the method embodiment of the present application for understanding.
[0124] It should be noted that in the embodiments of this application Fig.13 The division of modules in the leakage detection device shown is schematic and is only a logical function division. There may be other division methods in actual implementation. In addition, each functional unit in each embodiment of the present application may be integrated into a processing unit, or may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units. It may also be implemented in the form of a combination of software and hardware.
[0125] It should be noted that in the embodiment of the present application, if the above method is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiment of the present application can be essentially or partly embodied in the form of a software product that contributes to the relevant technology. The computer software product is stored in a storage medium, including several instructions to enable an electronic device to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a U disk, a mobile hard disk, a read-only memory (ROM), a magnetic disk or an optical disk. In this way, the embodiment of the present application is not limited to any specific combination of hardware and software.
[0126] The embodiment of the present application provides a computer device, which may be a server, and its internal structure diagram may be as follows: Fig.14As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a leakage detection method is implemented.
[0127] An embodiment of the present application provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps in the method provided in the above embodiment are implemented.
[0128] An embodiment of the present application provides a computer program product including instructions, which, when executed on a computer, enables the computer to execute the steps of the method provided in the above method embodiment.
[0129] Those skilled in the art will understand that Fig.14 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0130] In one embodiment, the leakage detection device provided by the present application can be implemented in the form of a computer program. The computer program can be Fig.14 The computer device shown in the figure can be run on the computer device. The memory of the computer device can store various program modules constituting the electronic device. The computer program composed of various program modules enables the processor to execute the steps of the leakage detection method of each embodiment of the present application described in this specification.
[0131] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the leakage detection method when executing the computer program.
[0132] It should be noted here that the description of the above storage medium and device embodiments is similar to the description of the above method embodiments, and has similar beneficial effects as the method embodiments. For technical details not disclosed in the storage medium, storage medium and device embodiments of this application, please refer to the description of the method embodiments of this application for understanding.
[0133] It should be understood that "one embodiment" or "an embodiment" or "some embodiments" mentioned throughout the specification means that specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in one embodiment" or "in some embodiments" appearing throughout the specification may not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in various embodiments of the present application, the size of the sequence number of the above-mentioned processes does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application. The above-mentioned sequence numbers of the embodiments of the present application are only for description and do not represent the advantages and disadvantages of the embodiments. The above description of each embodiment tends to emphasize the differences between the various embodiments, and the same or similar aspects can be referenced to each other. For the sake of brevity, this article will not repeat them.
[0134] The term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there may be three relationships. For example, object A and / or object B can represent three situations: object A exists alone, object A and object B exist at the same time, and object B exists alone.
[0135] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0136] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The embodiments described above are only schematic. For example, the division of the modules is only a logical function division. There may be other division methods in actual implementation, such as: multiple modules or components can be combined, or can be integrated into another system, or some features can be ignored, or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or modules can be electrical, mechanical or other forms.
[0137] The modules described above as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules; they may be located in one place or distributed on multiple network units; some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment.
[0138] In addition, all functional modules in the embodiments of the present application may be integrated into one processing unit, or each module may be a separate unit, or two or more modules may be integrated into one unit; the above-mentioned integrated modules may be implemented in the form of hardware or in the form of hardware plus software functional units.
[0139] A person of ordinary skill in the art can understand that: all or part of the steps of implementing the above-mentioned method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above-mentioned method embodiment; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM), magnetic disks or optical disks, etc., various media that can store program codes.
[0140] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application can essentially or in other words, the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling an electronic device to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROMs, magnetic disks, or optical disks.
[0141] The methods disclosed in several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.
[0142] The features disclosed in several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.
[0143] The features disclosed in several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.
[0144] The above is only an implementation method of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A leak detection method, characterized in that: The method comprises: Obtaining video stream data for a target space, wherein the video stream data includes at least two consecutive frames of images; Inputting the video stream data into a preset target network model, and outputting a leakage detection result of the target space through the target network model, wherein the leakage detection result is used to indicate whether there is a leakage detection object in the target space; The target network model is obtained by training an initial network model using a training data set, wherein the training data set includes a sample video set having the leakage detection object, and the spatial component of the leakage detection object varies in a time dimension of the sample video set; The target network model includes a two-dimensional spatial convolution module, a one-dimensional temporal convolution module, a component processing module and a result output module connected in series, wherein: The two-dimensional spatial convolution module is used to convolve the at least two frames of images to obtain an initial spatial component corresponding to at least one image feature of the at least two frames of images in the video stream data; The one-dimensional time convolution module is used to convolve the video stream data to obtain the initial time component of the video stream data; The component processing module is used to convolve the initial spatial component and the initial temporal component according to a preset convolution strategy to obtain a target spatial component and a target temporal component; The result output module is used to output a leakage detection result indicating that a leakage detection object exists in the target space when the difference between the target change amount and the preset change amount is less than a threshold value; and to output a leakage detection result indicating that no leakage detection object exists in the target space when the difference between the target change amount and the preset change amount is greater than or equal to the threshold value; The target variation is the variation of the target spatial component of the target image feature relative to the target time component, the preset variation is the variation of the spatial component of the leakage detection object in the time dimension of the sample video set, and the target image feature is one or more of at least one image feature of the at least two frames of images; The component processing module includes a serially connected inverse residual convolution submodule and a convolution processing submodule, wherein: The inverse residual convolution submodule is used to first perform channel expansion on the initial spatial component and the initial time component, obtain and convolve the expanded spatial component and the expanded time component to obtain a deep spatial component and a deep time component, wherein the number of channels of the deep spatial component is smaller than that of the expanded spatial component, and the number of channels of the deep time component is smaller than that of the expanded time component; The convolution processing submodule is used to perform convolution processing on the deep spatial component and the deep temporal component to obtain the target spatial component and the target temporal component; The convolution processing submodule includes a plurality of cascaded dilated convolution units, and different dilated convolution units have different dilated rates, wherein: The cascaded multiple dilated convolution units are used to perform dilated convolution processing on the deep spatial component and the deep temporal component to obtain a processed deep spatial component and a processed deep temporal component, wherein the processed deep spatial component has the same resolution as the deep spatial component, and the processed deep temporal component has the same resolution as the deep temporal component; The convolution processing submodule is specifically used to obtain the target spatial component and the target temporal component according to the processed deep spatial component and the processed deep temporal component; Among them, the number of the inverse residual convolution submodules is at least two, at least two inverse residual convolution submodules are connected in series with each other, the first part of the inverse residual convolution submodule is connected to the one-dimensional time convolution module, and the second part of the inverse residual convolution submodule is connected to the convolution processing submodule, wherein: The first partial inverse residual convolution submodule is used to first perform channel expansion on the initial spatial component and the initial time component, obtain and convolve the expanded spatial component and the expanded time component, so as to obtain and output the shallow spatial component and the shallow time component to the second partial inverse residual convolution submodule; The second partial inverse residual convolution submodule is used to first perform channel expansion on the shallow spatial component and the shallow temporal component, obtain and convolve the expanded spatial component and the expanded temporal component to obtain the deep spatial component and the deep temporal component; Accordingly, the convolution processing submodule is specifically used for: Fusing the shallow spatial component, the shallow temporal component, the processed deep spatial component, and the processed deep temporal component to obtain a fused spatial component and a fused temporal component; According to the fused spatial component and the fused temporal component, obtaining the target spatial component and the target temporal component; Among them, the result output module includes a first convolution unit, a second convolution unit, a mean calculation unit, a standard convolution unit and an upsampling unit connected in series, the first convolution unit and the second convolution unit have the same structure as the two-dimensional spatial convolution module and the one-dimensional temporal convolution module, and are used to convolve the target spatial component and the target temporal component, and output the convolution component, the convolution component including the convolved target spatial component and the convolution target temporal component; the mean calculation unit is used to calculate the mean of the convolution component in each dimension and output the mean component; the standard convolution unit is used to convolve the mean component again using a unit convolution kernel, so as to obtain the target change amount, and output the mean convolution component, wherein the leakage detection result is indicated in the mean convolution component; the upsampling unit is used to map the mean convolution component from a small resolution to a large resolution, so as to restore the feature map size corresponding to the mean convolution component to the size corresponding to the video stream data, so as to output the leakage detection result.
2. The method according to claim 1, characterized in that When the leakage detection result is used to indicate that a leakage detection object exists in the target space, the leakage detection result is a target image marked with the leakage detection object, and the target image is any one or more frames in which the leakage detection object exists in the at least two frames of images.
3. The method according to claim 2, characterized in that The training data set also includes a sample image set, and the sample image set includes one or more frames of images of the leakage detection object in the sample video set. Before inputting the video stream data into a preset target network model and outputting the leakage detection result of the target space through the target network model, the method also includes: Training the initial network model according to the sample video set and the sample image set to obtain a trained network model; According to the trained network model and the target loss function, a target loss value of the trained network model when detecting the sample video set is calculated, wherein the target loss value is used to indicate the difference between the true value and the detection value of the leakage detection object in the corresponding sample image frame, and the sample image frame is any one or more frames of the sample image set; According to the target loss value, retraining the trained network model to obtain the target network model; Wherein, when the proportion of the leakage detection object in the sample image frame is less than a first threshold and greater than a second threshold, the target loss function is any one or more of at least two preset loss functions; When the proportion of the leakage detection object in the sample image frame is less than the second threshold, the target loss function is a loss function whose corresponding loss value among the at least two loss functions is within a preset threshold range.
4. A leakage detection device, characterized in that: The device comprises: A video stream acquisition module, used to obtain video stream data for a target space, wherein the video stream data includes at least two consecutive frames of images; A detection result acquisition module, used for inputting the video stream data into a preset target network model, and outputting a leakage detection result of the target space through the target network model, wherein the leakage detection result is used for indicating whether there is a leakage detection object in the target space; The target network model is obtained by training an initial network model using a training data set, wherein the training data set includes a sample video set having the leakage detection object, and the spatial component of the leakage detection object varies in a time dimension of the sample video set; The target network model includes a two-dimensional spatial convolution module, a one-dimensional temporal convolution module, a component processing module and a result output module connected in series, wherein: the two-dimensional spatial convolution module is used to convolve the at least two frames of images to obtain the initial spatial component corresponding to at least one image feature of the at least two frames of images in the video stream data; the one-dimensional temporal convolution module is used to convolve the video stream data to obtain the initial time component of the video stream data; the component processing module is used to convolve the initial spatial component and the initial time component according to a preset convolution strategy to obtain the target spatial component and the target time component; the result output module is used to output the result to the target spatial component and the target time component. When the difference between the target variation and the preset variation is less than a threshold value, a leakage detection result indicating that a leakage detection object exists in the target space is output; when the difference between the target variation and the preset variation is greater than or equal to the threshold value, a leakage detection result indicating that no leakage detection object exists in the target space is output; wherein the target variation is the variation of the target spatial component of the target image feature relative to the target temporal component, the preset variation is the variation of the spatial component of the leakage detection object in the temporal dimension of the sample video set, and the target image feature is one or more of at least one image feature of the at least two frames of images; Wherein, the component processing module includes an inverse residual convolution submodule and a convolution processing submodule connected in series, the inverse residual convolution submodule is used to first perform channel expansion on the initial spatial component and the initial time component, obtain and convolve the expanded spatial component and the expanded time component to obtain a deep spatial component and a deep time component, the number of channels of the deep spatial component is smaller than that of the expanded spatial component, and the number of channels of the deep time component is smaller than that of the expanded time component; the convolution processing submodule is used to perform convolution processing on the deep spatial component and the deep time component to obtain the target spatial component and the target time component; Wherein, the convolution processing submodule includes a plurality of cascaded atrous convolution units, and different atrous convolution units have different atrous rates. The plurality of cascaded atrous convolution units are used to perform atrous convolution processing on the deep spatial component and the deep temporal component to obtain a processed deep spatial component and a processed deep temporal component, and the processed deep spatial component has the same resolution as the deep spatial component, and the processed deep temporal component has the same resolution as the deep temporal component; the convolution processing submodule is specifically used to obtain the target spatial component and the target temporal component according to the processed deep spatial component and the processed deep temporal component; Among them, the number of the inverse residual convolution submodules is at least two, at least two inverse residual convolution submodules are connected in series, the first partial inverse residual convolution submodule is connected to the one-dimensional time convolution module, and the second partial inverse residual convolution submodule is connected to the convolution processing submodule. The first partial inverse residual convolution submodule is used to first perform channel expansion on the initial spatial component and the initial time component, obtain and convolve the expanded spatial component and the expanded time component, so as to obtain and output the shallow spatial component and the shallow time component to the second partial inverse residual convolution submodule; the second partial inverse residual convolution submodule is used to first perform channel expansion on the shallow spatial component and the shallow time component, obtain and convolve the expanded spatial component and the expanded time component, so as to obtain the deep spatial component and the deep time component; Accordingly, the convolution processing submodule is specifically used for: Fusing the shallow spatial component, the shallow temporal component, the processed deep spatial component and the processed deep temporal component to obtain a fused spatial component and a fused temporal component; obtaining the target spatial component and the target temporal component according to the fused spatial component and the fused temporal component; Among them, the result output module includes a first convolution unit, a second convolution unit, a mean calculation unit, a standard convolution unit and an upsampling unit connected in series, the first convolution unit and the second convolution unit have the same structure as the two-dimensional spatial convolution module and the one-dimensional temporal convolution module, and are used to convolve the target spatial component and the target temporal component, and output the convolution component, the convolution component including the convolved target spatial component and the convolution target temporal component; the mean calculation unit is used to calculate the mean of the convolution component in each dimension and output the mean component; the standard convolution unit is used to convolve the mean component again using a unit convolution kernel, so as to obtain the target change amount, and output the mean convolution component, wherein the leakage detection result is indicated in the mean convolution component; the upsampling unit is used to map the mean convolution component from a small resolution to a large resolution, so as to restore the feature map size corresponding to the mean convolution component to the size corresponding to the video stream data, so as to output the leakage detection result.
5. A computer device comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, characterized in that: When the processor executes the program, the steps of the method according to any one of claims 1 to 3 are implemented.
6. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 3 is implemented.
