Overlapped object detection method and electronic equipment
By extracting semantic features and object query parameters, combined with the cascade decoder model, the problem of low overlapping object detection efficiency and accuracy in the existing technology is solved, and high-precision and efficient object detection is achieved.
Patent Information
- Application Number
- CN202410841416.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-26
- Publication Date
- 2024-08-30
AI Technical Summary
Existing object detection solutions have shortcomings in detection efficiency and accuracy. Especially when the image contains multiple overlapping objects, it is difficult to accurately distinguish and identify objects.
By acquiring the image to be processed, extracting semantic features and determining feature maps based on object query parameters, the cascade decoder model is used to perform feature fusion and update, generate object detection results, and achieve high-precision detection of overlapping objects.
It improves detection accuracy and efficiency, and can complete the distinction of object areas in one stage, similar to the segmentation accuracy of instance segmentation, while avoiding the problem of misidentification of objects of the same type in semantic segmentation.
Smart Images

Figure CN118570791A
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, and in particular to the fields of deep learning, object detection, etc. More specifically, it relates to an overlapping object detection method and an electronic device. Background Art
[0002] In some application scenarios, it is necessary to detect objects contained in an image to determine relevant information about the object. However, current object detection solutions have low detection efficiency or low detection accuracy. Summary of the invention
[0003] In view of this, the present disclosure provides an overlapping object detection method and an electronic device.
[0004] One aspect of the present disclosure provides an overlapping object detection method, comprising: acquiring an image to be processed; determining N feature maps corresponding one to one to N objects overlappingly distributed in the image to be processed; wherein the feature maps include position information of unobstructed areas in the corresponding objects and categories of the corresponding objects, the categories including foreground objects or background objects; N is an integer greater than or equal to 2; and determining object detection results based on the categories and position information in the N feature maps.
[0005] According to an embodiment of the present disclosure, determining N feature maps corresponding one-to-one to N objects overlappingly distributed in an image to be processed includes: performing a feature extraction operation on the image to be processed to obtain semantic features; and determining N feature maps based on the matching between the semantic features and object query parameters; wherein the object query parameters characterize the features of objects overlappingly distributed in the image, the semantic features include valid features that match the object query parameters, the position information in the feature map is related to the position of the valid features, and the categories in the feature map are related to the object query parameters matched by the valid features.
[0006] According to an embodiment of the present disclosure, based on the matching between semantic features and object query parameters, determining N feature maps includes: for two adjacent decoders in a plurality of cascaded decoders, inputting semantic features, object query parameters and output features of a previous decoder into a current decoder; the current decoder determines fused features based on a plurality of sub-features in the semantic features, the object query parameters and the semantic features; using the fused features as the output features of the current decoder, updating the current decoder to the previous decoder, and returning the input to the current decoder until the last decoder outputs N feature maps.
[0007] According to an embodiment of the present disclosure, it also includes: sending a model acquisition request, the model acquisition request includes at least one of model attribute information and device attribute information; and receiving a target model; wherein the target model includes multiple cascaded decoders, and the target model is determined from multiple candidate models based on at least one of the model attribute information and device attribute information.
[0008] According to an embodiment of the present disclosure, the object feature represented by the object query parameter is related to at least one of the following: whether the object is blocked, the area where the object is located in the image, the shape of the object, the size of the object, and the color of the object.
[0009] According to an embodiment of the present disclosure, the feature extraction operation is processed by a feature extraction network, which is obtained by knowledge distillation to transfer the feature extraction capability of the teacher model.
[0010] According to an embodiment of the present disclosure, it also includes: outputting a detection image based on the object detection result; wherein the detection image includes N object sub-images, the positions of the N object sub-images are consistent with the position information in the N feature maps, and the display modes of the N object sub-images are different from each other.
[0011] According to an embodiment of the present disclosure, it also includes: comparing N objects in the image to be processed with predetermined conditions; when it is determined that the N objects in the image to be processed meet the predetermined conditions, triggering the determination of N feature maps corresponding one-to-one to the N objects overlappingly distributed in the image to be processed.
[0012] According to an embodiment of the present disclosure, the predetermined condition includes at least one of the following: the distance between the N objects is less than or equal to a distance threshold; the shapes of the N objects are different; the areas of the N objects are different; and there is an overlapping area in the detection frames of the N objects.
[0013] Another aspect of the present disclosure provides an electronic device, including: one or more processors; and a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the above method. BRIEF DESCRIPTION OF THE DRAWINGS
[0014] The above and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:
[0015] Figure 1 An exemplary system architecture to which the overlapping object detection method and apparatus disclosed herein can be applied is schematically shown;
[0016] Figure 2 A flowchart of an overlapping object detection method according to an embodiment of the present disclosure is schematically shown;
[0017] Figure 3 A flowchart of an overlapping object detection method according to another embodiment of the present disclosure is schematically shown;
[0018] Figure 4 A flowchart of an overlapping object detection method according to another embodiment of the present disclosure is schematically shown;
[0019] Figure 5 A flowchart of an overlapping object detection method according to another embodiment of the present disclosure is schematically shown;
[0020] Figure 6 A schematic diagram of a method for detecting overlapping objects according to an embodiment of the present disclosure is schematically shown;
[0021] Fig. 7A A schematic diagram schematically shows a schematic principle diagram of a model training method in the first stage according to an embodiment of the present disclosure;
[0022] Figure 7B A schematic diagram schematically shows a schematic principle diagram of a model training method in the second stage according to an embodiment of the present disclosure;
[0023] Figure 8 A block diagram schematically shows an overlapping object detection device according to an embodiment of the present disclosure; and
[0024] Fig. 9 A block diagram of an electronic device suitable for implementing a robot according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0025] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.
[0026] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise", "include", etc. used herein indicate the existence of features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.
[0027] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.
[0028] When using expressions such as "at least one of A, B, and C, etc.", they should generally be interpreted according to the meaning of the expression commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).
[0029] In the embodiments of the present disclosure, the collection, updating, analysis, processing, use, transmission, provision, disclosure, storage, etc. of the data involved (for example, including but not limited to user personal information) are in compliance with the provisions of relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. In particular, necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information, network security, and national security.
[0030] In the embodiments of the present disclosure, the user's authorization or consent is obtained before obtaining or collecting the user's personal information.
[0031] In some embodiments, an object in an image can be detected by an algorithm based on instance segmentation. Instance segmentation is essentially a two-stage detection process, in which different tasks are processed in two stages to obtain the final result. Due to the two-stage processing, the detection speed of this algorithm is relatively slow.
[0032] In other embodiments, objects in images can be detected by algorithms based on semantic segmentation. Compared with algorithms based on instance segmentation, algorithms based on semantic segmentation can obtain the category and position of objects through one-stage processing, and the detection speed is improved. However, taking the overlapping document detection scenario as an example, the algorithm based on semantic segmentation ultimately outputs only one feature map, and uses different types of identifiers to represent the areas of different types of documents. This method will misidentify multiple documents of the same type as the same document. Specifically, for example, when training the model, if the labels of the foreground document and the background document are the same, then in the model reasoning stage, the model cannot distinguish the foreground document from the background document. If the labels of the foreground document and the background document are different when training the model, then in the model reasoning stage, if the image includes multiple background documents, the model cannot distinguish the multiple background documents. It can be seen that the algorithm based on semantic segmentation can only distinguish different types of objects, and cannot distinguish objects of the same type, so the detection accuracy is poor.
[0033] The disclosed embodiments are intended to provide an overlapping object detection method, which can distinguish the regions where each object is located through a one-stage detection process, and achieve segmentation accuracy similar to that of instance segmentation. Therefore, compared with the semantic segmentation method, the detection accuracy is improved. And in some embodiments, the detection efficiency is also improved quickly.
[0034] The technical solution provided by the present disclosure will be described in detail below with reference to the accompanying drawings and specific embodiments.
[0035] Figure 1 The following schematically illustrates an exemplary system architecture to which overlapping object detection can be applied according to an embodiment of the present disclosure. Figure 1 What is shown is merely an example of a system architecture to which the embodiments of the present disclosure can be applied, in order to help those skilled in the art understand the technical content of the present disclosure, but it does not mean that the embodiments of the present disclosure cannot be used in other devices, systems, environments or scenarios.
[0036] like Figure 1 As shown, the system architecture 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a server 105. The network 104 is used to provide a medium for a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired and / or wireless communication links, etc.
[0037] The user may use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications may be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, and / or social platform software, etc. (only for example).
[0038] The first terminal device 101, the second terminal device 102, and the third terminal device 103 may be various electronic devices having display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.
[0039] The server 105 may be a server that provides various services, such as a background management server (only as an example) that provides support for websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The background management server may analyze and process the received data such as user requests, and feed back the processing results (such as web pages, information, or data obtained or generated according to user requests) to the terminal device.
[0040] It should be noted that the overlapping object detection method provided in the embodiment of the present disclosure can generally be executed by the server 105. Accordingly, the overlapping object detection device provided in the embodiment of the present disclosure can generally be set in the server 105. The overlapping object detection method provided in the embodiment of the present disclosure can also be executed by a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105. Correspondingly, the overlapping object detection device provided in the embodiment of the present disclosure can also be set in a server or server cluster that is different from the server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the server 105. Alternatively, the overlapping object detection method provided in the embodiment of the present disclosure can also be performed by the first terminal device 101, the second terminal device 102 or the third terminal device 103, or can also be performed by other terminal devices different from the first terminal device 101, the second terminal device 102 or the third terminal device 103. Accordingly, the overlapping object detection device provided in the embodiment of the present disclosure may also be arranged in the first terminal device 101, the second terminal device 102 or the third terminal device 103, or in other terminal devices different from the first terminal device 101, the second terminal device 102 or the third terminal device 103.
[0041] For example, the image to be processed may be originally stored in any one of the first terminal device 101, the second terminal device 102 or the third terminal device 103 (for example, the first terminal device 101, but not limited thereto), or stored in an external storage device and may be imported into the first terminal device 101. Then, the first terminal device 101 may locally execute the overlapping object detection method provided in the embodiment of the present disclosure, or send the image to be processed to other terminal devices, servers, or server clusters, and the other terminal devices, servers, or server clusters that receive the image to be processed may execute the overlapping object detection method provided in the embodiment of the present disclosure.
[0042] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0043] Figure 2 The flowchart of the overlapping object detection method according to the embodiment of the present disclosure is schematically shown.
[0044] like Figure 2 As shown, the method includes operations S210 to S230.
[0045] In operation S210, an image to be processed is acquired.
[0046] For example, an image acquisition device such as a camera may be used to acquire images in advance and store them in a predetermined storage space, and when processing is required, the image to be processed is obtained from the storage space, or an image sent by other devices is used as the image to be processed.
[0047] In operation S220, N feature maps corresponding one-to-one to N objects overlappingly distributed in the image to be processed are determined.
[0048] For example, the image to be processed includes N objects, where N is an integer greater than or equal to 2. The objects may be animals, plants, objects, etc., and the objects may include vehicles, tables and chairs, etc., and may also include documents, magazines, certificates, books, etc. This embodiment does not limit the objects.
[0049] For example, N objects in the image to be processed are distributed overlappingly, and the overlapping distribution, for example, indicates that there is occlusion between the multiple objects, for example, a part of an object is occluded by other objects.
[0050] For example, the model may be pre-trained, and the image to be processed may be input into the trained model, and the output data of the model may include N feature maps. In other embodiments, the N feature maps may also be obtained by other methods.
[0051] For example, the feature map can be mask data or other forms of data. N feature maps correspond to N objects one by one. Taking the corresponding objects and feature maps as an example, the feature map can include: the position information of the unobstructed area of the object in the image to be processed. The feature map can also include the category of the object. The category includes foreground object or background object. For example, if the object is a document, the category indicates that the object is a foreground document or a background document. The foreground document indicates that the object is not obstructed by other objects, and the background document indicates that part of the object is obstructed by other objects.
[0052] In operation S230, an object detection result is determined based on the category and position information in the N feature maps.
[0053] For example, the location information and categories of N objects can be summarized and output, and the output result can be used as the object detection result. Based on the object detection result, the number of objects included in the image to be processed, the location of each object, and the category of the object can also be known as a foreground object or a background object.
[0054] According to the technical solution provided by the embodiment of the present disclosure, after obtaining the image to be processed, N feature maps corresponding to the N objects overlapping in the image to be processed are determined. It can be seen that each object corresponds to a feature map, and the location information and category of each object can be known based on the feature map, so the detection accuracy is high. In addition, the N feature maps can be determined directly based on the image to be processed, rather than in two stages, so the detection efficiency is high.
[0055] Figure 3 The flowchart of the overlapping object detection method according to another embodiment of the present disclosure is schematically shown.
[0056] like Figure 3 As shown, the method includes operations S310 to S340, wherein operations S310 to S330 may refer to the above operations S210 to S230, and will not be described in detail in this embodiment.
[0057] In operation S310, an image to be processed is acquired.
[0058] In operation S320, N feature maps corresponding one-to-one to N objects overlappingly distributed in the image to be processed are determined.
[0059] In operation S330, an object detection result is determined based on the category and position information in the N feature maps.
[0060] In operation S340, a detection image is output according to the object detection result.
[0061] For example, the detection image includes N object sub-images, the positions of the N object sub-images are consistent with the position information in the N feature maps, and the display modes of the N object sub-images are different from each other.
[0062] For example, the display mode may include color, texture, etc. Different display modes may include: different colors, different textures, etc. of each object sub-image.
[0063] For example, the image to be processed includes object A and object B, and the detection image may include two object sub-images, namely object sub-image Image_A and object sub-image Image_B, wherein the position of object sub-image Image_A in the detection image is consistent with the position of object A in the image to be processed, the position of object sub-image Image_B in the detection image is consistent with the position of object B in the image to be processed, and the colors of object sub-image Image_A and object sub-image Image_B are different. In addition, the detection image may also include a background sub-image, and the background sub-image may be the same as the area other than object A and object B in the image to be processed.
[0064] The disclosed embodiment visualizes the detection results through detection images, and adopts different display modes for different objects during the display process, so that the position, category, shape and other information of each object can be displayed more intuitively.
[0065] Figure 4 The flowchart of the overlapping object detection method according to another embodiment of the present disclosure is schematically shown.
[0066] like Figure 4 As shown, the method includes operations S410 to S430, wherein operations S410, S420, and S430 may refer to operations S210, S220, and S230 above, respectively, and will not be described in detail in this embodiment. In addition, operation S415 may be performed between operations S410 and S420.
[0067] In operation S410, an image to be processed is acquired.
[0068] In operation S415, it is determined whether the N objects in the image to be processed meet a predetermined condition.
[0069] If yes, the process proceeds to operation S420. If no, the process proceeds to other processes, such as using other predetermined algorithms to process the image to be processed. The other predetermined algorithms may be algorithms for detecting non-overlapping situations, and this embodiment does not limit the other predetermined algorithms.
[0070] It can be seen that this embodiment determines whether the image to be processed is a scene for detecting overlapping objects through operation S415, and only when the image to be processed satisfies the predetermined condition, that is, only in the specific scene of detecting overlapping objects, the subsequent process will be triggered to determine N feature maps. In this way, detection of non-overlapping objects can be avoided, thereby saving computing resources.
[0071] It should be noted that the predetermined condition is used to determine whether the image to be processed is a scene for detecting overlapping objects, and there are many ways to determine whether the image to be processed includes overlapping objects. Accordingly, the predetermined condition may include at least one of multiple sub-conditions.
[0072] For example, a sub-condition includes: the distance between N objects is less than or equal to a distance threshold. For example, target detection or other detection may be performed on the image to be processed to obtain the positions of N objects, and then the distance between the N objects is calculated. The distance threshold may be pre-configured, and this embodiment does not limit the distance threshold.
[0073] For another example, another sub-condition includes: the shapes of the N objects are different.
[0074] For another example, another sub-condition includes: the areas of the N objects are different.
[0075] For another example, another sub-condition includes: the detection frames of N objects have overlapping areas. For example, target detection or other detection can be performed on the image to be processed to obtain the detection frames of N objects, and then determine whether there is overlap between the detection frames.
[0076] In operation S420, N feature maps corresponding one-to-one to N objects overlappingly distributed in the image to be processed are determined.
[0077] In operation S430, an object detection result is determined based on the category and position information in the N feature maps.
[0078] According to another embodiment of the present disclosure, the image to be processed can be processed by a pre-trained deep learning model to obtain N feature maps.
[0079] It should be noted that the deep learning model can be trained on the first electronic device, and before the trained deep learning model is used, the deep learning model can be pre-deployed on the relevant second electronic device. The first electronic device is, for example, a server, and the second electronic device is, for example, a mobile phone, a computer or other terminal.
[0080] In the actual deployment process, the deep learning model deployment can be implemented through the following process: the second electronic device sends a model acquisition request to the first electronic device. Subsequently, the first electronic device can determine the target model from multiple candidate models based on a predetermined matching rule, and then send the target model so that the second electronic device receives the target model from the first electronic device.
[0081] It should be noted that the model acquisition request may include at least one of the model attribute information and the device attribute information. Accordingly, in the process of the first electronic device determining the target model from multiple candidate models, it can be determined based on at least one of the model attribute information and the device attribute information. For example, each candidate model corresponds to its own model attribute, and the model attribute information may include the model identification, category, model version, required storage space, etc., and the device attribute may include the model of the device, the remaining storage space, etc. The model attributes of multiple candidate models can be matched with the model attributes and device attributes in the model acquisition request, and the matching candidate model can be determined as the target model.
[0082] It should be noted that the target model is used to process the image to be processed into N feature maps. The structure of the target model acquired by the second electronic device is mainly related to the model to be used. This embodiment does not limit the model structure of the target model. For example, a feature extraction network is required to process the image to be processed, and the target model acquired by the second electronic device may include a feature extraction network. For another example, a decoder is required to process the image to be processed, and multiple decoders are cascaded, then the target model acquired by the second electronic device includes multiple cascaded decoders.
[0083] Figure 5 The flowchart of the overlapping object detection method according to another embodiment of the present disclosure is schematically shown.
[0084] like Figure 5 As shown, the method may include operation S510, operation S521, operation S522 and operation S530, wherein operation S510 and operation S530 may refer to operation S210 and operation S230 mentioned above, respectively, and will not be described in detail in this embodiment.
[0085] In operation S510, an image to be processed is acquired.
[0086] In operation S521, a feature extraction operation is performed on the image to be processed to obtain semantic features.
[0087] For example, a feature extraction network may be pre-trained to extract semantic features of an image to be processed.
[0088] In some embodiments, the feature extraction network is obtained by transferring the feature extraction capability of the teacher model through knowledge distillation. The training method of knowledge distillation can improve the generalization of the feature extraction network and make the feature extraction network more lightweight, thereby facilitating deployment on the terminal. In other embodiments, the feature extraction network may not be trained by knowledge distillation.
[0089] In operation S522 , N feature graphs are determined based on the matching between the semantic features and the object query parameters.
[0090] For example, the object query parameter may be pre-trained, and the object query parameter may include P object vectors, where P is an integer greater than or equal to 1. The object query parameter represents the characteristics of objects that are overlapped and distributed in the image. The characteristics of the foreground object or the characteristics of the background object may be known through the object query parameter. For example, the object characteristics represented by the object query parameter are related to at least one of the following: whether the object is blocked, the area where the object is located in the image, the shape of the object, the size of the object, the color of the object, etc.
[0091] For example, the matching between semantic features and object query parameters can be calculated based on cross-attention or other methods. If the matching between some features in the semantic features and the object query parameters is high, it is considered that these features match the object query parameters. These features are called effective features. The probability that effective features represent objects is higher, and the effective features can be used to determine the feature map. The position information in the feature map is related to the position of the effective features. For example, the position of the effective features is consistent with the position information in the feature map. In addition, the category in the feature map is related to the object query parameters matched by the effective features. For example, some object vectors represent the features of foreground objects. If some effective features in the semantic features have a high matching with these object vectors, the object category determined based on these effective features is the foreground object.
[0092] In this embodiment, N feature maps are determined by object query parameters. Since the object query parameters represent the features of the object, the accuracy of the feature maps can be improved by using the object query parameters, thereby improving the accuracy of the detection results. In addition, in this way, the segmentation effect of overlapping objects can be achieved by one segmentation based on the object query parameters, thereby improving processing efficiency.
[0093] In operation S530, an object detection result is determined based on the category and position information in the N feature maps.
[0094] Figure 6 A schematic diagram of a method for detecting overlapping objects according to an embodiment of the present disclosure is schematically shown.
[0095] According to another embodiment of the present disclosure, a deep learning model for processing an image to be processed 605 may include a plurality of cascaded decoders M_B. A feature extraction operation may be performed on the image to be processed 605 using a feature extraction network M_A3 or other methods to obtain a semantic feature 606. Then, for two adjacent decoders in the cascaded plurality of decoders M_B, the semantic feature 606, the object query parameter M_C2, and the output feature of the previous decoder are input into the current decoder. Then, the current decoder determines a fusion feature based on the plurality of sub-features in the semantic feature 606, the object query parameter M_C2, and the semantic feature 606. Then, the fusion feature is used as the output feature of the current decoder, the current decoder is updated to the previous decoder, and the current decoder is input back again until the last decoder outputs M feature maps 607, the M feature maps 607 may include N feature maps corresponding to the N objects in the image to be processed 605, and then a detection image 610 may be determined based on the N feature maps, and the detection image 610 may display objects in different display modes such as different colors and different textures.
[0096] In this embodiment, on the one hand, the decoder adopts a multi-layer structure, and the semantic feature 606 and the object query parameter M_C2 are input into each layer of the decoder, so that each layer of the decoder will perform a matching calculation of the semantic feature 606 and the object query parameter M_C2. On the other hand, the fusion feature output by the previous decoder is input into the next decoder, so that the effective features with higher matching can be iterated layer by layer between multiple decoders M_B, and the effective features are strengthened. Therefore, the accuracy of the feature map can be improved, thereby improving the accuracy of the detection result.
[0097] Fig. 7A The schematic diagram schematically shows a schematic principle diagram of the model training method in the first stage according to an embodiment of the present disclosure, Figure 7B The schematic diagram of the first stage model training method according to an embodiment of the present disclosure is schematically shown.
[0098] According to another embodiment of the present disclosure, the detection result can be determined based on a deep learning model, and the deep learning model is pre-trained. In this embodiment, the trained deep learning model may include a feature extraction network M_A3, a plurality of cascaded decoders M_B2, and an object query parameter M_C2. The training process is described in detail below.
[0099] The model training process can include two stages. The first training stage mainly trains the feature extraction network M_A1 through knowledge distillation. The second training stage mainly trains the decoder M_B1 and the object query parameter M_C1. At the same time, the parameters of the feature extraction network M_A1 can also be fine-tuned.
[0100] like Fig. 7AAs shown, in the first training stage, the unlabeled sample image 701 can be respectively input into the teacher model M_D and the feature extraction network M_A1 to be trained, the teacher model M_D outputs the first semantic feature 702, and the feature extraction network M_A1 outputs the second semantic feature 703. The first semantic feature 702 can be used as the true value, and the loss value 704 can be calculated based on the difference between the second semantic feature 703 and the first semantic feature 702, and then the parameters of the feature extraction network M_A1 can be adjusted based on the loss value 704 until the feature extraction network M_A1 converges, thereby obtaining the pre-trained feature extraction network M_A2.
[0101] In some embodiments, the feature extraction network M_A1 includes multiple network layers, and correspondingly, the teacher model M_D includes multiple network layers, and the number of network layers of the teacher model M_D is greater than the number of network layers of the feature extraction network M_A1. Uniform sampling or non-uniform sampling can be used to make each network layer of the feature extraction network M_A1 correspond to a network layer of the teacher model M_D, and the loss is calculated based on the output of each network layer of the feature extraction network M_A1 and the output of the network layer corresponding to the teacher model M_D, which can further improve the accuracy of the pre-trained feature extraction network M_A2.
[0102] For example, the teacher model M_D can be SAM (Segment Anything Model), and the parameter amount of the teacher model M_D is greater than the parameter amount of the feature privilege network. For example, the parameter amount of the teacher model M_D is 4G, while the parameter amount of the feature extraction network M_A1 is 9M. This embodiment does not limit the category and parameter amount of the teacher model M_D.
[0103] It should be noted that the first training stage mainly improves the accuracy of the feature extraction network M_A2 by means of knowledge distillation. In some embodiments, the first training stage process can be omitted.
[0104] like Figure 7B As shown, in the second training stage, a sample image 705 for two-stage training is first constructed.
[0105] The sample image 705 corresponds to a label 708, and the label 708 includes a real position and a real category. For example, a mask can be used to represent the real position; for another example, a point set can be used to represent the real position, and the point set includes multiple points, each of which has a coordinate value. For example, values such as 0, 1, and 2 can be used to represent the real category. For example, 0 can be used to represent a pure background, 1 can be used to represent a background object, and 2 can be used to represent a foreground object. For example, a sample image includes three objects, two of which are blocked by another object. Then the sample image has three labels, each label represents the real position and real category of an object, and the real categories in the labels of the two objects are both background objects.
[0106] Next, the object query parameter M_C1 may be initialized. The object query parameter M_C1 may include P object vectors, which are used to store object features in the image, and the object query parameter M_C1 is learnable during the training process. P may be an integer greater than or equal to 1. In some embodiments, P is greater than or equal to M, where M is the maximum number of model detections. The initialization process may be to assign a value of 0 to the object query parameter M_C1. In the subsequent model inference process, the trained object query parameter M_C2 may be input into the trained decoder M_B2 to participate in the calculation, thereby performing inference based on the trained object query parameter M_C2.
[0107] Next, the sample image 705 may be processed using a deep learning model to obtain M output feature maps 707 .
[0108] For example, the sample image 705 is input into the feature extraction network M_A2, the feature extraction network M_A2 outputs the output semantic feature 706 of the sample image 705, and then the output semantic feature 706 is input into the decoder M_B1, the number of decoders M_B1 can be 1 or more, and the last decoder outputs M output feature maps 707, where M is the maximum detection number of the model, M can be an integer greater than or equal to 2, and the value of M can be set according to actual needs. This embodiment does not limit the value of M.
[0109] For example, the sample image 705 includes 2 objects, and the value of M is 10, then the multiple decoders M_B1 can output 10 output feature maps 707, of which 2 output feature maps correspond to the two objects one-to-one, and the other 8 output feature maps can be output feature maps that are not related to the objects. Taking the output feature map as a mask as an example, 2 of the output feature maps include a black background and a white area, and the remaining 8 output feature maps are overall black mask maps. It can be seen that M is a hyperparameter, and the value of M is a pre-configured and fixed value. The value of M can be set larger so that the M output feature maps are capable of representing each object in the sample image 705.
[0110] The number of decoders M_B1 can be one or more. When the deep learning model is deployed on the cloud, the number of decoders M_B1 can be more. When the deep learning model is deployed on a terminal such as a mobile phone, the number of decoders M_B1 can be more, thereby achieving a lightweight effect.
[0111] When there are multiple decoders M_B1, the multiple decoders M_B1 can be cascaded, wherein the input of the first decoder may include: the output semantic features 706 output by the feature extraction network M_A2 and the object query parameter M_C1, and the output is a fused feature. The input of the remaining decoders may include the output semantic features 706 output by the feature extraction network M_A2, the object query parameter M_C1, and the fused features output by the previous decoder, and the output is the fused features output by the decoder. The last decoder outputs M output feature maps, and the M output feature maps include output categories and category confidences.
[0112] In the actual calculation process, each decoder can process the output semantic feature 706 and the object query parameter M_C1 based on the cross-attention mechanism and obtain the first feature, and can process the output semantic feature 706 and the fused feature output by the previous decoder based on the cross-attention mechanism to obtain the second feature, and then fuse the first feature and the second feature. The fusion method can be vector addition, and the fused feature can be processed based on the self-attention mechanism, and the processed data can be used as the output of the decoder M_B1.
[0113] Next, the label 708 and the output feature map 707 may be matched. The purpose of the matching is to determine the matching relationship between the M output feature maps 707 and the true label 708 so as to calculate the total loss of the model value 709. For example, the label 708 and each output feature map may be calculated, the category similarity between the true category and the output category may be calculated, and the position similarity between the output position and the true position may be calculated, and then the weighted result of the category similarity and the position similarity is calculated as the matching degree, and the label 708 with the largest matching degree and the output feature map may be matched.
[0114] Next, the total model loss value 709 can be calculated based on the matched label 708 and the output feature map 707. For example, for the matched output feature map 707 and label 708, the loss value of the feature map is calculated from the two dimensions of category and position, and then the total loss value 709 is calculated based on the N loss values of the N feature maps. In addition, during the training process, the output of each decoder M_B1 can have loss supervision, and the true value used by the output of each decoder M_B1 can be the label 708.
[0115] Next, based on the calculated total model loss value 709, the parameters of the deep learning model can be optimized by gradient descent method using back propagation until the deep learning model converges. In the process of optimizing the model parameters, for example, the parameters of the feature extraction network M_A2, the parameters of the decoder M_B1, and the object query parameter M_C1 can be adjusted to obtain the trained feature extraction network M_A3, the decoder M_B2, and the object query parameter M_C2. During the training process, the features of the learned object can be stored in the object query parameter M_C1, so that the trained object query parameter M_C2 can learn the representations of different objects, such as the features of different layers, different regions, different sizes, different colors, etc.
[0116] The trained deep learning model can be used to process the image to be processed. For example, the image to be processed is input into the feature extraction network M_A3 to obtain the semantic features of the image to be processed. The semantic features and the object query parameter M_C2 are then input into the cascaded multiple decoders M_B2. For example, the semantic features and the object query parameter M_C2 can be input into the first decoder of the multiple decoders M_B2 to obtain fused features. The semantic features, the object query parameter M_C2, and the fused features output by the previous decoder are then input into the next decoder to obtain the fused features output by the next decoder, and so on, until the last decoder outputs M feature maps, including N feature maps corresponding one to one to the N objects overlappingly distributed in the image to be processed.
[0117] It can be seen that the above deep learning model directly decodes and obtains M feature maps by combining the semantic features of the image to be processed, the object query parameters, etc. during reasoning. The above deep learning model can process the image to be processed into M feature maps at one time, which can improve the processing speed compared to the two-stage processing method of instance segmentation; at the same time, compared to the semantic segmentation method, it can detect multiple objects of the same type, which improves the processing accuracy. Therefore, the deep learning model can achieve the effect of instance segmentation at the speed of semantic segmentation, thereby taking into account high efficiency and high accuracy in the overlapping object detection scenario. In addition, the ability of the teacher model M_D is transferred to the feature extraction network M_A2 through knowledge distillation. Therefore, the feature extraction network M_A3 trained based on the feature extraction network M_A2 has higher accuracy and stronger generalization, and is more lightweight, suitable for deployment in terminals such as mobile phones to meet the real-time detection needs of the terminals.
[0118] Figure 8 The block diagram of the overlapping object detection device according to an embodiment of the present disclosure is schematically shown.
[0119] like Figure 8As shown, the overlapping object detection device 800 includes an acquisition module 810, a feature map determination module 820 and a result determination module 830.
[0120] The acquisition module 810 is used to acquire the image to be processed.
[0121] The feature map determination module 820 is used to determine N feature maps corresponding one by one to N overlapping objects in the image to be processed; wherein the feature map includes the position information of the unobstructed area in the corresponding object and the category of the corresponding object, and the category includes foreground object or background object; N is an integer greater than or equal to 2.
[0122] The result determination module 830 is used to determine the object detection result according to the category and position information in the N feature maps.
[0123] According to another embodiment of the present disclosure, a feature map determination module includes: an extraction submodule and a feature map determination submodule. The extraction submodule is used to perform a feature extraction operation on the image to be processed to obtain semantic features. The feature map determination submodule is used to determine N feature maps based on the matching between the semantic features and the object query parameters; wherein the object query parameters characterize the features of the overlapping objects in the image, the semantic features include valid features that match the object query parameters, the position information in the feature map is related to the position of the valid features, and the categories in the feature map are related to the object query parameters matched by the valid features.
[0124] According to another embodiment of the present disclosure, a feature map determination submodule includes: a processing unit, for inputting semantic features, object query parameters, and output features of a previous decoder into a current decoder for two adjacent decoders in a plurality of cascaded decoders; the current decoder determines fused features based on a plurality of sub-features in the semantic features, the object query parameters, and the semantic features; using the fused features as the output features of the current decoder, updating the current decoder to the previous decoder, and returning the input to the current decoder until the last decoder outputs N feature maps.
[0125] According to another embodiment of the present disclosure, the above-mentioned device further includes: a sending module and a receiving module. The sending module is used to send a model acquisition request, and the model acquisition request includes at least one of model attribute information and device attribute information. The receiving module is used to receive a target model; wherein the target model includes multiple cascaded decoders, and the target model is determined from multiple candidate models based on at least one of the model attribute information and the device attribute information.
[0126] According to another embodiment of the present disclosure, the object feature represented by the object query parameter is related to at least one of the following: whether the object is blocked, the area where the object is located in the image, the shape of the object, the size of the object, and the color of the object.
[0127] According to another embodiment of the present disclosure, the feature extraction operation is processed by a feature extraction network, and the feature extraction network is obtained by knowledge distillation to transfer the feature extraction capability of the teacher model.
[0128] According to another embodiment of the present disclosure, the device further includes: an output module, configured to output a detection image according to the object detection result. The detection image includes N object sub-images, the positions of the N object sub-images are consistent with the position information in the N feature maps, and the display modes of the N object sub-images are different from each other.
[0129] According to another embodiment of the present disclosure, the above-mentioned device further includes: a comparison module and a trigger module. The comparison module is used to compare the N objects in the image to be processed with the predetermined condition. The trigger module is used to trigger the determination of N feature maps corresponding to the N objects overlappingly distributed in the image to be processed when it is determined that the N objects in the image to be processed meet the predetermined condition.
[0130] According to another embodiment of the present disclosure, the predetermined condition includes at least one of the following: the distance between the N objects is less than or equal to a distance threshold; the shapes of the N objects are different; the areas of the N objects are different; and there is an overlapping area between the detection frames of the N objects.
[0131] According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits, or at least part of the functions of any one of them can be implemented in one module. According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits can be split into multiple modules for implementation. According to the embodiments of the present invention, any one or more of the modules, submodules, units, and subunits can be at least partially implemented as hardware circuits, such as field programmable gate arrays (FPGAs), programmable logic arrays (PLAs), systems on chips, systems on substrates, systems on packages, application specific integrated circuits (ASICs), or can be implemented by hardware or firmware in any other reasonable way of integrating or packaging circuits, or can be implemented in any one of the three implementation methods of software, hardware, and firmware, or in any appropriate combination of any of them. Alternatively, according to the embodiments of the present invention, one or more of the modules, submodules, units, and subunits can be at least partially implemented as computer program modules, and when the computer program modules are run, the corresponding functions can be performed.
[0132] For example, any multiple of the acquisition module 810, the feature map determination module 820, and the result determination module 830 can be combined in one module / unit / sub-unit for implementation, or any one of the modules / units / sub-units can be split into multiple modules / units / sub-units. Alternatively, at least part of the functions of one or more of these modules / units / sub-units can be combined with at least part of the functions of other modules / units / sub-units and implemented in one module / unit / sub-unit. According to an embodiment of the present disclosure, at least one of the acquisition module 810, the feature map determination module 820, and the result determination module 830 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware, and firmware or in a suitable combination of any of them. Alternatively, at least one of the acquisition module 810, the feature map determination module 820 and the result determination module 830 may be at least partially implemented as a computer program module, which may perform a corresponding function when the computer program module is executed.
[0133] It should be noted that the overlapping object detection device part in the embodiment of the present disclosure corresponds to the overlapping object detection method part in the embodiment of the present disclosure. The description of the overlapping object detection device part specifically refers to the overlapping object detection method part, which will not be repeated here.
[0134] Fig. 9 A block diagram of an electronic device suitable for implementing a robot according to an embodiment of the present disclosure is schematically shown.
[0135] Fig. 9 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0136] like Fig. 9 As shown, the electronic device 900 according to an embodiment of the present disclosure includes a processor 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage part 908 into a random access memory (RAM) 903. The processor 901 may include, for example, a general-purpose microprocessor (e.g., a CPU), an instruction set processor and / or a related chipset and / or a dedicated microprocessor (e.g., an application-specific integrated circuit (ASIC)), etc. The processor 901 may also include an onboard memory for caching purposes. The processor 901 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present disclosure.
[0137] In RAM 903, various programs and data required for the operation of electronic device 900 are stored. Processor 901, ROM 902 and RAM 903 are connected to each other via bus 904. Processor 901 performs various operations of the method flow according to the embodiment of the present disclosure by executing the program in ROM 902 and / or RAM 903. It should be noted that the program can also be stored in one or more memories other than ROM 902 and RAM 903. Processor 901 can also perform various operations of the method flow according to the embodiment of the present disclosure by executing the program stored in one or more memories.
[0138] According to an embodiment of the present disclosure, the electronic device 900 may further include an input / output (I / O) interface 905, which is also connected to the bus 904. The electronic device 900 may further include one or more of the following components connected to the input / output (I / O) interface 905: an input portion 906 including a keyboard, a mouse, etc.; an output portion 907 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 908 including a hard disk, etc.; and a communication portion 909 including a network interface card such as a LAN card, a modem, etc. The communication portion 909 performs communication processing via a network such as the Internet. A drive 910 is also connected to the input / output (I / O) interface 905 as needed. A removable medium 911, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 910 as needed, so that a computer program read therefrom is installed into the storage portion 908 as needed.
[0139] According to an embodiment of the present disclosure, the method flow according to an embodiment of the present disclosure can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 909, and / or installed from the removable medium 911. When the computer program is executed by the processor 901, the above-mentioned functions defined in the system of the embodiment of the present disclosure are executed. According to an embodiment of the present disclosure, the system, equipment, device, module, unit, etc. described above can be implemented by a computer program module.
[0140] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.
[0141] According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium. For example, it may include, but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, apparatus, or device.
[0142] For example, according to an embodiment of the present disclosure, the computer-readable storage medium may include the ROM 902 and / or the RAM 903 described above and / or one or more memories other than the ROM 902 and the RAM 903 .
[0143] An embodiment of the present disclosure also includes a computer program product, which includes a computer program, and the computer program contains program code for executing the method provided by the embodiment of the present disclosure. When the computer program product runs on an electronic device, the program code is used to enable the electronic device to implement the overlapping object detection method provided by the embodiment of the present disclosure.
[0144] When the computer program is executed by the processor 901, the above functions defined in the system / device of the embodiment of the present disclosure are executed. According to the embodiment of the present disclosure, the system, device, module, unit, etc. described above can be implemented by a computer program module.
[0145] In one embodiment, the computer program may be based on a tangible storage medium such as an optical storage device, a magnetic storage device, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of a signal on a network medium, and downloaded and installed through the communication part 909, and / or installed from a removable medium 911. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0146] According to an embodiment of the present disclosure, the program code for executing the computer program provided by the embodiment of the present disclosure can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level process and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, Java, C++, python, "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using an Internet service provider to connect through the Internet).
[0147] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram may represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box may also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions. It can be understood by those skilled in the art that the features recorded in the various embodiments of the present disclosure can be combined and / or combined in a variety of ways, even if such a combination or combination is not explicitly recorded in the present disclosure. In particular, without departing from the spirit and teaching of the present disclosure, the features described in the various embodiments of the present disclosure may be combined and / or combined in a variety of ways. All of these combinations and / or combinations fall within the scope of the present disclosure.
[0148] The embodiments of the present disclosure are described above. However, these embodiments are only for illustrative purposes and are not intended to limit the scope of the present disclosure. Although the embodiments are described above, this does not mean that the measures in the various embodiments cannot be used in combination to advantage. Without departing from the scope of the present disclosure, those skilled in the art may make a variety of substitutions and modifications, which should all fall within the scope of the present disclosure.
Claims
1. A method for detecting overlapping objects, comprising: Get the image to be processed; Determine N feature maps corresponding to the N objects overlappingly distributed in the image to be processed; wherein the feature maps include position information of unobstructed areas of the corresponding objects and categories of the corresponding objects, and the categories include foreground objects or background objects; and N is an integer greater than or equal to 2; as well as An object detection result is determined according to the categories and the position information in the N feature maps.
2. The method according to claim 1, wherein: Determining N feature maps corresponding one-to-one to the N objects overlappingly distributed in the image to be processed includes: Performing a feature extraction operation on the image to be processed to obtain semantic features; and Based on the matching between the semantic features and the object query parameters, the N feature maps are determined; wherein the object query parameters characterize the features of overlapping objects in the image, the semantic features include valid features that match the object query parameters, the position information in the feature map is related to the position of the valid features, and the categories in the feature map are related to the object query parameters matched by the valid features.
3. The method according to claim 2, wherein: The determining the N feature graphs based on the matching between the semantic features and the object query parameters comprises: For two adjacent decoders in multiple cascaded decoders, Inputting the semantic features, the object query parameters and the output features of the previous decoder into the current decoder; The current decoder determines a fusion feature based on a plurality of sub-features in the semantic feature, the object query parameter and the semantic feature; The fused features are used as the output features of the current decoder, the current decoder is updated to the previous decoder, and the input to the current decoder is returned again until the last decoder outputs the N feature maps.
4. The method according to claim 3, further comprising: Sending a model acquisition request, wherein the model acquisition request includes at least one of model attribute information and device attribute information; as well as Receive a target model; wherein the target model includes the multiple cascaded decoders, and the target model is determined from multiple candidate models based on at least one of the model attribute information and the device attribute information.
5. The method according to claim 2, wherein: The object feature represented by the object query parameter is related to at least one of the following: whether the object is blocked, the area where the object is located in the image, the shape of the object, the size of the object, and the color of the object.
6. The method according to claim 2, wherein: The feature extraction operation is processed by a feature extraction network, which is obtained by knowledge distillation to transfer the feature extraction ability of the teacher model.
7. The method according to any one of claims 1 to 6, further comprising: Outputting a detection image according to the object detection result; The detection image includes N object sub-images, the positions of the N object sub-images are consistent with the position information in the N feature maps, and the display modes of the N object sub-images are different from each other.
8. The method according to any one of claims 1 to 6, further comprising: Comparing the N objects in the image to be processed with a predetermined condition; When it is determined that the N objects in the image to be processed meet the predetermined condition, a trigger is provided to determine N feature maps corresponding one-to-one to the N objects overlappingly distributed in the image to be processed.
9. The method according to claim 8, wherein: The predetermined condition includes at least one of the following: The distance between the N objects is less than or equal to a distance threshold; The N objects have different shapes; The N objects have different areas; and The detection frames of the N objects have overlapping areas.
10. An electronic device comprising: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors execute the method according to any one of claims 1 to 9.
Citation Information
Patent Citations
Overlapped fruit detection method and system
CN114092796A
Picture-based recognition method under coincident shielding condition of target object
CN116229310A
Image processing method, and deep learning model training method and device
CN116665002A
Target detection method, training method of target detection model and electronic equipment
CN116843910A
Image processing method, device and equipment, readable storage medium and program product
CN116977359A
