Target detection model training method and device, equipment, storage medium and computer program product

By using feature extraction and detection of low-light and high-light image samples in the target detection model, a loss function is constructed to update the model parameters, which solves the problem of low target detection accuracy and efficiency in low-light environments and achieves more efficient feature extraction. and detection.

CN118628869APending Publication Date: 2024-09-10UBTECH ROBOTICS CORP LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410828295.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-24
Publication Date
2024-09-10

AI Technical Summary

Technical Problem

When using existing technology to detect image targets in low-light environments, brightness enhancement will introduce additional noise and make the process complex, resulting in low detection accuracy and efficiency.

Method used

By calling the target detection model to extract and detect features of low-light-intensity image samples and high-light-intensity image samples, a loss function is constructed to update model parameters, which improves feature extraction capabilities under low light and improves detection accuracy and efficiency.

Benefits of technology

It improves the feature extraction capability and detection accuracy of the target detection model in low-light environments, simplifies the process, and improves detection efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118628869A
    Figure CN118628869A
Patent Text Reader

Abstract

The invention provides a target detection model training method and device, equipment, a storage medium and a computer program product. The method comprises the steps of calling a target detection model, performing feature extraction on a first image sample to obtain a first image feature, and performing feature extraction on a second image sample to obtain a second image feature; calling a target detection model to perform target detection on the second image feature to obtain a first detection result; determining a value of a first loss function based on the first image feature and the second image feature, and determining a value of a second loss function based on the first detection result and the sample tag; and on the basis of the value of the first loss function and the value of the second loss function, updating model parameters of the target detection model so as to train the target detection model. According to the invention, the accuracy and efficiency of target detection can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a training method, apparatus, device, storage medium and computer program product for a target detection model. Background Art

[0002] In the related art, for image target detection, the brightness of the image (for example, an image captured in a low-light intensity environment) is first enhanced, and then target detection is performed based on the enhanced image. However, brightness enhancement of the image will bring additional noise, and the image enhancement process is complex to implement, which will lead to low accuracy and efficiency of target detection. Summary of the invention

[0003] The embodiments of the present application provide a method, apparatus, device, storage medium and computer program product for training a target detection model, which can improve the accuracy and efficiency of target detection.

[0004] The technical solution of the embodiment of the present application is implemented as follows:

[0005] The present invention provides a method for training a target detection model, the method comprising:

[0006] Calling the target detection model, performing feature extraction on the first image sample to obtain a first image feature, and performing feature extraction on the second image sample to obtain a second image feature; wherein the content of the first image sample is the same as the content of the second image sample, the light intensity corresponding to the first image sample is lower than the light intensity corresponding to the second image sample, and the second image sample carries a sample label;

[0007] Calling the target detection model to perform target detection on the second image feature to obtain a first detection result, wherein the first detection result indicates a position of the target in the second image sample at the second image sample;

[0008] Determine a value of a first loss function based on the first image feature and the second image feature, and determine a value of a second loss function based on the first detection result and the sample label;

[0009] Based on the value of the first loss function and the value of the second loss function, the model parameters of the target detection model are updated to train the target detection model.

[0010] The present invention provides a method for detecting a target, which includes:

[0011] Call the target detection model to extract features of the image to be detected to obtain the features of the image to be detected;

[0012] The target detection model is called to perform target detection on the features of the image to be detected, and a target detection result of the image to be detected is obtained, wherein the target detection result indicates the position of the target in the image to be detected in the image to be detected; wherein the target detection model is trained based on the training method of the target detection model provided in an embodiment of the present application.

[0013] The present application provides a training device for a target detection model, including:

[0014] a feature extraction module, configured to call the target detection model, perform feature extraction on the first image sample to obtain a first image feature, and perform feature extraction on the second image sample to obtain a second image feature; wherein the content of the first image sample is the same as the content of the second image sample, the light intensity corresponding to the first image sample is lower than the light intensity corresponding to the second image sample, and the second image sample carries a sample label;

[0015] a target detection module, configured to call the target detection model to perform target detection on the second image feature to obtain a first detection result, wherein the first detection result indicates a position of the target in the second image sample at the second image sample;

[0016] a loss determination module, configured to determine a value of a first loss function based on the first image feature and the second image feature, and to determine a value of a second loss function based on the first detection result and the sample label;

[0017] A parameter updating module is used to update the model parameters of the target detection model based on the value of the first loss function and the value of the second loss function to train the target detection model.

[0018] The present application provides a target detection device, including:

[0019] A feature extraction module is used to call the target detection model to extract features of the image to be detected and obtain features of the image to be detected;

[0020] A target detection module is used to call the target detection model to perform target detection on the features of the image to be detected, and obtain the target detection result of the image to be detected, wherein the target detection result indicates the position of the target in the image to be detected in the image to be detected; wherein the target detection model is trained by the training method of the target detection model provided in the embodiment of the present application.

[0021] An embodiment of the present application provides an electronic device, the electronic device comprising:

[0022] A memory for storing computer executable instructions or computer programs;

[0023] The processor is used to implement the method provided in the embodiment of the present application when executing the computer executable instructions or computer program stored in the memory.

[0024] An embodiment of the present application provides a computer-readable storage medium storing computer-executable instructions or a computer program for implementing the method provided in the embodiment of the present application when executed by a processor.

[0025] An embodiment of the present application provides a computer program product, including computer executable instructions or a computer program. When the computer executable instructions or the computer program are executed by a processor, the method provided in the embodiment of the present application is implemented.

[0026] The embodiments of the present application have the following beneficial effects:

[0027] By applying the embodiment of the present application, a target detection model is called to perform feature extraction on a first image sample to obtain a first image feature, and feature extraction is performed on a second image sample to obtain a second image feature, and then the target detection model is called to perform target detection on the second image feature to obtain a first detection result, and further based on the first image feature and the second image feature, a value of a first loss function is determined, and based on the first detection result and the sample label, a value of a second loss function is determined, and then based on the value of the first loss function and the value of the second loss function, the model parameters of the target detection model are updated.

[0028] Here, the illumination intensity corresponding to the first image sample is lower than the illumination intensity corresponding to the second image sample. Based on the first image feature of the first image sample and the second image feature of the second image sample, a loss is constructed for training the target detection model, which can make the first image feature under lower illumination intensity extracted by the target detection model closer to the first image feature under higher illumination intensity extracted by the target detection model, thereby improving the feature extraction capability of the trained target detection model for images under lower illumination intensity, thereby improving the detection accuracy of the target detection model, and the implementation method only needs to be through feature extraction, which is simple to implement, so that the efficiency of target detection is improved; at the same time, based on the first detection result and sample label of the second image sample, a loss is constructed for training the target detection model, thereby further improving the detection accuracy of the target detection model. Therefore, through the embodiments of the present application, the accuracy and efficiency of target detection are improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 It is a schematic diagram of an application mode of the training method of the target detection model provided in an embodiment of the present application;

[0030] Figure 2 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0031] Figure 3A It is a first flow chart of the training method of the target detection model provided in the embodiment of the present application;

[0032] Figure 3B It is a second flow chart of the training method of the target detection model provided in the embodiment of the present application;

[0033] Figure 3C 3 is a schematic diagram of a third flow chart of a method for training a target detection model provided in an embodiment of the present application;

[0034] Figure 3D It is a fourth flow chart of the training method of the target detection model provided in the embodiment of the present application;

[0035] Figure 4 is a schematic diagram of the structure of the feature extraction layer provided in an embodiment of the present application;

[0036] Figure 5 It is a structural schematic diagram of adjusting the image feature size in the sub-feature extraction layer provided in an embodiment of the present application;

[0037] Figure 6 It is a structural diagram of the training process of the target detection model provided in the embodiment of the present application;

[0038] Figure 7 It is a flowchart of the target detection method provided in the embodiment of the present application;

[0039] Figure 8 is a schematic diagram of the application structure of the target detection model provided in the embodiment of the present application;

[0040] Fig. 9 It is a schematic diagram of the structure of the image enhancement network model provided in the embodiment of the present application;

[0041] Fig.10 It is a schematic diagram of the model structure of the training image enhancement module provided in an embodiment of the present application.

[0042] It should be pointed out that the above-mentioned "first" and "second" are only used to distinguish different solutions, and do not represent the degree of superiority or inferiority of the solutions or the priority in the implementation process. DETAILED DESCRIPTION

[0043] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.

[0044] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0045] In the following description, the terms "first\second\third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.

[0046] The relevant data collection and processing in the embodiments of this application should be strictly in accordance with the requirements of relevant laws and regulations when applied in examples, obtain the informed consent or separate consent of the personal information subject, and carry out subsequent data use and processing within the scope of authorization of laws and regulations and the personal information subject.

