A method for identifying ancient building fire based on component occlusion sample image

CN122695335APending Publication Date: 2026-09-04PEOPLES POLICE UNIV OF CHINA (INT LAW ENFORCEMENT COOP INST OF THE MINISTRY OF PUBLIC SECURITY CHINA PEACEKEEPING POLICE TRAINING CENT)
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610882200.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-06-18
Publication Date
2026-09-04

AI Technical Summary

Technical Problem

[0005]本发明的目的是提供一种基于构件遮挡样本图像的古建筑火灾识别方法,解决现有古建筑火灾识别训练样本对构件遮挡场景覆盖不足的问题,实现古建筑遮挡场景下火灾目标识别稳定性的提高

Benefits of technology

(1)本发明通过根据古建筑场景中的构件遮挡形态构建古建筑构件遮挡模板,并利用所述古建筑构件遮挡模板对古建筑火灾图像样本进行结构遮挡增强处理,使训练样本中增加火灾目标被古建筑构件部分遮挡后的图像表征。相较于仅使用未遮挡火灾图像样本进行训练的方式,本发明在训练样本集中增加了构件遮挡样本图像,使火灾识别模型在训练阶段能够接触火焰或烟雾边界不完整、目标局部缺失的样本,解决古建筑遮挡场景下训练样本覆盖不足的问题,提高火灾识别模型对构件遮挡条件下火灾目标的识别稳定性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122695335A_ABST
    Figure CN122695335A_ABST
Patent Text Reader

Abstract

The application provides an ancient building fire identification method based on component occlusion sample images, and relates to the technical field of fire image identification.The ancient building fire image sample is obtained first, and the ancient building component occlusion template is constructed according to the component occlusion mode in the ancient building scene; the ancient building fire image sample is subjected to structure occlusion enhancement processing based on the ancient building component occlusion template, and the component occlusion sample image is obtained; the ancient building background image is obtained and the negative sample image is constructed; the ancient building fire image sample, the component occlusion sample image and the negative sample image are labeled, and the ancient building fire identification training sample set is generated; the fire identification model is trained by using the training sample set and the fire identification is carried out.The application can solve the problems of missing detection and false alarm of general algorithm models for occlusion detection in the ancient building scene and low recognition rate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of fire image recognition technology, and in particular to a method for identifying ancient building fires based on component-occluded sample images. Background Technology

[0002] Ancient buildings often employ a timber frame load-bearing system, with beams, purlins, rafters, and brackets forming a complex spatial structure in the roof and eaves areas. Smoke and flames generated in the early stages of a fire are easily obstructed by these structural components, potentially resulting in incomplete flame boundaries and smoke outlines captured by image-based fire detectors. Jiang Huiling et al., in their study "The Influence of Purlin Height on the Response Characteristics of Smoke Detectors in Ming and Qing Dynasty Ancient Buildings," pointed out that the purlin-style roof structure of ancient buildings from the Ming and Qing dynasties could affect the flow of smoke during fires, and current fire detector placement schemes rarely consider this structural factor.

[0003] With the application of image recognition technology in fire monitoring, methods for identifying flames and smoke in ancient buildings based on target detection models are increasingly being used for early warning. Existing technology discloses an O-Net fire detection algorithm for occluded scenarios in ancient buildings. This algorithm introduces an attention mechanism and a repulsion loss function into the improved YOLOv8 framework to enhance the ability to locate flames and smoke in occluded and dense scenes.

[0004] Existing methods for identifying fires in ancient buildings have focused on improving network structures in occluded scenarios. However, training sample construction typically emphasizes the annotation and model training of flame and smoke images in general scenarios, while neglecting to refine the organization of locally occluded samples formed by components such as beams, purlins, grilles, and brackets in specific scenarios of ancient buildings. The resulting training sample set struggles to consistently improve the incomplete representation of flame and smoke areas obscured by components, thus affecting the reliability of fire identification models in occluded scenarios of ancient buildings. Summary of the Invention

[0005] The purpose of this invention is to provide a method for identifying ancient building fires based on component occlusion sample images, which solves the problem that existing ancient building fire identification training samples do not cover component occlusion scenes, and improves the stability of fire target identification under ancient building occlusion scenes.

[0006] To achieve the above objectives, the present invention provides the following solution: A method for identifying ancient building fires based on component occlusion sample images includes the following steps: Obtain image samples of ancient building fires; Based on the occlusion patterns of components in ancient architectural scenes, an ancient architectural component occlusion template is constructed. The ancient architectural component occlusion template is used to represent the occlusion outline formed by the ancient architectural components. Based on the ancient building component occlusion template, structural occlusion enhancement processing is performed on ancient building fire image samples to obtain component occlusion sample images; Obtain background images of ancient buildings and construct negative sample images based on these background images; Annotate ancient building fire image samples, component occlusion sample images, and negative sample images to generate an ancient building fire recognition training sample set; A fire identification model was trained using a training sample set for ancient building fire identification, and the trained fire identification model was used to identify fires in the monitoring images of the ancient building to be identified, thus obtaining the fire identification results.

[0007] Preferably, a template for occluding ancient architectural components is constructed based on the occlusion patterns of components in an ancient architectural scene, including: Identify the areas obscured by components from images of ancient architectural scenes; Extract the occlusion boundary, occlusion extension direction, and occlusion interval based on the occlusion area of ​​the component; Generate templates for shielding ancient architectural components based on the shielding boundary, shielding extension direction, and shielding interval.

