Infrared ship identification method based on lightweight YOLOv8
Through the infrared ship recognition method based on lightweight YOLOv8, the anti-sharpening mask technology and MobileNetv4 network structure and combined with the MLLAttention module, the problem of low accuracy in traditional visible light image recognition technology in complex environments is solved, and efficient and real-time Ship monitoring and identification.
Patent Information
- Application Number
- CN202411117081.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-15
- Publication Date
- 2024-11-22
AI Technical Summary
Traditional visible light image recognition technology has low recognition accuracy in complex marine environments, especially in night or inclement weather conditions, and is difficult to achieve accurate detection and recognition of ships. It has high computational complexity and low resource utilization efficiency.
Using the infrared ship recognition method based on lightweight YOLOv8, the image is preprocessed by collecting and preprocessing the infrared ship dataset, using anti-sharpening mask technology and Gaussian blur, and the backbone feature extraction network in the YOLOv8 network structure Replace it with MobileNetv4, add the MLLAttention module to build a lightweight YOLOv8 recognition model, and optimize the hyperparameters of the model to improve recognition accuracy and efficiency.
It realizes the reduction of computing complexity while maintaining high accuracy, improves real-time performance and resource utilization efficiency, adapts to complex maritime monitoring environments, and improves the accuracy and stability of ship identification.
Smart Images

