Flame detection method and device based on visible light image and near infrared image
By introducing visible light and near-infrared detection channels and fusion detection channels into the flame detection model, feature-level and decision-level fusion is performed, which solves the problem of low flame detection accuracy in the existing technology and improves detection accuracy and robustness.
Patent Information
- Application Number
- CN202411163497.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-23
- Publication Date
- 2024-10-25
- Estimated Expiration
- 2044-08-23
AI Technical Summary
The visible and near-infrared fusion flame detection method based on deep learning has low detection accuracy, mainly due to the rough feature fusion granularity, insufficient use of texture information and spatial information in the visible and near-infrared bands, and the difficulty in aligning multi-band images, resulting in a dual-band flame model. The detection accuracy is low.
A flame detection model based on deep learning is adopted, including visible light detection channel, near-infrared detection channel and fusion detection channel. Visible light and near-infrared images are acquired through binocular cameras, feature extraction and detection are performed respectively, and feature-level fusion and decision-level fusion are performed. , comprehensive decision-making to improve flame detection accuracy.
Through feature-level and decision-level fusion, the flame detection accuracy of multi-modal images is improved, the problem of low detection accuracy is solved, more detailed feature fusion and decision-level information integration are achieved, and the accuracy of flame detection is enhanced. and robustness.
Smart Images