[0008] Preferably, the component covering form includes at least one of the following: beam covering form, grille covering form, purlin covering form, and bracket covering form; the ancient building component covering template includes a covering outline template corresponding to the component covering form.

[0009] Preferably, based on the ancient building component occlusion template, structural occlusion enhancement processing is performed on the ancient building fire image samples to obtain component occlusion sample images, including: Identify the target area of ​​the fire in the image sample of ancient building fires; The template overlay area is determined based on the location of the fire target area in the ancient building fire image sample; The ancient building component occlusion template is superimposed onto the template superposition area to obtain the component occlusion sample image.

[0010] Preferably, the ancient building component occlusion template is superimposed onto the template superposition area to obtain a component occlusion sample image, including: Adjust the template size of the ancient building components that cover the template according to the size of the template overlapping area; Adjust the template direction of the ancient building components' shielding template according to the boundary direction of the fire target area; The adjusted ancient building component occlusion template is superimposed onto the template superposition area to obtain the component occlusion sample image.

[0011] Preferably, the process involves acquiring a background image of the ancient building and constructing a negative sample image based on that image, including: Identify fire-free background samples and background interference samples from ancient building background images; Generate interference category labels based on the background interference type corresponding to the background interference sample; A negative sample image is constructed based on the background sample without fire and the background interference sample with interference category labels.

[0012] Preferably, the background interference type includes at least one of the following: bright background, painted pattern, light source, roof reflection, and non-fire smoke.

[0013] Preferably, the ancient building fire image samples, component occlusion sample images, and negative sample images are labeled to generate an ancient building fire recognition training sample set, including: Fire targets are labeled on images of ancient building fires to obtain positive fire samples; Fire target annotation and occlusion status annotation are performed on component occlusion sample images to obtain positive occlusion samples; Background category labeling is performed on the negative sample image to obtain the background negative sample image; A training sample set for ancient building fire identification is generated based on positive fire samples, positive occlusion samples, and negative background samples.

[0014] Preferably, the fire target is labeled and the occlusion status is labeled on the component occlusion sample image to obtain the occlusion positive sample, including: Mark the fire target area in the component-occluded sample image; The shielding status is determined based on the overlap between the shielding template of the ancient building components and the target area of ​​the fire. By associating the target area of ​​the fire with the occlusion status, positive occlusion samples are obtained.

[0015] Preferably, the fire identification model is trained using a training sample set for ancient building fire identification, including: Input the training sample set for ancient building fire identification into the fire identification model; During the forward propagation of the training network, the comprehensive error between the network output and the real label is calculated through the total loss function of the fire identification model. Specifically, only the classification loss is calculated for negative sample images, while for positive fire samples and occluded positive samples, the classification loss, bounding box regression loss, distribution focus loss, and geometric constraint rejection loss are calculated simultaneously. The network parameters of the fire identification model are updated using a backpropagation algorithm based on the comprehensive error.

[0016] The present invention discloses the following beneficial effects: (1) This invention constructs an ancient building component occlusion template based on the occlusion patterns of components in ancient building scenes, and uses the ancient building component occlusion template to perform structural occlusion enhancement processing on ancient building fire image samples, thereby increasing the image representation of fire targets partially occluded by ancient building components in the training samples. Compared with the method of training only using unoccluded fire image samples, this invention adds component occlusion sample images to the training sample set, enabling the fire recognition model to access samples with incomplete flame or smoke boundaries and locally missing targets during the training phase, solving the problem of insufficient training sample coverage in ancient building occlusion scenes, and improving the stability of the fire recognition model in recognizing fire targets under component occlusion conditions.

[0017] (2) This invention acquires background images of ancient buildings and constructs negative sample images based on these background images, so that the training sample set for ancient building fire identification simultaneously includes ancient building fire image samples, component occlusion sample images, and negative sample images. During training, the fire identification model not only learns the image features corresponding to the fire target, but also learns the image features of non-fire areas in the ancient building background image, which can reduce the situation where the ancient building background is misjudged as a fire target and solve the problem of misidentification caused by insufficient interference samples in the ancient building background.

[0018] (3) The ancient building fire recognition training sample set generated by this invention includes ancient building fire image samples, component occlusion sample images, and negative sample images. Let the number of ancient building fire image samples be N. After performing a structural occlusion enhancement process on the ancient building fire image samples based on the ancient building component occlusion template, at least N component occlusion sample images are obtained; after adding M negative sample images, the number of samples in the ancient building fire recognition training sample set is at least 2N+M. Therefore, without changing the fire recognition model structure, this invention can increase the proportion of occlusion scene samples and background negative sample images by adjusting the sample composition, making the training sample set closer to the actual recognition object under the ancient building occlusion scene. Attached Figure Description

[0019] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0020] Figure 1 A flowchart of the method provided in an embodiment of the present invention; Figure 2 This is a schematic diagram illustrating the generation of a template for obscuring ancient building components provided in an embodiment of the present invention; Figure 3This is a schematic diagram of the structural occlusion enhancement process provided in an embodiment of the present invention. Detailed Implementation

