Target detection method, device and electronic equipment

By performing target detection and classification recognition in the smart home system, the problem of insufficient subsequent processing accuracy of the target detection algorithm in the smart home scene is solved, more accurate assembly detection and solution push are achieved, and the user experience is improved.

CN114549968BActive Publication Date: 2024-10-15SHENZHEN LUMIUNITED TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210028805.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-11
Publication Date
2024-10-15
Estimated Expiration
2042-01-11

AI Technical Summary

Technical Problem

In smart home scenarios, there are accuracy issues in the subsequent processing of the target detection algorithm, making it difficult to accurately perform assembly detection and classification processing.

Method used

Propose a target detection method and device. By acquiring the image to be detected, target detection is performed, the integrity and position information of the target object is identified, the partial image is extracted for classification and identification, the assembly detection result is determined, and the adapted assembly is obtained according to the target object category. The plan is pushed to the terminal device.

Benefits of technology

The user experience is improved. Through accurate assembly test results and solution push, users can perform subsequent operations more accurately, enhancing the application efficiency of the smart home system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114549968B_ABST
    Figure CN114549968B_ABST
Patent Text Reader

Abstract

The embodiments of the present application disclose a target detection method, device and electronic device. The method comprises: acquiring an image to be detected under a target area; performing target detection on the image to be detected to obtain a recognition result of the target in the image to be detected; and determining an assembly detection result for the target under the target area based on the recognition result of the target. Through the above-mentioned method, target detection is performed on the image to be detected to obtain a recognition result of the target in the image to be detected, and based on the recognition result of the target, an assembly detection result for the target under the target area can be determined, so that the assembly scheme corresponding to the target can be obtained based on the assembly detection result, so that the user can perform subsequent operations more accurately based on the assembly scheme, thereby improving the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of smart home technology, and more specifically, to a target detection method, device and electronic device. Background Art

[0002] With the development of the Internet of Things industry and artificial intelligence technology, target detection algorithms are widely used in real life. For example, the target detection algorithm can be used to automatically identify whether there is a target object in the current scene and locate the target object. At the same time, the recognition result of the target detection algorithm can also be subsequently processed. For example, in a smart home scene, smart furniture can be used as the target object, and the target detection algorithm can be used to automatically identify whether the image includes smart furniture. If smart furniture is included, the identified smart furniture can be classified so as to realize different applications according to the classification.

[0003] However, the subsequent processing still has the problem of not being able to be executed more accurately. Summary of the invention

[0004] In view of the above problems, the present application proposes a target detection method, device and electronic device to improve the above problems.

[0005] In a first aspect, the present application provides a target detection method, which includes: acquiring an image to be detected in a target area; performing target detection on the image to be detected to obtain a recognition result of a target object in the image to be detected; and determining an assembly detection result for the target object in the target area based on the recognition result of the target object.

[0006] In a second aspect, the present application provides a target detection device, which includes: an image acquisition unit for acquiring an image to be detected, which is used to acquire an image to be detected in a target area; a recognition result acquisition unit, which is used to perform target detection on the image to be detected and obtain a recognition result of the target object in the image to be detected; and an assembly detection result acquisition unit, which is used to determine the assembly detection result for the target object in the target area based on the recognition result of the target object.

[0007] As a method, the recognition result includes the integrity of the target object, and the assembly detection result acquisition unit is specifically used to extract a local image of the area containing the target object from the image to be detected based on the position information of the target object if the integrity of the target object meets the integrity threshold; classify and identify the target object in the local image to obtain the target object category corresponding to the target object; and determine the assembly detection result of the target object in the target area according to the target object category and the recognition result.

[0008] As another way, the assembly detection result acquisition unit is specifically used to acquire an assembly plan for the target assembly object that matches the target object category if the assembly detection result indicates that the target object is adapted to the target assembly object; and push the assembly plan to the target terminal.

[0009] Among them, the recognition result of the target object in the image to be detected is obtained by detecting with a trained target detection model, and the target detection model is obtained by a model training unit; the model training unit is used to obtain a sample image and a corresponding sample label; the sample label includes a target object label and a position label in the sample image; target detection is performed on the sample image through the initial detection model to be trained to obtain a sample position detection result corresponding to the target object in the sample image; the target object in the sample image is recognized by the target recognition network in the initial detection model to obtain a sample object recognition result corresponding to the target object in the sample image; based on the sample object recognition result and the difference between the sample position detection result and the target object label and the position label, the model parameters of the initial detection model are adjusted and training is continued until the target training condition is met and the training is stopped to obtain a trained target detection model.

[0010] As a method, the target object label includes a target integrity soft label, and the model training unit is specifically used to determine the target recognition loss based on the difference between the sample object recognition result and the target integrity soft label; determine the position loss based on the position detection result and the position label; based on the target recognition loss and the position loss, adjust the model parameters of the initial detection model and continue training until the target training conditions are met, and stop training to obtain a trained target detection model.

[0011] Among them, optionally, the sample label includes a target object label, and the model training unit is specifically used to detect the position of the target object in the sample image through the position detection network in the initial detection model to obtain a sample position detection result; based on the coordinate difference between the coordinates in the sample position detection result and the coordinates in the position label, determine the detection frame position loss; based on the coincidence difference between the target object area in the sample position detection result and the target object area in the position label, determine the coincidence loss.

[0012] Optionally, the coordinates of each vertex corresponding to the target object in the sample position detection result are determined based on the center point coordinates, length and width of the target detection frame, and the target object area in the sample position detection result is determined based on the coordinates of each vertex corresponding to the target object in the sample position detection result and the coordinate difference between the coordinates of each vertex corresponding to the target object in the sample position detection result and the coordinates of each vertex of the target object in the position label, determine the detection frame position loss.

[0013] In a third aspect, the present application provides an electronic device comprising one or more processors and a memory; one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the above-mentioned method.

[0014] In a fourth aspect, the present application provides a computer-readable storage medium, in which program code is stored, wherein the above method is executed when the program code is run.

[0015] The present application provides a target detection method, device, electronic device and storage medium. After acquiring an image to be detected under a target area, target detection is performed on the image to be detected to obtain a recognition result of the target in the image to be detected, and the assembly detection result for the target in the target area is determined based on the recognition result of the target. Through the above method, target detection can be performed on the image to be detected to obtain a recognition result of the target in the image to be detected, and the assembly detection result for the target in the target area can be determined based on the recognition result of the target, so that the assembly scheme corresponding to the target can be obtained based on the assembly detection result, so that the user can perform subsequent operations more accurately based on the assembly scheme, thereby improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0017] Figure 1 A schematic diagram showing an application environment of a target detection method proposed in the present application;

