Cabin fire image recognition method based on improved YOLOv5 model

By adding a small object detection head to the YOLOv5 model, adding a CBAM attention mechanism and improving the loss function, the problem of low cabin fire recognition rate is solved, especially in small flame image recognition, which significantly improves the recognition accuracy and model performance.

CN119600541APending Publication Date: 2025-03-11中船九江海洋装备(集团)有限公司
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411674028.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-21
Publication Date
2025-03-11

AI Technical Summary

Technical Problem

The existing cabin fire recognition method based on the YOLOv5 model has the problem of low recognition rate, especially in small flame image recognition, due to the complex image background and small sample size.

Method used

On the basis of the original YOLOv5 model, add a small object detection head, add a CBAM attention mechanism, and improve the CIoU loss function to a WIoU loss function to form an improved YOLOv5 model. This model improves the detection effect of small targets by enhancing feature extraction capabilities and adaptability.

Benefits of technology

Through the improved YOLOv5 model, the recognition accuracy of cabin fire images is significantly improved, especially in the recognition of small flame images, and the performance and reliability of the model are improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119600541A_ABST
    Figure CN119600541A_ABST
Patent Text Reader

Abstract

The invention discloses a cabin fire image recognition method based on an improved YOLOv5 model, and belongs to the technical field of fire image recognition. The method comprises the steps of collecting and preprocessing fire image data, adding a small target detection head and a CBAM attention module, and improving a loss function to be WIoU. And through iterative training of the training set, adjusting model parameters to be optimal, and evaluating model performance on the verification set and the test set. The evaluation indexes comprise the average accuracy rate mAP, the model size and the complexity. According to the method, the fire image recognition accuracy and the model efficiency are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of fire image recognition, and in particular relates to a cabin fire image recognition method based on an improved YOLOv5 model. Background Art

[0002] Ship fire is one of the main disasters encountered during the voyage of ships. Since there are a large number of electrical equipment, fuel systems and high-temperature mechanical equipment in the ship's engine room, electrical failures, fuel leakage and mechanical friction overheating may cause fires. In addition, ships are sailing on the sea, far away from land, and rescue forces are difficult to arrive quickly. At the same time, the internal structure of the cabin is complex, the passages are narrow, and it is difficult for fire-fighting equipment and personnel to enter. In addition, the cabin space is relatively closed and poorly ventilated. Once a fire occurs, heat and smoke are difficult to dissipate, and it is easy to form a high-temperature and high-pressure environment, which accelerates the spread of the fire. These factors make ship fires often cause great casualties and property losses. Therefore, it is crucial to strengthen the prevention and control of ship fires.

[0003] In the early days, people used temperature-sensing, smoke-sensing and light-sensing sensors to collect data to determine whether a fire had occurred. However, the sensors only provide single information and are easily affected by ambient light, temperature, humidity and airflow, which can cause false alarms and missed alarms, making reliability and stability difficult to guarantee. With the development of image acquisition and processing technology, image-based fire monitoring technology has been widely used as an effective fire prevention technology. Compared with traditional fire detection technology, image-based fire monitoring technology has many advantages, such as large detection area, short response time, rich and intuitive information and low maintenance cost.

[0004] As a popular image recognition model, the YOLOv5 model has been successfully applied in the fields of vehicle recognition and face recognition. The fire recognition method based on the YOLOv5 model proposed in the current study still has some shortcomings, such as the small effective recognition image of cabin fire, complex image background, and small number of image samples, which lead to a low recognition rate of cabin fire. Summary of the invention

[0005] In view of the above technical problems, the present invention provides a method for cabin fire image recognition based on an improved YOLOv5 model, comprising the following steps: Step S1: Collect the original data set for cabin fire image recognition, perform preprocessing on the original data set, and divide the preprocessed fire image data set into a training set, a test set, and a validation set.

[0006] Step S2: Add a small target detection head to the original YOLOv5 model, add the CBAM attention mechanism to the feature extraction module, improve the original CIoU loss function to the WIoU loss function, and obtain the improved YOLOv5 model.