[0021] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0022] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0023] Figure 1 The method flowchart provided in the embodiments of the present invention is as follows: Figure 1 As shown, this embodiment provides a method for identifying ancient building fires based on component occlusion sample images, including: Step 100: Obtain image samples of ancient building fires; Step 101: Construct an ancient building component occlusion template based on the occlusion shape of the components in the ancient building scene; the ancient building component occlusion template is used to represent the occlusion outline formed by the ancient building components. Step 102: Based on the ancient building component occlusion template, perform structural occlusion enhancement processing on the ancient building fire image samples to obtain component occlusion sample images; Step 103: Obtain the background image of the ancient building and construct a negative sample image based on the background image of the ancient building; Step 104: Annotate the ancient building fire image samples, component occlusion sample images, and negative sample images to generate an ancient building fire recognition training sample set; Step 105: Train the fire identification model using the ancient building fire identification training sample set, and use the trained fire identification model to perform fire identification on the monitoring images of the ancient building to be identified, and obtain the fire identification results.

[0024] Specifically, in step 100, image samples of ancient building fires are obtained.

[0025] Ancient building fire image samples are used to characterize flame and smoke targets within ancient building scenes. These samples can be derived from screenshots of ancient building surveillance videos, real-scene captured images, simulated fire scene images, or existing fire image data. Image acquisition objects can include wooden palaces, ancient stages, ancient pagodas, ancient residences, corridors, and courtyards. The ancient building fire image samples preserve beams, purlins, grilles, brackets, eaves, red walls, painted decorations, lighting areas, and roof reflection areas, ensuring that subsequent sample enhancement processes maintain the structural occlusion features and background interference characteristics of the ancient building scene.

[0026] Image samples of ancient building fires can include complete flame targets, partial flame targets, complete smoke targets, and partial smoke targets. After acquiring image samples of ancient building fires, a sample number is assigned to each image sample, and the image source, acquisition scene, image size, and fire target category are recorded to form an original sample set. The original sample set does not have a limit on the number of images.

[0027] During the sample processing, images containing flame or smoke targets can be extracted from ancient building surveillance videos, and images with visible flame or smoke boundaries can be selected from existing fire image data. Images from different sources are merged and categorized as flame targets, smoke targets, targets with both flame and smoke, and targets without a fire background. Before further processing, images undergo size normalization, duplicate image removal, and low-quality image removal. Low-quality images include those with completely unidentifiable targets, severely out-of-focus images, or images with completely saturated brightness. The filtered ancient building fire image samples are used to generate subsequent component occlusion sample images.

[0028] In one implementation, the image samples of ancient building fires are uniformly adjusted to 640×640 pixels. This size is used to adapt to the input requirements of subsequent fire identification models and does not constitute a necessary limitation on image size. When labeling fire targets, the LabelImg tool can be used to generate target bounding box annotation files, with annotation categories including fire and smoke. If both flame and smoke targets exist in the same image, corresponding target bounding boxes are created separately.

[0029] Specifically, in step 101, an ancient building component occlusion template is constructed based on the component occlusion shape in the ancient building scene. The ancient building component occlusion template is used to characterize the occlusion outline formed by the ancient building components.

[0030] The component shielding pattern is used to characterize the local shielding state of ancient architectural components on flame or smoke targets. Component shielding patterns can include at least one of the following: beam shielding pattern, grille shielding pattern, purlin shielding pattern, and bracket shielding pattern. Beam shielding patterns typically appear as continuous strip-shaped shielding. Grille shielding patterns typically appear as strip-shaped shielding with a spaced arrangement. Purlin shielding patterns typically appear as approximately parallel linear shielding. Bracket shielding patterns typically appear as multi-layered, interlocking block-shaped shielding.

[0031] The occlusion regions of architectural components are determined from images of ancient buildings. These regions can be determined manually or through edge detection and connected component filtering. Once determined, the occlusion regions are binarized to obtain an occlusion mask. In the occlusion mask, pixels belonging to the occluded regions are recorded as 1, and pixels not belonging to the occluded regions are recorded as 0.

[0032] The occlusion boundary, occlusion extension direction, and occlusion interval are extracted from the occlusion mask. The occlusion boundary characterizes the outer contour of the occluded area. The occlusion extension direction characterizes the main orientation of the occluded area in the image plane. The occlusion interval characterizes the distance relationship between adjacent occluded components.

[0033] The direction of the shading extension is calculated according to the following formula: In the formula, To block the direction of extension; , , This represents the second-order central moment corresponding to the occlusion mask. The second-order central moment is calculated from the pixel coordinates in the occlusion mask and is used to characterize the principal direction distribution of the occlusion mask.

[0034] The shading interval is calculated using the following formula: In the formula, For blocking intervals; The number of occlusion strips detected along the direction perpendicular to the occlusion extension; For the first The projection coordinates of the center line of each shielding strip in the direction perpendicular to the shielding extension. If the shielding area of ​​the component does not have a periodic strip structure, the shielding interval does not participate in the generation of the shielding template for the corresponding ancient building component.

[0035] During the generation of a set of grid occlusion templates, five occlusion strips are extracted from the binarized grid region. The projected coordinates of the center lines of the five occlusion strips perpendicular to the occlusion extension direction are 18, 42, 66, 91, and 115 pixels, respectively. Therefore, the occlusion interval is: The occlusion interval stored in this grid occlusion template is 24.25 pixels. If the height of the fire target area in the same batch of ancient building fire image samples is about 120 pixels, this occlusion interval can form multiple visible occlusion gaps within the fire target area, making the component occlusion sample image close to the visible state of the target under grid occlusion.