[0018] Figure 2 A schematic diagram showing an application scenario of a target detection method proposed in the present application;

[0019] Figure 3 A flow chart of a target detection method proposed in an embodiment of the present application is shown;

[0020] Figure 4 A flow chart of a target detection method proposed in another embodiment of the present application is shown;

[0021] Figure 5 A schematic diagram of the network structure of an initial detection model to be trained proposed in the present application is shown;

[0022] Figure 6 A schematic diagram showing the overlap between the area corresponding to the position information and the area corresponding to the position tag in the image to be detected proposed by the present application;

[0023] Figure 7 A flow chart of a target detection method proposed in another embodiment of the present application is shown;

[0024] Figure 8 A schematic diagram of the network structure of an end-to-end network model proposed in this application is shown;

[0025] Fig. 9 A flowchart showing a practical application of a target detection method proposed in this application is shown;

[0026] Fig.10 A structural block diagram of a target detection device proposed in an embodiment of the present application is shown;

[0027] Fig.11 A structural block diagram of an electronic device proposed in this application is shown;

[0028] Fig.12 It is a storage unit of an embodiment of the present application for storing or carrying program codes for implementing the target detection method according to an embodiment of the present application. DETAILED DESCRIPTION

[0029] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0030] With the development of the Internet of Things industry and artificial intelligence technology, target detection algorithms are widely used in real life. For example, the target detection algorithm can be used to automatically identify whether there is a target object in the current scene and locate the target object. At the same time, the recognition result of the target detection algorithm can also be subsequently processed. For example, in a smart home scene, smart furniture can be used as the target object, and the target detection algorithm can be used to automatically identify whether the image includes smart furniture. If smart furniture is included, the identified smart furniture can be classified so as to realize different applications according to the classification.

[0031] However, the inventors found in relevant research that the subsequent processing process still has the problem of not being able to be executed more accurately.

[0032] Therefore, the inventors have proposed a target detection method, device, and electronic device in the present application. After acquiring the image to be detected under the target area, target detection is performed on the image to be detected to obtain the recognition result of the target in the image to be detected, and the assembly detection result for the target in the target area is determined based on the recognition result of the target. Through the above-mentioned method, target detection is performed on the image to be detected to obtain the recognition result of the target in the image to be detected, and the assembly detection result for the target in the target area can be determined based on the recognition result of the target, so that the assembly scheme corresponding to the target can be obtained based on the assembly detection result, so that the user can perform subsequent operations more accurately based on the assembly scheme, thereby improving the user experience.

[0033] Please refer to Figure 1 , is a schematic diagram of an application environment of an embodiment of the present application. Among them, Figure 1 Provided is a target detection system 10, which includes a gateway 100, an image acquisition device 200 connected to the gateway 100, a server 300 connected to the gateway 100, and a terminal device 400 connected to the server 300. The gateway 100 may be an intelligent gateway for smart home control, which may realize functions such as system data acquisition, data transmission, and linkage control. The gateway 100 may also exchange information with products such as servers and intelligent interactive terminals in a wireless manner.

[0034] The image acquisition device 200 may include a camera or an electronic device with a camera function set in a corresponding scene space. The gateway 100 and the image acquisition device 200 may be connected via Bluetooth, WiFi (Wireless-Fidelity), ZigBee (communication methods such as ZigBee technology), and the connection method between the gateway 100 and the image acquisition device 200 is not limited in the embodiment of the present application.

[0035] The server 300 may be a local server, a cloud server, or other servers, and the specific server type may not be limited in the embodiments of the present application. The image acquisition devices 200 and the gateway 100 disposed in different spatial regions may communicate with the same server 300 through the network.

[0036] The terminal device 400 may include a personal computer (PC), a tablet computer, a smart phone, a personal digital assistant (PDA), a smart panel, etc., which are not limited here.

[0037] In some embodiments, the image to be detected in the target area can be captured by the image capture device 200, and then the captured image to be detected can be uploaded to the gateway 100 or the server 300. The gateway 100 or the server 300 performs target detection on the image to be detected in the target area, respectively, to obtain the recognition result of the target object in the image to be detected, and then determines the assembly detection result for the target object in the target area according to the recognition result of the target object.

[0038] In order to better understand the solution of the embodiment of the present application, an application scenario of the target detection method provided by the embodiment of the present application is first introduced below.

[0039] like Figure 2 As shown, in Figure 2 The scene shown includes smart home devices (cameras, etc.), windows, etc. The user can take pictures of the windows through a terminal device with a camera function, and upload the taken images to the gateway or server through the user terminal device. The gateway or server can determine whether the image includes a window through the target detection method provided in the present application, and output the completeness of the target object when it is determined that there is a window, thereby providing more reference basis for the classification processing step of the window, and sending the classification results and installation suggestions to the user terminal after executing the classification processing step.

[0040] It should be noted that, in addition to the gateway and the server, the user terminal device can also execute the target detection method provided in the present application. Moreover, in some embodiments, the user can also control the camera device in the scene through the user terminal to take pictures of the window, and upload the taken images to the gateway, server or user terminal, so that the gateway, server and user terminal can execute the target detection method provided in the embodiment of the present application.

[0041] The following will introduce the embodiments of the present application in conjunction with the accompanying drawings.

[0042] See also Figure 3 , the present application provides a target detection method, the method comprising:

[0043] S110: Acquire the image to be detected in the target area.

[0044] The target area refers to the real space area where target detection is required, and specifically, it can be the scene area that can be covered by target detection, for example, the indoor area, living room area, bedroom area, etc. in the smart home scene. The image to be detected refers to the image that needs to be detected, and specifically, it can be used to detect whether there is a target object in the image to be detected.

[0045] As a method, the image to be detected sent by the user terminal can be received. For example, the user can take a photo of the object to be detected through the user terminal device, and upload the taken photo to the gateway or server, so that the gateway or server can obtain the image to be detected.

[0046] As another way, the user can control the image acquisition device (such as a camera, etc.) in the current scene through the user terminal device to take pictures of the objects to be detected, and upload the taken pictures to the gateway or server so that the gateway or server can obtain the images to be detected.