[0047] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.

[0048] Unless otherwise defined, all technical and scientific terms used in the embodiments of the present application have the same meanings as those commonly understood by those skilled in the art. The terms used in the embodiments of the present application are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.

[0049] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.

[0050] 1) Laplacian Pyramid: It is an image processing tool used to represent the same image at different resolutions. It is achieved by downsampling the original image step by step and reconstructing the image on this basis to obtain a series of image layers with different resolutions.

[0051] 2) Gaussian Pyramid: It is a commonly used technique in image processing. It is mainly used to reduce the resolution of an image while retaining as much information as possible. This pyramid structure is constructed by repeatedly applying Gaussian filters and downsampling operations.

[0052] 3) Yolov8 detection network: A neural network structure for target detection that detects targets of different scales by using multiple feature maps of different sizes.

[0053] 4) Residual block: It is a neural network module that alleviates the gradient vanishing problem by introducing skip connections, thereby improving the performance of the network. The structure usually consists of two or three groups of convolutional layers plus activation functions, and residual connections are added.

[0054] 5) Convolution: It is a mathematical operation that generates a third function from two functions. It is a special integral transformation that represents the integral of the product of the overlapping function values ​​of two functions after flipping and translating over the overlapping length.

[0055] 6) Activation function: It is a function that runs on the neurons of the artificial neural network and is responsible for mapping the input of the neuron to the output.

[0056] 7) Edge detection operator: It is a technique used in image processing, mainly used to identify areas in an image where brightness changes significantly, which usually correspond to the edges or contours of objects.

[0057] The embodiments of the present application provide a method, device, electronic device, computer-readable storage medium and computer program product for training a target detection model, which can improve the accuracy and efficiency of target detection.

[0058] The following describes an exemplary application of the electronic device provided by the embodiment of the present application. The electronic device provided by the embodiment of the present application can be implemented as various types of terminals such as a laptop computer, a tablet computer, a desktop computer, a set-top box, a smart phone, a smart speaker, a smart watch, a smart TV, and a vehicle-mounted terminal, and can also be implemented as a server. The following describes an exemplary application when the device is implemented as a server.

[0059] See also Figure 1 , Figure 1 Schematic diagram of the application mode of the training method of the target detection model provided in the embodiment of the present application, for example, Figure 1 The server 200, network 300, terminal 400 and database 500 are involved. The terminal 400 is connected to the server 200 via the network 300. The network 300 can be a wide area network or a local area network, or a combination of the two. The database 500 stores image samples required for training the target detection model.

[0060] When the target detection model needs to be trained, the user triggers a model training instruction for the target detection model on the terminal 400. The terminal 400 responds to the user's model training instruction and sends a model training request to the server 200. The server 200 responds to the model training request and obtains an image sample from the database 500, the image sample including a first image sample and a second image sample, the content of the first image sample and the content of the second image sample are the same, the light intensity corresponding to the first image sample is lower than the light intensity corresponding to the second image sample, and the second image sample carries a sample label; the target detection model is called, feature extraction is performed on the first image sample to obtain a first image feature, feature extraction is performed on the second image sample to obtain a second image feature, the target detection model is called to perform target detection on the second image feature to obtain a first detection result, the value of the first loss function is determined based on the first image feature and the second image feature, and the value of the second loss function is determined based on the first detection result and the sample label, and the model parameters of the target detection model are updated based on the value of the first loss function and the value of the second loss function to train the target detection model, and the training result is returned to the terminal 400. The terminal 400 receives the training result and displays it. In this way, the user can learn the training results of the target detection model through the terminal 400.

[0061] In some embodiments, after the server 200 obtains the trained target detection model, the server 200 can send the trained target detection model to the terminal 400 for use by the terminal 400 when performing target detection. The terminal 400 can also actively obtain the target detection model from the server 200 when performing target detection. In this case, the server 200 sends the target detection model to the terminal 400 when the terminal actively obtains it.

[0062] For example, the terminal 400 may be provided with a client supporting target detection. When performing target detection, the user may trigger a target detection instruction for the image to be detected at the terminal 400 through the client. The terminal 400 responds to the target detection instruction triggered by the user, obtains the trained target detection model from the server 200, and also obtains the image to be detected. Thus, the terminal 400 may call the target detection model to extract features of the image to be detected, and obtain features of the image to be detected; and call the target detection model to perform target detection on the features of the image to be detected, and obtain the target detection result of the image to be detected.

[0063] The embodiments of the present application can also be implemented through machine learning. Machine Learning (ML) is a multi-disciplinary cross-disciplinary subject involving probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and other disciplines. It specializes in how computers simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications are spread across all fields of artificial intelligence. Machine learning and deep learning usually include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and learning by teaching.

[0064] In some embodiments, the server (e.g., server 200) may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms. Terminal 400 may be a smart phone, tablet computer, laptop computer, desktop computer, smart speaker, smart watch, vehicle-mounted terminal robot, aircraft, etc., but is not limited thereto. The terminal and the server may be directly or indirectly connected via wired or wireless communication, which is not limited in the embodiments of the present application.

[0065] See also Figure 2 , Figure 2 is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application, the electronic device may be a terminal or a server, Figure 2 The electronic device 600 shown includes: at least one processor 410, a memory 450, and at least one network interface 420. The various components in the electronic device 600 are coupled together via a bus system 440. It is understood that the bus system 440 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 440 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clarity, the bus system 440 is not described in detail. Figure 2 Various buses are labeled as bus system 440 .

[0066] The processor 410 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.

[0067] The memory 450 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard disk drives, optical disk drives, etc. The memory 450 may optionally include one or more storage devices that are physically remote from the processor 410.

[0068] The memory 450 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 450 described in the embodiments of the present application is intended to include any suitable type of memory.

[0069] In some embodiments, memory 450 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.

[0070] The operating system 451 includes system programs for processing various basic system services and performing hardware-related tasks, such as a framework layer, a core library layer, a driver layer, etc., which are used to implement various basic businesses and process hardware-based tasks.

[0071] The network communication module 452 is used to reach other electronic devices via one or more (wired or wireless) network interfaces 420. Exemplary network interfaces 420 include: Bluetooth, Wireless Authentication (WiFi), and Universal Serial Bus (USB).

[0072] In some embodiments, the device provided in the embodiments of the present application can be implemented in software. Figure 2 A training device 455 of a target detection model stored in a memory 450 is shown, which may be software in the form of a program and a plug-in, etc., and includes the following software modules: a feature extraction module 4551, a target detection module 4552, a loss determination module 4553, and a parameter update module 4554. These modules are logical, and therefore may be arbitrarily combined or further split according to the functions implemented. The functions of each module will be described below.

[0073] In some embodiments, the terminal or server can implement the training method of the target detection model provided in the embodiment of the present application by running various computer executable instructions or computer programs. For example, computer executable instructions can be commands, machine instructions or software instructions at the microprogram level. The computer program can be a native program or software module in the operating system; it can be a local (Native) application (AP Plication, APP), that is, a program that needs to be installed in the operating system to run, such as cloud computing APP or instant messaging APP; it can also be a small program that can be embedded in any APP, that is, a program that can be run only by downloading it to a browser environment. In short, the above-mentioned computer executable instructions can be instructions in any form, and the above-mentioned computer program can be an application, module or plug-in in any form.

[0074] The training method of the target detection model provided in the embodiment of the present application will be explained in combination with the exemplary application and implementation of the server device provided in the embodiment of the present application.

[0075] The following describes the training method of the target detection model provided in the embodiment of the present application. As mentioned above, the electronic device that implements the training method of the target detection model in the embodiment of the present application can be a terminal, a server, or a combination of the two. Next, the training method of the target detection model provided in the embodiment of the present application is described by taking the electronic device as a server as an example. Figure 3A , Figure 3A is a first flow chart of the training method of the target detection model provided in the embodiment of the present application, which will be combined with Figure 3A The steps shown are explained.

[0076] In step 301, the target detection model is called to perform feature extraction on the first image sample to obtain the first image feature, and feature extraction is performed on the second image sample to obtain the second image feature.

[0077] Here, the content of the first image sample is the same as the content of the second image sample, the light intensity corresponding to the first image sample is lower than the light intensity corresponding to the second image sample, and the second image sample carries a sample label. The sample label indicates the actual position of the target in the second image sample in the second image sample. If the first image sample and the second image sample are actually collected image samples (such as image samples collected for the same scene), the light intensity is the actual light intensity when the image sample is collected; if the first image sample and the second image sample are generated by a machine that constructs a sample image sample set, the light intensity is the light intensity set when the image sample is generated. In some embodiments, the light intensity threshold is pre-set, and image samples with light intensity lower than the light intensity threshold are marked as dim images, and image samples with light intensity higher than or equal to the light intensity threshold are marked as bright images. For example, the first image sample can be a dim image and the second image sample can be a bright image.