[0036] Based on the occlusion boundaries, occlusion extension direction, and occlusion intervals, occlusion templates for ancient architectural components are generated. Each occlusion template includes an occlusion outline template and template attribute information. The occlusion outline template stores the occlusion mask. The template attribute information includes the component occlusion shape, occlusion extension direction, and occlusion interval. After template generation is complete, the occlusion templates for different component occlusion shapes are stored in a template library. The template library is used for subsequent structural occlusion enhancement processing.

[0037] Table 1 shows the correspondence between component occlusion template types and occlusion features.

[0038] Table 1. Correspondence between component occlusion template type and occlusion feature

[0039] Figure 2 A schematic diagram of generating a template for covering ancient architectural components. (Example) Figure 2 As shown, firstly, an image of an ancient architectural scene containing components such as eaves, brackets, beams, lattice windows, columns, and railings is acquired. Then, component regions capable of partially occluding flame or smoke targets are selected from the ancient architectural scene image. Subsequently, region extraction is performed on the selected component-occluded regions to obtain corresponding local component-occluded regions. These local component-occluded regions are then converted into a binary occlusion mask, which is used to distinguish between component-occluded regions and non-component-occluded regions. Based on the occlusion mask, the occlusion boundary is further extracted, and the occlusion extension direction is calculated. and occlusion interval The occlusion boundary is used to characterize the outer contour of the occluded area of ​​the component, and the occlusion extension direction is... Used to characterize the main orientation of the component occlusion region in the image plane, occlusion interval Used to characterize the distance relationship between adjacent occlusion strips; finally, based on the occlusion boundary and the occlusion extension direction... and the occlusion interval Generate ancient building component occlusion templates and store them in a template library for subsequent use when performing structural occlusion enhancement processing on ancient building fire image samples.

[0040] Specifically, in step 102, based on the ancient building component occlusion template, the ancient building fire image sample is subjected to structural occlusion enhancement processing to obtain the component occlusion sample image.

[0041] First, identify the target fire region in the ancient building fire image sample. The target fire region represents the location and extent of the flame or smoke target region in the image. The target fire region can be represented by a target bounding box, a segmented target region, or a target region derived from a target bounding box. Based on the location of the target fire region, determine the template overlay region. The template overlay region is located within the target fire region or partially overlaps with it. The template overlay region is used to simulate the image state after the flame or smoke target is partially obscured by ancient building components.

[0042] To reduce sample distortion caused by arbitrary overlay, the templates obscuring ancient architectural components are sorted according to their template matching scores. The template matching score is calculated using the following formula: In the formula, For the first Template matching score for templates obscured by ancient architectural components; For the first The coverage rate of the ancient building component shielding template and the target area of ​​the fire; For the first The orientation compatibility of the template for the ancient building components covering the template; For the first The dimensional fit of the template for covering ancient architectural components; , , These are the weighting coefficients, and .

[0043] The shading coverage rate is calculated using the following formula: In the formula, For the first The area formed by superimposing ancient architectural component templates onto the template superposition area; The target area for the fire; To cover the overlapping area between the masking area and the fire target area; The area of ​​the target area in the fire.

[0044] Orientation adaptability is calculated using the following formula: In the formula, For orientation adaptability; For the first The angle difference between the shielding extension direction of the ancient building component shielding template and the target extension direction of the fire target area. The target extension direction is calculated from the second-order central moment corresponding to the fire target area. If the angle difference is greater than... Then, convert according to the complementary angle to no greater than The angle difference.

[0045] Scale fit is calculated using the following formula: In the formula, For scale fit; For the first The height of the template was adjusted after the template was obscured by an ancient architectural component. The height of the target fire area. Using a maximum value function can avoid negative values ​​for scale fit.

[0046] Templates occluding ancient building components are sorted from highest to lowest based on their template matching scores. Templates ranking higher are used for structural occlusion enhancement. If a template's matching score is below a preset template selection threshold, that template will not be included in the structural occlusion enhancement process for the current ancient building fire image sample. The preset template selection threshold can be set based on the size of the sample library and the required number of occluded samples.

[0047] During a template selection process, the weighting coefficient is taken as follows: , , The target area of ​​the fire to be processed is 3600 pixels. The overlap area between the first ancient building component shielding template and the target area of ​​the fire is 900 pixels, the directional angle difference is 18 degrees, and the ratio of the template height to the target area height is 0.9. Therefore, the shielding coverage rate corresponding to the first ancient building component shielding template is 0.25, the directional fit is 0.8, the scale fit is 0.9, and the template matching score is: The overlap area between the second ancient building component shielding template and the fire target area is 1440 pixels, the directional angle difference is 45 degrees, and the ratio of the template height to the fire target area height is 1.4. Therefore, the shielding coverage rate of the second ancient building component shielding template is 0.4, the directional fit is 0.5, the scale fit is 0.6, and the template matching score is: The first ancient building component occlusion template is sorted first and used for this structural occlusion enhancement processing. This sorting method considers the occlusion area, occlusion direction, and scale matching relationship, which can reduce the number of samples with excessive occlusion or obviously mismatched directions entering the training sample set.

[0048] Structural occlusion enhancement processing includes template size adjustment, template orientation adjustment, and occlusion area blending. Occlusion area blending is calculated using the following formula: In the formula, To occlude the sample image of the fused component at the pixel location Pixel value at; Image samples of ancient building fires at pixel locations Pixel value at; The template for masking ancient building components corresponds to the masking pixels at the pixel position. Pixel value at; To mask the pixel position The value at the specified location is 1 if it belongs to the occluded area, and 0 if it does not belong to the occluded area.