[0007] Step S3: Use the training set to fully train the improved YOLOv5 model; during the training process, record the model parameters and the fire image feature recognition accuracy, adjust the model parameters, and after repeated iterations and optimization, finally determine the optimal weight parameters that can make the model performance reach the optimal state.

[0008] Step S4: Apply the final optimal weights to the validation set and test set, observe the performance of the model on different data sets, calculate the model evaluation index, and analyze and evaluate the improvement effect of the model based on the evaluation index.

[0009] Step S5: Use the YOLOv5 model improved by step S4 to perform fire image recognition and output the recognition result.

[0010] The process of collecting the original data set for cabin fire image recognition in step S1 includes the following steps: Step S101: Collect fire image data through network collection or self-photography, and add non-fire data to form a fire image data set; the non-fire data is image data with image features similar to flames.

[0011] Step S102: preprocessing the original fire image data set, including random cropping and mirroring of the image, resizing, contrast adjustment, and adding Gaussian noise.

[0012] Step S103: Divide the preprocessed fire image dataset into a training set, a test set, and a validation set in a ratio of 8:1:1.

[0013] Furthermore, the steps of improving the YOLOv5 model include: Step S201: Increase the original detection heads of the YOLOv5 model from 80×80, 40×40, and 20×20 to 160×160, 80×80, 40×40, and 20×20, where the 160×160 detection head is a newly added small target detection head.

[0014] Step S202: Add a CBAM attention module to the feature extraction module. The CBAM attention module can enhance the convolution performance of the model. The CBAM attention module improves the perception ability of the model by introducing a channel attention mechanism and a spatial attention mechanism, so that the model can focus on the key areas in the image.

[0015] Step S203: The original CIoU loss function in the YOLOv5 model is improved to a WIoU loss function, so as to reduce the adverse effects of samples of different qualities on model training and complete the improvement of the YOLOv5 model.

[0016] Furthermore, the training process includes the following steps: Step S301: Model training is started, and the improved YOLOv5 model is preliminarily trained using the training set to initialize the model parameters.

[0017] Step S302: Performance monitoring and parameter adjustment: continuously monitor the fire image recognition accuracy during the training process, and adjust the model parameters according to the monitoring results.

[0018] Step S303: Iterative training, through multiple iterative training processes, the model parameters are continuously optimized to improve the recognition accuracy of the fire image.

[0019] Step S304: Determine the optimal weights. After completing the iterative training, select a set of weight parameters that performs best on the training set as the final parameters of the model to ensure that the model reaches the optimal recognition state.

[0020] The model evaluation index in step S4 is to use the mean average accuracy (mAP), model size and model complexity to evaluate the improvement effect of the model; The mAP calculation formula is as follows: ; Among them, n is the number of categories and AP is the average precision.

[0021] Compared with the prior art, the invention has the following advantages: the detection method of the invention improves the original detection layer, feature extraction module and loss function according to the characteristics of the fire image data set. It focuses on the detection requirements of small flame images and improves the detection effect of the model on small targets. By optimizing the characteristics of fire images, the model performance is better. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 The present invention is a flowchart of an exemplary process for identifying a cabin fire according to an embodiment of the present invention.

[0023] Figure 2 A flowchart of an exemplary step for collecting a data set of the present invention.

[0024] Figure 3 A flow chart of an exemplary process for setting up an improved model for the present invention.

[0025] Figure 4 The following is a flowchart of an exemplary step of the training process of the present invention. DETAILED DESCRIPTION

[0026] Embodiment: In this embodiment, an improved fire image recognition method is provided based on the YOLOv5 model.

[0027] YOLOv5 (You Only Look Once version 5) is a popular real-time object detection model, which belongs to the YOLO (You Only Look Once) series and was released by Glenn Jocher in 2020. YOLO series models are known for their fast detection speed and high accuracy, and are widely used in the field of computer vision, including but not limited to video surveillance, autonomous driving, robot navigation, and real-time object detection.