[0078] In step 301, for the first image sample and the second image sample used to train the target detection model, the feature extraction layer of the target detection model can be called to perform feature extraction on the first image sample and the second image sample respectively to obtain the first image feature and the second image feature.

[0079] In some embodiments, the first image features may be obtained by performing feature extraction on the first image sample by executing the following steps: extracting edge features of the first image sample and extracting global features of the first image sample; and fusing the edge features and the global features into the first image features.

[0080] Here, edge features refer to points or areas in an image where the brightness changes significantly. The edge in an image usually represents the boundary between an object and the background, or the boundary between different areas inside an object. The edge detection algorithm is used to extract the edge features of the first image sample. The edge detection algorithm includes the Sobel operator, the Canny operator, and the Laplacian operator. These algorithms detect edges by calculating the gradient or second-order derivative of the image. Global features refer to features that describe the entire image or a certain overall area of ​​the image. They usually do not depend on the specific location or local details of the image and can reflect the overall properties of the image. The residual block, convolution layer, and activation function are combined to extract the global features of the first image sample.

[0081] Example, reference Figure 4 , Figure 44 is a schematic diagram of the structure of the feature extraction layer provided in an embodiment of the present application. In the feature extraction layer 401, the first image sample 402 is subjected to feature extraction processing of two branches. In one branch, the first image sample 402 is subjected to edge detection processing of the Canny operator to obtain edge features. In another branch, the first image sample 402 is input into the residual block, which is a structure in a deep convolutional network. The structure is usually composed of two or three groups of convolutional layers plus activation functions. It can better integrate features at different levels by introducing cross-layer links, and enable the network to be trained more stably. In the residual block, the first image sample first passes through a convolutional layer, then performs an addition operation with the original first image sample, and then passes through an activation function to obtain the residual features of the first image sample. The residual features of the first image sample are input into the convolutional layer. In the convolutional layer, a sliding window operation is performed on the residual features of the first image sample using a convolution kernel, thereby obtaining the local features of the first image sample. The local features of the first image sample are input into an activation function, which may be a linear rectification function (ReLU), to introduce the local features of the first image sample into a nonlinear transformation, thereby enhancing the expression capability of the local features of the first image sample, and thus obtaining a global feature. Finally, the edge features and the global features are fused into the first image feature 403.

[0082] The edge feature and the global feature are fused into the first image feature. The fusion method may be to perform weighted summation of the edge feature and the global feature to obtain the first image feature. The fusion method may also be to multiply the edge feature and the global feature to obtain the first image feature. The fusion method may also be to splice the edge feature and the global feature to obtain the first image feature.

[0083] In some embodiments, the second image features can be obtained by performing feature extraction on the second image sample by performing the following steps: extracting edge features of the second image sample, and extracting global features of the second image sample; and fusing the edge features and global features into the second image features. The edge feature extraction process and the global feature extraction process of the second image sample are the same as the edge feature extraction process and the global feature extraction process of the first image sample, and are not described in detail here.

[0084] In some embodiments, see Figure 3B , Figure 3B 2 is a schematic diagram of a second flow chart of a method for training a target detection model provided in an embodiment of the present application. Figure 3A Before step 301 shown, you can also perform Figure 3B Steps 3001 to 3003 are described in detail below.

[0085] In step 3001, the first original image sample is adjusted into n first adjusted images with different resolutions, and the second original image sample is adjusted into n second adjusted images with different resolutions.

[0086] Here, n is an integer greater than 1, the content of the first original image sample is the same as the content of the second original image sample, and the light intensity corresponding to the first original image sample is lower than the light intensity corresponding to the second original image sample. The first adjusted image refers to adjusting the first original image sample to multiple images of different sizes by image reduction or image enlargement, and the second adjusted image refers to adjusting the second original image sample to multiple images of different sizes by image reduction or image enlargement. For example, the first original image sample and the second original image sample are decomposed into multiple scales using a Gaussian pyramid. The Gaussian pyramid can represent the original image at different scales, so that the main features of the image can still be identified at a lower resolution. The Gaussian pyramid structure includes n layers of resolution adjustment layers, and the first original image sample is subjected to Gaussian filtering and downsampling through the first layer of resolution adjustment layer to obtain a first adjusted image of the first layer of resolution adjustment layer. Through the second resolution adjustment layer, the first adjustment image of the first resolution adjustment layer is subjected to Gaussian filtering and downsampling processing to obtain the first adjustment image of the second resolution adjustment layer... Through the nth resolution adjustment layer, the first adjustment image of the n-1th resolution adjustment layer is subjected to Gaussian filtering and downsampling processing to obtain the first adjustment image of the nth resolution adjustment layer. In this way, n first adjustment images are obtained.

[0087] Similarly, the second original image sample is subjected to Gaussian filtering and downsampling through the first resolution adjustment layer to obtain a second adjusted image of the first resolution adjustment layer. The second adjusted image of the first resolution adjustment layer is subjected to Gaussian filtering and downsampling through the second resolution adjustment layer to obtain a second adjusted image of the second resolution adjustment layer… Through the nth resolution adjustment layer, the second adjusted image of the n-1th resolution adjustment layer is subjected to Gaussian filtering and downsampling to obtain a second adjusted image of the nth resolution adjustment layer, and thus, n second adjusted images are obtained.

[0088] In step 3002, the first original image sample is subtracted from the n first adjusted images respectively to obtain n first sub-image samples.

[0089] Here, the first image sample includes n first sub-image samples. For each first adjusted image, the size of the first adjusted image is restored to the size of the first original image sample to obtain a first intermediate adjusted image, and the image features of the first original image sample and the first intermediate adjusted image are subtracted to obtain a first sub-image sample. Since the Gaussian pyramid only includes downsampling operations, and downsampling will cause the loss of image information, and the Laplacian pyramid includes upsampling operations, it reconstructs the upsampled image by applying the Laplacian operator to restore the lost information to a certain extent. The Laplacian pyramid is a difference image obtained by subtracting the image restored to the size of the original image from the original image. Using the Laplacian pyramid, the first adjusted image is upsampled to obtain a first intermediate adjusted image, and the image features of the first original image sample and the first intermediate adjusted image are subtracted to obtain a first sub-image sample. The process can be repeated multiple times to construct multiple first sub-image samples.

[0090] In step 3003, the second original image samples are subtracted from the n second adjusted images respectively to obtain n second sub-image samples.

[0091] Here, the second image sample includes n second sub-image samples. For each second adjusted image, the size of the second adjusted image is restored to the size of the second original image sample to obtain a second intermediate adjusted image, and the image features of the second original image sample and the second intermediate adjusted image are subtracted to obtain a second sub-image sample. Similarly, the second adjusted image is upsampled using the Laplacian pyramid to obtain a second intermediate adjusted image, and the image features of the first original image sample and the second intermediate adjusted image are subtracted to obtain a second sub-image sample. The process is repeated multiple times to construct multiple second sub-image samples.

[0092] In the embodiment of the present application, by adjusting the first original image sample into n first adjusted images of different resolutions, and subtracting the first original image sample from the n first adjusted images respectively, the detail information of the first image sample can be obtained, and the first image feature can be accurately extracted; by adjusting the second original image sample into n second adjusted images of different resolutions, and subtracting the second original image sample from the n second adjusted images respectively, the detail information of the second image sample can be obtained, and the second image feature can be accurately extracted. In this way, the feature extraction capability is improved.

[0093] In some embodiments, the object detection model includes n sub-feature extraction layers, each of which corresponds to a first sub-image sample and a second sub-image sample, see Figure 3C , Figure 3C This is a third flow chart of the target detection model training method provided in an embodiment of the present application. Figure 3AStep 301 shown may be performed by Figure 3C Steps 3011 to 3012 are implemented, and for each sub-feature extraction layer, the following operations are performed respectively, which are described in detail below.

[0094] In step 3011, the sub-feature extraction layer is called to perform feature extraction on the first sub-image sample corresponding to the sub-feature extraction layer to obtain the first sub-image feature of the sub-feature extraction layer.

[0095] Here, the first image feature includes n first sub-image features. For each sub-feature extraction layer, the first sub-image sample corresponding to the sub-feature extraction layer is determined, the edge feature of the first sub-image sample is extracted, and the global feature of the first sub-image sample is extracted, and the edge feature and the global feature are fused into the first sub-image feature, and multiple first sub-image features constitute the first image feature.