[0049] In one implementation, structural occlusion enhancement processing is overlaid with a mixed occlusion algorithm. The mixed occlusion algorithm generates mask blocks simulating grid or beam shapes in ancient building fire image samples and overlays these mask blocks onto the fire target area. The outline of the mask blocks is derived from the occlusion template of the ancient building components. The position of the mask blocks is determined by the template overlay area. The mask blocks can be locally offset along the smoke diffusion direction to simulate the discontinuity of the fire target boundary caused by smoke layer occlusion. This method differs from unconstrained random occlusion; the occlusion outline maintains a correspondence with the occlusion shape of the ancient building components.

[0050] After structural occlusion enhancement processing, component occlusion sample images are obtained. The fire target area in these component occlusion sample images is at least partially covered by the ancient building component occlusion template, resulting in image representations with missing boundaries, discontinuous contours, or incomplete local targets. Compared to training the model using only unoccluded images, component occlusion sample images can increase the proportion of scenarios with locally missing targets in the training sample set.

[0051] Figure 3 This is a schematic diagram of structural shading enhancement treatment. (Example) Figure 3 As shown, firstly, image samples of ancient building fires containing flame or smoke targets are acquired, and the fire target area is determined within these image samples. Then, a template overlay area is determined based on the location and extent of the fire target area. This template overlay area covers the fire target area while reserving space for overlaying templates that obscure ancient building components. In the ancient building component obscuring template library, multiple candidate ancient building component obscuring templates are sorted according to their template matching scores. The figure uses templates 1, 2, and 3 as examples. , and The size relationship is used to select the template 1 that ranks first as the ancient building component occlusion template for the current structural occlusion enhancement processing; then the sorted ancient building component occlusion templates are superimposed on the template superposition area, and the occlusion area of ​​the fire target area and the occlusion templates are fused so that the occlusion templates cover the local boundary or local main body of the fire target area; finally, the component occlusion sample image is obtained. In the component occlusion sample image, the fire target is shown as an image state after being partially occluded by the ancient building components, which is used to supplement the fire target representation under the component occlusion condition in the ancient building fire recognition training sample set.

[0052] Specifically, in step 103, the background image of the ancient building is obtained, and a negative sample image is constructed based on the background image of the ancient building.

[0053] Background images of ancient buildings are used to represent scenes of ancient buildings in a fire-free state. These images do not contain actual flame or smoke targets. Background images can include standard fire-free background images and fire-free background images with background interference.

[0054] From the background images of ancient buildings, fire-free background samples and background interference samples are identified. Fire-free background samples are used to characterize ancient building backgrounds where no obvious sources of interference are present. Background interference samples are used to characterize image areas that are easily confused with flame or smoke targets. Background interference samples may include at least one of the following: highlighted background, painted patterns, light sources, roof reflections, and non-fire smoke.

[0055] Interference category labels are generated based on the background interference type corresponding to the background interference samples. These labels are used to distinguish different types of non-fire image representations. The non-fire background samples and the background interference samples with interference category labels are collectively used as negative sample images.

[0056] Negative sample images can be added to the training sample set using a zero-label approach. Zero-labeled negative sample images do not have fire target bounding boxes. During fire identification model training, the predicted bounding boxes corresponding to the zero-labeled negative sample images are treated as background predicted bounding boxes. If the fire identification model outputs a fire predicted bounding box on a zero-labeled negative sample image, that fire predicted bounding box is included in the calculation of background misidentification loss. This method allows the model to be exposed to non-fire characteristics such as ancient building red walls, painted decorations, lighting, roof reflections, and non-fire smoke during the training phase.

[0057] During the manual verification phase, negative sample images can undergo dual verification. The first verification excludes images containing real flame or smoke targets. The second verification confirms that background interference areas such as strong light, reflections, painted decorations, lanterns, and incense smoke are not labeled as fire targets. The verified negative sample images are then added to the ancient building fire identification training sample set.

[0058] Specifically, in step 104, the ancient building fire image samples, component occlusion sample images, and negative sample images are labeled to generate an ancient building fire recognition training sample set.

[0059] Fire target annotation is performed on ancient building fire image samples to obtain positive fire samples. Fire target annotation is used to characterize the location range of flame target areas or smoke target areas in the image. Fire target annotation can be performed using bounding boxes or target regions.

[0060] Fire target annotation and occlusion status annotation are performed on the component occlusion sample images to obtain positive occlusion samples. The occlusion status annotation is determined based on the overlap relationship between the ancient building component occlusion template and the fire target area. Occlusion status can include boundary occlusion status, center occlusion status, and local occlusion status.

[0061] The occlusion status depends on the occlusion coverage rate. and boundary occlusion ratio Confirmed. Obstruction coverage. The occlusion coverage rate is calculated using the aforementioned formula. The boundary occlusion ratio is calculated using the following formula: In the formula, The proportion of boundary occlusion; To mask the area; The boundary area of ​​the fire target area; To determine the overlapping area between the masking area and the boundary area of ​​the fire target area; This refers to the area of ​​the boundary region of the fire target area.

