Target detection method and device, and computer-readable medium
By using the dense connection layer to replace the residual connection layer in the target detection model, the DE-YOLO model is designed, which solves the problem of information loss and large size of the YOLO model, improves the detection speed and accuracy, and is suitable for edge computing scenarios. .
Patent Information
- Application Number
- PCT/CN2024/076989
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-02-28
- Filing Date
- 2024-02-08
- Publication Date
- 2024-09-06
AI Technical Summary
Existing target detection models such as the YOLO model have problems such as information loss, large model size, high computing power requirements, and slow running speed during target detection, making it difficult to meet the needs of some real-time and edge computing scenarios.
The dense connection layer is used to replace the residual connection layer in the YOLO model, and a new target detection model DE-YOLO is designed. The dense connection layer improves the information reuse rate, reduces information loss, compresses model parameters, reduces computing power requirements, and Densely connected layers and auxiliary connected layers are used in the feature extraction module to improve detection accuracy and speed.
It is possible to reduce the size of the target detection model, reduce the demand for computing power, and speed up the operation while ensuring the detection accuracy remains unchanged. It is especially suitable for edge computing scenarios. The size is reduced by 80% and the detection speed is improved.
Smart Images

Figure CN2024076989_06092024_PF_FP
Abstract
Description
Method and device for target detection, and computer-readable medium
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This patent application claims priority to Chinese patent application 202310222336.1 filed with the State Intellectual Property Office of China on February 28, 2023, and the disclosure of this Chinese patent application is incorporated herein by reference in its entirety. Technical Field
[0003] The present disclosure relates to the technical field of target detection, and in particular to a target detection method and device, and a computer-readable medium. Background Art
[0004] The technology of analyzing images to identify specific targets (such as people, specific objects, etc.) (target detection) has been widely used in intelligent monitoring, intelligent driving, smart classrooms and other fields.
[0005] Summary of the Invention
[0006] The present disclosure provides a method and device for target detection, and a computer-readable medium.
[0007] In a first aspect, an embodiment of the present disclosure provides a method for object detection, comprising: inputting an original image into a preset object detection model; and
[0008] Receive the target detection results output by the target detection model;
[0009] Among them, the target detection model includes a feature extraction module and a detection module; the feature extraction module includes multiple processing layers connected in sequence, wherein a part of the multiple processing layers are convolution layers, and another part of the multiple processing layers are feature connection layers for outputting feature images to the detection module, and the feature connection layers are densely connected layers, and the scales of feature images output by different feature connection layers are different; the detection module is used to perform target detection based on the feature images.
[0010] In some embodiments, the target detection model is a YOLO model, and the detection module is a YOLO detection module.
[0011] In a second aspect, an embodiment of the present disclosure provides a device for target detection, which includes one or more memories and one or more processors; the memory stores a computer program that can be executed by the processor, and when the computer program is executed by the processor, it implements any one of the target detection methods of the embodiments of the present disclosure.
[0012] In a third aspect, an embodiment of the present disclosure provides a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements any one of the target detection methods of the embodiments of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] In the accompanying drawings of the embodiments of the present disclosure:
[0014] FIG1 is a schematic diagram of the structure of a target detection model in the related art;
[0015] FIG2 is a flow chart of a method for target detection provided by an embodiment of the present disclosure;
[0016] FIG3 is a flow chart of another target detection method provided by an embodiment of the present disclosure;
[0017] FIG4 is a schematic diagram of the structure of a target detection model used in a target detection method provided by an embodiment of the present disclosure;
[0018] FIG5 is a schematic diagram of the structure of a densely connected layer of a target detection model used in a target detection method provided by an embodiment of the present disclosure;
[0019] FIG6 is a schematic diagram of the structure of an object detection model used in another object detection method provided by an embodiment of the present disclosure;
[0020] FIG7 is a schematic diagram of the structure of an object detection model used in another object detection method provided by an embodiment of the present disclosure;
[0021] FIG8 is a block diagram of a target detection device provided by an embodiment of the present disclosure;
[0022] FIG9 is a block diagram of a computer-readable medium according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0023] To enable those skilled in the art to better understand the technical solutions of the present disclosure, the target detection method and device, and computer-readable medium provided by the embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.
[0024] The present disclosure will be described more fully hereinafter with reference to the accompanying drawings, but the illustrated embodiments may be embodied in different forms, and the present disclosure should not be construed as limited to the embodiments set forth below. Rather, these embodiments are provided so that the present disclosure will be thorough and complete and will fully understand the scope of the present disclosure to those skilled in the art.
[0025] The accompanying drawings of the embodiments of the present disclosure are used to provide a further understanding of the embodiments of the present disclosure and constitute a part of the specification. Together with the detailed embodiments, they are used to explain the present disclosure and do not constitute a limitation of the present disclosure. The above and other features and advantages will become more apparent to those skilled in the art by describing the detailed embodiments with reference to the accompanying drawings.
[0026] The present disclosure may be described with reference to plan views and / or cross-sectional views by way of ideal schematic views of the present disclosure. Therefore, the exemplary illustrations may be modified according to manufacturing techniques and / or tolerances.
[0027] In the absence of conflict, the various embodiments of the present disclosure and the various features therein may be combined with each other.
[0028] The terms used in this disclosure are only used to describe specific embodiments and are not intended to limit the disclosure. As used in this disclosure, the term "and / or" includes any and all combinations of one or more related enumerated items. As used in this disclosure, the singular forms "a" and "the" are also intended to include plural forms, unless the context clearly indicates otherwise. As used in this disclosure, the terms "comprising" and "made of" specify the presence of the features, wholes, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or groups thereof.
[0029] Unless otherwise defined, all terms (including technical and scientific terms) used in this disclosure have the same meanings as those commonly understood by those skilled in the art. It will also be understood that terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with their meaning in the context of the relevant art and this disclosure, and will not be interpreted as having an idealized or overly formal meaning unless expressly defined in this disclosure.
[0030] The present disclosure is not limited to the embodiments shown in the drawings, but includes modifications of the configurations formed based on the manufacturing process. Therefore, the regions illustrated in the drawings have schematic properties, and the shapes of the regions shown in the drawings illustrate the specific shapes of the regions of the elements, but are not intended to be limiting.
[0031] In some related technologies, a YOLO (You Only Look Once) model can be used for target detection.
[0032] The YOLO model (such as the YOLO V3 model) is a deep learning model based on convolutional neural networks (CNNs). It analyzes raw input images to detect specific targets (target detection), identify the target type (target recognition), and determine the target's location (target localization). Compared to traditional target detection models, such as the Faster R-CNN model, the YOLO model has higher speed (real-time performance) and higher accuracy.
[0033] For example, referring to FIG1 , in some related technologies, a YOLO model may include a feature extraction module and a detection module.
[0034] The feature extraction module includes multiple sequentially connected convolution (Conv) layers and multiple residual connection layers. Each convolution layer includes at least one convolution kernel, and uses the convolution kernel to perform a convolution operation on the input image to produce an output image; the residual connection layer is used to perform a residual operation on the input image to produce an output image. In addition to inputting the generated image into the subsequent layer (such as the subsequent convolution layer), the multiple residual connection layers also input the generated image as a "feature image (Box information)" into the detection module.
[0035] The feature images generated by different residual connection layers have different scales (sizes), so that the detection module can obtain information of the original image at different scales for analysis to achieve target detection.
[0036] However, the YOLO model in related technologies will cause a lot of information loss. Therefore, if the accuracy requirements are to be met, the model is still large in size, requires more computing power, and runs slowly, which cannot meet the needs of some situations (such as edge detection).
[0037] An embodiment of the present disclosure provides a method for target detection.
[0038] The embodiments of the present disclosure are used to detect specific targets (such as people, specific objects, etc.) in original images (such as images captured by an image capture device) to achieve target detection.
[0039] While detecting a specific target from the original image, it is usually also possible to determine the type of the specific target (such as whether the target is a person or a specific object), as well as the position of the specific target in the original image. Therefore, the embodiments of the present disclosure can also realize target recognition and target positioning.
[0040] 2 , the target detection method according to an embodiment of the present disclosure includes steps S101 and S102 .
[0041] In step S101, the original image is input into a preset object detection model.
[0042] In step S102, the target detection result output by the target detection model is received.
[0043] The object detection model includes a feature extraction module and a detection module. The feature extraction module comprises multiple sequentially connected processing layers, some of which are convolutional layers, and some of which are feature connection layers that output feature images to the detection module. The feature connection layers are densely connected layers, and different feature connection layers output feature images at different scales. The detection module performs object detection based on the feature images.
[0044] In an embodiment of the present disclosure, the original image to be detected is input into a preset target detection model (such as a deep learning model) and processed by the target detection model to obtain corresponding target detection results. The target detection results may include whether there is a specific target in the original image, as well as the type and location of the specific target.
[0045] 4 , the target detection model used in the embodiment of the present disclosure includes a feature extraction module and a detection module.
[0046] The feature extraction module is used to extract multiple feature images of different scales (sizes) from the original image and output these feature images to the detection module. The feature image of each scale mainly reflects the feature information of the original image at that scale.
[0047] The detection module is used to analyze the input feature images of various scales to detect specific targets in the original image and obtain target detection results.
[0048] The specific form of the detection module is diverse. For example, it can adopt the detection module in the target detection model of the related technology, which will not be described in detail here.
[0049] Referring to Figure 4 , the feature extraction module includes multiple sequentially connected processing layers, i.e., the output of the previous processing layer is connected to the input of the next processing layer. The specific types of processing layers vary; for example, some of the multiple processing layers may be convolutional layers, and some of the multiple processing layers may be feature connection layers. Because of the convolutional layers, the object detection model is a convolutional neural network (CNN).
[0050] Each convolutional layer includes at least one convolution kernel, which is used to perform a convolution operation on the input image to produce an output image. Depending on the convolution kernel size, stride, and padding, the output image of each convolutional layer may remain the same or be scaled down relative to the input image.
[0051] The feature connection layer is a connection layer that can be used to extract features from an image. In addition to outputting the generated image to the next processing layer (such as the convolutional layer), the feature connection layer also outputs the generated image to the detection module. The image output to the detection module is called a feature image.
[0052] The processing layer includes multiple feature connection layers, and at least one convolution layer that can reduce the image scale is provided between any adjacent feature connection layers, so that the scales of the feature images generated by each feature connection layer are different. Compared with the first processing layer that receives the original image, the scales of the feature images generated by the later feature connection layers are smaller.
[0053] In the embodiment of the present disclosure, the feature connection layer takes the form of a dense connection layer.
[0054] Densely connected layer, also known as densely connected network (Dense Net), is a form of connection layer.
[0055] Referring to Figure 5, a densely connected layer includes one or more densely connected blocks (Dense Block), each of which includes at least three sequentially connected dense convolutional layers (each dense convolutional layer includes at least one convolution kernel). Within each densely connected block, the output of each dense convolutional layer is simultaneously connected to the input of all subsequent dense convolutional layers, and correspondingly, the input of each dense convolutional layer is also simultaneously connected to the output of all preceding dense convolutional layers.
[0056] In some embodiments, each densely connected layer includes a densely connected block, each densely connected block includes at least three dense convolutional layers connected in sequence; each dense convolutional layer is used to receive the output data of all dense convolutional layers before it in the densely connected block, perform a convolution operation on the received output data to generate its own output data, and output its own output data to all dense convolutional layers after it in the densely connected block.
[0057] It can be seen that the work performed by each dense convolutional layer is actually to simultaneously receive the output data of all densely connected layers before it in the same densely connected block as its own input data, and convolve its own input data to obtain its own output data, and output its own output data to all densely connected layers after it in the same densely connected block.
[0058] It should be understood that the first dense convolution layer in each densely connected block only receives input data from outside the densely connected block to the densely connected block; and the last dense convolution layer in each densely connected block only outputs its own output data outside the densely connected block, and the output data of the last dense convolution layer in each densely connected block is the output data of the densely connected block.
[0059] As can be seen, for a conventionally connected layer with (N+1) convolutional layers, the total number of connections (one connection between every two adjacent convolutional layers) is N, while for a densely connected block with (N+1) dense convolutional layers, the total number of connections is N(N+1) / 2. Therefore, densely connected layers achieve "dense connections" between different parts, increasing information exchange between them and alleviating the vanishing gradient problem, thereby improving information reuse, reducing information loss, and compressing model parameters.
[0060] The dense connection layer may include one or more dense connection blocks. Referring to FIG5 , when the dense connection layer includes multiple dense connection blocks, different dense connection blocks may further be provided with connection convolution layers, downsampling layers, etc.
[0061] Referring to Figure 1, in some related technologies (such as the YOLO model), a residual connection layer can be used as a feature connection layer to output a feature image. This layer, while still a type of connection layer, has certain limitations compared to dense connection layers when extracting and transmitting feature information. This can result in significant information loss and can easily lead to false detections, especially for small or densely packed objects.
[0062] The disclosed embodiment uses a dense connection layer (such as replacing the residual connection layer in the YOLO model) in the target detection model to extract feature images, thereby shortening the connection length, improving the information reuse rate, and reducing information loss. In this way, while ensuring the accuracy remains unchanged (especially for small-sized targets or dense targets), the model parameters are compressed, the size of the target detection model is reduced, the demand for computing power is reduced, and the running speed is accelerated.
[0063] In some related technologies, after an image acquisition device (such as a camera) captures an image, it can send the image to a cloud server, which then performs unified object detection on the image and sends the object detection results to the application scenario. However, this method consumes a lot of transmission bandwidth, reduces the real-time performance of object detection, and causes excessive pressure on the server.
[0064] To this end, edge computing technology can be used, that is, using edge devices (such as image acquisition devices) to directly perform target detection. However, edge devices are not dedicated servers, so their storage space and computing power are often relatively limited. The target detection model used in the embodiments of this disclosure is small in size and requires little computing power, making it particularly suitable for target detection using edge computing.
[0065] In some embodiments, the target detection model is a YOLO model, and the detection module is a YOLO detection module.
[0066] As one embodiment of the present disclosure, the object detection model may specifically adopt the basic form of the YOLO (You Only Look Once) model in the related art (of course, not identical), for example, the basic form of the YOLO V3 model. Accordingly, the detection module in the object detection model of the embodiment of the present disclosure may also be the YOLO detection module in the YOLO model.
[0067] It should be understood that the object detection model of the present embodiment uses a densely connected layer as a feature connection layer in the feature extraction module, which is different from the existing YOLO model. Therefore, the object detection model used in the present embodiment can be regarded as a new YOLO model, such as the DE-YOLO model.
[0068] In some embodiments, at least one processing layer is an auxiliary connection layer; the auxiliary connection layer is a dense connection layer; and at least one convolution layer is provided between any auxiliary connection layer and the feature connection layer.
[0069] 6 , the auxiliary connection layer is also in the form of a dense connection layer, but the image it generates is not output to the detection module, so it does not belong to the feature connection layer; and any auxiliary connection layer and feature connection layer also has at least one convolution layer (belonging to the processing layer).
[0070] In some embodiments, each feature connection layer corresponds to multiple sequentially connected repeating units; each repeating unit includes n sequentially connected convolutional layers and a dense connection layer located after all the convolutional layers, where n is an integer greater than or equal to 2; among all the repeating units corresponding to each feature connection layer, the dense connection layer in the last repeating unit is the feature connection layer, and the dense connection layers in other repeating units are auxiliary connection layers.
[0071] Referring to Figure 1, in some related technologies, the output of each scale may correspond to multiple serially connected repeating units with the same structure (i.e., a "group" of repeating units), where each repeating unit has a convolutional layer and a connection layer (residual connection layer), but only the connection layer of the last repeating unit outputs the image (i.e., the feature connection layer).
[0072] In each figure, "2*, 8*" before the dotted box indicates the number of times the structure of the dotted box is repeated in series (2 times, 8 times), and for repeating units, it indicates the number of repeating units in the group of repeating units.
[0073] It can be seen that, in addition to the repeating units corresponding to the characteristic connection layer, which can be repeated multiple times, other structures can also be repeated multiple times, which are also represented by the above "8*" form.
[0074] Referring to Figure 6 , the output of each scale (i.e., each feature connection layer) in the disclosed embodiment can also correspond to a set of repeating units, where the densely connected layer in the last repeating unit is the feature connection layer, while the densely connected layers in the remaining repeating units are all auxiliary connection layers with no output. This shows that by adding more auxiliary connection layers (densely connected layers) with no output, the generated feature image can be enriched with information.
[0075] To ensure that the content is clearly visible within the limited size of the accompanying drawings, only a group of repeating units corresponding to the output of the first scale is separately represented in FIG6 (the repeating units of the other groups are still represented in the form of "8*"), and this group of repeating units includes only two repeating units, and each repeating unit has only one convolutional layer; however, it should be understood that the above specific numbers, etc., are not limitations on the scope of protection of the embodiments of the present disclosure.
[0076] In some embodiments, referring to FIG. 3 , before the original image is input into a preset object detection model, steps S1001 and S1002 are further included.
[0077] In step S1001, a clustering algorithm is used to cluster a preset training sample set to obtain a plurality of candidate training samples.
[0078] The training sample set includes multiple training samples.
[0079] In step S1002, the preset original model is trained using the candidate training samples to obtain a target detection model.
[0080] In some embodiments, the clustering algorithm includes a K-means clustering algorithm.
[0081] Before using the target detection model to perform target detection, the target detection model may be trained first (of course, the trained target detection model can be used for multiple target detections). The target detection model training process generally includes steps A101 to A104.
[0082] In step A101, a training sample set is set.
[0083] The training sample set includes a large number of preset training samples (different images), and the specific targets in the training samples have been labeled.
[0084] In step A102, a training sample is input as an original image into the original model for target detection.
[0085] In step A103, the parameters in the original model are adjusted according to the gap between the target detection results of the original model for the training samples and the labeled standard results (loss function loss).
[0086] In step A104, if the training end condition is met, the training is ended; if the training end condition is not met, a new training sample is selected and the process returns to step A102 to continue training.
[0087] The training end conditions may include the model achieving a certain effect (such as reaching a certain accuracy), the model parameters converging, reaching a predetermined number of training times, etc., which will not be described in detail here.
[0088] For example, verification samples can be set in advance (such as using part of the training samples as verification samples), and the verification samples can be input into the trained model. Based on the accuracy of the model's detection of the verification samples, it is determined whether the training end conditions are met.
[0089] In the embodiment of the present disclosure, a cluster analysis is first performed on a large number of training samples in the training sample set, such as k-means cluster analysis, to select training samples with similar features that are suitable for training the target detection model as candidate training samples for use in the actual training process.
[0090] Research has found that compared with the method of directly using all training samples for training, using clustered training samples for training can effectively improve training efficiency, achieve rapid convergence of model parameters, fully compress model parameters, reduce the size of the obtained target detection model, and improve its detection accuracy.
[0091] It should be understood that before the feature connection layer (repeating unit), other forms of connection layers (which do not output feature images, so are not feature connection layers; and are not in the form of dense connection layers, so are not auxiliary connection layers) and convolutional layers may be provided. For example, the connection layer may specifically be a residual connection layer, or a residual network.
[0092] It should be understood that in order to realize edge computing, it is necessary to reduce the size of the target detection model. Therefore, referring to Figures 4, 6, 7, etc., the embodiment of the present disclosure may also have only the structure of the corresponding feature connection layer (such as a repeating unit) without other structures such as the residual connection layer.
[0093] In some embodiments, the target detection model also includes: a feature convolution layer corresponding to each feature connection layer; the feature convolution layer is connected between the output of the feature connection layer corresponding to it and the input of the detection module, and is used to convolve the feature image output by the feature connection layer corresponding to it and output it to the detection module.
[0094] Referring to Figure 6, as an implementation method of the embodiment of the present disclosure, each feature connection layer also has a corresponding feature convolution layer (each feature convolution layer includes at least one convolution kernel), and the feature convolution layer is arranged between the corresponding feature connection layer and the detection module, so that the feature image generated by the feature connection layer needs to undergo convolution operation before entering the detection module.
[0095] In some embodiments, except for the feature connection layer that outputs the feature image of the largest scale, the output of each other feature connection layer is merged with the output of the feature connection layer that outputs a feature image of a scale larger than the feature image output by the feature connection layer through processing through the upsampling layer.
[0096] As one method of an embodiment of the present disclosure, in order to strengthen information exchange between different scales, referring to Figure 6, except for the feature connection layer corresponding to the feature image of the largest scale, the feature image generated by each other feature connection layer must output the feature image output by itself to the detection module (such as through the feature convolution layer), and at the same time, it must also increase the scale through an upsampling layer, and then merge with the feature image of the larger scale, and then output the detection module together (such as through the feature convolution layer).
[0097] For example, referring to Figure 7, the 8*8 scale feature image (Scale 1) is upsampled and merged with the 16*16 scale feature image (Scale 2), which is then output to the detection module through the feature convolution side layer. Similarly, the 16*16 scale feature image is upsampled and merged with the 32*32 scale feature image (Scale 3), which is then output to the detection module through the feature convolution side layer. The 32*32 scale feature image does not need to be upsampled and is directly output to the detection module.
[0098] In some embodiments, the number of feature connection layers is 3.
[0099] 6 and 7 , as one implementation of the present disclosure, there may be three feature connection layers, that is, the feature extraction module may extract feature information at three different scales (such as the above 8*8 scale, 16*16 scale, and 32*32 scale).
[0100] As a specific embodiment of the present disclosure, the structure, training, and use of a target detection model are introduced below.
[0101] In the disclosed embodiment, the target detection model was developed using the Windows 10 operating system, the Anaconda 3 + Keras platform, and the Python 3.6 language. The central processing unit (CPU) of the operating device was an Intel(R) Core(TM) and the memory size was 4GB.
[0102] In the embodiment of the present disclosure, the target detection model adopts the basic form of the YOLO V3 model, and its detection module adopts the YOLO detection module (such as the SOFT classifier), but the feature connection layer (residual connection layer) in its feature extraction module is replaced by a dense connection layer. Therefore, the target detection model of the embodiment of the present disclosure can be a DE-YOLO model.
[0103] 7 , the feature extraction module of the DE-YOLO model of the embodiment of the present disclosure includes a plurality of sequentially connected processing layers.
[0104] In Figure 7 (), the multiple processing layers from top to bottom represent the multiple processing layers in the DE-YOLO model, where Type indicates the type of the corresponding processing layer; Filter depth, also known as filter dimension, indicates the number of convolution kernels in the convolution layer; Convolution size indicates the size of a single convolution kernel; Output size indicates the size of the image output by the corresponding processing layer.
[0105] 7 , the DE-YOLO model can output feature images of three scales, such as scale 1 of 8*8, scale 2 of 16*16, and scale 3 of 32*32.
[0106] Scale 3 corresponds to a group of eight repeating units, scale 2 corresponds to a group of eight repeating units, and scale 1 corresponds to a group of eight repeating units. Each repeating unit includes three sequentially connected processing layers, the first two of which are convolutional layers, and the last one is a densely connected layer. The densely connected layer of the last repeating unit in each group of repeating units is the feature connection layer, which is used to output the feature image, while the densely connected layers of the other repeating units are auxiliary connection layers.
[0107] After passing through an upsampling layer (such as a pooling layer), the 8*8 scale feature image (scale 1) is combined with the 16*16 scale feature image (scale 2) and then passed through a feature convolution layer to be output to the detection module. Similarly, after passing through an upsampling layer, the 16*16 scale feature image is combined with the 32*32 scale feature image (scale 3) and then passed through a feature convolution layer to be output to the detection module. The 8*8 scale feature image (scale 1) is directly output to the detection module through a feature convolution layer.
[0108] Feature images of different scales contain different amounts of feature information and have different learning capabilities. For example, feature images of scales 1 and 2 contain more representational information, while the learning capability of scale 3 is limited. Therefore, in the DE-YOLO model of the embodiment of the present disclosure, the feature connection layers of the three scales no longer use residual connection layers (Residual Network), but instead use dense connection layers (Dense Net) that match their dimensions.
[0109] A processing layer may include n layers connected in sequence, where the The layer performs nonlinear transformation on the input image and Specifically, it can be one or more composite functions such as batch normalization (BN), activation function (ReLU), pooling sampling, convolution, etc.
[0110] The output of layer i is represented as x i , so for the densely connected layer (densely connected block) shown in Figure 5, the i-th layer (i-th dense convolutional layer) will receive the output x0,…,x0 of all previous layers. i-1 , so the output is: Among them, [x0,…,x i-1 ] represents the concatenation of images generated in layers 0,…,i-1.
[0111] Thus, for other processing layers with n layers, there are n connections (one connection between each layer and the subsequent layer), while a densely connected layer with n layers has n(n+1) / 2 connections, that is, each layer takes the output of all previous layers as input and uses its own output as input for all subsequent layers. Therefore, a densely connected layer has "dense connectivity" and is therefore called a densely connected layer.
[0112] In densely connected layers, the above formulas do not apply when the image scale changes. However, resizing an image is a crucial operation in convolution. Therefore, referring to Figure 5, the densely connected layer can be divided into multiple densely connected blocks. Adjacent densely connected blocks are connected via convolutional layers and downsampling (e.g., pooling) layers.
[0113] Referring to Figure 7, since the densely connected layer brings more inputs, the convolution layer may include an effective convolution layer (such as a 3*3 convolution kernel) and a preceding convolution layer with reduced input (such as a 1*1 convolution kernel) to reduce the number of inputs and improve computational efficiency; and after the last densely connected block, full pooling can also be performed.
[0114] To further compress the size of the DE-YOLO model, the number of images in the transition layer (feature convolution layer) can be appropriately reduced. For example, assuming that the densely connected layer generates a total of m images, the number of images generated by the subsequent transition layer can be set to λm, where λ is the compression factor, which can be set in the range of 0.2<λ≤0.8.
[0115] It can be seen that in the embodiment of the present disclosure, feature images of scales 1, 2, and 3 are generated through densely connected layers, so that the feature information learned at different scales can be fully utilized and aggregated, providing an effective guarantee for obtaining a DE-YOLO model that can achieve accurate detection in the next step.
[0116] Specifically, when training the above DE-YOLO model, 10,000 different images can be randomly sampled from VOC2017, 8,200 of which are randomly selected as the training sample set, 800 images as the validation sample set, and 1,000 images as the test sample set.
[0117] The training process may include steps 1 to 4.
[0118] In step 1, the training sample set and the validation sample set are preprocessed (such as Anchors selection).
[0119] In step 2, K-means clustering is performed on the training sample set to obtain the training samples to be used.
[0120] In step 3, the original model of the DE-YOLO model is trained using the training samples to be used, and the YOLO V3 model is trained using the training samples of the unclustered training sample set; and the validation sample set is used to determine whether the training is complete.
[0121] In step 4, the obtained DE-YOLO model and YOLO V3 model are tested separately.
[0122] The parameters of the original model can be obtained by using the parameters of the YOLO V3 model pre-trained on the COCO dataset provided by the Keras framework. The Adma+Momentum optimization algorithm is used in training, with an initial momentum of 0.9, an initial learning rate of 0.001, a weight decay coefficient of 0.0005, and 1000 iterations. The scale of the input image is unified to 416*416, and the compression factor λ is 0.5. To avoid overfitting, the model is saved every 50 iterations, and the output file is suffixed with .h5.
[0123] In the disclosed embodiment, when the DE-YOLO model iterates 800 times, the accuracy has reached 89.1%, which has exceeded the accuracy of the YOLO V3 model of the same period; when it iterates 1000 times, the accuracy of the DE-YOLO model is further improved and basically reaches saturation.
[0124] In the end, the trained DE-YOLO model has a size of 33Mb, while the YOLO V3 model has a size of 258Mb.
[0125] It can be seen that the size of the target detection model used in the embodiment of the present disclosure is reduced by more than 80%, and the detection speed is significantly improved.
[0126] 8 , an embodiment of the present disclosure provides a target detection device, which includes one or more memories and one or more processors; the memories store a computer program that can be executed by the processor, and when the computer program is executed by the processor, any one of the target detection methods of the embodiments of the present disclosure is implemented.
[0127] 9 , an embodiment of the present disclosure provides a computer-readable medium having a computer program stored thereon. When the computer program is executed by a processor, any one of the target detection methods of the embodiments of the present disclosure is implemented.
[0128] A processor is a device with data processing capabilities, including but not limited to a central processing unit (CPU); a memory is a device with data storage capabilities, including but not limited to random access memory (RAM, more specifically SDRAM, DDR, etc.), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), and flash memory (FLASH); an I / O interface (read-write interface) is connected between the processor and the memory, enabling information exchange between the memory and the processor, including but not limited to a data bus (Bus), etc.
[0129] Those skilled in the art will appreciate that all or some of the steps, systems, and functional modules / units in the apparatus disclosed above may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0130] In hardware implementations, the division between functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, one physical component may have multiple functions, or one function or step may be performed by several physical components in cooperation.
[0131] Some or all of the physical components may be implemented as software executed by a processor, such as a central processing unit (CPU), a digital signal processor, or a microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As is well known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, random access memory (RAM, more specifically SDRAM, DDR, etc.), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory (FLASH) or other disk storage; compact disc (CD-ROM), digital versatile disc (DVD) or other optical disc storage; magnetic cassettes, tapes, disk storage or other magnetic storage; any other medium that can be used to store desired information and can be accessed by a computer. Furthermore, as is well known to those skilled in the art, communication media typically embodies computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0132] The present disclosure has disclosed example embodiments, and although specific terms are employed, they are used and should be interpreted only in a general illustrative sense and not for purposes of limitation. In some instances, it will be apparent to those skilled in the art that, unless otherwise expressly indicated, features, characteristics, and / or elements described in conjunction with a particular embodiment may be used alone or in combination with features, characteristics, and / or elements described in conjunction with other embodiments. Therefore, it will be understood by those skilled in the art that various changes in form and detail may be made without departing from the scope of the present disclosure as set forth in the appended claims.
Claims
1. A method for target detection, comprising: Input the original image into the preset target detection model; as well as Receiving a target detection result output by the target detection model; Wherein, the target detection model includes a feature extraction module and a detection module; The feature extraction module includes a plurality of processing layers connected in sequence, wherein a portion of the plurality of processing layers are convolutional layers, another portion of the plurality of processing layers are feature connection layers for outputting feature images to the detection module, the feature connection layers are densely connected layers, and feature images outputted by different feature connection layers have different scales; The detection module is used to perform target detection according to the feature image.
2. The method according to claim 1, wherein: At least one of the plurality of processing layers is an auxiliary connection layer; the auxiliary connection layer is a dense connection layer; At least one convolutional layer is arranged between the auxiliary connection layer and the feature connection layer.
3. The method according to claim 2, wherein: Each of the characteristic connection layers corresponds to a group of repeating units including a plurality of repeating units connected in sequence; Each repeating unit includes n sequentially connected convolutional layers and a densely connected layer located after the n sequentially connected convolutional layers, where n is an integer greater than or equal to 2; In the group of repeating units, the densely connected layer in the last repeating unit is the characteristic connection layer, and the densely connected layers in the other repeating units are the auxiliary connection layers.
4. The method according to claim 1, wherein: Each of the densely connected layers includes at least one densely connected block, and each densely connected block includes at least three dense convolutional layers connected in sequence; In the at least one sequentially connected dense convolutional layer, the first dense convolutional layer Used to receive input data from outside the densely connected block, each of the dense convolution layers located after the one dense convolution layer is used to receive output data of all the dense convolution layers located before it, and perform a convolution operation on the received output data to generate its own output data, and output its own output data to all the dense convolution layers located after it, and the last dense convolution layer is used to output data outside the densely connected block.
5. The method according to claim 1, wherein: Before the original image is input into the preset target detection model, the method further includes: Using a clustering algorithm to cluster a preset training sample set to obtain a plurality of candidate training samples, wherein the training sample set includes a plurality of training samples; The preset original model is trained using the candidate training samples to obtain the target detection model.
6. The method according to claim 1, wherein: The target detection model also includes: A feature convolution layer corresponding to each feature connection layer; The feature convolution layer is connected between the output of the corresponding feature connection layer and the input of the detection module, and is used to convolve the feature image output by the corresponding feature connection layer and output it to the detection module.
7. The method according to claim 1, wherein: Except for the feature connection layer that outputs the feature image of the largest scale, the output of each other feature connection layer is merged with the output of the feature connection layer that outputs a feature image of a scale larger than that of the feature connection layer through processing through the upsampling layer.
8. The method according to any one of claims 1 to 7, wherein: The target detection model is a YOLO model, and the detection module is a YOLO detection module.
9. A target detection device, comprising one or more memories and one or more processors; the memory stores a computer program that can be executed by the processor, and when the computer program is executed by the processor, it implements the target detection method described in any one of claims 1 to 8.
10. A computer-readable medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method for target detection according to any one of claims 1 to 8.
Citation Information
Patent Citations
Target detection method based on feature multiplexing and YOLOv3
CN110826379A
Garbage multi-target detection method based on improved YOLOv3
CN111833322A
Multi-scale target detection method based on YOLO v3
CN112801183A
Object recognition method, apparatus and network
US20200265254A1