[0047] S120: Performing target detection on the image to be detected to obtain a recognition result of the target object in the image to be detected.

[0048] Among them, target detection refers to an image segmentation based on the geometric and statistical features of the target. Specifically, it can be a method of finding the target from a scene (image), which mainly includes two processes: detection and recognition. For example, in the smart home scene, windows and doors are detected and recognized. The target object refers to the target of target detection. Specifically, it can be a target in the scene area that can be covered by the target detection. The target object can be smart furniture, such as windows and doors. The recognition result of the target object can include the completeness of the target object and whether the target object is contained in the image to be detected.

[0049] As a method, the recognition result of the target object in the image to be detected can be obtained by detecting through a trained target detection model, wherein the position information of the target object in the image to be detected can also be obtained through the target detection model.

[0050] In order to better represent the completeness of the target, the value range of the target recognition result in the image to be detected can be set between 0 and 1. The more complete the target in the image to be detected is, the closer the recognition result of the target in the image to be detected is to 1. The position information of the target in the image to be detected can be the center point coordinates, length and width of the detection frame corresponding to the target. Exemplarily, the position information of the target can be (Xo, Yo, Wo, Ho), where (Xo, Yo) can represent the center point coordinates of the target detection frame, that is, the intersection of the two diagonals of the target detection frame, Wo can represent the width of the target detection frame, and Ho can represent the length of the target detection frame.

[0051] It should be noted that before the image to be detected is input into the target detection model, the image to be detected can also be preprocessed to input the preprocessed image into the target detection model. Exemplarily, the size of the image to be detected can be adjusted to 224×224, and then each pixel in the image to be detected can be multiplied by 1 / 256, so that the value of each pixel in the image is between 0 and 1. By preprocessing the image, the calculation speed and calculation accuracy of the target detection model can be accelerated, thereby obtaining a more accurate detection result.

[0052] Through the above method, the target object recognition result can not only characterize whether the image to be detected includes the target object, but also characterize the completeness of the target object if there is a target object, thereby providing more reference basis (completeness) for the subsequent processing steps of the target object, which is conducive to more accurate execution of the subsequent processing steps.

[0053] S130: Determine an assembly detection result for the target object in the target area according to the recognition result of the target object.

[0054] Among them, the assembly detection result refers to the matching result between the target object and the target assembly object. For example, in a smart home scenario, when the target object is a window, the target assembly object may be a smart curtain, and the assembly detection result may indicate whether the window is suitable for installing a smart curtain.

[0055] As a method, if the completeness of the recognition result of the target object meets the completeness threshold, a local image of the area containing the target object can be extracted from the image to be detected based on the position information of the target object; the target object in the local image is classified and identified to obtain the target object category corresponding to the target object; and then the assembly detection result for the target object in the target area is determined based on the target object category and the recognition result.

[0056] Among them, optionally, the target object in the local image can be classified and identified by a classification model to obtain the target object category corresponding to the target object. The classification model can be a classification network such as VGG16, ResNet, MobileNet, etc. In the embodiment of the present application, the network structure of the classification model to be trained is not limited. Exemplarily, if the target object is a window, the local image can be input into the classification model to obtain the type of window in the local image (for example: a straight window, an L-shaped window, an arched window, a special-shaped window, etc.).

[0057] Optionally, after obtaining the target object category, the assembly detection result for the target object under the target area can be determined based on the characteristics of the target object category itself. Exemplarily, when the target object is a window, its category can be a straight window, an L-shaped window, an arched window, a special-shaped window, etc., wherein, due to shape restrictions, special-shaped windows, arched windows, etc., may not be convenient for laying smart curtain rails, and thus do not have the conditions for installing smart curtains. Therefore, the assembly detection result corresponding to the above-mentioned categories of windows is that the target object is not suitable for the target assembly object, that is, the window is not suitable for installing smart curtains; while the shape of straight windows, etc. is relatively regular, and smart curtain rails can be laid. Therefore, the assembly detection result corresponding to windows such as straight windows is that the target object is suitable for the target assembly object, that is, the window is suitable for installing smart curtains.

[0058] Optionally, if the assembly detection result indicates that the target object is adapted to the target assembly object, an assembly solution for the target assembly object that matches the target object category is obtained, and the assembly solution is pushed to the target terminal, where the target terminal refers to a terminal bound to the target area, which may be a user terminal.

[0059] Exemplarily, when the classification model outputs that the target object is a straight window, the assembly detection result of the window is that the target object is adapted to the target assembly object, that is, smart curtains can be installed. At this time, the server or gateway can send the window that can be installed with smart curtains and the corresponding installation method (pictures, text, videos, etc.) to the user terminal to guide the user to install the smart curtains.

[0060] Through the above method, the integrity of the target object in the image to be detected can be compared with the integrity threshold. When the integrity of the target object in the image to be detected is greater than or equal to the integrity threshold, it can be characterized that the image to be detected contains a complete target object. The target image corresponding to the complete target object can be input into the classification model to obtain the assembly plan corresponding to the target object. The assembly plan can also be sent to the user terminal so that the user can perform subsequent operations based on the obtained assembly plan, thereby improving the user experience.

[0061] As another way, if the integrity of the target object is less than the integrity threshold, it can be indicated that the target object contained in the image to be detected is incomplete or does not contain the target object. At this time, the server or gateway can send a prompt information system to the user terminal. The prompt information can be used to prompt the user that there is no target object or the target object is incomplete in the image to be detected, and can also be used to prompt the user to re-execute the photo upload operation.

[0062] Optionally, the integrity threshold can be determined based on the classification model's ability to distinguish the category of the target object. Exemplarily, if the classification model has a strong ability to distinguish the category of the target object and can basically achieve correct classification for incomplete target objects, the integrity threshold can be set to A (for example, 0.5); if the classification model has a weak ability to distinguish the category of the target object and can basically not achieve correct classification for incomplete target objects, the integrity threshold can be set to B, where A < B. In the embodiments of the present application, when the integrity degree of the target object is greater than or equal to the integrity threshold, it can be characterized that the to-be-detected image contains a complete target object.