[0096] In step 3012, the sub-feature extraction layer is called to perform feature extraction on the second sub-image sample corresponding to the sub-feature extraction layer to obtain the second sub-image feature of the sub-feature extraction layer.

[0097] Here, the second image feature includes n second sub-image features. For each sub-feature extraction layer, the second sub-image sample corresponding to the sub-feature extraction layer is determined, the edge feature of the second sub-image sample is extracted, and the global feature of the second sub-image sample is extracted, and the edge feature and the global feature are fused into the second sub-image feature, and the multiple second sub-image features constitute the second image feature.

[0098] Continue to refer Figure 3A In step 302, the target detection model is called to perform target detection on the second image feature to obtain a first detection result.

[0099] Here, the first detection result indicates the position of the target in the second image sample at the second image sample, and in some embodiments, the first detection result may also include the confidence of the target at the position. The target detection layer of the target detection model is called to perform target detection on the second image feature.

[0100] The target detection layer can be a YOLOv8 detection network, which includes an image preprocessing module, a model reasoning module and a post-processing module. The image preprocessing module is used to preprocess the second image features. The preprocessing operations include scaling, cropping, normalization, etc. The second image features can be adjusted to an image format that can be processed by the detection network, and the processing speed and efficiency of the detection network can be optimized. The preprocessing also includes dividing the second image features into a plurality of grid units, each of which is responsible for detecting the target in the second image features and predicting the category and position of the target. The model reasoning module is used to extract the features of the image, usually using a deep convolutional network structure, which can extract high-level abstract features from the second image features, and perform specific calculations for target detection based on the extracted features, such as predicting the bounding box of the target, the category probability and the target confidence. The post-processing module is used to parse and optimize the results output by the model reasoning module to obtain the first detection result.

[0101] In some embodiments, the feature size of each second sub-image feature is different, see Figure 3D , Figure 3D 4 is a schematic diagram of a fourth flow chart of a method for training a target detection model provided in an embodiment of the present application. Figure 3A Before step 302 shown, you can also perform Figure 3D Steps 3004 to 3006 are described in detail below.

[0102] In step 3004, the feature size of the second sub-image feature of the i-th sub-feature extraction layer among the n sub-feature extraction layers is adjusted to the feature size of the second sub-image feature of the i+1-th sub-feature extraction layer among the n sub-feature extraction layers, thereby obtaining the size adjustment feature of the i-th sub-feature extraction layer.

[0103] Here, the feature size of the second sub-image feature of the i-th sub-feature extraction layer is adjusted, and the adjustment method can be linear interpolation. Image scaling operations may cause the size of features in the image to change, and linear interpolation can keep the size of these features unchanged, so that the relative size and position relationship of the features remain consistent when the image is enlarged or reduced. Using the linear interpolation method, by interpolating on each dimension (width and height) of the second sub-image feature, the feature size of the second sub-image feature of the i-th sub-feature extraction layer is adjusted to the feature size of the second sub-image feature of the i+1-th sub-feature extraction layer.

[0104] In step 3005, the size adjustment feature of the i-th sub-feature extraction layer is fused with the second sub-image feature of the i+1-th sub-feature extraction layer to obtain a first fused feature of the i+1-th sub-feature extraction layer.

[0105] Here, the features of the second sub-image feature of the adjusted i-th sub-feature extraction layer and the second sub-image feature of the (i + 1)-th sub-feature extraction layer are fused to obtain the first fused feature of the (i + 1)-th sub-feature extraction layer. Exemplarily, the features of the second sub-image feature of the adjusted i-th sub-feature extraction layer and the second sub-image feature of the (i + 1)-th sub-feature extraction layer can be linearly added to obtain the first fused feature of the (i + 1)-th sub-feature extraction layer.

[0106] In step 3006, by traversing i, the first fused feature of the n-th sub-feature extraction layer is obtained.

[0107] Here, i is an integer and its value satisfies 1 ≤ i < n. Exemplarily, referring to Figure 5 , Figure 5 is a schematic structural diagram of the structure for adjusting the image feature size in the sub-feature extraction layer provided by the embodiments of the present application. Exemplarily, n = 4, and the feature extraction layer includes the first sub-feature extraction layer 501, the second sub-feature extraction layer 502, the third sub-feature extraction layer 503, and the fourth sub-feature extraction layer 504. The first sub-feature extraction layer 501 extracts the second sub-image feature 1 from the second sub-image sample 1. By performing upsampling processing on the second sub-image feature 1 of the first sub-feature extraction layer 501, the feature size of the second sub-image feature 1 of the first sub-feature extraction layer 501 is adjusted to the feature size of the second sub-image feature 2 of the second sub-feature extraction layer 502, obtaining the size-adjusted feature of the first sub-feature extraction layer 501. The size-adjusted feature of the first sub-feature extraction layer 501 and the second sub-image feature 2 of the second sub-feature extraction layer 502 are added to obtain the first fused feature of the second sub-feature extraction layer 502. Then, by performing upsampling processing on the second sub-image feature 2 of the second sub-feature extraction layer 502, the size of the first fused feature of the second sub-feature extraction layer 502 is adjusted to the feature size of the second sub-image feature 3 of the third sub-feature extraction layer 503, obtaining the size-adjusted feature of the second sub-feature extraction layer 502. The size-adjusted feature of the second sub-feature extraction layer 502 and the second sub-image feature 3 of the third sub-feature extraction layer 503 are added to obtain the first fused feature of the third sub-feature extraction layer 503. And so on, the first fused feature 505 of the fourth sub-feature extraction layer 504 is obtained.

[0108] Continuing to refer to Figure 3D , after step 3006, Figure 3A the step 302 shown can be implemented by Figure 3D step 3021 below, which will be specifically described as follows.

[0109] In step 3021, the target detection model is called to perform target detection on the first fused feature of the n-th sub-feature extraction layer, obtaining the first detection result.

[0110] Here, the target detection layer of the target detection model is called to perform target detection on the first fused feature of the nth sub-feature extraction layer to detect the position of the target in the second image sample at the second image sample.

[0111] In the embodiment of the present application, by performing target detection on the first fusion feature of the nth sub-feature extraction layer, the second sub-image feature of each sub-feature extraction layer is taken into account, thereby improving the target detection accuracy.

[0112] In some embodiments, before calling the target detection model to perform target detection on the second image features and obtaining the first detection result, the following steps can be performed: obtaining the weight value of each feature extraction layer; based on the weight value of each feature extraction layer, fusing the second sub-image features of each feature extraction layer to obtain a second fused feature; calling the target detection model to perform target detection on the second fused feature to obtain the first detection result.

[0113] Here, according to the extraction dimension of the second sub-image features by each feature extraction layer, the weight value corresponding to each feature extraction layer is pre-set, and the second sub-image features of each feature extraction layer are weighted and summed to obtain the second fusion feature, so as to perform target detection based on the second fusion feature to obtain the first detection result.

[0114] Continue to refer Figure 3A In step 303, a value of a first loss function is determined based on the first image feature and the second image feature, and a value of a second loss function is determined based on the first detection result and the sample label.

[0115] Here, the loss function refers to a function used to measure the difference between the model prediction value and the true value. Select an appropriate loss function according to the task type of target detection. For example, for classification target detection tasks, you can select the cross entropy loss function; for regression target detection tasks, you can select the mean square error loss function. Substitute the first image feature and the second image feature into the first loss function, and calculate the value of the first loss function between the first image feature and the second image feature. When determining the value of the second loss function, you can select the bounding box loss function or the category loss function, substitute the first detection result and the sample label into the second loss function, and calculate the value of the second loss function between the first detection result and the sample label.

[0116] In step 304, based on the value of the first loss function and the value of the second loss function, the model parameters of the target detection model are updated to train the target detection model.

[0117] Here, based on the value of the first loss function, the model parameters of the feature extraction layer of the target detection model are updated. Specifically, when the value of the first loss function exceeds a preset threshold, the error signal of the feature extraction layer is determined based on the loss function, the error signal is back-propagated in the feature extraction layer, and the model parameters of the feature extraction layer are updated during the propagation process. Based on the value of the second loss function, the model parameters of the target detection layer of the target detection model are updated. Specifically, when the value of the second loss function exceeds a preset threshold, the error signal of the target detection layer is determined based on the loss function, the error signal is back-propagated in the target detection layer, and the model parameters of the target detection layer are updated during the propagation process.

[0118] In some embodiments, the value of the first loss function may be determined based on the first image feature and the second image feature by performing the following steps: based on the first sub-image feature and the second sub-image feature of each sub-feature extraction layer, the value of the first loss function corresponding to each sub-feature extraction layer is determined. Here, for each sub-feature extraction layer, the first image feature and the second image feature of the sub-feature extraction layer are substituted into the loss function to calculate the value of the first loss function corresponding to the sub-feature extraction layer.

