A flame detection method and system based on a color condition state space model
The flame detection method based on the color-conditional state space model solves the problems of locality limitation of convolutional neural networks and high computational complexity of self-attention mechanisms, and achieves effective differentiation and efficient detection of flames and flame-like interference.
Patent Information
- Application Number
- CN202611522165.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-29
- Publication Date
- 2026-11-27
AI Technical Summary
In existing flame detection methods, the locality limitation based on convolutional neural networks leads to insufficient detection robustness, the self-attention mechanism has high computational complexity, and the discretization process of the state space model lacks task awareness, making it difficult to effectively distinguish between flames and flame-like interference.
A flame detection method based on a color conditional state space model is adopted. By normalizing the size and pixels of the image, extracting initial convolutional features, transforming the color space and extracting secondary convolutional features, the discretization step size of the image block feature sequence is determined. The color modulation signal is used for iterative processing, and combined with dynamic fusion weights and global average pooling, flame detection is achieved.
The model's ability to distinguish between flames and flame-like interference objects has been enhanced, computational overhead has been reduced, and the robustness and efficiency of flame detection have been improved, making it suitable for real-time flame monitoring systems.
Smart Images

Figure CN123182152A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image recognition technology, and in particular to a flame detection method and system based on a color conditional state space model. Background Technology
[0002] With the development of image acquisition equipment and computer vision technology, image-based flame detection methods are gradually being applied in fields such as environmental monitoring and scene surveillance. Compared with traditional detection methods based on physical sensors, image-based detection methods can acquire visual information over a larger range and use image processing models to analyze the color, texture, and shape features of the target area.
[0003] Early deep learning methods were dominated by convolutional neural networks (CNNs), such as classic architectures like VGG, ResNet, GoogLeNet, Inception, and MobileNet, as well as lightweight networks specifically designed for flame detection, like FireNet. CNNs excel at extracting low-level visual features of flames through hierarchical local convolutional operations. However, an inherent weakness of CNNs lies in the limitation of their local receptive fields. Flames are non-rigid objects with variable shapes and blurred boundaries; their visual features may be distributed throughout the entire scene. The locality of CNNs makes it difficult for them to distinguish between interfering objects with similar local features, resulting in insufficient detection robustness.
[0004] To address the locality of reference problem in CNNs, existing technologies have introduced Transformer architectures based on self-attention mechanisms (such as ViT, DETR, and Swin-Transformer). Transformers model the relationships between image patches from a global perspective, significantly enhancing the model's contextual understanding and effectively reducing false detections caused by background interference. However, the computational complexity of Transformers has become a major bottleneck in their practical application for flame detection: the computational and memory requirements of the self-attention mechanism increase quadratically with the length N of the input sequence. In real-time flame monitoring systems that require 24 / 7 uninterrupted operation, such high computational overhead is unacceptable, especially on edge devices with limited computing resources.
[0005] In recent years, state-space models, represented by Mamba, have gained popularity due to their linear complexity. Its global context modeling capability makes it a powerful alternative to Transformer. Vision Mamba variants successfully adapt Mamba to vision tasks by scanning two-dimensional image patches into one-dimensional sequences along multiple directions. However, all existing vision Mamba architectures share a fundamental limitation: while their SSM discretization process is content-dependent, i.e., the discretization step size... It is calculated from the input token, but is completely unaware of specific task domains. Each spatial location is assigned equal structural priority, regardless of its task relevance, resulting in the model lacking the ability to distinguish between flames and flame-like disturbances at the mechanistic level.
[0006] Therefore, how to provide a flame detection method and system based on a color conditional state space model is an urgent problem to be solved. Summary of the Invention
[0007] This invention provides a flame detection method and system based on a color conditional state space model to solve the problems mentioned above in the prior art.
[0008] According to a first aspect of the present invention, a flame detection method based on a color conditional state space model is provided.
[0009] In one embodiment, the flame detection method based on the color conditional state space model includes: The acquired image to be detected is normalized in size and pixels to obtain a preprocessed image; The preprocessed image is sequentially subjected to initial convolution feature extraction, color space transformation and secondary convolution feature extraction to obtain image block feature sequence and color modulation signal; Based on the image block feature sequence and color modulation signal, the discretization step size corresponding to each spatial position in the image block feature sequence is determined; based on the discretization step size, the image block feature sequence is processed by color conditional state space to obtain several state space outputs corresponding to several preset scanning directions; based on the several state space outputs, the dynamic fusion weights are determined, and the dynamic fusion weights are used to perform fusion calculation to obtain the initial feature representation. The initial feature representation is used as the input for the next color conditional state space processing, and the color modulation signal is used for iterative processing to obtain the target feature representation. Global average pooling and classification processing are then performed on the target feature representation to obtain the flame detection result.
[0010] In one embodiment, the acquired image to be detected is normalized in size and pixels to obtain a preprocessed image, including: The image to be detected is scaled up according to a preset size; when the aspect ratio of the image to be detected is inconsistent with the preset size, the scaled image is filled to obtain an image to be detected with uniform size. The pixel values in the image to be detected, after being standardized in size, are mapped from the original value range to a preset value range to obtain a preprocessed image.
[0011] In one embodiment, initial convolutional feature extraction of the preprocessed image includes: The preprocessed image is subjected to a first-level convolution process, which projects the image blocks in the preprocessed image onto the feature space to obtain the first feature map. The first feature map is subjected to a second-level convolution process, and features are extracted and spatial dimensions are adjusted to obtain the second feature map. The second feature map is subjected to a third-level convolution to obtain a third feature map, and the third feature map is then subjected to dimensionality transformation to obtain an image patch feature sequence.
[0012] In one embodiment, color space conversion and secondary convolution feature extraction of the preprocessed image include: The preprocessed image is converted to a color space to obtain a color space image; Using independently set convolution parameters, the color space image is subjected to first-level convolution, second-level convolution, and third-level convolution processing in sequence to obtain color features, which are then used as color modulation signals.
[0013] In one embodiment, determining the discretization step size corresponding to each spatial location in the image patch feature sequence based on the image patch feature sequence and the color modulation signal includes: Obtain the image patch features and color modulation signals corresponding to each spatial location in the image patch feature sequence; Linear projection is performed on the image patch features and color modulation signal respectively to obtain the self-feature term and the color modulation term; Based on the bias term, the self-feature term and the color modulation term are superimposed, and the superposition result is activated to obtain the discretization step size corresponding to each spatial location.
[0014] In one embodiment, based on the discretization step size, color conditional state space processing is performed on the image block feature sequence to obtain several state space outputs corresponding to several preset scanning directions, including: Based on the traversal path corresponding to several preset scanning directions, the image block feature sequence and color modulation signal are synchronously rearranged to obtain a one-dimensional image block feature sequence corresponding to several preset scanning directions. For several preset scanning directions, based on the discretized step size and state space parameters corresponding to the spatial position, the one-dimensional image block feature sequence is processed by state space to obtain several state space outputs corresponding to several preset scanning directions.
[0015] In one embodiment, dynamic fusion weights are determined based on several state space outputs, and fusion calculations are performed using these dynamic fusion weights to obtain an initial feature representation, including: Global average pooling is performed on several state space outputs corresponding to several preset scanning directions to obtain the direction summary features. The directional aggregation features are mapped using a preset routing network to obtain scalar weight parameters corresponding to several preset scanning directions. The scalar weight parameters are normalized to obtain dynamic fusion weights corresponding to several preset scanning directions. The dynamic fusion weights are weighted and fused with the corresponding state space outputs to obtain the initial feature representation.
[0016] In one embodiment, the initial feature representation is used as input for the next color conditional state space processing, and iterative processing is performed using the color modulation signal to obtain the target feature representation, including: The initial feature representation is used as input for color conditional state space processing, and the color modulation signal is used to process the initial feature representation in color conditional state space to obtain the updated feature representation. The updated feature representation is used as the input for the next color conditional state space processing, and the color modulation signal is used for iterative processing until a preset number of color conditional state space processing processes are completed. The updated feature representation of the last output is used as the target feature representation.
[0017] In one embodiment, the mathematical expression for the discretization step size is: ; In the formula, Indicates the first Discretization step size corresponding to each spatial location Represents the self-characteristic term. Indicates color modulation item, Indicates the bias term. This represents the activation function.
[0018] According to a second aspect of the present invention, a flame detection system based on a color conditional state space model is provided.
[0019] In one embodiment, the flame detection system based on the color conditional state space model includes: The image preprocessing module is used to normalize the size and pixels of the acquired image to be detected to obtain a preprocessed image; The color space feature extraction module is used to sequentially perform initial convolution feature extraction, color space transformation and secondary convolution feature extraction on the preprocessed image to obtain image block feature sequence and color modulation signal; The color conditional state space processing module is used to determine the discretization step size corresponding to each spatial position in the image block feature sequence based on the image block feature sequence and the color modulation signal; based on the discretization step size, the color conditional state space processing is performed on the image block feature sequence to obtain several state space outputs corresponding to several preset scanning directions; based on the several state space outputs, the dynamic fusion weights are determined, and the dynamic fusion weights are used to perform fusion calculation to obtain the initial feature representation. The feature iterative classification module is used to take the initial feature representation as the input for the next color conditional state space processing, and to perform iterative processing using the color modulation signal to obtain the target feature representation; global average pooling and classification processing are performed on the target feature representation to obtain the flame detection result.
[0020] The technical solutions provided by the embodiments of the present invention may include the following beneficial effects: 1. This invention uses color modulation signals to participate in the determination of the discretization step size of each spatial position, enabling the state space processing to adjust the state update intensity according to the color information of the corresponding position, thereby enhancing the model's ability to distinguish between flames and flame-like interference objects.
[0021] 2. The present invention performs state space processing on the feature sequence of image blocks through four preset scanning directions, and determines the dynamic fusion weights based on the state space output of each direction, which can fuse the feature representations corresponding to different scanning directions to obtain the initial feature representations for subsequent processing.
[0022] 3. This invention utilizes a state-space model to perform global context modeling with linear complexity, and performs global average pooling and binary classification on the stack output through color-conditional state space. While obtaining flame detection results, it reduces the computational overhead generated by long sequence modeling based on self-attention mechanism.
[0023] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit the invention. Attached Figure Description
[0024] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0025] Figure 1 This is a flowchart illustrating a flame detection method based on a color conditional state space model, according to an exemplary embodiment. Figure 2 This is a block diagram illustrating the principle of a flame detection system based on a color conditional state space model, according to an exemplary embodiment. Figure 3This is a block diagram illustrating the structure of a flame detection algorithm based on a color conditional state space model, according to an exemplary embodiment. Figure 4 This is one of the schematic diagrams illustrating the detection results of a real flame image according to an exemplary embodiment; Figure 5 This is a second schematic diagram illustrating the detection results of a real flame image according to an exemplary embodiment. Detailed Implementation
[0026] The following description and accompanying drawings fully illustrate specific embodiments described herein to enable those skilled in the art to practice them. Some portions and features of certain embodiments may be included in or replace portions and features of other embodiments. The scope of the embodiments herein includes the entire scope of the claims and all available equivalents thereof. The various embodiments described herein are presented in a progressive manner, with each embodiment focusing on its differences from other embodiments; similar or identical parts between embodiments can be referred to interchangeably.
[0027] The modules in the apparatus or system of this application can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0028] Where there is no conflict, the embodiments and features in the embodiments of the present invention can be combined with each other.
[0029] Figure 1 An embodiment of a flame detection method based on a color-conditional state space model according to the present invention is shown.
[0030] In this optional embodiment, the flame detection method based on the color conditional state space model includes: Step S101: Normalize the size and pixels of the acquired image to be detected to obtain a preprocessed image; In this optional embodiment, the above-mentioned size and pixel normalization processing of the acquired image to be detected to obtain a preprocessed image includes: The image to be detected is scaled up according to a preset size; when the aspect ratio of the image to be detected is inconsistent with the preset size, the scaled image is filled to obtain an image to be detected with uniform size. The pixel values in the image to be detected, after being standardized in size, are mapped from the original value range to a preset value range to obtain a preprocessed image.
[0031] Specifically, the image to be detected is preferably in RGB format, and the size normalization process includes: scaling the image to be detected to a uniform size. For non-square images to be detected, first scale them proportionally to 256 pixels along the longer side, then symmetrically fill the shorter side until the image size is [resolution value missing]. Pixel, padding value set to 0.
[0032] Pixel value normalization includes: to ensure that the range of input values matches the initial range of model weights, which is beneficial for training stability and convergence speed, the pixel values are normalized from... The integer range is linearly scaled to The floating-point range, and the normalized mathematical expression is: ; In the formula, This represents the pixel value after normalization. This represents the original pixel values of the image to be detected before normalization.
[0033] in, It is short for Normalization. This represents the original data.
[0034] The size of the preprocessed image is That is, channel × height × width.
[0035] Step S102: Perform initial convolution feature extraction, color space conversion, and secondary convolution feature extraction on the preprocessed image in sequence to obtain image block feature sequence and color modulation signal; It should be noted that the initial convolutional feature extraction is used to represent the image feature extraction path for the preprocessed image. Specifically, a three-level convolutional structure is used to extract image texture and spatial structure features and generate an image block feature sequence. The secondary convolutional feature extraction is used to represent the color feature extraction path based on color space transformation. Specifically, independently set convolutional parameters are used to perform three-level convolution processing on the color space image to generate color features, and the color features are used as color modulation signals.
[0036] In this optional embodiment, the above-mentioned initial convolutional feature extraction of the preprocessed image includes: The preprocessed image is subjected to a first-level convolution process, which projects the image blocks in the preprocessed image onto the feature space to obtain the first feature map. The first feature map is subjected to a second-level convolution process, and features are extracted and spatial dimensions are adjusted to obtain the second feature map. The second feature map is subjected to a third-level convolution to obtain a third feature map, and the third feature map is then subjected to dimensionality transformation to obtain an image patch feature sequence.
[0037] Specifically, such as Figure 3 As shown, in the image feature extraction path (i.e., the RGB branch), the preprocessed image (size is...) The image is used as the input image and is then processed by a three-level convolution process (i.e., a three-layer convolution stem).
[0038] The first-level convolution process is as follows: ; And proceed in sequence And GELU activation.
[0039] In the first-level convolution, K convolution kernels are used, and the kernel size is... With a step size of 4, the input image is divided into non-overlapping or partially overlapping patches, and the output size is [size missing]. The feature map (i.e., the first feature map) is obtained. This allows the image blocks in the original pixel space to be projected into a high-dimensional feature space.
[0040] The second-level convolution process is as follows: ; And proceed in sequence And GELU activation.
[0041] In the second-level convolution, K convolution kernels with a kernel size of 3×3 and a stride of 2 are used to further extract features and adjust the spatial dimensions of the first feature map to obtain the second feature map.
[0042] The third-level convolution process is as follows: ; And proceed in sequence And GELU activation.
[0043] In the third-level convolution, D convolutional kernels are used, each with a size of 3×3 and a stride of 2, to transform the dimensionality of the second feature map, resulting in the third feature map with a size of [missing value]. .
[0044] The third feature map is then reshaped. A two-dimensional sequence (i.e., an image patch feature sequence), wherein, M = D represents the number of image patch feature sequences (patch tokens), and D is the feature dimension of each token. It should be noted that... Figure 3 CC-SMB×8 in the text indicates that the color condition state space processing module 203 contains 8 modules connected in series.
[0045] The weights for the above convolution processing are respectively , and The weights mentioned above are all trainable parameters learned by the model during training. Their specific values are determined by the training data and there are no preset fixed values. They are randomly initialized according to a Gaussian distribution before training (mean 0, standard deviation 0.02) and updated during training using the backpropagation algorithm. The biases of each convolutional layer are initialized to 0. The learnable scaling parameters of each batch normalization layer are also specified. Initialize to 1, translation parameter Initialize to 0. Accumulated step size is... Project the input image as The feature mesh is obtained. Each feature vector has a dimension of 64, and the feature grid is converted into a two-dimensional sequence according to its spatial location to form a patch token sequence.
[0046] In this optional embodiment, the above-mentioned color space conversion and secondary convolution feature extraction of the preprocessed image include: The preprocessed image is converted to a color space to obtain a color space image; Using independently set convolution parameters, the color space image is subjected to first-level convolution, second-level convolution, and third-level convolution processing in sequence to obtain color features, which are then used as color modulation signals.
[0047] Specifically, such as Figure 3 As shown, in the color feature extraction path (i.e., the HSV branch), each pixel of the preprocessed image, identical to that in the RGB branch, is converted from the RGB color space to the HSV color space. Let the normalized pixel channel values be... and define brightness Color difference Saturation Hue Its mathematical expression is: ; ; ; ; Using the above formula, the converted HSV image (i.e., color space image) has the following dimensions: And the three channels correspond to hue respectively. ( Hue ), saturation ( Saturation ) and brightness ( Value ).in, Hue The range of values is , Saturation and Value The range of values is .
[0048] The converted HSV image is processed using the same three-level convolution stem, normalization, and activation configuration as the RGB branch, but with different kernel weights. , and The corresponding bias and normalization parameters are set independently and are not shared with the convolution parameters of the RGB branch. The convolution kernel weights of the HSV branch are also trainable parameters with no preset limit on their value range. The specific values are determined by learning from the training data and are randomly initialized according to a Gaussian distribution before training (mean is 0 and standard deviation is 0.02). The bias of each convolutional layer is initialized to 0, and the learnable scaling parameter γ of each batch normalization layer is initialized to 1 and the translation parameter β is initialized to 0, resulting in color features of dimension 64, which are used as color modulation signals.
[0049] Through the RGB branch described above, texture and structural features common to flame detection (such as RGB texture features, including spatial structural information such as image edges, gradients, and local shapes) are extracted from the original RGB pixels of the preprocessed image; through the HSV branch, discriminative features (such as hue) that are similar to flame color (e.g., warm tones, high saturation) are learned to be extracted from the chromaticity information. Hue saturation Saturation (Isochromatic distribution statistics).
[0050] It should be noted that the discriminative feature is specifically the warm hue of the flame in the HSV color space. High saturation and moderately high brightness However, the saturation of colors at sunset or afterglow is diluted due to atmospheric scattering, generally resulting in a lower saturation. Incandescent lamps or car lights have a narrower hue peak and lower saturation in the area outside the filament.
[0051] Furthermore, the RGB branch and the HSV branch each have independent convolution kernel parameters (including weight matrices). and bias vector The two branches do not share convolution parameters during the feature extraction stage. The RGB branch extracts image texture and spatial structure features, while the HSV branch extracts color features. During training, the parameters of the RGB and HSV branches are jointly optimized end-to-end using a backpropagation algorithm based on a unified cross-entropy loss function. Both sets of parameters are updated according to the gradients of their respective branches, and joint optimization is achieved through a shared classification loss function. This allows the two branches to converge collaboratively, capturing complementary feature representations and providing visual prior information for subsequent processing.
[0052] like Figure 3 As shown in the CSPE (Color-Space Patch Embedding Module), the convolutional stem outputs of both the RGB and HSV branches are 64-dimensional features; the two features are concatenated along the channel dimensions to form a 128-dimensional feature at each spatial location with an overall shape of [missing information]. The principal feature Z is used, while the 64-dimensional color features of the HSV branch remain unchanged after feature extraction and are independently retained as color modulation signals. These signals are input into each level of the color conditional state space processing to participate in determining the discretization step size corresponding to each spatial location. The color conditional state space processing does not regenerate the color modulation signal. For a 256×256 pixel input image, the spatial grid is 16×16, corresponding to 256 spatial locations.
[0053] Step S103: Based on the image block feature sequence and color modulation signal, determine the discretization step size corresponding to each spatial position in the image block feature sequence; based on the discretization step size, perform color conditional state space processing on the image block feature sequence to obtain several state space outputs corresponding to several preset scanning directions; based on the several state space outputs, determine the dynamic fusion weights, and use the dynamic fusion weights to perform fusion calculations to obtain the initial feature representation. It should be noted that, as Figure 3 middle As shown, This represents the input stage of color condition state space processing, where the image patch feature sequence is used as the feature input to be processed, and the color modulation signal is used as the color condition information input to participate in the determination of the discretization step size corresponding to each spatial position in the image patch feature sequence.
[0054] In this optional embodiment, determining the discretization step size corresponding to each spatial location in the image patch feature sequence based on the image patch feature sequence and color modulation signal includes: Obtain the image patch features and color modulation signals corresponding to each spatial location in the image patch feature sequence; Linear projection is performed on the image patch features and color modulation signal respectively to obtain the self-feature term and the color modulation term; Based on the bias term, the self-feature term and the color modulation term are superimposed, and the superposition result is activated to obtain the discretization step size corresponding to each spatial location.
[0055] In this optional embodiment, the mathematical expression for the discretization step size is: ; In the formula, Indicates the first Discretization step size corresponding to each spatial location Represents the self-characteristic term. Indicates color modulation item, Indicates the bias term. This represents the activation function.
[0056] Specifically, for the first Each spatial location, and the image patch features at that location. and color modulation signal Perform linear projection to form self-characteristic terms and color modulation items Combine the two terms with the bias term. Add them together and input the result. The activation function yields the positive discretization step size at that position. .
[0057] like Figure 3 middle As shown, This represents the stage for determining the discretization step size for color conditions. For the... i For each spatial location, the image patch features and color modulation signal at that location are linearly projected to form a self-feature term and a color modulation term. The self-feature term, color modulation term, and bias term are added together, and the sum is input into the activation function to obtain the positive discretization step size corresponding to that spatial location.
[0058] It should be noted that the color modulation signals at different spatial locations are calculated independently, so that the discretization step size at different locations is modulated by the HSV characteristics of the corresponding local region. The larger the value, the stronger the influence of the current input on the hidden state; when The smaller the value, the more the state-space model depends on the historical context, and the greater the bias term. The base offset used to adjust the discretization step size calculation process is obtained after the self-feature term, color modulation term, and bias term are superimposed. The activation function performs a nonlinear mapping, keeping the output discretization step size positive.
[0059] In this optional embodiment, the above-mentioned color conditional state space processing of the image block feature sequence based on the discretization step size to obtain several state space outputs corresponding to several preset scanning directions includes: Based on the traversal path corresponding to several preset scanning directions, the image block feature sequence and color modulation signal are synchronously rearranged to obtain a one-dimensional image block feature sequence corresponding to several preset scanning directions. For several preset scanning directions, based on the discretized step size and state space parameters corresponding to the spatial position, the one-dimensional image block feature sequence is processed by state space to obtain several state space outputs corresponding to several preset scanning directions.
[0060] Specifically, such as Figure 3 middle As shown, This represents the multi-directional state space processing stage, where color conditional state space processing is performed in four complementary preset scanning directions. For the first... Each scanning direction, following the traversal path along that direction, scans the main features corresponding to the 2D patch mesh. and color modulation signal Synchronous rearrangement is performed to maintain the spatial correspondence between the two, resulting in a one-dimensional sequence (i.e., a one-dimensional image patch feature sequence) in that direction. The one-dimensional sequence is then processed using the discretization step size and state-space parameters to obtain the state-space output, the mathematical expression of which is: ; In the formula, Indicates the first The state space output corresponding to each scanning direction. Indicates along the first The traversal path rearranges the two-dimensional patch grid into a one-dimensional sequence. This indicates that the two-dimensional color modulation signal is synchronously rearranged into a one-dimensional sequence along the k-th traversal path to maintain a one-to-one correspondence with the spatial position of the main feature. Wherein, This indicates scanning (traversal). Indicates the scan direction number. This represents the color modulation signal in the HSV color space.
[0061] It should be noted that each of the four directions uses independent state-space parameters, including , , , , and .in, This represents the weight matrix used in the discretization step-size calculation to linearly project the image patch features (i.e., the weight matrix mentioned earlier). ), This represents the weight matrix used in the discretization step-size calculation to linearly project the color modulation signal (i.e., the one mentioned earlier). ), A Represents the state transition matrix. B Represents the input matrix, C Indicates the output matrix. D The through-term matrix is used to allow the model in the above text to learn direction-specific feature transformations, and the four-directional scans together provide near-isotropic context coverage, with long-range dependencies in the horizontal, vertical, and diagonal directions all captured within a single module.
[0062] Furthermore, the State Space Model (SSM) is a sequence modeling framework derived from continuous system theory. It maps a one-dimensional input sequence to an output sequence through hidden states. Its mathematical expression is: , ; In the formula, This represents the derivative of the hidden state vector with respect to time. This represents the hidden state vector. Represents the input sequence. Indicates the output sequence. Represents the state transition matrix. Represents the input matrix, This represents the output matrix.
[0063] In this optional embodiment, the above-mentioned determination of dynamic fusion weights based on several state space outputs, and the use of dynamic fusion weights for fusion calculation to obtain the initial feature representation includes: Global average pooling is performed on several state space outputs corresponding to several preset scanning directions to obtain the direction summary features. The directional aggregation features are mapped using a preset routing network to obtain scalar weight parameters corresponding to several preset scanning directions. The scalar weight parameters are normalized to obtain dynamic fusion weights corresponding to several preset scanning directions. The dynamic fusion weights are weighted and fused with the corresponding state space outputs to obtain the initial feature representation.
[0064] Specifically, such as Figure 3 middle As shown, In the input-sensory fusion stage, the state space outputs of the four directions are aggregated through a lightweight input-sensory fusion mechanism. Specifically, the spatial positions of the four scanning directions are... The state-space outputs at each point are denoted as follows: , , and And each output has a dimension of Global average pooling is performed on the outputs in these four directions respectively, resulting in a shape of... The splicing features or shapes are The directional summary feature is input into the routing network (micro-routing network), and four scalar weight parameters are output. These parameters are then normalized using softmax to obtain the dynamic fusion weights. And the fusion weight satisfies: .
[0065] Spatial position The fusion output expression at the location is: ; In the formula, Indicates the first The fusion output features of each spatial location (i.e., the weighted sum of the outputs from four preset scanning directions). Indicates the first Dynamic fusion weights corresponding to each scanning direction Indicates the first The scanning direction in the first... The state space output for each spatial location, where... .
[0066] The fused outputs from each spatial location collectively form the initial feature representation.
[0067] like Figure 3 middle As shown, This indicates the residual connection and feedforward processing stage. The fusion output in the four directions is also residually connected to the main feature input of the current CC-SMB module and processed by the feedforward network (FFN) to form the output of the current CC-SMB module (i.e., the initial feature representation).
[0068] Step S104: Use the initial feature representation as the input for the next color conditional state space processing, and perform iterative processing using the color modulation signal to obtain the target feature representation; perform global average pooling and classification processing on the target feature representation to obtain the flame detection result.
[0069] In this optional embodiment, the above-mentioned method of using the initial feature representation as input for the next color conditional state space processing and performing iterative processing using the color modulation signal to obtain the target feature representation includes: The initial feature representation is used as input for color conditional state space processing, and the color modulation signal is used to process the initial feature representation in color conditional state space to obtain the updated feature representation. The updated feature representation is used as the input for the next color conditional state space processing, and the color modulation signal is used for iterative processing until a preset number of color conditional state space processing processes are completed. The updated feature representation of the last output is used as the target feature representation.
[0070] Specifically, such as Figure 3As shown, the CC-SMB stack includes eight cascaded CC-SMB modules (color conditional state space Mamba modules). The first CC-SMB module corresponding to step S103 outputs the initial feature representation. The subsequent seven CC-SMB modules sequentially use the output of the previous module as the main feature input and continuously use the same color modulation signal obtained in step S102. The discretization step size at each spatial location is calculated to ultimately obtain the target feature representation. Furthermore, Figure 3 The color modulation signal path in the code indicates that the same color modulation signal is continuously passed to each level of the color conditional state space processing, rather than regenerating the color modulation signal for each level. Global average pooling is performed on the target feature representation through the detection head to obtain 128-dimensional pooled features, which are then processed... The linear classification layer performs a linear mapping on the 128-dimensional pooling features to generate 2D outputs corresponding to the two categories of flame and non-flame. The linear classification layer consists of a 2×128-dimensional weight matrix and a 2-dimensional bias vector. Then, the 2D output is normalized using the softmax function to obtain the binary classification probabilities of the two categories of flame and non-flame, and the category with the highest probability is taken as the flame detection result.
[0071] like Figure 4 and Figure 5 As shown, flame detection is performed using this method. Figure 4 The detection result (Prediction) is Fire, with a Fire Probability and Confidence of 0.9378, and a NoFire Probability of 0.0622; Figure 5 The detection result was flame, with a flame probability and confidence level of 0.9497, and a non-flame probability of 0.0503.
[0072] Figure 2 An embodiment of a flame detection system based on a color-conditional state space model according to the present invention is shown.
[0073] In this optional embodiment, the flame detection system based on the color conditional state space model includes: The image preprocessing module 201 is used to perform size and pixel normalization processing on the acquired image to be detected to obtain a preprocessed image; The color space feature extraction module 202 is used to sequentially perform initial convolution feature extraction, color space transformation and secondary convolution feature extraction on the preprocessed image to obtain image block feature sequence and color modulation signal; The color conditional state space processing module 203 is used to determine the discretization step size corresponding to each spatial position in the image block feature sequence based on the image block feature sequence and the color modulation signal; perform color conditional state space processing on the image block feature sequence based on the discretization step size to obtain several state space outputs corresponding to several preset scanning directions; determine the dynamic fusion weights based on the several state space outputs, and use the dynamic fusion weights to perform fusion calculations to obtain the initial feature representation. The feature iterative classification module 204 is used to take the initial feature representation as the input for the next color conditional state space processing, and to perform iterative processing using the color modulation signal to obtain the target feature representation; global average pooling and classification processing are performed on the target feature representation to obtain the flame detection result.
[0074] This invention is not limited to the structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this invention is limited only by the appended claims.
Claims
1. A flame detection method based on a color-conditional state-space model, characterized in that, include: The acquired image to be detected is normalized in size and pixels to obtain a preprocessed image; The preprocessed image is sequentially subjected to initial convolution feature extraction, color space transformation, and secondary convolution feature extraction to obtain image block feature sequence and color modulation signal; Based on the image block feature sequence and color modulation signal, the discretization step size corresponding to each spatial position in the image block feature sequence is determined; based on the discretization step size, the image block feature sequence is processed by color conditional state space to obtain several state space outputs corresponding to several preset scanning directions; based on the several state space outputs, the dynamic fusion weights are determined, and the dynamic fusion weights are used to perform fusion calculation to obtain the initial feature representation. The initial feature representation is used as the input for the next color conditional state space processing, and the color modulation signal is used for iterative processing to obtain the target feature representation. Global average pooling and classification processing are then performed on the target feature representation to obtain the flame detection result.
2. The flame detection method based on a color-conditional state-space model according to claim 1, characterized in that, The step of normalizing the size and pixels of the acquired image to be detected to obtain a preprocessed image includes: The image to be detected is scaled up according to a preset size; when the aspect ratio of the image to be detected is inconsistent with the preset size, the scaled image is filled to obtain an image to be detected with uniform size. The pixel values in the image to be detected, after being standardized in size, are mapped from the original value range to a preset value range to obtain a preprocessed image.
3. The flame detection method based on a color-conditional state-space model according to claim 1, characterized in that, The initial convolutional feature extraction of the preprocessed image includes: The preprocessed image is subjected to a first-level convolution process, which projects the image blocks in the preprocessed image onto the feature space to obtain the first feature map. The first feature map is subjected to a second-level convolution process, and features are extracted and spatial dimensions are adjusted to obtain the second feature map. The second feature map is subjected to a third-level convolution to obtain a third feature map, and the third feature map is then subjected to dimensionality transformation to obtain an image patch feature sequence.
4. The flame detection method based on a color-conditional state-space model according to claim 1, characterized in that, The color space conversion and secondary convolution feature extraction of the preprocessed image include: The preprocessed image is converted to a color space to obtain a color space image; Using independently set convolution parameters, the color space image is subjected to first-level convolution, second-level convolution, and third-level convolution processing in sequence to obtain color features, which are then used as color modulation signals.
5. The flame detection method based on a color-conditional state-space model according to claim 1, characterized in that, The step of determining the discretization step size corresponding to each spatial position in the image block feature sequence based on the image block feature sequence and color modulation signal includes: Obtain the image patch features and color modulation signals corresponding to each spatial location in the image patch feature sequence; Linear projection is performed on the image patch features and color modulation signal respectively to obtain the self-feature term and the color modulation term; Based on the bias term, the self-feature term and the color modulation term are superimposed, and the superposition result is activated to obtain the discretization step size corresponding to each spatial location.
6. The flame detection method based on a color-conditional state-space model according to claim 5, characterized in that, The step of performing color conditional state space processing on the image block feature sequence based on the discretization step size to obtain several state space outputs corresponding to several preset scanning directions includes: Based on the traversal path corresponding to several preset scanning directions, the image block feature sequence and color modulation signal are synchronously rearranged to obtain a one-dimensional image block feature sequence corresponding to several preset scanning directions. For several preset scanning directions, based on the discretized step size and state space parameters corresponding to the spatial position, the one-dimensional image block feature sequence is processed by state space to obtain several state space outputs corresponding to several preset scanning directions.
7. The flame detection method based on a color-conditional state-space model according to claim 6, characterized in that, The process of determining dynamic fusion weights based on several state space outputs and using these dynamic fusion weights for fusion calculation to obtain the initial feature representation includes: Global average pooling is performed on several state space outputs corresponding to several preset scanning directions to obtain the direction summary features. The directional aggregation features are mapped using a preset routing network to obtain scalar weight parameters corresponding to several preset scanning directions. The scalar weight parameters are normalized to obtain dynamic fusion weights corresponding to several preset scanning directions. The dynamic fusion weights are weighted and fused with the corresponding state space outputs to obtain the initial feature representation.
8. The flame detection method based on a color-conditional state-space model according to claim 1, characterized in that, The step of using the initial feature representation as input for the next color conditional state space processing and iteratively processing it using the color modulation signal to obtain the target feature representation includes: The initial feature representation is used as input for color conditional state space processing, and the color modulation signal is used to process the initial feature representation in color conditional state space to obtain the updated feature representation. The updated feature representation is used as the input for the next color conditional state space processing, and the color modulation signal is used for iterative processing until a preset number of color conditional state space processing processes are completed. The updated feature representation of the last output is used as the target feature representation.
9. The flame detection method based on a color-conditional state-space model according to claim 5, characterized in that, The mathematical expression for the discretization step size is: ; In the formula, Indicates the first Discretization step size corresponding to each spatial location Represents the self-characteristic term. Indicates color modulation item, Indicates the bias term. This represents the activation function.
10. A flame detection system based on a color-conditional state-space model, characterized in that, include: The image preprocessing module is used to normalize the size and pixels of the acquired image to be detected to obtain a preprocessed image. The color space feature extraction module is used to sequentially perform initial convolution feature extraction, color space transformation and secondary convolution feature extraction on the preprocessed image to obtain image block feature sequence and color modulation signal; The color conditional state space processing module is used to determine the discretization step size corresponding to each spatial position in the image block feature sequence based on the image block feature sequence and the color modulation signal; based on the discretization step size, the color conditional state space processing is performed on the image block feature sequence to obtain several state space outputs corresponding to several preset scanning directions; based on the several state space outputs, the dynamic fusion weights are determined, and the dynamic fusion weights are used to perform fusion calculation to obtain the initial feature representation. The feature iterative classification module is used to take the initial feature representation as the input for the next color conditional state space processing, and to perform iterative processing using the color modulation signal to obtain the target feature representation; global average pooling and classification processing are performed on the target feature representation to obtain the flame detection result.