[0062] When the boundary occlusion ratio is greater than the occlusion coverage rate, the component occlusion sample image is labeled as a boundary occlusion state. When the occlusion coverage rate is greater than the boundary occlusion ratio, and the occlusion mask area overlaps with the central area of ​​the fire target area, the component occlusion sample image is labeled as a central occlusion state. Other overlapping component occlusion sample images are labeled as partial occlusion states.

[0063] In a labeling verification, the fire target region area of ​​a component-occluded sample image was 4200 pixels, and the overlap area between the occluding mask area and the fire target region was 840 pixels, resulting in an occlusion coverage rate of 0.20. The boundary region area of ​​the fire target region was 1000 pixels, and the overlap area between the occluding mask area and the boundary region was 320 pixels, resulting in a boundary occlusion ratio of 0.32. Since the boundary occlusion ratio is greater than the occlusion coverage rate, the component-occluded sample image was labeled as a boundary occlusion state. This occlusion state labeling result was saved together with the fire target labeling, providing a clear basis for the occlusion state of positive occlusion samples in the training sample set. Table 2 shows the occlusion state determination rules.

[0064] Table 2 Rules for Determining Occlusion Status

[0065] Background category annotations are applied to negative sample images to obtain background negative sample images. These annotations characterize the type of background interference corresponding to the negative sample images. Zero-annotated negative sample images do not have fire target bounding boxes, but their background category annotations are preserved. These background category annotations are not used as fire target annotations; they are only used for sample inspection, data distribution statistics, and analysis of the training sample set composition.

[0066] A training sample set for ancient building fire identification is generated based on positive fire images, occlusion positive images, and negative background images. Let the number of ancient building fire image samples be... The number of component occlusion sample images generated from each ancient building fire image sample is [number]. The number of negative sample images is The number of samples in the training sample set for identifying fires in ancient buildings. for: In the formula, The number of samples in the training sample set for identifying fires in ancient buildings; Number of images of ancient buildings in fire; The number of component occlusion sample images generated for each ancient building fire image sample; This represents the number of negative sample images.

[0067] If the number of ancient building fire image samples is 2000, and each ancient building fire image sample generates 2 component occlusion sample images, and the number of negative sample images is 1500, then the number of samples in the ancient building fire recognition training sample set is: The above method for calculating the number of samples is used to verify the composition of the training sample set for identifying fires in ancient buildings. The number of component-occluded sample images can be adjusted according to training needs, and the number of negative sample images can be adjusted according to the coverage of background interference types in the ancient buildings.

[0068] Before generating a training sample set for ancient building fire identification, supplementary enhancements can be performed on the ancient building fire image samples. Supplementary enhancements can include Mosaic dynamic stitching and HSV color space perturbation. Mosaic dynamic stitching is used to scale, crop, and stitch multiple images containing different fire stages or different backgrounds. HSV color space perturbation is used to simulate changes in flame color and background color temperature. Supplementary enhancements do not change the generation logic of the ancient building component occlusion template and component occlusion sample images; they are mainly used to expand the range of appearance variations in the samples.

[0069] In one set of embodiments, the training sample set for identifying fires in ancient buildings contains 15,847 images. This data size is used to illustrate the achievable sample capacity of the training sample set and does not constitute a limitation on the number of images in the training sample set for identifying fires in ancient buildings.

[0070] Specifically, in step 105, a fire identification model is trained using a training sample set for ancient building fire identification, and the trained fire identification model is used to identify fires in the monitoring images of the ancient building to be identified, thereby obtaining the fire identification result.

[0071] Fire identification models can be target detection models, flame identification models, or smoke identification models. The fire identification model is not limited to a specific network structure. In one implementation, the fire identification model can employ a YOLOv8-based target detection model. This target detection model includes a feature extraction network, a feature fusion network, and a prediction network. The feature extraction network extracts image features from flame and smoke targets. The feature fusion network fuses image features at different scales. The prediction network outputs the fire target category, fire target location, and identification confidence level.

[0072] In a more specific implementation, the fire identification model can employ the O-Net model. The O-Net model introduces a Convolutional Block Attention (CBAM) module and a Repulsion Loss function on top of the YOLOv8 framework. CBAM is embedded at the end of the backbone network to perform channel and spatial attention weighting on the input features. Repulsion Loss is used to constrain predicted bounding boxes away from adjacent non-target boxes in occluded and dense target scenes, reducing the merging of overlapping flame or smoke targets into a single predicted box. This O-Net model is merely one specific implementation of the fire identification model and does not restrict the use of other target detection networks.

[0073] After the training sample set for ancient building fire identification is input into the fire identification model, the fire identification model learns the representation of unobstructed fire targets based on positive fire samples, learns the representation of fire targets under component occlusion conditions based on positive occlusion samples, and learns the representation of ancient building background interference based on negative background sample images.

[0074] The training process can update the fire recognition model based on the fire target recognition loss, occluded target recognition loss, and background misrecognition loss. The total training loss is calculated using the following formula: In the formula, Total training loss; The fire target identification loss is calculated based on positive fire samples; The occluded target recognition loss is calculated based on occluded positive samples; The background misidentification loss is calculated based on the background negative sample image; Weights for identifying occluded targets; The background misidentification loss weights are used. Each loss item can be calculated using the classification loss and location loss corresponding to the fire identification model itself. and Used to adjust the contributions of occluded positive sample images and background negative sample images during the training process.