[0028] The architecture of the YOLOv5 model mainly includes the following parts: Backbone (backbone network), Neck (feature pyramid network), and Head (prediction head). Backbone usually uses CSPDarknet53 to extract the basic features of the image. It contains multiple convolutional layers and residual connections, which can effectively extract the deep features of the image; the Neck part is composed of the feature pyramid network (FPN) and the path aggregation network (PAN). FPN transmits high semantic features from top to bottom, and PAN transmits fine-grained features from bottom to top. The combination of the two can enhance the model's detection ability for targets of different scales; the Head part is responsible for the final prediction, including the location of the bounding box, the target category, and the target confidence. It usually contains several convolutional layers to generate the final detection results. The entire network structure design enables YOLOv5 to achieve single-stage, real-time target detection.

[0029] like Figure 1 As shown, it is an exemplary step of this embodiment, which includes: Step S1: Collect the original data set for cabin fire image recognition, perform preprocessing on the original data set, and divide the preprocessed fire image data set into a training set, a test set, and a validation set.

[0030] Step S2: Add a small target detection head to the original YOLOv5 model, add the CBAM attention mechanism to the feature extraction module, improve the original CIoU loss function to the WIoU loss function, and obtain the improved YOLOv5 model.

[0031] Step S3: Use the training set to fully train the improved YOLOv5 model; during the training process, record the model parameters and the fire image feature recognition accuracy, adjust the model parameters, and after repeated iterations and optimization, finally determine the optimal weight parameters that can make the model performance reach the optimal state.

[0032] Step S4: Apply the final optimal weights to the validation set and test set, observe the performance of the model on different data sets, calculate the model evaluation index, and analyze and evaluate the improvement effect of the model based on the evaluation index.

[0033] Step S5: Use the YOLOv5 model improved by step S4 to perform fire image recognition and output the recognition result.

[0034] like Figure 2 As shown in FIG. 1 , an exemplary process of collecting the original data set for cabin fire image recognition in step S1 in this embodiment includes the following steps: Step S101: Collect fire image data through the Internet or by self-photographing, and add non-fire data to form a fire image data set; non-fire data is image data with image features similar to flames.

[0035] Step S102: preprocessing the original fire image data set, including random cropping and mirroring of the image, resizing, contrast adjustment, and adding Gaussian noise.

[0036] Step S103: Divide the preprocessed fire image dataset into a training set, a test set, and a validation set in a ratio of 8:1:1.

[0037] In this embodiment, the image size is adjusted: all images are uniformly adjusted to a size of 416x416 pixels to meet the input requirements of the YOLOv5 model. Then, data enhancement is performed: random horizontal flipping, random cropping, color jittering and other data enhancement techniques are applied to increase the generalization ability of the model. Finally, the annotation processing is performed: the fire image is annotated using an annotation tool to mark the bounding box of the fire area.

[0038] like Figure 3 An exemplary step of improving the YOLOv5 model in this embodiment is shown, including: Step S201: Increase the original detection heads of the YOLOv5 model from 80×80, 40×40, and 20×20 to 160×160, 80×80, 40×40, and 20×20, where the 160×160 detection head is a newly added small target detection head.

[0039] Step S202: Add a CBAM attention module to the feature extraction module. The CBAM attention module can enhance the convolution performance of the model. The CBAM attention module improves the perception ability of the model by introducing a channel attention mechanism and a spatial attention mechanism, so that the model can focus on the key areas in the image.

[0040] Step S203: The original CIoU loss function in the YOLOv5 model is improved to a WIoU loss function, so as to reduce the adverse effects of samples of different qualities on model training and complete the improvement of the YOLOv5 model.

[0041] The original YOLOv5 model contains three detection heads, each responsible for detecting objects of different scales. We add a new 160×160 detection head specifically for detecting small-sized fire targets.

[0042] To match the newly added detection head, we added an additional feature pyramid layer in the Neck part of the model to ensure that the 160×160 detection head can receive feature maps of sufficient resolution. During training, we designed specific anchor sizes for the 160×160 detection head, such as [10,15], [15,20], [20,25], to meet the detection requirements of small-sized objects.

[0043] like Figure 4 The following is an exemplary step of the training process according to the present embodiment, including: Step S301: Model training is started, and the improved YOLOv5 model is preliminarily trained using the training set to initialize the model parameters.

[0044] Step S302: Performance monitoring and parameter adjustment: continuously monitor the fire image recognition accuracy during the training process, and adjust the model parameters according to the monitoring results.