[0119] In some embodiments, the model parameters of the target detection model can be updated based on the value of the first loss function and the value of the second loss function by performing the following steps: based on the value of the first loss function corresponding to each sub-feature extraction layer, the model parameters of each sub-feature extraction layer are updated; based on the value of the second loss function, the model parameters of the target detection layer of the target detection model are updated. Here, for each sub-feature extraction layer, the model parameters of the sub-feature extraction layer are updated based on the value of the first loss function corresponding to the sub-feature extraction layer. Based on the value of the second loss function, the model parameters of the target detection layer of the target detection model are updated.

[0120] In an embodiment of the present application, by updating the model parameters of each sub-feature extraction layer based on the value of the first loss function corresponding to each sub-feature extraction layer, the first image feature and the second image feature extracted by the target detection model can be made close, thereby improving the effect of image feature enhancement.

[0121] In some embodiments, the target detection model includes a feature extraction layer and a target detection layer, the value of the first loss function corresponds to the feature extraction layer, and the value of the second loss function corresponds to the target detection layer; the model parameters of the target detection model can be updated based on the value of the first loss function and the value of the second loss function by performing the following steps: based on the value of the first loss function, the model parameters of the feature extraction layer are updated; based on the value of the second loss function, the model parameters of the target detection layer are updated.

[0122] Here, based on the value of the first loss function and the value of the second loss function, the model parameters of the target detection model are updated respectively. According to the value of the first loss function, the model parameters of the feature extraction layer of the target detection model are updated. According to the value of the second loss function, the model parameters of the target detection layer of the target detection model are updated.

[0123] In an embodiment of the present application, by updating the model parameters of the feature extraction layer based on the value of the first loss function, the image feature extraction effect of the feature extraction layer is improved; by updating the model parameters of the target detection layer based on the value of the second loss function, the target detection accuracy of the target detection layer is improved.

[0124] In some embodiments, the model parameters of the target detection model can be updated based on the value of the first loss function and the value of the second loss function by performing the following steps: fusing the value of the first loss function and the value of the second loss function into a total loss value of the target detection model; and updating the model parameters of the target detection model based on the total loss value.

[0125] Here, based on the value of the first loss function and the value of the second loss function, the model parameters of the target detection model are updated as a whole. The value of the first loss function and the value of the second loss function can be added to obtain the total loss value of the target detection model, and the model parameters of the target detection model are updated based on the total loss value. Different weights can also be set for the value of the first loss function and the value of the second loss function, and the value of the first loss function and the value of the second loss function are weighted and summed to obtain the total loss value of the target detection model, and the model parameters of the target detection model are updated based on the total loss value.

[0126] In an embodiment of the present application, by fusing the value of the first loss function and the value of the second loss function into the total loss value of the target detection model, the model parameters of the target detection model are updated based on the total loss value, so that the model parameters of the feature extraction layer and the model parameters of the target detection layer are updated at the same time, thereby improving the accuracy and efficiency of target detection.

[0127] In some embodiments, when the training target of the target detection model reaches a specific training target, a third image sample is obtained, the light intensity corresponding to the third image sample is lower than the light intensity threshold, and the third image sample carries a target sample label; the target detection model is called to perform feature extraction on the third image sample to obtain a third image feature; the target detection model is called to perform target detection on the third image feature to obtain a second detection result, and the second detection result indicates the position of the target in the third image sample in the third image sample; based on the second detection result and the target sample label, the value of the third loss function is determined, and based on the value of the third loss function, the model parameters of the target detection model that reaches the specific training target are updated.

[0128] Here, the specific training target may be that the loss function value of the target detection model reaches a preset threshold, the specific training target may be that the detection result accuracy of the target detection model reaches the target accuracy, and the specific training target may be that the number of training times of the target detection model reaches a preset number threshold. The illumination intensity threshold is pre-set, and image samples with illumination intensity lower than the illumination intensity threshold are marked as dim images, and image samples with illumination intensity higher than the illumination intensity threshold are marked as bright images. The third image sample is a dim image, and the target sample label indicates the actual position of the target in the third image sample in the third image sample. The feature extraction layer of the target detection model is called, and edge feature extraction and global feature extraction are performed on the third image sample, and the edge feature and the global feature are fused to obtain the third image feature. The target detection layer of the target detection model is called, and target detection is performed on the third image feature to obtain a second detection result. Based on the second detection result and the target sample label, the value of the third loss function is determined, and the model parameters of the target detection layer of the target detection model are updated based on the value of the third loss function.

[0129] In an embodiment of the present application, by using a third image sample with a light intensity lower than a light intensity threshold to train a target detection model that achieves a specific training goal, the detection accuracy of the target detection model for image samples below the light intensity threshold can be improved.

[0130] Example, reference Figure 6 , Figure 6 It is a structural schematic diagram of the training process of the target detection model provided in an embodiment of the present application. The feature extraction layer 604 in the target detection model 601 is called to perform feature extraction on the first image sample 602 to obtain the first image feature, and feature extraction is performed on the second image sample 603 to obtain the second image feature. The target detection layer 606 in the target detection model 601 is called to perform target detection on the second image feature to obtain a first detection result. Based on the first image feature and the second image feature, the value of the first loss function is determined, and based on the first detection result and the sample label 605, the value of the second loss function is determined. Based on the value of the first loss function and the value of the second loss function, the model parameters of the target detection model are updated to train the target detection model.

[0131] By applying the above-mentioned embodiments of the present application, a target detection model is called to perform feature extraction on a first image sample to obtain a first image feature, and feature extraction is performed on a second image sample to obtain a second image feature, and then the target detection model is called to perform target detection on the second image feature to obtain a first detection result, and further based on the first image feature and the second image feature, a value of a first loss function is determined, and based on the first detection result and the sample label, a value of a second loss function is determined, and then based on the value of the first loss function and the value of the second loss function, the model parameters of the target detection model are updated. Here, the illumination intensity corresponding to the first image sample is lower than the illumination intensity corresponding to the second image sample. Based on the first image feature of the first image sample and the second image feature of the second image sample, a loss is constructed for training the target detection model, which can make the first image feature under lower illumination intensity extracted by the target detection model closer to the first image feature under higher illumination intensity extracted by the target detection model, thereby improving the feature extraction capability of the trained target detection model for images under lower illumination intensity, thereby improving the detection accuracy of the target detection model, and the implementation method only needs to be through feature extraction, which is simple to implement, so that the efficiency of target detection is improved; at the same time, based on the first detection result and sample label of the second image sample, a loss is constructed for training the target detection model, thereby further improving the detection accuracy of the target detection model. Therefore, through the embodiments of the present application, the accuracy and efficiency of target detection are improved.

[0132] The target detection method provided by the embodiment of the present application is described below. Figure 7 , Figure 7 is a flow chart of the target detection method provided in the embodiment of the present application, which will be combined with Figure 7 The steps shown are explained.

[0133] In step 701, the target detection model is called to extract features of the image to be detected to obtain features of the image to be detected.

[0134] Here, the trained target detection model is called to perform feature extraction on the image to be detected. The image to be detected can be a dim image with a light intensity lower than the light intensity threshold, or a bright image with a light intensity higher than the light intensity threshold. Taking the case that the image to be detected is a dim image, the original image to be detected is adjusted to n adjusted images of different resolutions, and the original image to be detected is subtracted from the n adjusted images respectively to obtain n sub-images to be detected. The target detection model includes n sub-feature extraction layers. For each sub-feature extraction layer, the sub-feature extraction layer is called, and edge feature extraction and global feature extraction are performed on the sub-image to be detected corresponding to the sub-feature extraction layer. The edge features and global features are fused into sub-image features to be detected. Multiple sub-image features to be detected constitute the features of the image to be detected.

[0135] The feature size of each sub-image to be detected is different. The feature size of the sub-image feature to be detected of the i-th sub-feature extraction layer among the n sub-feature extraction layers is adjusted to the feature size of the sub-image feature to be detected of the i+1-th sub-feature extraction layer among the n sub-feature extraction layers, and the size adjustment feature of the i-th sub-feature extraction layer is obtained. The size adjustment feature of the i-th sub-feature extraction layer is fused with the sub-image feature to be detected of the i+1-th sub-feature extraction layer to obtain the fused feature of the i+1-th sub-feature extraction layer. Traverse i to obtain the fused feature of the n-th sub-feature extraction layer, where i is an integer and its value satisfies 1≤i <n。

[0136] In step 702, the target detection model is called to perform target detection on the features of the image to be detected, and the target detection result of the image to be detected is obtained.