[0063] A target detection method provided in this embodiment, after obtaining the to-be-detected image in the target area, performs target detection on the to-be-detected image to obtain the recognition result of the target object in the to-be-detected image, and determines the assembly detection result for the target object in the target area according to the recognition result of the target object. Through the above method, by performing target detection on the to-be-detected image, the recognition result of the target object in the to-be-detected image can be obtained, and according to the recognition result of the target object, the assembly detection result for the target object in the target area can be determined, so that the assembly scheme corresponding to the target object can be obtained according to the assembly detection result, so that the user can perform subsequent operations more accurately based on the assembly scheme, improving the user experience.

[0064] Please refer to Figure 4 , a target detection method provided in the present application, the method includes:

[0065] S210: Obtain a sample image and the corresponding sample label, where the sample label includes the target object label and the position label in the sample image.

[0066] Among them, there can be multiple sample images, and each sample image is an image containing a target object. The target object can be intelligent furniture, such as: windows, doors, etc. In the sample image, the target object can occupy most of the image space of the image where it is located, that is to say, the main body of the sample image is the target object. As a way, multiple scenes containing the target object can be photographed by a camera, a camera, or an electronic device with a photographing function to obtain multiple images containing the target object.

[0067] The target object label may include a target integrity soft label, which refers to a soft label set based on the integrity of the target object in the sample image, and may specifically include 0, 0.5, and 1, wherein the soft label of the sample image that does not contain the target object is set to 0, the soft label of the sample image that contains an incomplete target object is set to 0.5, and the label of the sample image that contains a complete target object is set to 1. The position label refers to a label that can indicate the position of the target object in the sample image, and may specifically be the center point coordinates of the region that only contains the target object in the image and the length and width of the region. The region may also be referred to as the target region. Exemplarily, the target region in the image may be a rectangular frame, and the center point coordinates of the region may be the intersection of two diagonal lines of the rectangular frame. The center point coordinates of the region may be set to (X, Y), the width of the region may be set to W, and the height of the region may be set to H. Then the position label of the target object may be (X, Y, W, H).

[0068] As a method, a corresponding sample label can be set for each sample image by manual labeling, and each sample image and sample label can be stored in a one-to-one correspondence so that subsequent tasks can directly obtain the labeled sample image. For example, the sample label corresponding to each sample image can be stored in the form of an array, for example: {image 1: soft label 1, position label 1}, {image 2: soft label 2, position label 2}, etc. Optionally, obtaining the sample label corresponding to each sample image in the embodiment of the present application can be understood as reading the sample label corresponding to each sample image stored in advance.

[0069] S220: Performing target detection on the sample image using the initial detection model to be trained to obtain a sample position detection result corresponding to the target object in the sample image.

[0070] Among them, as a method, the sizes of multiple sample images can be first adjusted to the same size to obtain multiple adjusted images, and then the multiple adjusted images can be normalized to obtain multiple normalized images; target detection is performed on the multiple normalized images through the initial detection model to be trained to obtain the sample position detection results corresponding to the target objects in the sample images.

[0071] Exemplarily, the size of multiple sample images can be adjusted to 224×224, and then each pixel in each image is multiplied by 1 / 256, so that the value of each pixel in the image is between 0 and 1. By preprocessing the images, the sizes of all sample images can be made the same, thereby reducing the difficulty of feature extraction of the sample images by the initial detection model to be trained. At the same time, normalizing the sample images can increase the speed at which the initial detection model to be trained obtains the optimal solution through the gradient descent algorithm, that is, it can accelerate the convergence speed of the model, and normalizing the sample images can also improve the accuracy of the model.

[0072] In the embodiments of the present application, Figure 5 As shown, the initial detection model to be trained may include a feature extraction network, a target recognition network, and a position detection network, wherein the target recognition network may include a feature extraction network and a fully connected layer 1; the position detection network may include a feature extraction network and a fully connected layer 2, the feature extraction network may be used to extract features of the sample image, the target recognition network may be used to output the completeness of the target object in the sample image, and the position detection network may be used to output the sample position detection result corresponding to the target object in the sample image.

[0073] Among them, the network structure of the feature extraction network can be the same as the network structure of the feature extraction part in the network such as ResNet (Residual Network) and MobileNet. This application does not limit the specific structure of the feature extraction network. As a method, multiple sample images can be randomly divided into multiple groups of images (min-batch), and each group of images can be input into the feature extraction network in turn for training, and the features corresponding to each image can be output. Exemplarily, multiple sample images can be randomly divided into multiple groups in a group of 32 images or 64 images, and each group of images can be input into the feature extraction network in turn for feature extraction.

[0074] As a way, the image features output by the feature extraction network can be input into Figure 5 In the position detection network shown, a 1×4 vector can be output through the fully connected layer 2, which can represent the sample position detection result corresponding to the target in the sample image, and the sample position detection result can correspond to a target detection box (Bounding Box, BBox). Exemplarily, the sample position detection result corresponding to the target can be (center_x, center_y, w, h), where (center_x, center_y) can represent the center point coordinates of the target detection box, that is, the intersection of the two diagonals of the target detection box, w can represent the width of the target detection box, and h can represent the length of the target detection box.

[0075] It should be noted that other network structures (for example, convolutional layer, pooling layer, etc.) can be added between the feature extraction network and the fully connected layer 1, and between the feature extraction network and the fully connected layer 2 according to actual needs, so as to make the output of the detection model more accurate.

[0076] S230: Identify the target object in the sample image through the target recognition network in the initial detection model to obtain a sample object recognition result corresponding to the target object in the sample image.

[0077] As a method, the sample image normalized in step S220 can be input into Figure 5 The target recognition network in the initial detection model shown recognizes the target object in the sample image to obtain a sample object recognition result corresponding to the target object in the sample image.

[0078] In the embodiment of the present application, the sample object recognition result may include the completeness of the target object in the sample image. The higher the completeness of the target object, the more complete the target object is. As a method, the image features output by the feature extraction network can be input into Figure 5 In the target recognition network shown, a 1×1 vector can be output through the fully connected layer 1, and the vector can represent the completeness of the detected object. In order to better represent the completeness of the object to be detected, a sigmoid function can be added after the fully connected layer 1 to control the output of the target recognition network within the range of 0 to 1.

[0079] S240: Based on the differences between the sample object recognition result and the sample position detection result and the target object label and the position label, adjust the model parameters of the initial detection model and continue training until the target training conditions are met, and stop training to obtain a trained target detection model.