Figure CN118691932B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image recognition, and in particular to a flame detection method and device based on visible light images and near infrared images. Background Art
[0002] Object detection aims to accurately locate the target in an image and output the pixel coordinates of the target's corresponding bounding box and the target category probability information. The development of object detection can be divided into traditional object detection algorithms and deep learning-based object detection algorithms. Traditional object detection algorithms are based on manual feature extraction and detection and classification of the extracted features, but traditional methods have considerable limitations, such as poor recognition effect and low accuracy.
[0003] The algorithm based on deep learning is different from the traditional target detection algorithm. It uses CNN convolution to extract the spatial information and semantic information of the image. Since the convolution kernel parameters are generated according to training and are not restricted by specific convolution templates, better results are obtained and the detection accuracy is greatly improved. In the field of fire detection, there have been some explorations of visible light flame detection based on deep learning. Although the target detection algorithm in the visible light band has achieved a good accuracy, it is still limited by the information limitation brought by single-band imaging. In simple scenes, it may be sufficient to use only visible light images for detection, but in the face of interference from multiple light sources, such as mobile phone lights, the sun on sunny days, car lights, etc., a single visible light sensor will be greatly affected, resulting in inaccurate flame detection and false detection. At this time, the detection method of multi-sensor fusion becomes a necessary option. Although multimodal fusion detection has opened up a new idea for fire detection and prevention, the feature fusion method currently used by the visible light near-infrared fusion flame detection method based on deep learning is mostly decision-level fusion. As for the fusion at the feature level, most of them are fused on feature vectors without spatial structure, and the spatial information of the features is not deeply extracted. The granularity of feature fusion is relatively coarse, and the texture information and spatial information of the visible light and near-infrared bands are not fully utilized. There is still further research on the fusion method of information in the two bands, which leads to the problem of low detection accuracy. At the same time, it is currently difficult to accurately align multi-band images, resulting in poor feature fusion effect of multi-band flame images, and also leads to low detection accuracy of dual-band flame models.
[0004] The current flame detection method based on deep learning and visible light near-infrared fusion has the problem of low detection accuracy, and no effective solution has been proposed yet. Summary of the invention
[0005] The present invention provides a flame detection method and device based on visible light images and near-infrared images to solve the problem of low detection accuracy in the current flame detection method based on deep learning-based visible light and near-infrared fusion.
[0006] In a first aspect, the present invention provides a flame detection method based on visible light images and near infrared images, comprising:
[0007] Inputting a multimodal image to be detected into a trained flame detection model based on deep learning, wherein the multimodal image includes a visible light image and a near infrared image and is obtained by a binocular camera, wherein the binocular camera includes a visible light camera and a near infrared camera;
[0008] Obtaining a first flame detection result of the multimodal image by using the flame detection model;
[0009] Wherein, the flame detection model includes a visible light detection channel, a near infrared detection channel and a fusion detection channel;
[0010] The visible light detection channel includes a first backbone network and a first feature detection module, and the near-infrared detection channel includes a second backbone network and a second feature detection module. The first backbone network and the second backbone network are respectively used to extract features of the visible light image and the near-infrared image. The first feature detection module is used to detect the features extracted by the first backbone network and output the flame detection result of the visible light image. The second feature detection module is used to detect the features extracted by the second backbone network and output the flame detection result of the near-infrared image. The fusion detection channel is used to perform fusion detection on the features extracted by the first backbone network and the second backbone network and output the second flame detection result of the multimodal image.
[0011] The first flame detection result of the multimodal image is obtained by making a comprehensive decision on the flame detection result of the visible light image, the flame detection result of the near infrared image and the second flame detection result of the multimodal image.
[0012] In a second aspect, the present invention provides a flame detection device based on visible light images and near infrared images, comprising:
[0013] An image input module, used for inputting a multimodal image to be detected into a trained flame detection model based on deep learning, wherein the multimodal image includes a visible light image and a near infrared image and is obtained by a binocular camera, wherein the binocular camera includes a visible light camera and a near infrared camera;
[0014] A result output module, used for obtaining a first flame detection result of the multimodal image through the flame detection model;
[0015] Wherein, the flame detection model includes a visible light detection channel, a near infrared detection channel and a fusion detection channel;
[0016] The visible light detection channel includes a first backbone network and a first feature detection module, and the near-infrared detection channel includes a second backbone network and a second feature detection module. The first backbone network and the second backbone network are respectively used to extract features of the visible light image and the near-infrared image. The first feature detection module is used to detect the features extracted by the first backbone network and output the flame detection result of the visible light image. The second feature detection module is used to detect the features extracted by the second backbone network and output the flame detection result of the near-infrared image. The fusion detection channel is used to perform fusion detection on the features extracted by the first backbone network and the second backbone network and output the second flame detection result of the multimodal image.
[0017] The first flame detection result of the multimodal image is obtained by making a comprehensive decision on the flame detection result of the visible light image, the flame detection result of the near infrared image and the second flame detection result of the multimodal image.
[0018] Compared with the related art, the flame detection model adopted by the present invention mainly includes a visible light detection channel, a near infrared detection channel and a fusion detection channel. The visible light detection channel and the near infrared detection channel detect the visible light image and the near infrared image respectively, and obtain the flame detection results for the two different modal images respectively. The fusion detection channel realizes the feature-level fusion of the two modal images, and gives the flame detection result based on the fused features. Finally, the flame detection results of the three channels are comprehensively decided, the decision-level fusion of the two modal images is realized, and the final flame detection result is obtained. According to the final flame detection result, it can be determined whether a fire occurs at the position photographed by the binocular camera. By improving the flame detection model, the present invention realizes the feature-level fusion and decision-level fusion of multi-modal images at the same time, thereby improving the flame detection accuracy of multi-modal images, and solving the problem of low detection accuracy of the flame detection method based on deep learning and visible light near infrared fusion.
[0019] Details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 It is a flow chart of the flame detection method based on visible light image and near infrared image provided in the present invention;
[0021] Figure 2A flame detection technology roadmap for an embodiment of the present invention;
[0022] Figure 3 It is a structural schematic diagram of a dual-band flame collection device proposed in one embodiment of the present invention;
[0023] Figure 4 A dual-band flame image alignment flow chart proposed in one embodiment of the present invention;
[0024] Figure 5 is a structural diagram of a flame detection model in one embodiment of the present invention;
[0025] Figure 6 is the visible light detection result of the dual-band flame detection model in the present invention;
[0026] Figure 7 is the near infrared detection result of the dual-band flame detection model in the present invention;
[0027] Figure 8 It is the visible light detection result of YOLOX network;
[0028] Fig. 9 It is the near infrared detection result of YOLOX network. DETAILED DESCRIPTION
[0029] In order to more clearly understand the purpose, technical solutions and advantages of the present application, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments.
[0030] Unless otherwise defined, the technical terms or scientific terms involved in this application shall have the general meaning understood by people with general skills in the technical field to which this application belongs. The words "one", "a", "a", "the", "these" and the like in this application do not indicate a quantitative limitation, and they may be singular or plural. The terms "include", "comprise", "have" and any variants thereof involved in this application are intended to cover non-exclusive inclusions; for example, a process, method and system, product or device comprising a series of steps or modules (units) is not limited to the listed steps or modules (units), but may include unlisted steps or modules (units), or may include other steps or modules (units) inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there may be three relationships, for example, "A and / or B" may mean: A exists alone, A and B exist at the same time, and B exists alone. Generally, the character " / " indicates that the objects associated with each other are in an "or" relationship. The terms "first", "second", "third", etc. in this application are only used to distinguish similar objects and do not represent a specific ordering of the objects.
[0031] The present invention provides a flame detection method based on visible light images and near infrared images. Figure 1 is a flow chart of the flame detection method based on visible light image and near infrared image provided in the present invention, such as Figure 1 As shown, the process includes step S110 and step S110.
[0032] Step S110, inputting the multimodal image to be detected into the trained deep learning-based flame detection model, the multimodal image includes a visible light image and a near-infrared image and is obtained by a binocular camera, the binocular camera includes a visible light camera and a near-infrared camera, the visible light camera is used to capture visible light images, and the near-infrared camera is used to capture near-infrared images.
[0033] Step S120: obtaining a first flame detection result of the multimodal image through a flame detection model.
[0034] Among them, the flame detection model includes a visible light detection channel, a near-infrared detection channel and a fusion detection channel; the visible light detection channel includes a first backbone network and a first feature detection module, the near-infrared detection channel includes a second backbone network and a second feature detection module, the first backbone network and the second backbone network are used to extract features of the visible light image and the near-infrared image respectively, the first feature detection module is used to detect the features extracted by the first backbone network and output the flame detection result of the visible light image, the second feature detection module is used to detect the features extracted by the second backbone network and output the flame detection result of the near-infrared image, the fusion detection channel is used to perform fusion detection on the features extracted by the first backbone network and the second backbone network and output the second flame detection result of the multimodal image; the first flame detection result of the multimodal image is obtained by making a comprehensive decision on the flame detection result of the visible light image, the flame detection result of the near-infrared image and the second flame detection result of the multimodal image.
[0035] In the above technical solution, the multimodal image is mainly detected by a flame detection model based on deep learning to determine whether there is a flame image in the multimodal image. In order to ensure the detection accuracy, the above solution detects the visible light image and near-infrared image of the same position at the same time. The visible light image and near-infrared image are obtained by shooting the same target position with a visible light camera and a near-infrared camera respectively.
[0036] Compared with the related art, the main improvement of the above technical solution lies in the flame detection model adopted. For the above flame detection model, feature-level fusion and decision-level fusion are adopted at the same time. Specifically, for feature-level fusion: firstly, the visible light detection channel and the near-infrared detection channel are used to detect the visible light image and the near-infrared image respectively, and the flame detection results for the two different modal images are obtained respectively. The flame detection result refers to whether there is a flame in the image and the flame is located by the detection frame; and the fusion detection channel is used to fuse the visible light image features and the near-infrared image features for re-detection, and the corresponding flame detection result (that is, the second flame detection result of the multimodal image, if there is a flame, the channel can display the detection frame on any modal image) is given, and then the feature-level fusion is realized through the fusion detection channel. For decision-level fusion: after obtaining the flame detection results of the three channels, the three are comprehensively decided to obtain the final flame detection result, that is, the first flame detection result of the multimodal image. For example, when the flame detection results of the three channels are all flames, and the positions of the three detection frames are the same or close, the prediction of the presence of flames in the multimodal image will be given after the comprehensive decision, and the flame detection results of any channel will be output. Alternatively, if the flame detection results of some channels indicate the presence of flame, while the flame detection results of the remaining channels indicate the absence of flame, then the comprehensive decision may result in a prediction that there is no flame in the multimodal image.
[0037] In summary, the flame detection model adopted by the present invention mainly includes a visible light detection channel, a near infrared detection channel and a fusion detection channel. The visible light detection channel and the near infrared detection channel detect the visible light image and the near infrared image respectively, and obtain the flame detection results for the two different modal images respectively. The fusion detection channel realizes the feature-level fusion of the two modal images, and gives the flame detection result based on the fused features. Finally, the flame detection results of the three channels are comprehensively decided, the decision-level fusion of the two modal images is realized, and the final flame detection result is obtained. According to the final flame detection result, it can be determined whether a fire occurs at the position photographed by the binocular camera. By improving the flame detection model, the present invention realizes the feature-level fusion and decision-level fusion of multi-modal images at the same time, thereby improving the flame detection accuracy of multi-modal images, and solving the problem of low detection accuracy in the flame detection method based on visible light near infrared fusion based on deep learning.
[0038] In some of the embodiments, the first feature detection module includes a first Transformer encoder, a first Transformer decoder and a first Detr detection head, and the second feature detection module includes a second Transformer encoder, a second Transformer decoder and a second Detr detection head; the output of the first backbone network is the input of the first Transformer encoder, the output of the first Transformer encoder is the input of the first Transformer decoder and the fusion detection channel, the output of the first Transformer decoder is the input of the first Detr detection head, and the output of the first Detr detection head is the flame detection result of the visible light image; the output of the second backbone network is the input of the second Transformer encoder, the output of the second Transformer encoder is the input of the second Transformer decoder and the fusion detection channel, the output of the second Transformer decoder is the input of the second Detr detection head, and the output of the second Detr detection head is the flame detection result of the near-infrared image.
[0039] In these embodiments, both the visible light detection channel and the near-infrared detection channel adopt the detection paradigm of Detr, which detects features through the Transformer encoder, the Transformer decoder and the Detr detection head. The new detection paradigm of Detr uses a small-scale target query set query to infer the relationship between the target and the global image. Furthermore, this embodiment explores the application of the new detection paradigm in dual-band fire detection. Correspondingly, in other embodiments, the visible light detection channel and the near-infrared detection channel can also adopt detection paradigms such as YOLOv3, YOLOX, and Faster RCNN.
[0040] In some of the embodiments, the fusion detection channel includes a cross-attention cross-modal fusion module, a third Transformer decoder, and a third Detr detection head; the output of the first Transformer encoder and the second Transformer encoder is the input of the cross-attention cross-modal fusion module, the output of the cross-attention cross-modal fusion module is the input of the third Transformer decoder, the output of the third Transformer decoder is the input of the third Detr detection head, and the output of the third Detr detection head is the second flame detection result of the multimodal image.
[0041] In these embodiments, the fusion detection channel uses a cross-modal fusion module to fuse the features of different modal images, and introduces a cross-attention mechanism in the cross-modal fusion module, thereby having a more detailed fusion granularity, and can fuse according to the correlation of the feature information of the two bands, achieving feature-level fusion. Correspondingly, in other embodiments, the fusion detection channel can also use fusion methods such as pixel-by-pixel addition and channel connection.
[0042] In some of the embodiments, the flame detection model further includes a comprehensive decision module, which is used to make a comprehensive decision on the flame detection result of the visible light image, the flame detection result of the near infrared image and the second flame detection result of the multimodal image and output the first flame detection result of the multimodal image according to the comprehensive result; the decision calculation of the comprehensive decision module is:
[0043]
[0044] in, P RBG , P Infra and P Fusion They respectively represent the flame detection result of the visible light image, the flame detection result of the near infrared image and the second flame detection result of the multimodal image, DBC IOU Indicates the decision result. In the invention, RGB , Infra and Fusion They represent visible light detection channel, near infrared detection channel and fusion detection channel respectively.
[0045] When the decision result is less than the threshold, the comprehensive decision module determines that there is no flame in the multimodal image; when the decision value is greater than the threshold, the comprehensive decision module determines that there is a flame in the multimodal image.
[0046] In these embodiments, the above-mentioned comprehensive decision module is used to comprehensively calculate the intersection and union rate of the flame detection results of each channel. If the flame detection results of the three channels are very close, for example, they all determine that there is a flame in the image and the positions of the prediction boxes are relatively close, then the comprehensive decision module can calculate a higher decision value (decision result), and at this time it is determined that there is a flame in the multimodal image, and the flame detection result of any channel can be output. Among them, the threshold value can be set according to the actual situation, such as 90%, 95%, etc.
[0047] In some of the embodiments, the first backbone network and the second backbone network are both ResNet50; the visible light detection channel also includes a first position encoder, which is used to provide position information of the output of the first backbone network; the near-infrared detection channel also includes a second position encoder, which is used to provide position information of the output of the second backbone network.
[0048] In these embodiments, the two backbone networks specifically use ResNet50. Also, position encoders are provided in both the visible light detection channel and the near infrared detection channel, mainly for position encoding the features extracted by the backbone network.
[0049] In some of the embodiments, the flame detection model training step includes steps S210 to S250.
[0050] Step S210 , collecting multiple pairs of flame multimodal images, each pair of flame multimodal images includes a corresponding flame visible light image and a flame near-infrared image and is obtained by a binocular camera.
[0051] The flame visible light image and the flame near infrared image refer to a visible light image and a near infrared image containing the flame, respectively.
[0052] Specifically, a high-resolution visible light camera and a near-infrared camera can be used, the near-infrared camera is adjacent to the visible light camera, and both the visible light camera and the near-infrared camera take images of the same position. The two cameras are fixed on a square aluminum alloy bottom plate, which constitutes a binocular camera for collecting multimodal images of flames in the present invention.
[0053] Step S220, jointly calibrate the binocular camera using the Zhang Zhengyou calibration method to obtain the camera's internal and external parameters and distortion coefficients.
[0054] As follows, the joint calibration of the binocular camera using the Zhang Zhengyou calibration method is specifically explained by taking the solution process of the camera's internal and external parameters (intrinsic parameter matrix and extrinsic parameter matrix) as an example.
[0055] Using Zhang Zhengyou's calibration method, the world coordinate system is fixed on the checkerboard calibration board. Then the physical coordinates of any point on the checkerboard calibration board are w =0,w Represents the depth coordinate of the physical coordinates of a point on the checkerboard calibration plate in the world coordinate system. Since the checkerboard calibration plate is a plane, the depth is perpendicular to the plane, and thus the physical coordinates of any point on the checkerboard calibration plate w = 0. The imaging model can be obtained as follows:
[0056]
[0057] Transformed into:
[0058]
[0059] in,( u , v ) are pixel coordinates; ( x w , y w , z w )and( U , V ) is the world coordinate; s is the scale factor; f is the focal length of the camera; dx and dy They are x Direction and y The pixel length in the direction; and are the normalized focal lengths in the x direction respectively; u 0 and v 0 is the principal point coordinate, that is, the intersection of the optical axis on the image plane in the image coordinate system (pixel coordinate system); R is the rotation matrix, t is the translation vector; A is the internal parameter matrix; R 1 R 2 T ) is the external parameter matrix, R1 is the first column of the rotation matrix, R2 is the second column of the rotation matrix, and the product of the internal parameter matrix and the external parameter matrix is recorded as the homography matrix: H , then:
[0060]
[0061] The homography matrix can be estimated by the least squares method through the pixel coordinates of each chessboard calibration plate and the corresponding world coordinates. R 1 and R 2 as the rotation matrix RThe two columns of , if there is a unit orthogonal condition, can get the camera's intrinsic parameter matrix. For the same camera, the intrinsic parameter matrix is constant. The homography matrix of each calibration image is known. The intrinsic parameter matrix of all calibration images is known and constant. Then, it can be obtained by ( R 1 R 2 T )= A -1 H The external parameter matrix corresponding to each calibration image is obtained. At this time, the internal parameter matrix and external parameter matrix of the visible light and near-infrared cameras have been estimated. In order to obtain the relative posture relationship between the two cameras, the following formula is used:
[0062]
[0063] in, R is the rotation matrix between the two cameras; T is the translation vector between the two cameras; R r and T r is the estimated rotation matrix and translation vector of the visible light camera (obtained through the above calibration process); R i and T i are the estimated rotation matrix and translation vector of the near-infrared camera (obtained through the above calibration process).
[0064] Furthermore, the distortion coefficient of the camera can be obtained through calibration. This is a relatively mature algorithm process and will not be described in detail in the present invention.
[0065] Step S230 , according to the camera internal and external parameters, distortion correction and epipolar correction are performed on the flame multimodal image in sequence to achieve horizontal alignment of the flame visible light image and the flame near infrared image.
[0066] The step of correcting the distortion of the flame multimodal image includes step S231, step S232 and step S233.
[0067] Step S231, determining a projection matrix according to the camera internal and external parameters, where the projection matrix is a mapping matrix between the camera coordinate system and the pixel coordinate system.
[0068] Step S232, determining the correction coefficients of the radial distortion and tangential distortion of the binocular camera according to the camera internal and external parameters and the projection matrix.
[0069] Step S233: performing distortion correction on the multimodal image according to the correction coefficient.
[0070] Specifically, the collected visible light image and near-infrared image are first distorted. After the above calibration, the internal and external parameters of the camera can be obtained, and the projection matrix is calculated, that is, the mapping matrix that converts the three-dimensional points in the camera coordinate system to the pixel coordinate system. According to the projection matrix and the distortion coefficient, the correction coefficients of the radial distortion and tangential distortion in the camera coordinate system are calculated. Through the above steps, the correction coefficients of the visible light camera and the near-infrared camera can be obtained respectively. The correction coefficients of the camera are applied to the corresponding image, and the image can be dedistorted.
[0071] The step of correcting the epipolar lines of the flame multimodal image includes steps S234 to S238.
[0072] Step S234 , determining a first camera and a second camera in the binocular camera, the first camera is a visible light camera and the second camera is a near infrared camera, or the first camera is a near infrared camera and the second camera is a visible light camera.
[0073] Step S235, dividing the rotation matrix of the first camera relative to the second camera into a composite matrix of the first camera and the second camera, the composite matrix is:
[0074]
[0075] in, R represents the rotation matrix of the first camera relative to the second camera, r 1 represents the synthesis matrix of the first camera, r 2 represents the synthesis matrix of the second camera.
[0076] Step S236, determining a row alignment matrix according to the translation vector of the first camera relative to the second camera, the row alignment matrix is:
[0077]
[0078] in, R rect represents a row-aligned matrix, T represents the translation vector of the first camera relative to the second camera, T x and T y Respectively expressed in x Direction and y The weight in direction, x Direction and y Direction parallel to the image plane.
[0079] Step S237, determining the transformation matrix of the first camera and the second camera according to the synthesis matrix and the row alignment matrix, the transformation matrix is:
[0080]
[0081] in, R 1 represents the transformation matrix of the first camera, R 2 represents the transformation matrix of the second camera.
[0082] Step S238, applying the corresponding transformation matrix to the flame visible light image and the flame near infrared image, so as to achieve horizontal alignment of the flame visible light image and the flame near infrared image.
[0083] Specifically, after binocular calibration, in order to horizontally align the visible light image and the near-infrared image, each row of pixels corresponds to each other, thereby improving the matching accuracy of the detection frame of the visible light detection channel and the detection frame of the near-infrared detection channel, the two modal images can be subjected to epipolar correction. The epipolar correction steps are steps S234 to S238. Among them, the relative position between the first camera and the second camera is the external parameter matrix of the two cameras ( R 1 R 2 T ), and the rotation matrix of the first camera relative to the second camera R Then ( R 1 R 2). After obtaining the transformation matrices of the first camera and the second camera, the transformation matrices are multiplied by the images of the corresponding cameras to complete the epipolar correction of the multimodal image.
[0084] Step S240: annotating the corrected flame multimodal image.
[0085] Specifically, a rectangular frame is used to manually annotate the flames in the visible light image and near-infrared image after distortion correction and epipolar correction. Each visible light annotated image has a corresponding infrared annotated image, and the frame rates between them are strictly synchronized. Through annotation, a priori frames can be formed on the flame multimodal image.
[0086] Step S250: training a flame detection model using the annotated flame multimodal image.
[0087] Among them, the losses of the visible light detection channel, near infrared detection channel and fusion detection channel all include category loss, detection frame position loss and detection frame overlap loss. The total loss of the flame detection model is:
[0088]
[0089] in, loss represents the total loss of the flame detection model, loss RGB , loss Infra and loss FusionRespectively represent the loss of visible light detection channel, near infrared detection channel and fusion detection channel, w RGB , w Infra and w Fusion They represent the weights of the visible light detection channel, near infrared detection channel and fusion detection channel respectively.
[0090] In a single round of training: if the prior frame of the visible light image of the flame matches the prior frame of the near-infrared image, the weight of the visible light detection channel is 1, otherwise it takes a random weight between 0 and 1; if the prior frame of the near-infrared image of the flame matches the prior frame of the visible light image, the weight of the near-infrared detection channel is 1, otherwise it takes a random weight between 0 and 1, and the weight of the fusion detection channel takes the weight of the near-infrared detection channel. The matching degree of the two prior frames is determined according to the intersection and union ratio of the two prior frames.
[0091] Specifically, the manually annotated data set is used to train the dual-channel flame detection model in the above embodiment. In the training stage, the dual-band fuzzy perception module is first used to use the prior frame in the visible light image. B r and the prior box in the near infrared image B i , calculate the intersection-over-combination ratio between the two channel prior frames DB IOU , the specific calculation method is as follows:
[0092]
[0093] Calculate the intersection and union ratio of the prior frame of the visible light image and the prior frame of the near infrared image. In theory, DB IOU It should be equal to 1, but due to the parallax between the visible light camera and the near infrared camera, the prior frames of the two modal images should be close to 1. The threshold can be set to determine whether the prior frames match. For a prior frame of the visible light detection channel, its corresponding weight is calculated by the following formula:
[0094]
[0095] in, w RGB represents the weight of the visible light detection channel, w random represents random weights.
[0096] That is, if there is no match, it means that the infrared mode does not judge the area as a flame, and the two modes do not reach a consensus on the decision, so a fuzzy weight (random weight) is assigned to the prior frame. Similarly, the following weight calculation formula is also used for a prior frame of the near-infrared detection channel:
[0097]
[0098] in, w Infra Represents the weight of the near-infrared detection channel.
[0099] This embodiment believes that the near infrared detection channel has a relatively obvious judgment effect on flames, so the weight of the fusion detection channel is kept consistent with the weight of the near infrared detection channel, and the calculation method is as follows:
[0100]
[0101] The losses used in this embodiment can be divided into three types of losses: loss cls , which is used to measure the gap between the category predicted by the model and the true category label; the second is the detection box position loss loss bbox , which is used to measure the gap between the detection box position predicted by the model and the prior box position; the third is the detection box overlap loss loss io , which is used to directly measure the degree of overlap between the detection box predicted by the model and the prior box.
[0102] Three types of losses are calculated on each channel, and the calculation method is as follows:
[0103]
[0104] After obtaining the loss on each channel, the overall loss of the dual-band flame detection network can be calculated as follows:
[0105]
[0106] In some of the embodiments, the flame detection model training step further includes: pre-training the flame detection model using non-flame multimodal images before using the labeled flame multimodal images to train the flame detection model.
[0107] In the embodiment where the Detr detection paradigm is used for the visible light detection channel and the near infrared detection channel, considering that the Detr detection paradigm is difficult to converge on a small data set, and it is relatively difficult to obtain larger flame image data, the flame detection model can be pre-trained using non-flame multimodal images. Among them, non-flame multimodal images refer to multimodal images that contain objects to be identified other than flames. Through this pre-training, the flame detection model can have a generalized object recognition and detection capability, and by training the pre-trained flame detection model with flame multimodal images, the model can have a higher flame recognition and detection capability.
[0108] As described above, at least one embodiment of each part of the flame detection method based on visible light image and near infrared image provided by the present invention has been described respectively. It should be noted that each part of the flame detection method can be combined with different embodiments to form different embodiments of the flame detection method.
[0109] For example, in some specific embodiments, the flame detection method based on visible light images and near infrared images includes:
[0110] S1: A dedicated visible-light near-infrared dual-channel camera is used to collect relevant flame images.
[0111] A high-resolution visible light camera and a near-infrared camera are used, and the near-infrared camera is next to the visible light camera, and both the visible light camera and the near-infrared camera take images of the same position. The two cameras are fixed on a square aluminum alloy bottom plate, which is a visible light and near-infrared dual-channel camera (binocular camera) for collecting flame images in this embodiment.
[0112] S2: Use Zhang Zhengyou calibration method to calibrate the visible light near-infrared dual-channel camera to obtain the camera's internal and external parameters.
[0113] Using Zhang Zhengyou's calibration method, the world coordinate system is fixed on the checkerboard calibration board. Then the physical coordinates of any point on the checkerboard calibration board are w =0, w Represents the depth coordinate of the physical coordinates of a point on the checkerboard calibration plate in the world coordinate system. Since the checkerboard calibration plate is a plane, the depth is perpendicular to the plane, and thus the physical coordinates of any point on the checkerboard calibration plate w = 0. The imaging model can be obtained as follows:
[0114]
[0115] Transformed into:
[0116]
[0117] in,( u ,v ) are pixel coordinates; s is the scale factor; f is the camera focal length; dx and dy They are x Direction and y The pixel length in the direction; A is the internal parameter matrix; R 1 R 2 T ) is the external parameter matrix, and the product of the internal parameter matrix and the external parameter matrix is recorded as the homography matrix: H , then:
[0118]
[0119] The homography matrix can be estimated by the least squares method through the pixel coordinates of each chessboard calibration plate and the corresponding world coordinates. R 1 and R 2 as the rotation matrix R The two columns of , if there is a unit orthogonal condition, can get the camera's intrinsic parameter matrix. For the same camera, the intrinsic parameter matrix is constant. The homography matrix of each calibration image is known. The intrinsic parameter matrix of all calibration images is known and constant. Then, it can be obtained by ( R 1 R 2 T )= A -1 H The extrinsic parameter matrix corresponding to each calibration image is obtained. At this time, the intrinsic parameter matrix and extrinsic parameter matrix of the camera have been calculated.
[0120] S3: Using the camera internal and external parameters in step 2, the collected visible light and near-infrared images are horizontally aligned using distortion correction and epipolar correction.
[0121] First, the collected visible light image and near-infrared image are distorted and corrected. After the above calibration, the internal and external parameters of the camera can be obtained, and the projection matrix can be calculated. Q , that is, the mapping matrix that transforms the 3D points in the camera coordinate system into the pixel coordinate system of the calibration plate. According to the projection matrix Q And distortion coefficients, calculate the correction coefficients of radial distortion and tangential distortion in the camera coordinate system. Through the above steps, the correction coefficients of the visible light camera and the near infrared camera can be obtained respectively. The correction coefficients of the camera are applied to the corresponding image, and the image can be dedistorted.
[0122] After binocular calibration, in order to horizontally align the visible light image and the near-infrared image, each row of pixels corresponds to each other, thereby improving the matching accuracy of the detection frame of the visible light detection channel and the detection frame of the near-infrared detection channel. The position relationship of the right camera relative to the left camera (in this embodiment, the left and right cameras correspond to the first camera and the second camera respectively) can be obtained by the external parameter matrix ( R 1 R 2 T ). The rotation matrix of the right camera relative to the left camera R =( R 1 R 2) Divide into the synthesis matrix of the left and right cameras r l , r r , to achieve parallelism of the image plane, the specific calculation is as follows:
[0123]
[0124] Then create the row alignment matrix R rect , transform the pole to infinity and establish the translation vector T =( T x T y T z ) The transformation matrix in the same direction is calculated as follows:
[0125]
[0126] in, , is the translation vector T The poles in the same direction, , is the vector in the direction of the image plane, , which is perpendicular to e 1 and e 2 is the vector of the plane.
[0127] joint R rect , r l , r r , we can get the final transformation matrix of the left and right cameras R l , R r , the calculation method is as follows:
[0128]
[0129] After obtaining the transformation matrices of the first camera and the second camera, the transformation matrices are multiplied by the images of the corresponding cameras to complete the epipolar correction of the multimodal image.
[0130] S4: Manually annotate the visible light image and near infrared image obtained in step 3.
[0131] Specifically, a rectangular frame is used to manually annotate the flames in the visible light image and near-infrared image after distortion correction and epipolar correction. Each visible light annotated image has a corresponding infrared annotated image, and the frame rates between them are strictly synchronized. Through annotation, a priori frames can be formed on the flame multimodal image.
[0132] S5: Based on the data set annotated in step 4, the visible light and near-infrared image features are fused at the feature level and decision level, and a dual-channel visible light and near-infrared flame fusion detection network is trained.
[0133] Specifically, the manually annotated data set is used to train the dual-channel flame detection model in the above embodiment. In the training stage, the dual-band fuzzy perception module is first used to use the prior frame in the visible light image. B r and the prior box in the near infrared image B i , calculate the intersection-over-combination ratio between the two channel prior frames DB IOU , the specific calculation method is as follows:
[0134]
[0135] Calculate the intersection and union ratio of the prior frame of the visible light image and the prior frame of the near infrared image. In theory, DB IOU It should be equal to 1, but due to the parallax between the visible light camera and the near infrared camera, the prior frames of the two modal images should be close to 1. The threshold can be set to determine whether the prior frames match. For a prior frame of the visible light detection channel, its corresponding weight is calculated by the following formula:
[0136]
[0137] in, w RGB represents the weight of the visible light detection channel, w random represents random weights.
[0138] That is, if there is no match, it means that the infrared mode does not judge the area as a flame, and the two modes do not reach a consensus on the decision, so a fuzzy weight (random weight) is assigned to the prior frame. Similarly, the following weight calculation formula is also used for a prior frame of the near-infrared detection channel:
[0139]
[0140] in, w Infra Represents the weight of the near-infrared detection channel.
[0141] This embodiment believes that the near infrared detection channel has a relatively obvious judgment effect on flames, so the weight of the fusion detection channel is kept consistent with the weight of the near infrared detection channel, and the calculation method is as follows:
[0142]
[0143] The losses used in this embodiment can be divided into three types of losses: loss cls , which is used to measure the gap between the category predicted by the model and the true category label; the second is the detection box position loss loss bbox , which is used to measure the gap between the detection box position predicted by the model and the prior box position; the third is the detection box overlap loss loss io , which is used to directly measure the overlap between the detection box predicted by the model and the prior box. There are three detection channels: one is the visible light detection channel, which consists of the backbone network, Transformer encoder, Transformer decoder, and Detr detection head; the second is the near-infrared detection channel, which consists of the backbone network, Transformer encoder, Transformer decoder, and Detr detection head; the third is the fusion detection channel, which consists of the cross-attention fusion module, Transformer decoder, and Detr detection head. Three types of losses are calculated on each channel, and the calculation method is as follows:
[0144]
[0145] After obtaining the loss on each channel, the overall loss of the dual-band flame detection network can be calculated as follows:
[0146]
[0147] In the process of dual-band flame detection network inference, the output results of the three channels are passed through the dual-band comprehensive decision module. DBC Decision The final flame detection result is obtained. The calculation method of the dual-band comprehensive decision module is as follows:
[0148]
[0149] in, P RBG , P Infra and P Fusion They respectively represent the flame detection result of the visible light image, the flame detection result of the near infrared image and the second flame detection result of the multimodal image, DBC IOU Indicates the decision result.
[0150] When the decision result is less than the threshold, the comprehensive decision module determines that there is no flame in the multimodal image; when the decision value is greater than the threshold, the comprehensive decision module determines that there is a flame in the multimodal image.
[0151] Compared with the prior art, the flame detection method based on visible light image and near infrared image in the above specific embodiment has the following technical effects:
[0152] 1. Different from previous fire detection models such as YOLOv3 and YOLOX, this paper adopts the detection paradigm of Detr, uses a small-scale target query set query, infers the relationship between the target and the global image, and explores the application of the new detection paradigm in dual-band fire detection.
[0153] 2. Compared with the background technology that only uses visible light, or only uses near-infrared detection networks, or trains two networks separately and fuses them at the decision-making level for fire detection, the fusion granularity of the present invention is more detailed. It fuses according to the correlation of the feature information of the two bands, which not only achieves fine-grained fusion at the feature level, but also fuses the results at the decision-making level through a comprehensive decision-making module.
[0154] 3. Compared with the background technology that directly trains the network, the present invention proposes a dual-band fuzzy perception module, which pre-gives a priori frame weight through the prior frames in two modes. The present invention believes that a priori frame with flames in one mode and a priori frame without flames at the same position in the corresponding other mode is a fuzzy training case. The dual-band fuzzy perception module will give the weight of the frame according to the matching of the prior frames in the two modes. If there is no match, the frame will be given a fuzzy weight between 0 and 1, thereby weakening the impact of the case on model training.
[0155] In a specific embodiment, see Figure 2 , Figure 2 This is a flame detection technology roadmap for an embodiment of the present invention. The overall process is divided into five steps. First, a dual-band flame acquisition device (binocular camera) is designed to collect high-quality visible light and infrared flame data. Secondly, the visible light camera and the infrared camera are calibrated by shooting a calibration plate to obtain the camera's internal parameters, external parameters and distortion coefficients. Next, the collected dual-band flame data set is subjected to distortion correction and epipolar correction through the internal and external parameters and distortion coefficients of the visible light camera and the near-infrared camera to ensure horizontal alignment of the collected images. The aligned images are manually annotated, and finally a dual-band flame detection network is designed. The dual-band flame is trained using the annotated high-quality data set to obtain the dual-band flame detection model of the present invention.
[0156] Step 1: Use a dedicated visible-light near-infrared dual-channel camera to collect relevant flame images, see Figure 3 , Figure 3 The dual-band flame acquisition device proposed in one embodiment of the present invention includes an image acquisition unit and an image processing unit 4. The image acquisition unit includes a plane base 3 (length × width = 10.47 cm × 6.17 cm), a visible light camera 1, and a near infrared camera 2 mounted on the plane base 3 for acquiring visible light images. I rgb , near infrared image I infra , where the baseline distance between the two is B , B The smaller the parallax, the better the detection effect. Visible light camera 1 uses Hikvision MV-CE200-10UC with a 50mm fixed-focus lens, and near-infrared camera 2 uses Hikvision MV-CE200-10UM with a 50mm fixed-focus lens and a 950nm high-pass filter. They are set up on the left and right. B = 4.88 cm , when collecting visible light image and near infrared image data, strict frame rate synchronization and consistent images are guaranteed.
[0157] The purpose of this step is to design visible light image and near-infrared image acquisition equipment to efficiently and stably acquire dual-band flame data, ensure strict synchronization of the frame rates of visible light images and near-infrared images, improve the quality of the dual-band flame detection dataset, and better serve the training of the dual-band flame detection model.
[0158] Step 2: Use Zhang Zhengyou calibration method to calibrate the visible light and near-infrared dual-channel camera to obtain the internal and external parameters of the camera. The calibration process follows the standard steps: First, fix the camera and image the checkerboard calibration plate with different rotation angles and pitch angles, and shoot a total of 131 sets of calibration image pairs. First, use the Matlab toolbox Stereo Camera Calibrator to shoot infrared, click Add Images to load the image pair, select 3 Coefficients, select Skew and TangentialDistortion to calculate the skew coefficient and tangential distortion, and click Calibrate to calibrate the visible light camera C1 and infrared camera C2 to obtain the visible light camera internal parameters. M 1 and distortion coefficient D 1. Infrared camera internal parameters M 2 and distortion coefficient D 2 and the external parameters of the visible light camera and infrared camera ( R , T ).
[0159] The purpose of this step is to calibrate the visible light camera and the infrared camera by photographing the calibration plate, obtain the intrinsic and extrinsic parameters of the visible light camera and the infrared camera, and provide corresponding parameters for the distortion correction and epipolar correction in step 3.
[0160] Step 3: Use the calibrated intrinsic and extrinsic parameters to horizontally align the collected visible light image with the infrared image using distortion correction and epipolar correction. Figure 4 , Figure 4 The dual-band flame image alignment process proposed in an embodiment of the present invention uses the calibrated camera intrinsic parameters and extrinsic parameters obtained in step 4. The StereoRectify tool in the Opencv toolbox is first used to perform distortion correction and epipolar correction on the intrinsic parameters and extrinsic parameters of the visible light camera and the infrared camera to obtain the unified intrinsic parameters. Then, initUndistortRectifyMap is used to generate a remapping map, and then remap is used to align the visible light image. I 1 and I 2. Pixel shifting of infrared image to obtain corrected image , , thus completing the horizontal alignment of the visible light image and the infrared image.
[0161] The purpose of this step is to use the intrinsic parameters, extrinsic parameters, and distortion coefficients of the visible light camera and the infrared camera to perform distortion correction and epipolar correction on the images taken by the two cameras, eliminate the distortion caused by the camera lens, and keep the images taken by the two cameras horizontally aligned, reduce the error of IOU calculation and matching in the dual-band fuzzy perception module of the dual-band flame detection model, and improve the accuracy of the prediction results in the dual-band comprehensive decision module of the dual-band flame detection model.
[0162] Step 4: Manually annotate the horizontally aligned visible light image from step 3 With infrared images ,The labeling process follows standard steps: Generally, the labeling software labelimg is used to label the images, the ,labeled data set format is PascalVOC, the labeling category is one class of “fire”, and a total of ,5380 images are labeled as the data set in the present ,invention.
[0163] The purpose of this step is to improve the quality of the dual-band flame dataset by annotating the images and screening high-quality images, so as to provide high-quality training samples for the dual-band flame detection model and thus improve the model's flame detection accuracy.
[0164] Step 5: Based on the labeled data set in step 4, design a dual-band flame detection model, fuse the visible light data and near-infrared data at the feature level and decision level, and train a dual-band visible light and near-infrared flame fusion detection network. Figure 5In the present invention, the backbone network of the dual-band flame detection model on the visible light channel and the infrared channel adopts ResNet50. At the same time, two position encoders are set on the visible light channel and the infrared channel respectively. The position encoder and the extracted features are fused and put into the Transformer Encoder for encoding, and the encoded results are put into the Transformer decoder for decoding. At the same time, the encoded results of the two channels are feature fused through cross attention and also put into the Transformer decoder for decoding. Finally, the results of the visible light channel, the fused channel, and the infrared channel are put into the detection head, and the weights of each channel obtained by the dual-band fuzzy perception module are used to calculate the overall loss, and then back-propagated to complete one training. In the model reasoning, after passing through the detection head, the final detection result will be obtained through the dual-band comprehensive decision module (Dual Band Comprehensive Decision) in the present invention. Since the detection paradigm of the Dert structure adopted in the present invention is small, the flame data set collected by the present invention is small. If the dual-band flame detection model of this article is trained directly from beginning to end, it will not converge. Therefore, the present invention adopts the method of weight migration, and the weights of the model trained on the COCO data set with a larger sample size are migrated to the dual-band flame detection model, and then the dual-band flame data set adopted by the present invention is used for fine-tuning, and finally the dual-band flame detection network in the present invention is obtained, and the average accuracy mAP@0.5 in the visible light data set reaches 94.9%, and the average accuracy mAP@0.5 in the infrared data set reaches 93.8%.
[0165] The purpose of this step is to design a dual-band fire source detection network, fuse the visible light flame information and infrared flame information at the feature level and decision level, realize the complementarity of the two bands of information, improve the detection accuracy, and avoid false alarms.
[0166] At the same time, the present invention also verifies the above embodiments. Figures 6 to 9 . Figure 6 is the visible light detection result of the dual-band flame detection model in the present invention, Figure 7 It is the near infrared detection result of the dual-band flame detection model in the present invention. Figure 8 is the visible light detection result of the YOLOX network, Figure 7It is the near-infrared detection result of the YOLOX network. A dual-band flame image acquisition device was set up in the evening of a certain day. Visible light camera 1 uses Hikvision MV-CE200-10UC, equipped with a 50mm fixed-focus lens, and infrared camera 2 uses Hikvision MV-CE200-10UM, equipped with a 50mm fixed-focus lens and a 950nm high-pass filter. They are set on the left and the right to ensure strict frame rate synchronization and consistent images when collecting visible light image and near-infrared image data. After shooting the dual-band flame image, the YOLOX network trained with the data set collected in the present invention is used to detect flames on the captured images. The results show that false detection has occurred. Regardless of the visible light mode or the infrared mode, the light of the mobile phone lighting is detected as a flame. The network in the present invention correctly identifies the flame in the image and does not misjudge the mobile phone light as a flame. The network in the present invention has stronger robustness and higher detection accuracy than other networks.
[0167] In the embodiments of the present invention, a flame detection device based on visible light images and near infrared images is also provided, which is used to implement the above embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. The terms "module", "unit", "subunit" and the like used below can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware is also possible and conceivable.
[0168] A flame detection device based on visible light images and near infrared images comprises:
[0169] An image input module, used for inputting a multimodal image to be detected into a trained flame detection model based on deep learning, wherein the multimodal image includes a visible light image and a near infrared image and is obtained by a binocular camera, wherein the binocular camera includes a visible light camera and a near infrared camera;
[0170] A result output module, used for obtaining a first flame detection result of the multimodal image through the flame detection model;
[0171] Wherein, the flame detection model includes a visible light detection channel, a near infrared detection channel and a fusion detection channel;
[0172] The visible light detection channel includes a first backbone network and a first feature detection module, and the near-infrared detection channel includes a second backbone network and a second feature detection module. The first backbone network and the second backbone network are respectively used to extract features of the visible light image and the near-infrared image. The first feature detection module is used to detect the features extracted by the first backbone network and output the flame detection result of the visible light image. The second feature detection module is used to detect the features extracted by the second backbone network and output the flame detection result of the near-infrared image. The fusion detection channel is used to perform fusion detection on the features extracted by the first backbone network and the second backbone network and output the second flame detection result of the multimodal image.
[0173] The first flame detection result of the multimodal image is obtained by making a comprehensive decision on the flame detection result of the visible light image, the flame detection result of the near infrared image and the second flame detection result of the multimodal image.
[0174] It should be noted that the above modules can be functional modules or program modules, and can be implemented by software or hardware. For modules implemented by hardware, the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.
[0175] It should be understood that the specific embodiments described herein are only used to explain the application, rather than to limit it. Based on the embodiments provided in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the protection scope of this application.
[0176] Obviously, the drawings are only some examples or embodiments of the present application. For ordinary technicians in the field, the present application can also be applied to other similar situations based on these drawings without creative work. In addition, it is understandable that although the work done in this development process may be complicated and lengthy, for ordinary technicians in the field, certain changes in design, manufacturing or production based on the technical content disclosed in this application are only conventional technical means and should not be regarded as insufficient content disclosed in this application.
Claims
1. A flame detection method based on visible light image and near infrared image, characterized in that: include: Inputting a multimodal image to be detected into a trained flame detection model based on deep learning, wherein the multimodal image includes a visible light image and a near infrared image and is obtained by a binocular camera, wherein the binocular camera includes a visible light camera and a near infrared camera; Obtaining a first flame detection result of the multimodal image through the flame detection model; Wherein, the flame detection model includes a visible light detection channel, a near infrared detection channel and a fusion detection channel; The visible light detection channel includes a first backbone network and a first feature detection module, and the near-infrared detection channel includes a second backbone network and a second feature detection module. The first backbone network and the second backbone network are respectively used to extract features of the visible light image and the near-infrared image. The first feature detection module is used to detect the features extracted by the first backbone network and output the flame detection result of the visible light image. The second feature detection module is used to detect the features extracted by the second backbone network and output the flame detection result of the near-infrared image. The fusion detection channel is used to perform fusion detection on the features extracted by the first backbone network and the second backbone network and output the second flame detection result of the multimodal image. The first flame detection result of the multimodal image is obtained by making a comprehensive decision on the flame detection result of the visible light image, the flame detection result of the near infrared image and the second flame detection result of the multimodal image; The first feature detection module includes a first Transformer encoder, a first Transformer decoder and a first Detr detection head, and the second feature detection module includes a second Transformer encoder, a second Transformer decoder and a second Detr detection head; The output of the first backbone network is the input of the first Transformer encoder, the output of the first Transformer encoder is the input of the first Transformer decoder and the fusion detection channel, the output of the first Transformer decoder is the input of the first Detr detection head, and the output of the first Detr detection head is the flame detection result of the visible light image; The output of the second backbone network is the input of the second Transformer encoder, the output of the second Transformer encoder is the input of the second Transformer decoder and the fusion detection channel, the output of the second Transformer decoder is the input of the second Detr detection head, and the output of the second Detr detection head is the flame detection result of the near-infrared image; The fusion detection channel includes a cross-attention cross-modal fusion module, a third Transformer decoder, and a third Detr detection head; The output of the first Transformer encoder and the second Transformer encoder is the input of the cross-attention cross-modal fusion module, the output of the cross-attention cross-modal fusion module is the input of the third Transformer decoder, the output of the third Transformer decoder is the input of the third Detr detection head, and the output of the third Detr detection head is the second flame detection result of the multimodal image.
2. The flame detection method based on visible light image and near infrared image according to claim 1 is characterized in that: The flame detection model further includes a comprehensive decision module, which is used to make a comprehensive decision on the flame detection result of the visible light image, the flame detection result of the near infrared image and the second flame detection result of the multimodal image and output the first flame detection result of the multimodal image according to the comprehensive result; The decision calculation of the comprehensive decision module is: in, P RBG , P Infra and P Fusion respectively represent the flame detection result of the visible light image, the flame detection result of the near infrared image and the second flame detection result of the multimodal image, Indicates the decision result; When the decision result is less than a threshold, the comprehensive decision module determines that there is no flame in the multimodal image; when the decision result is greater than the threshold, the comprehensive decision module determines that there is a flame in the multimodal image.
3. The flame detection method based on visible light image and near infrared image according to claim 1 is characterized in that: The first backbone network and the second backbone network are both ResNet50; The visible light detection channel further includes a first position encoder, which is used to perform position encoding on the features extracted by the first backbone network; The near-infrared detection channel also includes a second position encoder, which is used to perform position encoding on the features extracted by the second backbone network.
4. The flame detection method based on visible light image and near infrared image according to claim 1 is characterized in that: The training steps of the flame detection model include: Collecting a plurality of pairs of flame multimodal images, each pair of the flame multimodal images comprising a corresponding flame visible light image and a flame near infrared image and obtained by the binocular camera; The binocular camera is jointly calibrated by Zhang Zhengyou calibration method to obtain camera internal and external parameters and distortion coefficients; According to the camera internal and external parameters, the flame multimodal image is sequentially subjected to distortion correction and epipolar correction to achieve horizontal alignment of the flame visible light image and the flame near-infrared image; Annotating the corrected flame multimodal image; The flame detection model is trained using the annotated flame multimodal image.
5. The flame detection method based on visible light image and near infrared image according to claim 4 is characterized in that: The step of correcting the distortion of the flame multimodal image comprises: Determine a projection matrix according to the camera internal and external parameters, wherein the projection matrix is a mapping matrix between a camera coordinate system and a pixel coordinate system; Determine the correction coefficients of radial distortion and tangential distortion of the binocular camera according to the camera internal and external parameters and the projection matrix; Performing distortion correction on the multimodal image according to the correction coefficient; The epipolar line correction step of the flame multimodal image comprises: Determining a first camera and a second camera in the binocular camera, wherein the first camera is a visible light camera and the second camera is a near infrared camera, or the first camera is a near infrared camera and the second camera is a visible light camera; The rotation matrix of the first camera relative to the second camera is divided into a composite matrix of the first camera and the second camera, and the composite matrix is: in, R represents the rotation matrix of the first camera relative to the second camera, r 1 represents the synthesis matrix of the first camera, r 2 represents the synthesis matrix of the second camera; A row alignment matrix is determined according to the translation vector of the first camera relative to the second camera, and the row alignment matrix is: in, R rect represents a row-aligned matrix, T represents the translation vector of the first camera relative to the second camera, T x and T y Respectively T exist x Direction and y The weight in direction, x Direction and y Direction parallel to the image plane; The transformation matrix of the first camera and the second camera is determined according to the synthesis matrix and the row alignment matrix, and the transformation matrix is: in, R 1 represents the transformation matrix of the first camera, R 2 represents the transformation matrix of the second camera; The corresponding transformation matrix is applied to the flame visible light image and the flame near infrared image to achieve horizontal alignment of the flame visible light image and the flame near infrared image.
6. The flame detection method based on visible light image and near infrared image according to claim 4 is characterized in that: The losses of the visible light detection channel, the near infrared detection channel and the fusion detection channel all include category loss, detection frame position loss and detection frame overlap loss. The total loss of the flame detection model is: in, loss represents the total loss of the flame detection model, loss RGB , loss Infra and loss Fusion represent the losses of the visible light detection channel, the near infrared detection channel and the fusion detection channel respectively, w RGB , w Infra and w Fusion Respectively represent the weights of the visible light detection channel, the near infrared detection channel and the fusion detection channel. In a single round of training: If the prior frame of the flame visible light image matches the prior frame of the near-infrared image, the weight of the visible light detection channel is 1, otherwise it takes a random weight between 0 and 1; if the prior frame of the flame near-infrared image matches the prior frame of the visible light image, the weight of the near-infrared detection channel is 1, otherwise it takes a random weight between 0 and 1, and the weight of the fusion detection channel takes the weight of the near-infrared detection channel. The matching degree of the two prior frames is determined according to the intersection and union ratio of the two prior frames.
7. The flame detection method based on visible light image and near infrared image according to claim 4 is characterized in that: The flame detection model training step further includes, before using the annotated flame multimodal image to train the flame detection model: The flame detection model is pre-trained using non-flame multimodal images.
8. A flame detection device based on visible light image and near infrared image, characterized in that: include: An image input module, used for inputting a multimodal image to be detected into a trained flame detection model based on deep learning, wherein the multimodal image includes a visible light image and a near infrared image and is obtained by a binocular camera, wherein the binocular camera includes a visible light camera and a near infrared camera; A result output module, used for obtaining a first flame detection result of the multimodal image through the flame detection model; Wherein, the flame detection model includes a visible light detection channel, a near infrared detection channel and a fusion detection channel; The visible light detection channel includes a first backbone network and a first feature detection module, and the near-infrared detection channel includes a second backbone network and a second feature detection module. The first backbone network and the second backbone network are respectively used to extract features of the visible light image and the near-infrared image. The first feature detection module is used to detect the features extracted by the first backbone network and output the flame detection result of the visible light image. The second feature detection module is used to detect the features extracted by the second backbone network and output the flame detection result of the near-infrared image. The fusion detection channel is used to perform fusion detection on the features extracted by the first backbone network and the second backbone network and output the second flame detection result of the multimodal image. The first flame detection result of the multimodal image is obtained by making a comprehensive decision on the flame detection result of the visible light image, the flame detection result of the near infrared image and the second flame detection result of the multimodal image; The first feature detection module includes a first Transformer encoder, a first Transformer decoder and a first Detr detection head, and the second feature detection module includes a second Transformer encoder, a second Transformer decoder and a second Detr detection head; The output of the first backbone network is the input of the first Transformer encoder, the output of the first Transformer encoder is the input of the first Transformer decoder and the fusion detection channel, the output of the first Transformer decoder is the input of the first Detr detection head, and the output of the first Detr detection head is the flame detection result of the visible light image; The output of the second backbone network is the input of the second Transformer encoder, the output of the second Transformer encoder is the input of the second Transformer decoder and the fusion detection channel, the output of the second Transformer decoder is the input of the second Detr detection head, and the output of the second Detr detection head is the flame detection result of the near-infrared image; The fusion detection channel includes a cross-attention cross-modal fusion module, a third Transformer decoder, and a third Detr detection head; The output of the first Transformer encoder and the second Transformer encoder is the input of the cross-attention cross-modal fusion module, the output of the cross-attention cross-modal fusion module is the input of the third Transformer decoder, the output of the third Transformer decoder is the input of the third Detr detection head, and the output of the third Detr detection head is the second flame detection result of the multimodal image.