[0137] Here, the target detection result indicates the position of the target in the image to be detected. The target detection layer of the target detection model is called to perform target detection on the fused features of the nth sub-feature extraction layer to obtain the target detection result of the image to be detected.

[0138] Example, reference Figure 8 , Figure 8 801, and performs feature extraction on the image to be detected 802 to obtain features of the image to be detected. The target detection layer 804 in the target detection model 801 is called to perform target detection on the features of the image to be detected to obtain target detection results of the image to be detected.

[0139] Based on step 701 to step 702, by calling the trained target detection model, feature extraction and target detection are performed on the image to be detected in the target detection model, thereby enhancing the features of the image to be detected and improving the accuracy of target detection.

[0140] In some embodiments, the target detection model provided by the embodiments of the present application can be applied in the field of intelligent robots (such as cleaning robots). In a dim scene (a scene where the light intensity is lower than the light intensity threshold), the intelligent robot collects a dim image (the corresponding light intensity is lower than the light intensity threshold), calls the target detection model, extracts features from the collected dim image, obtains enhanced dim image features, and then calls the target detection model to perform target detection on the enhanced dim image features to obtain target detection results. In this way, the accuracy and efficiency of the intelligent robot in detecting targets in dim scenes are improved.

[0141] Below, the training method of the target detection model provided in the embodiment of the present application will be described, with an exemplary application in a scenario where a cleaning robot performs real-time target detection in a dim environment.

[0142] With the development of artificial intelligence, more and more robots are used in various service scenarios. For example, cleaning robots in shopping malls are a widely used service robot. The cleaning robot detects the garbage and then gets the location of the garbage. The robot reaches the designated location to clean up the garbage. Since there are more people in the mall during the day and fewer people at night, the mall is closed when it is the most suitable time for the robot to clean. However, when the mall is closed, only a part of the light source is left, which has a great impact on the robot's visual target detection. The traditional method for target detection in a dim environment is to enhance the brightness of the dark image and then input the enhanced image into the target detection network.

[0143] In the process of image enhancement, the related technologies have the following problems:

[0144] Image enhancement not only brings some noise, but also because the network for image brightness enhancement is relatively complex, combining the image enhancement network and the target detection network to run together will result in low accuracy and efficiency of the robot's target detection.

[0145] In view of the problems existing in the related art, the present application embodiment proposes a method for training a target detection model, which includes the following improvements compared with the related art:

[0146] (1) A dim image and a bright image of the same scene are collected, and the image detail features of the dim image and the image detail features of the bright image are obtained by using the Laplacian pyramid. The image detail features of the dim image and the image detail features of the bright image are respectively subjected to edge feature extraction and global feature extraction to obtain the dim features of the dim image and the bright features of the bright image. The dim features of the dim image and the bright features of the bright image are subjected to loss function calculation. Based on the loss function calculation result, the parameters of the image enhancement network (the above-mentioned feature extraction layer) are adjusted to make the features of the dim image close to the features of the bright image. The image enhancement network structure is simple to implement.

[0147] (2) The bright features of the bright images output by the image enhancement network are used as training samples to train the object detection network (the above-mentioned object detection layer), so that the image enhancement network is combined with the object detection network for end-to-end training, thereby enhancing the real-time object detection capability of images in dim environments.

[0148] Example, reference Fig. 9 , Fig. 9 Schematic diagram of the image enhancement network model structure provided by the embodiment of the present application. Fig. 9 The model structure in is used to explain the target detection method provided in the embodiment of the present application.

[0149] For example, a dim image in a dim scene is input into an image enhancement network model. In the image enhancement network model, the input image 901 is processed by the Laplacian pyramid to obtain multiple images of different sizes (resolutions), such as L0, L1, L2 and L3 shown in area 902. Before the input image 901 is processed by the Laplacian pyramid, the original input image is transformed into images of different sizes by using the Gaussian pyramid, and the length and width of the image are simultaneously reduced to half of the original. Inputting multiple reduced images into the image enhancement network will shorten the training and detection time. Restoring the reduced image to the original image size will cause the image to lose some information, because the Gaussian pyramid only includes downsampling operations, and downsampling will cause the loss of image information. The Laplacian pyramid includes an upsampling operation, which reconstructs the upsampled image by applying the Laplacian operator to restore the lost information to a certain extent. The information lost in the process of processing the image by the Gaussian pyramid constitutes the components of the Laplacian pyramid, and the Laplacian pyramid is a difference image of detail information obtained by subtracting the original image from the image restored to the original image size. The image after Laplacian pyramid processing is used to perform image enhancement on the input image 901, and the image L0, image L1, image L2 and image L3 are respectively input into the enhancement module (the feature extraction layer of the above-mentioned target detection model), such as the enhancement module shown in area 903, to obtain the image enhancement features corresponding to each image.

[0150] For image L3, image L3 is input into the enhancement module to obtain the image enhancement features of image L3. For image L2, image L2 is input into the enhancement module to obtain the image enhancement features of image L2. The image enhancement features of image L3 are upsampled to make the image enhancement features of image L3 and the image enhancement features of image L2 the same size, and then the image enhancement features of image L3 are added to the image enhancement features of image L2 to obtain the total image enhancement features of image L2 and image L3.

[0151] For image L1, image L1 is input into the enhancement module to obtain the image enhancement feature of image L1. The total image enhancement features of images L2 and L3 are upsampled to make the total image enhancement features of images L2 and L3 have the same size as the image enhancement features of image L1, and then the total image enhancement features of images L2 and L3 are added to the image enhancement features of image L1 to obtain the total image enhancement features of images L1, L2, and L3.

[0152] For image L0, image L0 is input into the enhancement module to obtain the image enhancement feature of image L0. The total image enhancement features of images L1, L2, and L3 are upsampled to make the total image enhancement features of images L1, L2, and L3 the same size as the image enhancement features of image L0, and then the total image enhancement features of images L1, L2, and L3 are added to the image enhancement features of image L0 to obtain the enhanced feature 904. The enhanced feature 904 is a feature in a 3xHxW (three channels x height x width) format, because the input of the target detection network is image data, and the image is an RGB three-channel data, the length, width, and number of channels of the enhanced feature 904 and the RGB image data are the same, but it is no longer data in the range of 0-255. Then, the enhanced feature 904 is input into the target detection network 905 to perform target detection processing on the enhanced dim image.

[0153] Since the semantic features of normal images and dim images in the network are inconsistent, dim images have more noise, so when training the image enhancement module in the embodiment of the present application, the training data set is dim images and normal images of the same scene. For example, in a shopping mall, dim images and bright images of the same scene are collected, and the sweeping robot can walk along a specific route at night or in the morning to capture dim images and bright images of the same scene.

[0154] Example, reference Fig.10 , Fig.10 Schematic diagram of the model structure of the training image enhancement module provided in the embodiment of the present application. Fig.10 The model structure in the example is used to explain the training method of the target detection model provided in the embodiment of the present application.

[0155] In the enhancement module, input feature 1001 is Fig. 9 Here, the dark image and the bright image are processed by Laplacian pyramid to obtain the dark image L0, the dark image L1, the dark image L2 and the dark image L3, and the bright image L0, the bright image L1, the bright image L2 and the bright image L3. The dark image and the bright image are subjected to feature extraction operations of two branches respectively, and finally the dark features and the bright features are obtained, wherein the extraction operations include edge feature extraction and global feature extraction. The loss function is calculated for the dark features and the bright features, and the parameters of the enhancement network are updated based on the loss function result, so that the dim features and the bright features extracted by the network are closer, ensuring that the features extracted by the network for the dim images and the bright images are consistent.

[0156] For example, for the dim image L0, the edge detection Candy operator 1002 is used to extract the edge features of the dim image L0 to obtain the edge features of the dim image L0. The residual block 1003, the convolution function 1004, and the activation function 1005 are used to extract the global features of the dim image L0 to obtain the global features of the dim image L0. The edge features and global features of the dim image L0 are added to obtain the dim features of the dim image L0. For the bright image L0, the edge detection Candy operator 1009 is used to extract the edge features of the bright image L0 to obtain the edge features of the bright image L0. The residual block 1006, the convolution function 1007, and the activation function 1008 are used to extract the global features of the bright image L0 to obtain the global features of the bright image L0. The edge features and global features of the bright image L0 are added to obtain the bright features of the bright image L0. Then, based on the dark features of the dark image L0 and the bright features of the bright image L0, the loss function is calculated to construct the loss of the dark image L0 and the bright image L0, so as to update the parameters of the enhancement network based on the loss, so that the features of the dark image L0 are as close as possible to the features of the bright image L0. Through network training, the dark image and the bright image of the same scene will get the same features when input into the image enhancement network. Finally, the bright features of the bright image L0 are output.