[0080] Among them, as a method, the target recognition loss can be determined based on the difference between the sample object recognition result and the target integrity soft label; the position loss can be determined based on the position detection result and the position label; based on the target recognition loss and the position loss, the model parameters of the initial detection model are adjusted and training is continued until the target training conditions are met, and the training is stopped to obtain a trained target detection model.

[0081] Optionally, the target recognition loss can be determined based on the difference between the sample object recognition result and the target integrity soft label, including: the integrity of the target object in the sample image and the corresponding target integrity soft label can be input into the target recognition loss function for calculation to obtain the loss value of the target recognition loss.

[0082] Among them, the smaller the value of the target recognition loss is, the closer the integrity of the target object output by the target recognition network is to the corresponding target integrity soft label, that is, the accuracy of the target recognition network is higher. In the embodiment of the present application, the calculation formula of the target recognition loss can be:

[0083]

[0084] Among them, loss1 represents the target loss, which can be the difference loss between the integrity of the target object corresponding to the image and the soft label of the target integrity corresponding to the image; N can represent the number of images in a min-batch; l n =-[y n ·logx n +(1-y n )·log(1-x n )] can represent the binary cross entropy loss corresponding to each image in a min-batch. In the expression of ln, y n It can represent the target completeness soft label corresponding to the image, x n It can indicate the completeness of the target object corresponding to the image.

[0085] Optionally, the position loss includes detection frame position loss and coincidence loss. The position loss is determined based on the position detection result and the position label, including: detecting the position of the target object in the sample image through the position detection network in the initial detection model to obtain a sample position detection result; determining the detection frame position loss based on the difference between the coordinates in the sample position detection result and the coordinates in the position label; determining the coincidence loss based on the difference in coincidence between the target object area in the sample position detection result and the target object area in the position label.

[0086] The sample position detection result includes the center point coordinates, length and width of the target object detection frame, and the position label includes the center point coordinates, length and width of the target object.

[0087] As one approach, the coordinates of each vertex corresponding to the target in the sample position detection result are determined based on the center point coordinates, length and width of the target detection frame, and the target area in the sample position detection result is determined based on the above vertex coordinates.

[0088] Optionally, the coordinates of four vertices corresponding to the sample position detection result can be obtained based on the center point coordinates, length and width of the target detection frame, and then the area corresponding to the sample position detection result can be determined based on the above four vertex coordinates. Similarly, the coordinates of four vertices corresponding to the position tag can be obtained based on the center point coordinates, length and width of the position tag, and then the area corresponding to the position tag can be determined based on the four vertex coordinates.

[0089] Among them, the method of calculating the coordinates of the four vertices from the center point coordinates, length and width is as follows: first, the horizontal axis coordinate of the center point coordinate is subtracted from 1 / 2 of the width and the vertical axis coordinate of the center point coordinate is subtracted from 1 / 2 of the length to obtain the first vertex coordinate; then, the horizontal axis coordinate of the center point coordinate is subtracted from 1 / 2 of the width and the vertical axis coordinate of the center point coordinate is added to 1 / 2 of the length to obtain the second vertex coordinate; then, the horizontal axis coordinate of the center point coordinate is added to 1 / 2 of the width and the vertical axis coordinate of the center point coordinate is subtracted from 1 / 2 of the length to obtain the third vertex coordinate; then, the horizontal axis coordinate of the center point coordinate is added to 1 / 2 of the width and the vertical axis coordinate of the center point coordinate is added to 1 / 2 of the length to obtain the fourth vertex coordinate; through the above method, the area corresponding to the sample position detection result and the position label can be determined based on the first vertex coordinate, the second vertex coordinate, the third vertex coordinate and the fourth vertex coordinate.

[0090] For example: if the sample position detection result is (center_x, center_y, w, h), then the four vertex coordinates corresponding to the sample position detection result may be: (center_x-1 / 2w, center_y-1 / 2h), (center_x-1 / 2w, center_y+1 / 2h), (center_x+1 / 2w, center_y-1 / 2h), (center_x+1 / 2w, center_y+1 / 2h). According to the four vertex coordinates corresponding to the sample position detection result, a rectangular area may be determined and the area may be used as the area corresponding to the sample position detection result. Another example: if the position tag is (X, Y, W, H), then the four vertex coordinates corresponding to the position tag may be: (X-1 / 2W, Y-1 / 2H), (X-1 / 2W, Y+1 / 2H), (X+1 / 2W, Y-1 / 2H), (X+1 / 2W, Y+1 / 2H). According to the four vertex coordinates corresponding to the position tag, a rectangular area may be determined and the area may be used as the area corresponding to the position tag.

[0091] As one approach, the detection frame position loss may be determined based on the coordinate difference between the coordinates of each vertex corresponding to the target object in the sample position detection result and the coordinates of each vertex of the target object in the position label.

[0092] Optionally, the loss value of the detection box position loss function can be obtained based on the four vertex coordinates corresponding to the sample position detection result and the four vertex coordinates corresponding to the position label. The calculation formula of the detection box position loss function can be:

[0093]

[0094] Among them, loss2 represents the position loss of the detection box, which can be the position difference loss between the position of the target object in the sample position detection result and the position label; N can represent the number of images in a min-batch, and li can represent the distance between the i-th vertex coordinate corresponding to the position information and the i-th vertex coordinate corresponding to the position label. This distance can be Manhattan distance, Euclidean distance, etc. For example, when the Euclidean distance between two vertex coordinates is calculated, When calculating the detection box position loss function, we can first obtain the distance between the position information of each image in a min-batch and the four vertices corresponding to the position label, then add the four vertex distances to get the distance of each image, and then add the distances of all images in a min-batch and divide it by the number of images in the min-batch to get the average distance of the min-batch, which is the loss value of the detection box position loss function.

[0095] As a method, the coincidence loss can be determined based on the coincidence difference between the target object area in the sample position detection result and the target object area in the position tag. The calculation formula of the coincidence loss can be:

[0096] loss3 = -ln(IoU)