[0045] Step S303: Iterative training, through multiple iterative training processes, the model parameters are continuously optimized to improve the recognition accuracy of the fire image.

[0046] Step S304: Determine the optimal weights. After completing the iterative training, select a set of weight parameters that performs best on the training set as the final parameters of the model to ensure that the model reaches the optimal recognition state.

[0047] In this embodiment, the model evaluation index in step S4 is to use the average accuracy mAP, model size and model complexity to evaluate the improvement effect of the model.

[0048] The mAP calculation formula is as follows: ; Among them, n is the number of categories and AP is the average precision.

Claims

1. A cabin fire image recognition method based on an improved YOLOv5 model, characterized in that: The following steps are involved: Step S1: collecting the original data set for cabin fire image recognition, and performing preprocessing operations on the original data set, dividing the preprocessed fire image data set into a training set, a test set and a verification set; Step S2: Add a small target detection head to the original YOLOv5 model, add the CBAM attention mechanism to the feature extraction module, improve the original CIoU loss function to the WIoU loss function, and obtain the improved YOLOv5 model; Step S3: Use the training set to fully train the improved YOLOv5 model; during the training process, record the model parameters and the fire image feature recognition accuracy, adjust the model parameters, and after repeated iterations and optimizations, finally determine the optimal weight parameters that can make the model performance reach the optimal state; Step S4: Apply the optimal weights finally determined to the validation set and the test set, observe the performance of the model on different data sets, calculate the model evaluation index, and analyze and evaluate the improvement effect of the model based on the evaluation index; Step S5: Use the YOLOv5 model improved by step S4 to perform fire image recognition and output the recognition result.

2. The method for cabin fire image recognition based on the improved YOLOv5 model according to claim 1, characterized in that: The process of collecting the original data set for cabin fire image recognition in step S1 includes the following steps: Step S101: Collect fire image data through the Internet or by self-photographing, and add non-fire data to form a fire image data set; the non-fire data is image data with image features similar to flames; Step S102: performing preprocessing operations on the original fire image data set, including random cropping and mirroring operations of the image, size adjustment, contrast adjustment, and adding Gaussian noise; Step S103: Divide the preprocessed fire image dataset into a training set, a test set, and a validation set in a ratio of 8:1:

1.

3. The method for cabin fire image recognition based on the improved YOLOv5 model according to claim 1, characterized in that: The steps of improving the YOLOv5 model include: Step S201: increase the original detection heads of the YOLOv5 model from 80×80, 40×40, and 20×20 to 160×160, 80×80, 40×40, and 20×20, where the 160×160 detection head is a newly added small target detection head; Step S202: adding a CBAM attention module to the feature extraction module, the CBAM attention module can enhance the convolution performance of the model; the CBAM attention module improves the perception ability of the model by introducing a channel attention mechanism and a spatial attention mechanism, so as to enable the model to focus on key areas in the image; Step S203: The original CIoU loss function in the YOLOv5 model is improved to a WIoU loss function, so as to reduce the adverse effects of samples of different qualities on model training and complete the improvement of the YOLOv5 model.

4. The method for cabin fire image recognition based on the improved YOLOv5 model according to claim 1, characterized in that: The training process includes the following steps: Step S301: Model training is started, and the improved YOLOv5 model is preliminarily trained using the training set to initialize the model parameters; Step S302: Performance monitoring and parameter adjustment: continuously monitoring the fire image recognition accuracy during the training process, and adjusting the model parameters according to the monitoring results; Step S303: iterative training, through multiple iterative training processes, continuously optimizing model parameters to improve the recognition accuracy of fire images; Step S304: Determine the optimal weights. After completing the iterative training, select a set of weight parameters that performs best on the training set as the final parameters of the model to ensure that the model reaches the optimal recognition state.

5. The method for cabin fire image recognition based on the improved YOLOv5 model according to claim 1, characterized in that: The model evaluation index in step S4 is to use the mean average accuracy (mAP), model size and model complexity to evaluate the improvement effect of the model; The mAP calculation formula is as follows: ; Among them, n is the number of categories and AP is the average precision.