[0075] In one training parameter setting Take 0.5, Let's take 0.3. When the fire target recognition loss is 0.42, the occluded target recognition loss is 0.58, and the background misidentification loss is 0.21 in a certain training batch, the total training loss is: In the forward propagation of each training batch, for the input zero-labeled negative sample image, since it does not contain any real flame or smoke bounding boxes, it does not participate in the bounding box regression loss Lbox distribution focus loss L. dfl and repulsion loss L rep The calculation only triggers the classification loss L. cls The calculation involves the following steps: if the model outputs candidate targets in non-fire areas of negative sample images, gradient penalty is applied using classification loss to suppress false alarms caused by background interference such as ancient building red walls, painted decorations, and lighting. For positive fire samples and positive samples with component occlusion, all four losses mentioned above are calculated in full.

[0076] Wherein, the repulsion loss L rep The internal optimized architecture is as follows: In the formula, To avoid losses; To attract loss items; Exclude loss terms for true bounding boxes; Exclude loss terms for predicted bounding boxes; and To eliminate loss weights, during training, adjustments can be made on the validation set. and A grid search is performed, with search values ​​including 0.1, 0.5, and 1.0. When the weights are too high, the exclusion terms significantly impact training stability; when the weights are too low, the ability to separate adjacent targets is insufficient. In a training set, , At that time, the model showed good localization stability on occluded samples.

[0077] After training, the monitoring images of the ancient buildings to be identified are input into the trained fire identification model. The trained fire identification model outputs fire identification results. The fire identification results may include at least one of the following: fire target category, fire target location, and identification confidence level.

[0078] In one edge deployment method, network cameras are deployed in key areas of ancient buildings. These cameras push surveillance video to edge computing nodes via the RTSP protocol. The edge computing nodes extract keyframes from the video and input them into a trained fire detection model. If the fire detection results show a target classified as "fire" or "smoke," and the detection confidence level is greater than a preset alarm threshold, the edge computing node generates an alarm. The alarm information may include the target category, target location, detection confidence level, and timestamp. The alarm information can be uploaded to a monitoring platform or trigger on-site audible and visual alarm devices.

[0079] To verify the effectiveness of the proposed component-occlusion sample image generation method, comparative experiments were designed using different training data construction strategies under the same general-purpose basic object detection network. To highlight the advantages of this scheme in complex scenes, a high-difficulty subset of ancient buildings containing severe physical occlusion and strong background interference was specifically selected for the test set. The experimental results are shown in Table 3. Table 3. Experimental results of different experiments

[0080] Table 3 shows that when faced with the complex occlusion environment of ancient buildings, traditional data augmentation (control group B) alone provides extremely limited improvement. However, after adopting the component occlusion template of the present invention (Example 1), the model encountered occlusion patterns that conformed to physical laws, resulting in a significant increase in recall. Furthermore, by combining negative samples and joint loss strategies (Example 2), false alarms caused by strong interference were effectively suppressed, and the comprehensive evaluation index mAP reached its highest level.

[0081] Criteria for model structure selection when using O-Net.

[0082] To further confirm the optimal embedding node of the Convolutional Block Attention (CBAM) module in the backbone network of the fire recognition model, this embodiment verifies the convergence of four spatial topology embedding strategies in an FP16 half-precision quantization deployment environment for edge terminals (corresponding to: shallow edge-aware location, mid-layer texture fusion location, deep semantic enhancement location, and backbone network output terminal location, respectively). The macroscopic recognition metrics obtained from the experiment are shown in Table 4. Table 4. Metrics embedded in different locations

[0083] Based on the feature representation patterns in Table 4, it can be seen that when CBAM is embedded in the shallow or middle layers of the network (Strategies 1 and 2), the feature map contains a large amount of disordered noise composed of sunlight reflection and complex ancient building paintings. This makes the channel and spatial attention modules highly susceptible to being misled by interference information, leading to a drop in overall recall and average precision. However, the strategy 3 adopted in this embodiment (deploying CBAM at the backbone network output terminal) can, after the deep semantic map has undergone high-level abstraction, allow the channel attention module (CAM) to accurately lock onto the active channels representing the flame wavelength in the feature map, and the spatial attention module (SAM) to adaptively enhance the radiation center of the bright diffuse smoke, thereby maximizing recognition accuracy with minimal computational overhead.

[0084] To quantitatively analyze the synergistic gain of the Hybrid Attention Module (CBAM) and Repulsion Loss function introduced in this invention in addressing fires caused by special obstructions in ancient buildings, combined ablation verification was performed under the same network basis. The evaluation benchmark selected a challenging subset of tests containing severe component overlap and high-frequency environmental interference. The ablation evaluation data are shown in Table 5. Table 5 Ablation Evaluation Data

[0085] Based on the ablation results analysis in Table 5, CBAM and Repulsion Loss exhibit significant complementary characteristics across different dimensions of target detection. Specifically, when CBAM is introduced alone (No. 2), the system's ability to eliminate non-fire visual interference such as strong light and painted patterns is significantly enhanced, increasing the false positive control rate by 4.3 percentage points, thus confirming its anti-interference characteristics at the feature level. When Repulsion Loss is introduced alone (No. 3), due to the geometric topological constraints of the attraction and repulsion terms, incomplete bounding boxes that overlap or are partially occluded by the grid are forced to decouple and separate, directly increasing the false negative avoidance rate to 85.9%. When the two modules work together (No. 4), the model achieves deep synergy in feature discrimination and refined bounding box localization, enabling the average regional localization accuracy to reach the optimal level of 89.4%.