Figure CN119007136A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of ship detection, and in particular relates to an infrared ship recognition method based on lightweight YOLOv8. Background Art
[0002] With the rapid increase in the number and types of ships at sea, modern maritime surveillance faces increasingly complex challenges. It is particularly important to develop efficient and accurate ship identification technology. Traditional visible light image recognition technology is greatly affected by weather conditions and lighting, and is easily affected by factors such as weather changes and cloud cover, resulting in a significant drop in recognition accuracy. In addition, at night or in severe weather conditions, visible light image recognition technology performs poorly, making it difficult to accurately detect and identify ships. In contrast, infrared sensors can receive thermal radiation emitted by the target, so they are not restricted by lighting conditions and can achieve stable ship detection and identification both during the day and at night.
[0003] In order to meet the real-time detection needs of ships, lightweight target detection models have become a necessary choice. Lightweight target detection models can reduce the computational complexity and parameter volume of the model while maintaining high accuracy, thereby improving the operating efficiency and real-time performance on devices with limited resources. In particular, the technology based on lightweight YOLOv8 can significantly improve real-time performance while ensuring target detection accuracy, adapt to complex maritime monitoring environments and respond to security challenges. Summary of the invention
[0004] The technical problem to be solved by the present invention is to reduce the computational complexity and optimize resource utilization to achieve efficient and real-time ship monitoring.
[0005] To achieve the above object, the present invention provides the following technical solution: an infrared ship recognition method based on lightweight YOLOv8, comprising the following steps:
[0006] S1. Collect and organize marine infrared ship data sets into data sets, and mark the ship targets in the data sets;
[0007] S2. Preprocess the infrared ship images in the data set;
[0008] Optionally, preprocessing the infrared ship images in the data set includes: preprocessing the infrared ship images in the data set using an unsharp masking technique, and highlighting the edge and detail information of the image while keeping the low-frequency information unchanged through Gaussian blurring.
[0009] Optionally, the unsharp masking technique is used for the infrared ship images in the data set, including: first, the original image is subjected to blur preprocessing such as spatial filtering to obtain a blunted blurred image by suppressing high-frequency components in the image; then, the input image is subtracted from the blurred image to obtain the high-frequency components in the original image, and then the high-frequency components are amplified by a gain factor and superimposed with the original image to obtain an enhanced image.
[0010] Optionally, Gaussian filtering can preserve more image structures and can better enhance image details without excessively enhancing noise.
[0011] S3. Convert the dataset to YOLO format and divide it into training set, validation set and test set according to 8:1:1;
[0012] S4. Build a lightweight YOLOv8 recognition model;
[0013] Optionally, building a lightweight YOLOv8 recognition model includes: replacing a backbone feature extraction network in the YOLOv8 network structure with a MobileNetv4 network, and adding a MLL Attention (Mamba-Like Linear Attention) module.
[0014] Optionally, the MobileNetv4 network introduces a Universal Inverted Bottleneck (UIB) search block and a mobile multi-head attention (Mobile MQA), wherein the UIB search block includes an Inverted Bottleneck (IB), ConvNext, a feedforward network (FFN), and a novel extra depth (ExtraDW) variant.
[0015] Optionally, the MLL Attention module combines the advantages of the Mamba model and the linear attention Transformer, and has efficient calculation and inference speed through specific design improvements. Among them, the MLL Attention module integrates the two most critical advantages of Mamba, the forget gate and block design, into the linear attention model Transformer.
[0016] S5. Using the training set and the validation set to train and validate the improved YOLOv8 recognition model, an infrared ship target recognition model is obtained;
[0017] Optionally, the process of training and verifying the lightweight YOLOv8 recognition model using the training set and the verification set includes: setting the hyperparameters of the lightweight YOLOv8 recognition model including the batch size of the training, the number of training rounds and the initial learning rate, etc. Input the preprocessed training set into the lightweight YOLOv8 recognition model for training to obtain the trained lightweight YOLOv8 recognition model, input the preprocessed verification set into the trained lightweight YOLOv8 recognition model for verification to obtain the test result, and use the mean average precision mAP to evaluate the accuracy of the test result to determine whether the accuracy of the test result is optimal. If the accuracy of the test result is optimal, stop training to obtain a lightweight YOLOv8 recognition model; if the accuracy of the test result is not optimal, adjust the hyperparameters of the lightweight YOLOv8 recognition model until the accuracy of the test result is optimal, obtain the model hyperparameters, and then obtain the trained lightweight YOLOv8 recognition model; finally, test the trained lightweight YOLOv8 recognition model based on the adjusted test set.
[0018] S6. Use the infrared ship recognition model to test the test set and output the recognition result.
[0019] The beneficial effects of the present invention are:
[0020] 1. The infrared ship image is preprocessed using the unsharp masking technology. Through Gaussian blurring, the edge and detail information of the image are highlighted while keeping the low-frequency information unchanged, thereby improving the image clarity and reducing the impact of noise.
[0021] 2. Taking YOLOv8 as the standard, during the model building stage, the backbone network in the YOLOv8 network structure is replaced with a lightweight network MobileNetv4, which can make a temporary trade-off between space and channel mixing and expand the receptive field as needed to maximize computing utilization.
[0022] 3. Adding the MLL Attention module can improve the generalization ability at multiple scales. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 It is an overall flow chart of an infrared ship recognition method based on lightweight YOLOv8 of the present invention;
[0024] Figure 2 It is a structural schematic diagram of preprocessing an infrared ship image in an infrared ship recognition method based on lightweight YOLOv8 of the present invention;
[0025] Figure 3It is a structural schematic diagram of a lightweight YOLOv8 detection model in an infrared ship recognition method based on lightweight YOLOv8 of the present invention; DETAILED DESCRIPTION
[0026] In order to make the purpose, technical solution and advantages of the present invention clearer and more specific, the present invention is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0027] See also Figure 1 , Figure 1 It is an overall flow chart of the infrared ship recognition method based on lightweight YOLOv8 of the present invention, which includes the following steps:
[0028] S1. Construct a marine infrared ship dataset, collect marine infrared ship data, and annotate the ship targets in the dataset;
[0029] Specifically, the ship area is labeled through the LabelImg program, using liner, bulk carrier, warship, sailboat, canoe, and container ship as labels for cruise ship, bulk carrier, warship, canoe, sailboat, and container ship, respectively.
[0030] S2. Preprocessing of marine infrared ship dataset, such as Figure 2 As shown, the specific implementation steps are as follows:
[0031] S201. Input the marine infrared ship dataset.
[0032] S202. Use Gaussian blur to blur the image, and obtain a blunted blurred image by suppressing high-frequency components in the image.
[0033] S203. Subtract the input image from the blurred image to obtain the high-frequency component in the original image.
[0034] S204. Amplify the high-frequency component using a gain factor and superimpose it with the original image.
[0035] S205. Obtain the preprocessed marine infrared ship dataset.
[0036] S3. Conversion and division of the marine infrared ship dataset: convert the dataset format into YOLO format and divide it into training set, validation set and test set according to 8:1:1;
[0037] Specifically, the recognition model is trained through the training set, the training effect is checked based on the validation set, the actual learning ability is tested based on the test set, and the effectiveness of the recognition model is verified.
[0038] S4. Build a lightweight YOLOv8 recognition model, such as Figure 3 As shown:
[0039] Specifically, the target detection model includes three parts: a backbone network, a neck network, and a head network.
[0040] The backbone network includes replacing the modules except the SPPF module in the backbone part of the original YOLOv8 model with the MobileNetV4 module; the neck network adds the MLL Attention module. It can enrich feature information, enhance feature fusion capabilities, reduce calculations, enhance detection robustness, and achieve the expected improvement in detection speed and accuracy.
[0041] S5. Training of the lightweight YOLOv8 recognition model: using the training set and the validation set to train and validate the lightweight YOLOv8 recognition model to obtain an infrared ship target recognition model, which is specifically implemented in the following steps:
[0042] S501. Input the preprocessed training set into the lightweight YOLOv8 recognition model for training to obtain a trained lightweight YOLOv8 recognition model;
[0043] S502. Input the preprocessed validation set into the trained lightweight YOLOv8 recognition model for verification to obtain the test results, and use the mean average precision (mAP) to evaluate the accuracy of the test results to determine whether the accuracy of the test results is optimal;
[0044] S503. If the accuracy of the test result reaches the optimal value, stop training and obtain a lightweight YOLOv8 recognition model; if the accuracy of the test result does not reach the optimal value, adjust the hyperparameters of the lightweight YOLOv8 recognition model until the accuracy of the test result reaches the optimal value;
[0045] S6. Identify infrared ship targets, use the infrared ship recognition model to test the test set, and output the recognition result.
[0046] The present invention uses unsharp masking technology to preprocess infrared ship images. Through Gaussian blurring, the edges and details of the image are highlighted while keeping the low-frequency information unchanged, thereby improving the clarity of the image and reducing the impact of noise. The modules other than the SPPF module in the backbone of the original YOLOv8 model are replaced with the MobileNetV4 module, so that the algorithm can make a temporary trade-off between space and channel mixing and expand the receptive field as needed to maximize the computational utilization. Adding the MLL Attention module to the neck of the original YOLOv8 model can improve the generalization ability at multiple scales.
Claims
1. An infrared ship recognition method based on lightweight YOLOv8, characterized in that: The steps of the method include: S1. Collect and organize marine infrared ship data sets into data sets, and mark the ship targets in the data sets; S2. Preprocess the infrared ship images in the data set; S3. Convert the dataset to YOLO format and divide it into training set, validation set and test set according to 8:1:1; S4. Build a lightweight YOLOv8 recognition model; S5. Using the training set and the validation set to train and validate the improved YOLOv8 recognition model, an infrared ship target recognition model is obtained; S6. Use the infrared ship recognition model to test the test set and output the recognition result.
2. According to claim 1, the infrared ship recognition method based on lightweight YOLOv8 is characterized in that: The method in S1 further includes labeling the ship area for each infrared ship image in the data set by using the LabelImg program.
3. According to the infrared ship recognition method based on lightweight YOLOv8 in claim 1, it is characterized in that: In S2, Gaussian blur and linear gain factor are used to preprocess and sharpen the infrared ship images in the dataset, and the gain factor k is 1.
5.
4. According to the infrared ship recognition method based on lightweight YOLOv8 according to claim 1, it is characterized in that: The lightweight YOLOv8 recognition model described in S3 includes two parts: a backbone and an attention mechanism; the specific structure of the backbone part of the lightweight YOLOv8 detection model is: it includes a MobileNetV4 module, the output end of the MobileNetV4 module is connected to the input end of the SPPF module, wherein the MobileNetV4 module adopts the MobileNetV4ConvMedium type, the number of output channels of the SPPF module is 1024, and the pooling kernel size of the SPPF module is 5×5; the specific structure of the attention mechanism of the lightweight YOLOv8 detection model is: adding an MLL Attention module in the neck network.
5. According to the infrared ship recognition method based on lightweight YOLOv8 in claim 1, it is characterized in that: The specific structure of the attention part of the improved YOLOv8 recognition model is: it includes an upsampling module 1, a tensor splicing module 1, a Cf2 module 1, an upsampling module 2, a tensor splicing module 2, a Cf2 module 2, a MLLAttention module 1, a Conv module 1, a tensor splicing module 3, a Cf2 module 3, a MLLAttention module 2, a Conv module 2, a tensor splicing module 4, a Cf2 module 4 and a MLLAttention module 3 connected in sequence; the output end of the first Cf2 module is connected to the tensor splicing module 3; the output end of the SPPF module is connected to the tensor splicing module 4; the output ends of the MLLAttention module 1, the MLLAttention module 2 and the MLLAttention module 3 are respectively connected to the detection head 0, the detection head 1 and the detection head 2.
Citation Information
Cited By
Image-based power equipment temperature monitoring method and system, and electronic equipment
CN119323766A
Image-based power equipment temperature monitoring method, system and electronic equipment
CN119323766B
Marine target heterogenous data matching method based on spatial topology and multiple features
CN119888181A
Battery replacement station vehicle in-place identification method and system, storage medium and battery replacement station
CN119941845A
Jersey cattle body condition scoring method and system based on tail root area segmentation
CN120451714A
