A method for detecting internal and external fuel tank caps in automobiles based on the combination of Vmamba and YOLOv8n

By combining the VMamba framework with the YOLOv8n network, improving the YOLOv8n structure and introducing the SS2D module, the problem of high computational complexity in the detection of internal and external fuel tank caps of automobiles by traditional detection methods is solved, and efficient and real-time small target detection is achieved.

CN119314158BActive Publication Date: 2026-01-30NANJING UNIV OF SCI & TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411305737.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-19
Publication Date
2026-01-30
Estimated Expiration
2044-09-19

AI Technical Summary

Technical Problem

Traditional convolutional neural networks and Transformer architectures have limitations in detecting fuel tank caps inside and outside automobiles, especially when dealing with small target detection, where they are computationally complex and inefficient, making it difficult to meet real-time detection requirements.

Method used

By combining the VMamba framework and the YOLOv8n network, and by improving the YOLOv8n structure and introducing the 2D-Selective-Scan (SS2D) module, a detection model for the internal and external fuel tank caps of automobiles is constructed. The ODSSBlock is used to replace the C2f structure, simplifying the detection process and maintaining linear complexity. The model parameters are optimized using the EIoU loss function.

Benefits of technology

It enables efficient and real-time detection of the internal and external fuel tank caps of automobiles, and the detection results are accurate, especially under different lighting conditions, thus improving the performance and efficiency of small target detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119314158B_ABST
    Figure CN119314158B_ABST
Patent Text Reader

Abstract

This invention discloses a method for detecting internal and external fuel tank caps of automobiles based on a combination of VMamba and YOLOv8n. First, images of internal and external fuel tank caps of automobiles are acquired to construct an initial dataset. The images in the dataset are preprocessed and then partitioned. Next, based on the VMamba framework, the network structure of YOLOv8n is improved to construct a detection model for internal and external fuel tank caps of automobiles. The model is then trained based on the dataset. Finally, the trained model is used to detect internal and external fuel tank caps of automobiles. The solution of this invention uses a network structure of YOLOv8n based on the VMamba framework to construct a detection model for internal and external fuel tank caps of automobiles. On the one hand, it directly predicts the center of the object, simplifying the detection process. On the other hand, by introducing a 2D-Selective-Scan (SS2D) module, it can effectively process global and local information of the image while maintaining linear complexity, enabling high-precision real-time detection of internal and external fuel tank caps of automobiles under various lighting conditions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the fields of deep learning and computer vision, specifically relating to a method for detecting the internal and external fuel tank caps of automobiles based on the combination of Vmamba and YOLOv8n. Background Technology

[0002] In the field of object detection, especially for detecting interior and exterior fuel tank caps of cars, traditional convolutional neural networks (CNNs) and Transformer architectures have achieved significant results, but some limitations remain. For example, CNNs are limited by their local receptive fields when capturing long-range dependencies, while the self-attention mechanism of Transformers has high computational complexity and high memory consumption when processing large-scale images. These limitations are particularly pronounced in small object detection tasks such as car fuel tank caps, as they are typically small in size and may be occluded, increasing the difficulty of detection.

[0003] Among them, the VMamba framework based on the State-Space Model (SSM) has attracted attention due to its advantages in capturing long-range dependencies and global modeling. By introducing the 2D-Selective-Scan (SS2D) module, the VMamba framework can effectively process global and local information of images while maintaining linear complexity, which is particularly important when dealing with small object detection tasks.

[0004] However, despite the many theoretical advantages of the VMamba framework, its performance and efficiency still need further verification and optimization in practical applications, especially in the specific field of detecting fuel tank caps inside and outside automobiles. Summary of the Invention

[0005] To address the aforementioned problems, the present invention aims to provide a method for detecting the internal and external fuel tank caps of automobiles based on the combination of Vmamba and YOLOv8n.

[0006] The specific technical solution for achieving the objective of this invention is as follows:

[0007] A method for detecting internal and external fuel tank caps in automobiles based on the combination of Vmamba and YOLOv8n includes the following steps:

[0008] Step 1: Collect photos of the inside and outside fuel tank caps of a car to build an initial dataset;

[0009] Step 2: Preprocess the photos in the dataset and divide the preprocessed dataset;

[0010] Step 3: Based on the VMamba framework, improve the network structure of YOLOv8n, build a detection model for the internal and external fuel tank caps of automobiles, and train the model based on the dataset;