[0157] In the embodiment of the present application, the process of constructing the loss of the dark image L1 and the bright image L1, the process of constructing the loss of the dark image L2 and the bright image L2, and the process of constructing the loss of the dark image L3 and the bright image L4 is the same as the process of constructing the loss of the dark image L0 and the bright image L0, and will not be repeated here. Similarly, the bright features of the bright image L1, the bright features of the bright image L2, and the bright features of the bright image L3 can also be output.

[0158] Continue to refer Fig. 9In the processing, the bright features of the bright image L3 are upsampled so that the bright features of the bright image L3 are the same size as the bright features of the bright image L2, and then the bright features of the bright image L3 are added to the bright features of the bright image L2 to obtain the total bright features of the bright images L2 and L3. The total bright features of the bright images L2 and L3 are upsampled so that the total bright features of the bright images L2 and L3 are the same size as the bright features of the bright image L1, and then the total bright features of the bright images L2 and L3 are added to the bright features of the bright image L1 to obtain the total bright features of the bright images L1, L2, and L3. The total bright features of bright images L1, bright images L2, and bright images L3 are upsampled to make the total bright features of bright images L1, bright images L2, and bright images L3 the same size as the bright features of bright image L0, and then the total bright features of bright images L1, bright images L2, and bright images L3 are added to the bright features of bright image L0 to finally obtain the total bright features of the bright images.

[0159] For example, the total bright features of the acquired bright image are input into the target detection network to obtain the detection result of the bright image. According to the detection result and the label carried by the bright image, the loss function of the target detection network is constructed, so as to train the target detection network based on the loss function. After the image enhancement network and the target detection network are trained, the output in the enhancement module can be changed to the dim features of the dim image. When the dim image is input into the image enhancement network model provided in the embodiment of the present application, the same effect as the bright image can be obtained.

[0160] In the above-mentioned application scenario of real-time target detection in dim environment, bright features and dim features are obtained by extracting features from bright images and dim images respectively; a first loss is constructed based on the bright features and dim features, and an image enhancement network is trained based on the first loss, so that after the image enhancement network is trained, the dim features of the extracted dim images are closer to the bright features of the extracted bright images; and target detection is performed on the bright features through the target detection network to obtain detection results; a second loss is constructed based on the detection results and the labels of the bright images, and a target detection network is trained based on the second loss; and target detection is performed on the dim images based on the trained image enhancement network and target detection network, thereby enhancing the real-time target detection capability of images in dim environments.

[0161] The following further describes the exemplary structure of the target detection model training device 455 provided in the embodiment of the present application implemented as a software module. In some embodiments, Figure 2As shown, the software modules in the training device 455 of the target detection model stored in the memory 450 may include: a feature extraction module 4551, which is used to call the target detection model, perform feature extraction on the first image sample to obtain the first image feature, and perform feature extraction on the second image sample to obtain the second image feature; wherein the content of the first image sample is the same as the content of the second image sample, the light intensity corresponding to the first image sample is lower than the light intensity corresponding to the second image sample, and the second image sample carries a sample label; a target detection module 4552, which is used to call the target detection model to perform target detection on the second image feature to obtain a first detection result, wherein the first detection result indicates the position of the target in the second image sample at the second image sample; a loss determination module 4553, which is used to determine the value of the first loss function based on the first image feature and the second image feature, and determine the value of the second loss function based on the first detection result and the sample label; a parameter updating module 4554, which is used to update the model parameters of the target detection model based on the value of the first loss function and the value of the second loss function to train the target detection model.

[0162] In some embodiments, the feature extraction module 4551 is further used to extract edge features of the first image sample and extract global features of the first image sample; and merge the edge features and the global features into the first image features.

[0163] In some embodiments, the feature extraction module 4551 is also used to call the target detection model, perform feature extraction on the first image sample to obtain the first image feature, and perform feature extraction on the second image sample. Before obtaining the second image feature, the first original image sample is adjusted to n first adjusted images of different resolutions, and the second original image sample is adjusted to n second adjusted images of different resolutions, where n is an integer greater than 1; the first original image sample is subtracted from the n first adjusted images to obtain n first sub-image samples, and the first image sample includes the n first sub-image samples; the second original image sample is subtracted from the n second adjusted images to obtain n second sub-image samples, and the second image sample includes the n second sub-image samples.

[0164] In some embodiments, the target detection model includes n sub-feature extraction layers, each sub-feature extraction layer corresponds to a first sub-image sample and a second sub-image sample; the feature extraction module 4551 is also used to perform the following operations for each sub-feature extraction layer: calling the sub-feature extraction layer, performing feature extraction on the first sub-image sample corresponding to the sub-feature extraction layer, and obtaining the first sub-image feature of the sub-feature extraction layer, and the first image feature includes n first sub-image features; calling the sub-feature extraction layer, performing feature extraction on the second sub-image sample corresponding to the sub-feature extraction layer, and obtaining the second sub-image feature of the sub-feature extraction layer, and the second image feature includes n second sub-image features.

[0165] In some embodiments, the feature size of each second sub-image feature is different; the target detection module 4552 is further used to call the target detection model to perform target detection on the second image feature, and before obtaining the first detection result, adjust the feature size of the second sub-image feature of the i-th sub-feature extraction layer in the n sub-feature extraction layers to the feature size of the second sub-image feature of the i+1-th sub-feature extraction layer in the n sub-feature extraction layers to obtain the size adjustment feature of the i-th sub-feature extraction layer; fuse the size adjustment feature of the i-th sub-feature extraction layer with the second sub-image feature of the i+1-th sub-feature extraction layer to obtain the first fused feature of the i+1-th sub-feature extraction layer; traverse i to obtain the first fused feature of the n-th sub-feature extraction layer, where i is an integer and its value satisfies 1≤i <n。

[0166] In some embodiments, the target detection module 4552 is further used to call the target detection model to perform target detection on the first fused feature of the nth sub-feature extraction layer to obtain a first detection result.

[0167] In some embodiments, the target detection module 4552 is also used to call the target detection model to perform target detection on the second image features, and obtain the weight value of each feature extraction layer before obtaining the first detection result; based on the weight value of each feature extraction layer, the second sub-image features of each feature extraction layer are fused to obtain a second fused feature.

[0168] In some embodiments, the target detection module 4552 is further used to call the target detection model to perform target detection on the second fusion feature to obtain a first detection result.

[0169] In some embodiments, the loss determination module 4553 is further used to determine the value of the first loss function corresponding to each sub-feature extraction layer based on the first sub-image feature and the second sub-image feature of each sub-feature extraction layer.

[0170] In some embodiments, the parameter updating module 4554 is also used to update the model parameters of each sub-feature extraction layer based on the value of the first loss function corresponding to each sub-feature extraction layer; and to update the model parameters of the target detection layer of the target detection model based on the value of the second loss function.

[0171] In some embodiments, the target detection model includes a feature extraction layer and a target detection layer, the value of the first loss function corresponds to the feature extraction layer, and the value of the second loss function corresponds to the target detection layer; the parameter updating module 4554 is also used to update the model parameters of the feature extraction layer based on the value of the first loss function; and to update the model parameters of the target detection layer based on the value of the second loss function.

[0172] In some embodiments, the parameter updating module 4554 is further used to merge the value of the first loss function and the value of the second loss function into a total loss value of the target detection model; and based on the total loss value, update the model parameters of the target detection model.

[0173] In some embodiments, the parameter updating module 4554 is also used to obtain a third image sample when the training target of the target detection model reaches a specific training target, the light intensity corresponding to the third image sample is lower than the light intensity threshold, and the third image sample carries a target sample label; call the target detection model to perform feature extraction on the third image sample to obtain a third image feature; call the target detection model to perform target detection on the third image feature to obtain a second detection result, and the second detection result indicates the position of the target in the third image sample in the third image sample; determine the value of the third loss function based on the second detection result and the target sample label, and update the model parameters of the target detection model that reaches the specific training target based on the value of the third loss function.

[0174] The following continues to describe an exemplary structure of a target detection device provided in an embodiment of the present application implemented as a software module. In some embodiments, the software module in the target detection device may include: a feature extraction module, used to call a target detection model to perform feature extraction on an image to be detected, and obtain features of the image to be detected; a target detection module, used to call a target detection model to perform target detection on the features of the image to be detected, and obtain a target detection result of the image to be detected, wherein the target detection result indicates the position of the target in the image to be detected in the image to be detected; wherein the target detection model is trained using the training method of the target detection model provided in an embodiment of the present application.