[0097] Among them, loss3 represents the target object coincidence loss, which can be specifically the coincidence difference loss between the target object area in the sample position detection result and the target object area in the position label; It can represent the ratio of the intersection of the sample position detection result and the area corresponding to the position label to the union of the sample position detection result and the area corresponding to the position label. The intersection and union between the two areas can be calculated based on the four vertex coordinates corresponding to the sample position detection result and the position label. For example, Figure 6 As shown in the figure, the coordinates of the upper left corner vertex of the area corresponding to the sample position detection result are (x1, y1) and the coordinates of the lower right corner vertex are (x2, y2). The coordinates of the upper left corner vertex of the area corresponding to the position label are (X1, Y1) and the coordinates of the lower right corner vertex are (X2, Y2). The coordinates of the upper left corner of the intersection area (intersection) are: X1 = max (x1, X1), Y1 = max (y1, Y1), and the coordinates of the lower right corner of the intersection area (intersection) are: X2 = min (x2, X2), Y2 = min (y2, Y2). The area of ​​the intersection is:

[0098] intersection=max(X2-X1+1.0,0)*max(Y2-Y1+1.0,0);

[0099] The purpose of adding 1.0 is to exclude the influence of the overlapping pixels between the two regions on the area, and the max function can avoid negative numbers. After calculating the intersection, the area S1 corresponding to the sample position detection result and the area S2 corresponding to the position label can be calculated according to the length and width corresponding to the sample position detection result and the position label, and then the union between the above two regions can be obtained through the formula union = S1 + S2-intersection, thereby obtaining the value of IoU.

[0100] It should be noted that the formula of the final loss function of the initial detection model to be trained can be:

[0101] LOSS=a*loss1+b*loss2+c*loss3;

[0102] Wherein, a, b, c represent the weight parameters corresponding to loss1, loss2, and loss3 respectively, and the sum of a, b, and c is 1; the corresponding values ​​of a, b, and c can be obtained through experimental tests. The model parameters (such as weights, etc.) of the initial detection model are adjusted by LOSS and training is continued until the target training conditions are met, and the training is stopped to obtain a trained target detection model. Among them, the target training conditions may include any one of the following: the initial detection model converges, the LOSS reaches the target value, the number of training rounds reaches the preset number of rounds, and the detection accuracy reaches the target accuracy.

[0103] Through the above method, the initial detection model to be trained can be trained based on the target recognition loss, the detection box position loss function and the overlap loss to obtain a trained target detection model, which can make the output of the target detection model more accurate.

[0104] S250: Acquire the image to be detected in the target area.

[0105] S260: Performing target detection on the image to be detected to obtain a recognition result of the target object in the image to be detected.

[0106] S270: Determine an assembly detection result for the target object in the target area according to the recognition result of the target object.

[0107] The present embodiment provides a target detection method, through the above-mentioned method, by performing target detection on the image to be detected, the recognition result of the target in the image to be detected can be obtained, and according to the recognition result of the target, the assembly detection result for the target under the target area can be determined, so that the assembly scheme corresponding to the target can be obtained according to the assembly detection result, so that the user can perform subsequent operations more accurately based on the assembly scheme, thereby improving the user experience. In addition, in the present embodiment, the sample image can be subjected to target detection by the initial detection model to be trained, and after obtaining the sample object recognition result and the sample position detection result corresponding to the target in the sample image, the target recognition loss can be obtained based on the target integrity and the target integrity soft label in the sample object recognition result, and the position loss can be obtained based on the sample position detection result and the position label, and then the initial detection model is trained by the target recognition loss and the position loss to obtain the target detection model, so that the target detection model can not only detect whether the image input into the model includes the target, but also output the integrity of the target when there is a target, thereby providing more reference basis for the assembly detection result of the target, which is conducive to obtaining a more accurate assembly detection result.

[0108] See also Figure 7 , the present application provides a target detection method, the method comprising:

[0109] S310: Acquire a sample image and a corresponding sample label; the sample label includes a target object label and a position label in the sample image.

[0110] S320: Performing target detection on the sample image using the initial detection model to be trained to obtain a sample position detection result corresponding to the target object in the sample image.

[0111] S330 identifies the target object in the sample image through the target recognition network in the initial detection model to obtain a sample object recognition result corresponding to the target object in the sample image.

[0112] S340: Based on the differences between the sample object recognition result and the sample position detection result and the target object label and the position label, adjust the model parameters of the initial detection model and continue training until the target training conditions are met, and stop training to obtain a trained target detection model.

[0113] S350: Obtain a classification model dataset.

[0114] As a method, an image containing a complete target object in a sample image can be obtained as an initial image, and the position labels and category labels corresponding to each of the initial images can be obtained, and then the image of the object to be detected contained in the initial image can be extracted based on the position label, so as to use the extracted image of the object to be detected as a classification model data set. Among them, the category label corresponding to the classification model data set can be a label determined according to the morphological characteristics of the object to be detected. For example, when the object to be detected is a window, the category label can be set to 0, 1, 2, etc. based on the different shapes of the window (straight window, L-shaped window, arched window, special-shaped window, etc.).

[0115] As another method, the target object can be photographed by a camera, a camera or an electronic device with a shooting function to obtain multiple images (the images only include the target object) and each image is marked with a corresponding category label to obtain a classification model data set.

[0116] S360: Training the classification model to be trained using the classification model data set, so as to use the converged classification model to be trained as the classification model.

[0117] Among them, the classification model to be trained can be a classification network such as VGG16, ResNet, MobileNet, etc. In the embodiment of the present application, the network structure of the classification model to be trained is not limited.

[0118] As a method, the classification model data set can be input into the classification model to be trained, and the classification model to be trained is trained through a loss function (for example, a cross entropy loss function, etc.), so that the converged classification model to be trained is used as the classification model.

[0119] As another way, Figure 8As shown, the initial detection model to be trained and the classification model to be trained can be integrated into a network model. Between the initial detection model to be trained and the classification model to be trained, a completeness threshold judgment layer can be customized. The completeness threshold judgment layer can compare the completeness of the target object output by the initial detection model to be trained with a preset value. If the completeness of the target object is less than the preset value, the training of the classification model to be trained is not performed, and the information that does not contain the target object in the image is output; if the completeness of the target object is greater than or equal to the preset value, the image containing only the target object is extracted from the original image through the position information of the object to be detected output by the initial detection model to be trained, and then the image containing only the target object is input into the classification network for training, and the category information corresponding to the target object is output. Through the above method, the initial detection model to be trained and the classification model to be trained are integrated into a network model for training, which can improve the training efficiency, and the network model can achieve end-to-end result output, that is, an image is input and the network model can directly output whether the image contains the target object and the category information of the target object, thereby improving the efficiency of the algorithm.