[0011] Step 4: Use the trained vehicle internal and external fuel tank cap detection model to detect the vehicle internal and external fuel tank caps.

[0012] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0013] The present invention employs a YOLOv8n network structure based on the VMamba framework to construct a detection model for the inner and outer fuel tank caps of automobiles. The overall network adopts the YOLOv8n structure. YOLOv8 is an anchorless model that directly predicts the center of the object, simplifying the detection process. Among the YOLOv8 series, YOLOv8n is the smallest model, the fastest, and easiest to use for video detection. The VMamba framework, by introducing the 2D-Selective-Scan (SS2D) module, can effectively process global and local information of the image while maintaining linear complexity, which is particularly important when handling small target detection tasks such as the inner fuel tank cap of a car. Furthermore, in this model structure, the C2f structure in the backbone network is replaced with the ODSSBlock structure, reducing some network parameters and ensuring real-time video detection.

[0014] The present invention will be further described below with reference to specific embodiments. Attached Figure Description

[0015] Figure 1 This is a schematic diagram of the process for detecting the internal and external fuel tank caps of automobiles based on the combination of Vmamba and YOLOv8n according to the present invention.

[0016] Figure 2 This is a schematic diagram of the automotive internal and external fuel tank cap detection model of the present invention.

[0017] Figure 3 This is a graph showing the loss function of the improved YOLOv8 model of this invention.

[0018] Figure 4 This is an image showing the identification of the inner and outer covers of a car fuel tank under high light conditions, as described in an embodiment of the present invention.

[0019] Figure 5 This is an image showing the identification of the inner and outer covers of a car fuel tank under low-light conditions in an embodiment of the present invention. Detailed Implementation

[0020] Example

[0021] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. 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] As indicated in this application and claims, unless the context clearly indicates otherwise, the words "a," "an," "an," and / or "the" do not specifically refer to the singular and may also include the plural. Generally speaking, the terms "comprising" and "including" only indicate the inclusion of explicitly identified steps and elements, which do not constitute an exclusive list, and the method or apparatus may also include other steps or elements.

[0023] Unless otherwise specifically stated, the relative arrangement, numerical expressions, and values ​​of the components and steps described in these embodiments do not limit the scope of this application. It should also be understood that, for ease of description, the dimensions of the various parts shown in the drawings are not drawn to actual scale. Techniques, methods, and devices known to those skilled in the art may not be discussed in detail, but where appropriate, such techniques, methods, and devices should be considered part of the specification. In all examples shown and discussed herein, any specific values ​​should be interpreted as merely exemplary and not as limitations. Therefore, other examples of exemplary embodiments may have different values. It should be noted that similar reference numerals and letters in the following drawings denote similar items; therefore, once an item is defined in one drawing, it need not be further discussed in subsequent drawings.

[0024] Combination Figure 1 A method for detecting the internal and external fuel tank caps of automobiles based on the combination of Vmamba and YOLOv8n includes the following steps:

[0025] Step 1: Collect photos of the car's internal and external fuel tank caps to build the initial dataset:

[0026] Collect photos of the car's interior and exterior fuel tank caps from different angles, under different lighting conditions, and in different locations, and shuffle them to form an initial dataset.

[0027] In specific operations, a camera can be used to collect photos of the car's interior and exterior fuel tank caps from different angles and under different lighting conditions when the caps are open, or photos of the car's interior and exterior fuel tank caps when the caps are open can be collected via the network.

[0028] In this embodiment, 100 photos of the inside and outside fuel tank caps of a car with the cap open were captured by an industrial camera at different angles and under different lighting conditions. In addition, 1,400 photos of the inside and outside fuel tank caps of a car with the cap open were collected by the network. The above images were shuffled and mixed with the images captured under different lighting conditions, different angles, and different positions to create a complex initial dataset of 1,500 high-definition images.

[0029] Step 2: Preprocess the photos in the initial dataset and divide the preprocessed dataset into parts, including:

[0030] First, preprocessing is performed, including scaling the image and adjusting its size to meet the model's requirements while maintaining the original aspect ratio. In this embodiment, the input size of the corresponding YOLOv8 model is 640×640×3. The output feature maps of the model at each scale are superimposed to obtain 4 prediction boxes, 1 confidence score, and 2 class probabilities corresponding to 1500 feature maps.

[0031] Normalize the image pixel values;