[0086] This embodiment utilizes ancient building component occlusion templates to generate component occlusion sample images, ensuring that the ancient building fire identification training sample set includes image representations of fire targets partially occluded by ancient building components. After negative sample images are added to the ancient building fire identification training sample set, the training sample set simultaneously contains fire target samples, occluded target samples, and background interference samples. By receiving component occlusion sample images and negative sample images during the training phase, the fire identification model can reduce recognition bias caused by the lack of occlusion representations and background interference representations in the training samples.

[0087] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0088] Specific examples have been used to illustrate the principles and implementation methods of this invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this invention. Furthermore, those skilled in the art will recognize that, based on the ideas of this invention, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of this invention.

Claims

1. A method for identifying fires in ancient buildings based on component-occluded sample images, characterized in that, Includes the following steps: Obtain image samples of ancient building fires; Based on the occlusion patterns of components in ancient architectural scenes, an ancient architectural component occlusion template is constructed, which is used to characterize the occlusion outline formed by the ancient architectural components. Based on the ancient building component occlusion template, structural occlusion enhancement processing is performed on the ancient building fire image sample to obtain the component occlusion sample image; Obtain background images of ancient buildings and construct negative sample images based on the background images of ancient buildings; The ancient building fire image samples, the component occlusion sample images, and the negative sample images are labeled to generate an ancient building fire recognition training sample set; A fire identification model is trained using the ancient building fire identification training sample set, and the trained fire identification model is used to identify fires in the monitoring images of the ancient building to be identified, so as to obtain the fire identification results.

2. The method for identifying ancient building fires based on component occlusion sample images according to claim 1, characterized in that, Based on the occlusion patterns of components in ancient architectural scenes, construct templates for occlusion of ancient architectural components, including: Identify the areas obscured by components from images of ancient architectural scenes; Extract the occlusion boundary, occlusion extension direction, and occlusion interval based on the occlusion area of ​​the component; Ancient building component shielding templates are generated based on the shielding boundary, the shielding extension direction, and the shielding interval.

3. The method for identifying ancient building fires based on component occlusion sample images according to claim 2, characterized in that, The component shading form includes at least one of the following: beam shading form, grille shading form, purlin shading form, and bracket shading form; the ancient building component shading template includes a shading outline template corresponding to the component shading form.

4. The method for identifying ancient building fires based on component occlusion sample images according to claim 1, characterized in that, Based on the ancient building component occlusion template, structural occlusion enhancement processing is performed on the ancient building fire image samples to obtain component occlusion sample images, including: Identify the target fire area in the ancient building fire image sample; The template overlay area is determined based on the location of the fire target area in the ancient building fire image sample; The ancient building component occlusion template is superimposed onto the template superposition area to obtain a component occlusion sample image.

5. The method for identifying ancient building fires based on component occlusion sample images according to claim 4, characterized in that, The ancient building component occlusion template is superimposed onto the template superposition area to obtain a component occlusion sample image, including: Adjust the template size of the ancient building component covering the template according to the size of the template superposition area; Adjust the template direction of the ancient building component shielding template according to the boundary direction of the fire target area; The adjusted ancient building component occlusion template is superimposed onto the template superposition area to obtain a component occlusion sample image.

6. The method for identifying ancient building fires based on component occlusion sample images according to claim 1, characterized in that, Acquire background images of ancient buildings and construct negative sample images based on these background images, including: Determine fire-free background samples and background interference samples from the background images of the ancient buildings; Generate interference category labels based on the background interference types corresponding to the background interference samples; A negative sample image is constructed based on the fireless background sample and the background interference sample with the interference category label.

7. The method for identifying ancient building fires based on component occlusion sample images according to claim 6, characterized in that, The background interference types include at least one of the following: bright background, painted patterns, light sources, roof reflections, and non-fire smoke.

8. The method for identifying ancient building fires based on component occlusion sample images according to claim 1, characterized in that, The ancient building fire image samples, the component occlusion sample images, and the negative sample images are labeled to generate an ancient building fire recognition training sample set, including: Fire target annotation is performed on the ancient building fire image samples to obtain positive fire samples; Fire target labeling and occlusion status labeling are performed on the component occlusion sample images to obtain occlusion positive samples; The negative sample image is labeled with a background category to obtain a background negative sample image; A training sample set for ancient building fire identification is generated based on the fire positive sample, the occlusion positive sample, and the background negative sample image.

9. The method for identifying ancient building fires based on component occlusion sample images according to claim 8, characterized in that, Fire target labeling and occlusion status labeling are performed on the component occlusion sample images to obtain positive occlusion samples, including: Mark the fire target area in the sample image obscured by the component; The shielding status is determined based on the overlap between the ancient building component shielding template and the fire target area; By associating the fire target area with the occlusion status, positive occlusion samples are obtained.

10. The method for identifying ancient building fires based on component occlusion sample images according to claim 1, characterized in that, Training a fire identification model using the aforementioned ancient building fire identification training sample set includes: Input the ancient building fire identification training sample set into the fire identification model; During the forward propagation of the training network, the comprehensive error between the network output and the real label is calculated through the total loss function of the fire recognition model. Specifically, only the classification penalty loss is calculated for the negative sample image, while the classification loss and bounding box localization regression loss are calculated simultaneously for the fire positive sample and the occlusion positive sample. The network parameters of the fire identification model are updated using a backpropagation algorithm based on the comprehensive error.