[0120] S370: Acquire the image to be detected in the target area.

[0121] S380: Performing target detection on the image to be detected to obtain a recognition result of the target object in the image to be detected.

[0122] S390: Determine an assembly detection result for the target object in the target area according to the recognition result of the target object.

[0123] The target detection method provided by the present embodiment enables, through the above-mentioned method, the detection model to be trained by setting soft labels based on the completeness of the target in the image, so that the detection model can not only detect whether the image input into the model includes the target, but also output the completeness of the target if there is a target, thereby providing more reference basis for the classification processing step of the target, which is conducive to the more accurate execution of the subsequent classification processing step. Moreover, in the present embodiment, the classification model to be detected is trained by the classification model data set, and the classification model can be obtained, so that the classification model can be used in the subsequent classification processing step.

[0124] Through the above-mentioned method, target detection is performed on the image to be detected, and the recognition result of the target in the image to be detected can be obtained, and according to the recognition result of the target, the assembly detection result for the target under the target area can be determined, so that the assembly scheme corresponding to the target can be obtained according to the assembly detection result, so that the user can perform subsequent operations more accurately based on the assembly scheme, thereby improving the user experience. In addition, in this embodiment, the classification model to be detected is trained by the classification model data set to obtain the classification model, so that when the integrity of the target obtained by the target detection model of the image to be detected meets the integrity threshold, the local image of the area containing the target extracted from the image to be detected can be classified and identified to obtain the category corresponding to the target, so that the assembly detection result corresponding to the target can be determined according to the category of the target.

[0125] The present application also provides an application scenario, and the above target detection method is applied in the application scenario as follows: Figure 2 In the smart home scenario shown, users can Fig. 9 The process shown obtains suggestions on whether the window in the current scene is suitable for installing smart curtains. First, the user can take a photo of the object to be detected (for example, the window behind the sofa) through the user terminal device, and upload the taken photo to the gateway or server; then, when the gateway or server receives the photo, it can input the photo into the detection model after preprocessing, and obtain the integrity and position information of the window in the photo. If the window integrity of the photo is lower than the integrity threshold, the user terminal device can be sent a message that "there is no target object in the photo or the target object is incomplete, please take a new photo"; if the window integrity of the photo is higher than the integrity threshold, a local image of the area containing the window can be extracted from the photo, and the local image can be input into the classification model to obtain the category information of the window in the photo, and determine whether the window is suitable for the target assembly object (smart curtain) based on the category information. If the window is suitable for installing smart curtains, the category information of the window and the assembly scheme corresponding to the category information can be sent to the user terminal device (for example, "the window is a straight window, smart curtains can be installed, and the installation steps are XXX", etc.), so that the user can correctly install the smart curtain according to the assembly scheme.

[0126] It should be noted that, in some implementations, the user can also control the camera to take pictures of the window through the user terminal device, for example, Figure 2 In the scene shown, the camera can be controlled to take pictures of the window on the left hand side of the user and upload them. In some embodiments, the detection model and the classification model can also be deployed on the user terminal device.

[0127] See also Fig.10, the present application provides a target detection device 600, the device 600 comprising:

[0128] The image to be detected acquiring unit 610 is used to acquire the image to be detected in the target area.

[0129] The recognition result acquisition unit 620 is used to perform target detection on the image to be detected to obtain a recognition result of the target object in the image to be detected.

[0130] The assembly detection result acquisition unit 630 is used to determine the assembly detection result for the target object in the target area according to the recognition result of the target object.

[0131] As a method, the recognition result includes the integrity of the target object, and the assembly detection result acquisition unit 630 is specifically used to extract a local image of the area containing the target object from the image to be detected based on the position information of the target object if the integrity of the target object meets the integrity threshold; classify and identify the target object in the local image to obtain the target object category corresponding to the target object; and determine the assembly detection result of the target object in the target area according to the target object category and the recognition result.

[0132] As another way, the assembly detection result acquisition unit 630 is specifically used to acquire an assembly solution for the target assembly object that matches the target object category if the assembly detection result indicates that the target object is adapted to the target assembly object; and push the assembly solution to the target terminal.

[0133] The device 600 further includes:

[0134] The recognition result of the target object in the image to be detected is obtained by detecting with a trained target detection model, and the target detection model is obtained by a model training unit 640; the model training unit 640 is used to obtain a sample image and a corresponding sample label; the sample label includes a target object label and a position label in the sample image; target detection is performed on the sample image through the initial detection model to be trained to obtain a sample position detection result corresponding to the target object in the sample image; the target object in the sample image is recognized by the target recognition network in the initial detection model to obtain a sample object recognition result corresponding to the target object in the sample image; based on the sample object recognition result and the difference between the sample position detection result and the target object label and the position label, the model parameters of the initial detection model are adjusted and training is continued until the target training condition is met and the training is stopped to obtain a trained target detection model.

[0135] As a method, the target object label includes a target integrity soft label, and the model training unit 640 is specifically used to determine the target recognition loss based on the difference between the sample object recognition result and the target integrity soft label; determine the position loss based on the position detection result and the position label; based on the target recognition loss and the position loss, adjust the model parameters of the initial detection model and continue training until the target training conditions are met, and stop training to obtain a trained target detection model.

[0136] Among them, optionally, the sample label includes a target object label, and the model training unit 640 is specifically used to detect the position of the target object in the sample image through the position detection network in the initial detection model to obtain a sample position detection result; based on the coordinate difference between the coordinates in the sample position detection result and the coordinates in the position label, determine the detection frame position loss; based on the coincidence difference between the target object area in the sample position detection result and the target object area in the position label, determine the coincidence loss.

[0137] Optionally, the sample position detection result includes the center point coordinates, length and width of the target detection frame, and the position label includes the center point coordinates, length and width of the target. The model training unit 640 is specifically used to determine the coordinates of each vertex corresponding to the target based on the center point coordinates, length and width of the target detection frame, and determine the target area based on the vertex coordinates; determine the detection frame position loss based on the coordinate difference between the vertex coordinates corresponding to the target in the sample position detection result and the vertex coordinates of the target in the position label.

[0138] The following will be combined Fig.11 An electronic device provided by the present application is described.