[0032] The image is subjected to data augmentation and labeling processing. The data augmentation processing includes mosaic enhancement, blending enhancement, random perturbation, color perturbation processing, as well as confidence filtering and non-maximum suppression processing.

[0033] The labeling process includes selecting and labeling the outer and inner covers of the car fuel tank in the dataset photos, and obtaining the category, height, width, and position information of the recognition boxes of the outer and inner covers of the car fuel tank.

[0034] Finally, the preprocessed dataset is divided into training, testing, and validation sets according to a certain ratio.

[0035] Step 3: Based on the VMamba framework, improve the network structure of YOLOv8n, build a detection model for the internal and external fuel tank caps of automobiles, and train the model based on the dataset;

[0036] Specifically:

[0037] Combination Figure 2 The vehicle internal and external fuel tank cap detection model is built based on the YOLOv8n network architecture and includes a feature extraction unit, a feature fusion unit, and a detection unit.

[0038] The feature extraction unit is implemented based on an improved Vmamba Backbone network, including Conv convolutional layers and ODSSBlock layers, and is used to extract image features. The specific process is as follows:

[0039] (1) Input the image into the 0th Conv convolutional layer to perform preliminary feature extraction. The output is an image with a size of 1 / 2 of the original input image. In this embodiment, the input of the 0th layer is a 640*640*3 image, and the output feature map size is 320*320*64, with a length and width of 1 / 2 of the original input image.

[0040] (2) The output image of the 0th Conv convolutional layer is used as the input of the 1st Conv convolutional layer. The 1st Conv convolutional layer is used to extract further features. The output is an image that is 1 / 4 the size of the original input image. In this embodiment, the output feature map of the 1st Conv convolutional layer is 160*160*128, and the length and width are 1 / 4 of the original input image.

[0041] (3) The second ODSS Block layer receives the feature image from the first Conv convolutional layer as input. First, it effectively extracts local spatial information through depthwise separable convolution. Then, it performs batch normalization to provide a certain degree of regularization effect and reduce overfitting. The input image is divided into a series of sub-images, each sub-image representing a specific direction. The image is scanned and expanded along four symmetrical directions. Feature extraction is performed on the sub-images in each direction. The features in different directions are merged to form an output image of the same size as the input image.

[0042] More specifically, the ODSS Block layer receives input feature Z l-3 The input channel is subjected to depthwise separable convolution, with each channel operated on independently, followed by batch normalization to reduce overfitting. The intermediate states are then mixed using 1×1 convolutions to blend channel information, and a non-linear GeLU activation function is used to enhance feature representation. The processed feature map is compared with the original input Z. l-3 The output Z of the local spatial block is obtained by residual connection fusion. l-2 ;

[0043] The output Z of the local space block l-2 After SS2D processing, the input image is first divided into a series of sub-images using Scan Expansion, each sub-image representing a specific direction. The scan is performed along four symmetrical directions: up-down, down-up, left-right, and right-left. Then, S6 Block is used to extract features from these sub-images. Finally, Scan Merge is used to merge these sub-images to form an output image of the same size as the input image.

[0044] Then, a 1x1 convolution is applied to the output Z of SS2D. l-1 Create a branch and exist Depthwise separable convolutions are used as position encoding modules on the branches, and gradient backflow efficiency during training is improved through residual connections.

[0045] The information flow of each layer is controlled using a nonlinear GeLU activation function, and element-wise multiplication is used. The branches are merged, then fused with global features via 1x1 convolutions, and finally connected to the original input Z via residual connections. l-2 Add;

[0046] The output Z of RG Block l Input Z before SS2D processing l-3 The residuals are summed to obtain the final output feature Z. l .

[0047] The output feature map size of this layer remains 160*160*128;

[0048] (4) The output of the ODSS Block layer is used as the input to the next Conv convolutional layer. The output is an image that is 1 / 8 the size of the original input image. In this embodiment, the output feature map size is 80*80*256.

[0049] (5) After that, the image is repeatedly input into the Conv convolutional layer and ODSS Block layer of layers 3-8, and finally the final image feature information is extracted through the SPPF layer in the ninth layer.

[0050] The feature fusion unit is implemented based on the Neck network and performs feature fusion through a feature pyramid network.

[0051] The detection unit is implemented based on a Head network. It uses EIoU as the localization loss function of YOLOv8 as the basis for final identification through bounding box regression and category classification.

[0052] The process by which the Head network achieves identification is as follows:

[0053] The detection unit outputs the predicted bounding box of the fuel tank cap, determines the area of ​​the intersection and union of the predicted bounding box and the true bounding box, and determines the IoU loss based on this, thereby determining the EIoU loss L:

[0054] L = L IoU +L asp +L dis

[0055]

[0056] L IoU =1-IoU

[0057]

[0058]

[0059] Where w, h, and b are the width, height, and center point of the predicted bounding box, respectively; w gt and h gt These are the width and height of the actual bounding box; w c and h c A is the width and height of the smallest bounding rectangle containing the two boxes. i A represents the area of ​​the intersection between the predicted bounding box and the ground truth bounding box. u The area represents the union of the predicted bounding box and the ground truth bounding box, and ρ represents the center point b of the predicted bounding box and the center point b of the ground truth bounding box. gt Euclidean distance;

[0060] After obtaining the predicted bounding boxes, the model uses the EIOU loss function to calculate the difference between the predicted boxes and the corresponding ground truth boxes. This includes calculating the IOU, center distance loss, and aspect ratio loss, and then summing them to form the EIOU loss.

[0061] After the loss function is calculated, backpropagation is performed. The backpropagation algorithm calculates the gradient of the loss function with respect to the model parameters. Using the calculated gradient, the model parameters are updated through an optimization algorithm to reduce the value of the loss function, thereby reducing the difference between the predicted bounding box and the ground truth bounding box.

[0062] Through multiple iterations of training, the model gradually learns how to predict bounding boxes more accurately. In each iteration, the model updates its parameters based on the EIOU loss function. After a sufficient number of training iterations, the model will converge on the loss function.

[0063] That is, based on the value of EIoU loss L, the parameters of the vehicle internal and external fuel tank cap detection model are continuously optimized during the model training process until the vehicle internal and external fuel tank cap detection model meets the set requirements after multiple iterations of training, and the model training is completed.

[0064] like Figure 3 The figure shows the curves of the loss function in this embodiment during training and validation, which are bounding box loss, classification loss, feature point loss, precision and recall, respectively.

[0065] Figure 4 This is an image showing the identification of the inner and outer fuel tank covers of a car under high light conditions in this embodiment. Figure 5 This is an image showing the identification of the inner and outer fuel tank caps of a car under low light conditions in this embodiment. It can be seen that the improved detection model for the inner and outer fuel tank caps of the present invention is quite accurate in both high light and low light conditions.

[0066] Step 4: Use the trained vehicle internal and external fuel tank cap detection model to detect the vehicle internal and external fuel tank caps.

[0067] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that the processor performs the following steps when executing the computer program:

[0068] Step 1: Collect photos of the inside and outside fuel tank caps of a car to build an initial dataset;

[0069] Step 2: Preprocess the photos in the initial dataset and divide the preprocessed dataset;

[0070] Step 3: Based on the VMamba framework, improve the network structure of YOLOv8n, build a detection model for the internal and external fuel tank caps of automobiles, and train the model based on the dataset;

[0071] Step 4: Use the trained vehicle internal and external fuel tank cap detection model to detect the vehicle internal and external fuel tank caps.

[0072] A computer-storable medium having a computer program stored thereon, characterized in that the computer program, when executed by a processor, performs the following steps:

[0073] Step 1: Collect photos of the inside and outside fuel tank caps of a car to build an initial dataset;

[0074] Step 2: Preprocess the photos in the initial dataset and divide the preprocessed dataset;

[0075] Step 3: Based on the VMamba framework, improve the network structure of YOLOv8n, build a detection model for the internal and external fuel tank caps of automobiles, and train the model based on the dataset;

[0076] Step 4: Use the trained vehicle internal and external fuel tank cap detection model to detect the vehicle internal and external fuel tank caps.

[0077] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this patent application should be determined by the appended claims.

Claims

1. A method for detecting the inside and outside tank cover of a car based on the combination of Vmamba and YOLOv8n, characterized in that, The method comprises the following steps: Step 1, collecting photos of the inner and outer oil tank covers of the automobile to construct an initial data set; Step 2, preprocessing the photos in the initial data set, and dividing the preprocessed data set; Step 3, improving the network structure of YOLOv8n based on the VMamba framework, constructing an automobile inner and outer oil tank cover detection model, and training the model based on the data set: The automobile inner and outer oil tank cover detection model is constructed based on the YOLOv8n network architecture, and comprises a feature extraction unit, a feature fusion unit and a detection unit; The feature extraction unit is realized based on the improved Vmamba Backbone network, and comprises a Conv convolutional layer and an ODSSBlock layer, which is used for extracting image features; The feature fusion unit is realized based on the Neck network, and performs feature fusion through a feature pyramid network; The detection unit is realized based on the Head network, and performs regression of the bounding box and classification of the class through the EIoU as the positioning loss function of YOLOv8 as the basis for final identification; Step 4, detecting the inner and outer oil tank covers of the automobile by using the trained automobile inner and outer oil tank cover detection model.