[0175] The embodiment of the present application provides a computer program product, which includes computer executable instructions or computer programs, and the computer executable instructions or computer programs are stored in a computer-readable storage medium. The processor of the electronic device reads the computer executable instructions or computer programs from the computer-readable storage medium, and the processor executes the computer executable instructions or computer programs, so that the electronic device performs the above-mentioned method of the embodiment of the present application.

[0176] The present application embodiment provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions or computer programs are stored. When the computer-executable instructions or computer programs are executed by a processor, the processor will be caused to execute the method provided by the present application embodiment, for example, Figure 3A The training method of the target detection model is shown.

[0177] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EP ROM, EEPROM, flash memory, magnetic surface storage, optical disk, or CD-ROM; or it may be various devices including one or any combination of the above memories.

[0178] In some embodiments, computer executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.

[0179] As an example, computer-executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions).

[0180] As an example, computer executable instructions may be deployed to be executed on one electronic device, or on multiple electronic devices located at one site, or on multiple electronic devices distributed at multiple sites and interconnected by a communication network.

[0181] The above is only an embodiment of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent substitutions and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.

Claims

1. A method for training a target detection model, characterized in that: The method comprises: Calling the target detection model, performing feature extraction on the first image sample to obtain a first image feature, and performing feature extraction on the second image sample to obtain a second image feature; The content of the first image sample is the same as the content of the second image sample, the light intensity corresponding to the first image sample is lower than the light intensity corresponding to the second image sample, and the second image sample carries a sample label; Calling the target detection model to perform target detection on the second image feature to obtain a first detection result, wherein the first detection result indicates a position of the target in the second image sample at the second image sample; Determine a value of a first loss function based on the first image feature and the second image feature, and determine a value of a second loss function based on the first detection result and the sample label; Based on the value of the first loss function and the value of the second loss function, the model parameters of the target detection model are updated to train the target detection model.

2. The method according to claim 1, characterized in that The step of extracting features from the first image sample to obtain first image features includes: Extracting edge features of the first image sample and extracting global features of the first image sample; The edge feature and the global feature are fused into the first image feature.

3. The method according to claim 1, characterized in that Before calling the target detection model, performing feature extraction on the first image sample to obtain the first image feature, and performing feature extraction on the second image sample to obtain the second image feature, the method further includes: Adjusting the first original image sample into n first adjusted images with different resolutions, and adjusting the second original image sample into n second adjusted images with different resolutions, where n is an integer greater than 1; Subtracting the first original image sample from the n first adjusted images respectively to obtain n first sub-image samples, where the first image sample includes the n first sub-image samples; The second original image samples are respectively subtracted from the n second adjusted images to obtain n second sub-image samples, where the second image samples include the n second sub-image samples.

4. The method according to claim 3, characterized in that The target detection model comprises n sub-feature extraction layers, each of which corresponds to one first sub-image sample and one second sub-image sample; The calling of the target detection model, performing feature extraction on the first image sample to obtain the first image feature, and performing feature extraction on the second image sample to obtain the second image feature, includes: For each of the sub-feature extraction layers, the following operations are performed respectively: Calling the sub-feature extraction layer, performing feature extraction on the first sub-image sample corresponding to the sub-feature extraction layer, and obtaining a first sub-image feature of the sub-feature extraction layer, wherein the first image feature includes n first sub-image features; The sub-feature extraction layer is called to perform feature extraction on the second sub-image samples corresponding to the sub-feature extraction layer to obtain second sub-image features of the sub-feature extraction layer, where the second image features include n second sub-image features.

5. The method according to claim 4, characterized in that The feature size of each of the second sub-image features is different, and before calling the target detection model to perform target detection on the second image features and obtaining the first detection result, the method further includes: Adjusting the feature size of the second sub-image feature of the i-th sub-feature extraction layer among the n sub-feature extraction layers to the feature size of the second sub-image feature of the i+1-th sub-feature extraction layer among the n sub-feature extraction layers, to obtain a size adjustment feature of the i-th sub-feature extraction layer; The size adjustment feature of the i-th sub-feature extraction layer is fused with the second sub-image feature of the i+1-th sub-feature extraction layer to obtain a first fused feature of the i+1-th sub-feature extraction layer; Traverse the i to obtain the first fusion feature of the nth sub-feature extraction layer, where i is an integer and its value satisfies 1≤i <n; The calling of the target detection model to perform target detection on the second image feature to obtain a first detection result includes: The target detection model is called to perform target detection on the first fused feature of the nth sub-feature extraction layer to obtain a first detection result.

6. The method according to claim 4, characterized in that Before calling the target detection model to perform target detection on the second image feature to obtain the first detection result, the method further includes: Obtaining a weight value of each of the feature extraction layers; Based on the weight value of each feature extraction layer, the second sub-image features of each feature extraction layer are fused to obtain a second fused feature; The calling of the target detection model to perform target detection on the second image feature to obtain a first detection result includes: The target detection model is called to perform target detection on the second fusion feature to obtain a first detection result.

7. The method according to claim 4, characterized in that The determining a value of a first loss function based on the first image feature and the second image feature includes: Determine a value of a first loss function corresponding to each of the sub-feature extraction layers based on the first sub-image feature and the second sub-image feature of each of the sub-feature extraction layers; The updating of the model parameters of the target detection model based on the value of the first loss function and the value of the second loss function includes: Based on the value of the first loss function corresponding to each of the sub-feature extraction layers, updating the model parameters of each of the sub-feature extraction layers; Based on the value of the second loss function, the model parameters of the target detection layer of the target detection model are updated.

8. The method according to claim 1, characterized in that The target detection model includes a feature extraction layer and a target detection layer, the value of the first loss function corresponds to the feature extraction layer, and the value of the second loss function corresponds to the target detection layer; The updating of the model parameters of the target detection model based on the value of the first loss function and the value of the second loss function includes: Based on the value of the first loss function, updating the model parameters of the feature extraction layer; Based on the value of the second loss function, the model parameters of the target detection layer are updated.

9. The method according to claim 1, characterized in that The updating of the model parameters of the target detection model based on the value of the first loss function and the value of the second loss function includes: Merging the value of the first loss function and the value of the second loss function into a total loss value of the target detection model; Based on the total loss value, model parameters of the target detection model are updated.

10. The method according to any one of claims 1 to 9, characterized in that: The method further comprises: When the training target of the target detection model reaches a specific training target, obtaining a third image sample, the light intensity corresponding to the third image sample is lower than the light intensity threshold, and the third image sample carries a target sample label; Calling the target detection model to perform feature extraction on the third image sample to obtain third image features; Calling the target detection model to perform target detection on the third image feature to obtain a second detection result, where the second detection result indicates a position of the target in the third image sample at which the target in the third image sample is located; Based on the second detection result and the target sample label, a value of a third loss function is determined, and based on the value of the third loss function, a model parameter of the target detection model that achieves the specific training goal is updated.

11. A target detection method, characterized in that: The method comprises: Call the target detection model to extract features of the image to be detected to obtain the features of the image to be detected; Calling the target detection model to perform target detection on the features of the image to be detected, and obtaining a target detection result of the image to be detected, wherein the target detection result indicates a position of the target in the image to be detected at the location of the image to be detected; Wherein, the target detection model is trained based on the target detection model training method described in any one of claims 1-10.

12. A training device for a target detection model, characterized in that: The device comprises: a feature extraction module, configured to call the target detection model, perform feature extraction on the first image sample to obtain a first image feature, and perform feature extraction on the second image sample to obtain a second image feature; wherein the content of the first image sample is the same as the content of the second image sample, the light intensity corresponding to the first image sample is lower than the light intensity corresponding to the second image sample, and the second image sample carries a sample label; a target detection module, configured to call the target detection model to perform target detection on the second image feature to obtain a first detection result, wherein the first detection result indicates a position of the target in the second image sample at the second image sample; a loss determination module, configured to determine a value of a first loss function based on the first image feature and the second image feature, and to determine a value of a second loss function based on the first detection result and the sample label; A parameter updating module is used to update the model parameters of the target detection model based on the value of the first loss function and the value of the second loss function to train the target detection model.

13. An electronic device, characterized in that: The electronic device comprises: A memory for storing computer executable instructions or computer programs; A processor, configured to implement the method according to any one of claims 1 to 11 when executing computer executable instructions or computer programs stored in the memory.

14. A computer-readable storage medium storing computer-executable instructions or a computer program, characterized in that: When the computer executable instructions or computer program are executed by a processor, the method according to any one of claims 1 to 11 is implemented.

Citation Information

Patent Citations

  • Target identification method and device, equipment, storage medium and program product

    CN117975048A

  • Vehicle target detection method based on LLC-YOLO algorithm

    CN118172541A