[0139] See also Fig.11 Based on the above-mentioned target detection method and device, the embodiment of the present application also provides another electronic device 100 that can execute the above-mentioned target detection method. The electronic device 100 includes one or more (only one is shown in the figure) processors 102, a memory 104, and an image acquisition device 106 that are coupled to each other. Among them, the memory 104 stores a program that can execute the content of the above-mentioned embodiment, and the processor 102 can execute the program stored in the memory 104, and the image acquisition device 106 can be used to perform image acquisition.

[0140] Among them, the processor 102 may include one or more processing cores. The processor 102 uses various interfaces and lines to connect various parts of the entire electronic device 100, and executes various functions and processes data of the electronic device 100 by running or executing instructions, programs, code sets or instruction sets stored in the memory 104, and calling data stored in the memory 104. Optionally, the processor 102 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programmable Logic Array, PLA). The processor 102 can integrate one or a combination of a central processing unit (Central Processing Unit, CPU), a graphics processing unit (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 102, but may be implemented separately through a communication chip.

[0141] The memory 104 may include a random access memory (RAM) or a read-only memory (ROM). The memory 104 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 104 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the following various method embodiments, etc. The data storage area may also store data (such as a phone book, audio and video data, chat record data) created by the terminal 100 during use.

[0142] The image acquisition device 106 may include a camera or the like.

[0143] Please refer to Fig.12 , which shows a structural block diagram of a computer-readable storage medium provided in an embodiment of the present application. The computer-readable storage medium 800 stores program codes, which can be called by a processor to execute the method described in the above method embodiment.

[0144] The computer readable storage medium 800 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk, or a ROM. Optionally, the computer readable storage medium 800 includes a non-transitory computer-readable storage medium. The computer readable storage medium 800 has storage space for program code 810 that performs any method step in the above method. These program codes can be read from or written to one or more computer program products. The program code 810 can be compressed, for example, in an appropriate form.

[0145] In summary, the present application provides a target detection method, device, and electronic device. After acquiring an image to be detected under a target area, target detection is performed on the image to be detected to obtain a recognition result of the target in the image to be detected, and an assembly detection result for the target in the target area is determined based on the recognition result of the target. Through the above-mentioned method, target detection is performed on the image to be detected to obtain a recognition result of the target in the image to be detected, and based on the recognition result of the target, an assembly detection result for the target in the target area can be determined, so that the assembly scheme corresponding to the target can be obtained based on the assembly detection result, so that the user can perform subsequent operations more accurately based on the assembly scheme, thereby improving the user experience.

[0146] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A target detection method, characterized in that: The method comprises: Obtain the image to be detected in the target area; Performing target detection on the image to be detected to obtain a recognition result of the target in the image to be detected, wherein the recognition result includes the integrity of the target; If the integrity of the target object satisfies the integrity threshold, extracting a local image of the area including the target object from the image to be detected based on the position information of the target object; Classifying and identifying the target object in the local image to obtain the target object category corresponding to the target object; An assembly detection result for the target object in the target area is determined according to the target object category and the recognition result.

2. The method according to claim 1, characterized in that The method further comprises: If the assembly detection result indicates that the target object is adapted to the target assembly object, obtaining an assembly solution for the target assembly object that matches the category of the target object; The assembly solution is pushed to the target terminal.

3. The method according to any one of claims 1-2, characterized in that: The recognition result of the target object in the image to be detected is obtained by detecting the trained target detection model, and the target detection model is obtained through a model training step; The model training step includes: Acquire a sample image and a corresponding sample label; the sample label includes a target object label and a position label in the sample image; Performing target detection on the sample image by using the initial detection model to be trained to obtain a sample position detection result corresponding to the target object in the sample image; Identify the target object in the sample image through the target recognition network in the initial detection model to obtain a sample object recognition result corresponding to the target object in the sample image; Based on the differences between the sample object recognition results and the sample position detection results and the target object label and the position label, the model parameters of the initial detection model are adjusted and training is continued until the target training conditions are met, and the training is stopped to obtain a trained target detection model.

4. The method according to claim 3, characterized in that The target object label includes a target integrity soft label, and based on the difference between the sample object recognition result and the sample position detection result and the target object label and the position label, the model parameters of the initial detection model are adjusted and training is continued until the target training condition is met, and the training is stopped to obtain a trained target detection model, including: Determining a target recognition loss based on a difference between the sample object recognition result and the target integrity soft label; determining a position loss based on the position detection result and the position tag; Based on the target recognition loss and the position loss, the model parameters of the initial detection model are adjusted and training is continued until the target training condition is met and the training is stopped to obtain a trained target detection model.

5. The method according to claim 4, characterized in that The sample label includes a target label; and determining the position loss based on the position detection result and the position label includes: Detecting the position of the target object in the sample image through the position detection network in the initial detection model to obtain a sample position detection result; Determine the detection frame position loss based on the coordinate difference between the coordinates in the sample position detection result and the coordinates in the position label; The coincidence loss is determined based on the coincidence difference between the target object area in the sample position detection result and the target object area in the position tag.

6. The method according to claim 5, characterized in that The sample position detection result includes the center point coordinates, length and width of the target detection frame, and the position tag includes the center point coordinates, length and width of the target; the method further includes: Determine the coordinates of each vertex corresponding to the target object in the sample position detection result based on the center point coordinates, length and width of the target object detection frame, and determine the target object area in the sample position detection result based on the vertex coordinates; The determining the detection frame position loss based on the coordinate difference between the coordinates in the sample position detection result and the coordinates in the position tag includes: The detection frame position loss is determined based on the coordinate difference between the coordinates of each vertex corresponding to the target object in the sample position detection result and the coordinates of each vertex of the target object in the position label.

7. A target detection device, characterized in that: The device comprises: An image acquisition unit to be detected is used to acquire the image to be detected in the target area; A recognition result acquisition unit, used to perform target detection on the image to be detected, and obtain a recognition result of the target in the image to be detected, wherein the recognition result includes the integrity of the target; The assembly detection result acquisition unit is used to extract a local image of the area containing the target object from the image to be detected based on the position information of the target object if the integrity of the target object meets the integrity threshold; classify and identify the target object in the local image to obtain the target object category corresponding to the target object; and determine the assembly detection result of the target object in the target area according to the target object category and the recognition result.

8. An electronic device, characterized in that: comprising one or more processors and memory; One or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program code, wherein when the program code is run, the method according to any one of claims 1 to 6 is executed.