2. The method for detecting the inside and outside tank cap of the car based on the combination of Vmamba and YOLOv8n according to claim 1, characterized in that, The initial data set in step 1 is specifically: Collecting photos of the inner and outer oil tank covers of the automobile under different angles, different illuminations and different positions, and shuffling the order to form the initial data set.

3. The method for detecting the inside and outside tank cap of the car based on the combination of Vmamba and YOLOv8n according to claim 1, characterized in that, The preprocessing and division of the photos in the data set in step 2 are specifically: Adjusting the image size to make the maximum size meet the model requirements while maintaining the original aspect ratio of the image; Normalizing the image pixel values; Performing data enhancement processing and labeling processing on the image, wherein the data enhancement processing includes mosaic enhancement, mixed enhancement, random disturbance and color disturbance processing; Finally, the preprocessed data set is divided into a training set, a test set and a validation set according to a certain proportion.

4. The method for detecting the inside and outside tank cap of the car based on the combination of Vmamba and YOLOv8n according to claim 3, characterized in that, The labeling processing includes respectively framing and labeling the outer and inner covers of the automobile oil tank in the data set photos, and obtaining the class, height, width and position information of the recognition box of the outer and inner covers of the automobile oil tank.

5. The method for detecting the inside and outside tank cap of the car based on the combination of Vmamba and YOLOv8n according to claim 1, characterized in that, The process of extracting image features is: (1) input the image into the 0th layer Conv convolutional layer to extract the initial features, and output an image with a size of 1 / 2 of the original input image; (2) the output image of the 0th layer Conv convolutional layer is input into the 1st layer Conv convolutional layer to further extract the features, and output an image with a size of 1 / 4 of the original input image; (3) the 2nd layer ODSS Block layer receives the feature image from the 1st layer Conv convolutional layer as input, first extracts local spatial information through depth separable convolution, then provides a certain degree of regularization effect through batch normalization to reduce overfitting, and divides the input image into a series of sub-images, each sub-image represents a certain direction, scans and expands along four symmetric directions, extracts features for each direction sub-image, and combines the features of different directions to form an output image with the same size as the input image; (4) The output of the ODSS Block layer is taken as the input of the next Conv convolutional layer, and the output is an image with an original input image size of 1 / 8; (5) After the image is repeatedly input into the Conv convolutional layer and the ODSS Block layer, the final image feature information is extracted through the SPPF layer.

6. The method for detecting the inside and outside tank cap of the car based on the combination of Vmamba and YOLOv8n according to claim 1, characterized in that, The process of the Head network for recognition is as follows: The detection unit outputs the predicted bounding box of the fuel tank cover, determines the intersection and union areas of the predicted bounding box and the real bounding box of the fuel tank cover, and determines the IoU loss based on the areas, so as to determine the EIoU loss L: ; ; ; ; ; where w, h, b are the width, height and center point of the predicted bounding box, respectively; and are the width and height of the true bounding box; and are the width and height of the minimum enclosing rectangle containing both boxes, denotes the intersection area of the predicted bounding box and the true bounding box, denotes the union area of the predicted bounding box and the true bounding box, and p denotes the Euclidean distance between the center point b of the predicted bounding box and the center point of the true bounding box. The value of the EIoU loss L is continuously optimized in the model training process to optimize the parameters of the automobile inner and outer fuel tank cover detection model, until the automobile inner and outer fuel tank cover detection model meets the set requirements after multiple iterations, and the training of the model is completed.

7. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the steps of the method of claims 1-6.

8. A computer storable medium having stored thereon a computer program, characterized in that The computer program is executed by the processor to implement the steps of the method of claims 1-6.

Citation Information

Patent Citations

  • Vehicle detection method based on improved YOLOv4 model

    CN114283390A

  • Vehicle-mounted target detection method based on improved YOLOv5

    CN115731533A