Method and electronic device for optimizing an instance profile
By optimizing the contour of the instance segmentation algorithm through expansion and weight update, the problem of contour mismatch in the prior art is solved, and higher segmentation accuracy is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BYD CO LTD
- Filing Date
- 2024-04-26
- Publication Date
- 2026-06-09
AI Technical Summary
Existing deep learning-based instance segmentation algorithms struggle to obtain detailed contours that perfectly match the real instance contours when dealing with complex instance objects, resulting in poor segmentation performance.
The first instance contour obtained by instance segmentation is expanded to construct the second instance contour. The shortest path weight from the internal pixels to the contour is calculated. The first instance contour is updated according to the weight to optimize the contour. Pixels belonging to the background are replaced to form the third instance contour.
It improves the accuracy of instance segmentation, making the third instance contour closer to the real instance contour, thus enhancing the segmentation effect.
Smart Images

Figure CN118314346B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and more specifically, to a method and electronic device for optimizing instance contours. Background Technology
[0002] In recent years, deep learning-based instance segmentation algorithms have been widely used in fields such as autonomous driving. However, these algorithms still have some shortcomings, and related technical challenges require further research and improvement. One such challenge is optimizing the instance contours obtained from segmentation. For some instance objects with complex contours, the instance contours obtained by deep learning-based instance segmentation algorithms are not detailed enough. Some parts fail to completely contain the pixels of the instance object itself, while others contain pixels outside the instance object, failing to perfectly match the true instance contour. In application scenarios with strict requirements for instance segmentation, coarse instance contours can have a significant negative impact on the segmentation results. Summary of the Invention
[0003] The summary section introduces a series of simplified concepts, which will be further explained in detail in the detailed description section. The summary section of this invention is not intended to limit the key features and essential technical features of the claimed technical solution, nor is it intended to determine the scope of protection of the claimed technical solution.
[0004] To address the shortcomings of existing technologies, the first aspect of this invention proposes a method for optimizing instance profiles, comprising:
[0005] Instance segmentation is performed on the target image to obtain the first instance contour in the target image;
[0006] The first instance outline is enlarged to obtain the second instance outline;
[0007] Determine the shortest path from the pixels within the second instance contour to the second instance contour;
[0008] Calculate the shortest path weight of the shortest path corresponding to each pixel point within the contour of the second instance;
[0009] The first instance contour is updated based on the shortest path weight corresponding to the pixels on the second instance contour to obtain the third instance contour of the target image.
[0010] In one embodiment, updating the first instance contour based on the shortest path weights corresponding to pixels within the second instance contour to obtain a third instance contour of the target image includes:
[0011] Based on the shortest path weight corresponding to the pixel within the second instance contour, the foreground saliency value of the pixel within the second instance contour is obtained, and the foreground saliency value represents the probability that the pixel belongs to the foreground point; among the pixels on the first instance contour, the first pixel whose foreground saliency value does not reach the foreground saliency value threshold is determined.
[0012] The first pixel is replaced with the second pixel whose foreground saliency value reaches the foreground saliency value threshold to obtain the third instance contour of the target image.
[0013] In one embodiment, replacing the first pixel with a second pixel whose foreground salience value reaches a foreground salience value threshold includes:
[0014] Search along the normal direction of the first pixel for the second pixel that is closest to the first pixel and whose foreground saliency value reaches the foreground saliency value threshold, and replace the first pixel with the second pixel.
[0015] In one embodiment, expanding the first instance outline to obtain the second instance outline includes:
[0016] The pixels on the first instance contour are moved a target distance outward along the normal direction to obtain the second instance contour.
[0017] In one embodiment, before enlarging the first instance contour to obtain the second instance contour, the method further includes determining the target distance based on the area of the first instance contour.
[0018] In one embodiment, determining the shortest path from a pixel within the second instance contour to the second instance contour includes: connecting the pixels within the second instance contour to obtain the shortest path from the pixel within the second instance contour to the second instance contour.
[0019] In one embodiment, determining the shortest path weight of the shortest path corresponding to the pixel point within the second instance contour includes:
[0020] Determine the weights of the connected edges between adjacent pixels on the shortest path;
[0021] The weights of each connected edge on the shortest path are weighted to obtain the shortest path weight.
[0022] In one embodiment, determining the weight of the connected edge between adjacent pixels on the shortest path includes:
[0023] The weight of the connected edge between adjacent pixels is determined based on the difference between the coordinate values and the difference in pixel values of the adjacent pixels.
[0024] In one embodiment, connecting the pixels within the second instance contour to obtain the shortest path from the pixels within the second instance contour to the second instance contour includes:
[0025] Determine virtual pixel vertices and connect each pixel on the second instance contour to the virtual pixel vertex. Determine the shortest path from the pixel in the second instance contour to the second instance contour based on the shortest path from the pixel in the second instance contour to the virtual pixel vertex.
[0026] In one embodiment, determining virtual pixel vertices includes:
[0027] The coordinates and pixel values of each pixel on the second instance contour are averaged to obtain the coordinates and pixel values of the virtual pixel vertex.
[0028] In one embodiment, the shortest path from a pixel within the second instance contour to the virtual pixel vertex is determined based on Dijkstra's algorithm.
[0029] A second aspect of the present invention provides an electronic device, the electronic device including a memory and a processor, the memory storing a computer program executed by the processor, the computer program executing the method of optimizing the instance profile as described above when executed by the processor.
[0030] A third aspect of the present invention provides a computer storage medium having a computer program stored thereon, wherein the computer program, when executed, implements the method for optimizing instance profiles as described above.
[0031] The method and electronic device for optimizing instance contours proposed in this invention expand the first instance contour obtained by instance segmentation to obtain a second instance contour representing background points. Based on the shortest path weight from the pixels inside the second instance contour to the second instance contour, it is determined whether the pixels inside the second instance contour belong to foreground or background points, thereby updating the first instance contour to obtain an optimized third instance contour. This makes the third instance contour closer to the real instance contour and improves the accuracy of instance segmentation. Attached Figure Description
[0032] The above and other objects, features, and advantages of the present invention will become more apparent from the more detailed description of embodiments thereof in conjunction with the accompanying drawings. The drawings are provided to further illustrate embodiments of the invention and form part of the specification. They are used together with the embodiments to explain the invention and do not constitute a limitation thereof. In the drawings, the same reference numerals generally represent the same parts or steps.
[0033] Figure 1 A schematic flowchart illustrating a method for optimizing instance contours according to an embodiment of the present invention;
[0034] Figure 2A This is a schematic diagram of a first instance outline, a second instance outline, and a third instance outline according to an embodiment of the present invention;
[0035] Figure 2B This is a schematic connectivity diagram formed by connecting adjacent pixels according to an embodiment of the present invention;
[0036] Figure 3 This is a schematic block diagram of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0037] To make the objectives, technical solutions, and advantages of this application more apparent, exemplary embodiments according to this application will be described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are merely some embodiments of this application, and not all embodiments of this application. It should be understood that this application is not limited to the exemplary embodiments described herein. Based on the embodiments of this application described herein, all other embodiments obtained by those skilled in the art without inventive effort should fall within the protection scope of this application.
[0038] The following description provides numerous specific details to offer a more thorough understanding of this application. However, it will be apparent to those skilled in the art that this application can be practiced without one or more of these details. In other instances, certain technical features well-known in the art have not been described to avoid confusion with this application.
[0039] It should be understood that this application can be implemented in various forms and should not be construed as being limited to the embodiments set forth herein. Rather, providing these embodiments will make the disclosure thorough and complete, and will fully convey the scope of this application to those skilled in the art.
[0040] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the scope of this application. When used herein, the singular forms “a,” “an,” and “the” are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the terms “comprising” and / or “including,” when used in this specification, identify the presence of the stated features, integers, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and / or groups. When used herein, the term “and / or” includes any and all combinations of the associated listed items.
[0041] To fully understand this application, a detailed structure will be presented in the following description to illustrate the technical solution proposed in this application. Optional embodiments of this application are described in detail below; however, in addition to these detailed descriptions, this application may have other implementation methods.
[0042] The method, apparatus, and computer storage medium for optimizing example profiles according to embodiments of the present invention will now be described with reference to the accompanying drawings. First, see... Figure 1 , Figure 1 A schematic flowchart of a method 100 for optimizing instance contours according to an embodiment of the present invention is shown. Figure 1 As shown, the method 100 for optimizing instance contours according to an embodiment of the present invention includes the following steps:
[0043] In step S110, the target image is segmented to obtain the first instance contour in the target image;
[0044] In step S120, the first instance outline is enlarged to obtain the second instance outline;
[0045] In step S130, the shortest path from the pixel point within the second instance contour to the second instance contour is determined;
[0046] In step S140, the shortest path weight of the shortest path corresponding to each pixel point within the second instance contour is calculated.
[0047] In step S150, the first instance contour is updated according to the shortest path weight corresponding to the pixel points in the second instance contour to obtain the third instance contour of the target image.
[0048] The method 100 for optimizing instance contours in this embodiment of the invention expands the first instance contour obtained from instance segmentation to obtain a second instance contour representing background points. Based on the shortest path weight from the pixels inside the second instance contour to the second instance contour, it is determined whether the pixels inside the second instance contour belong to foreground points or background points. The pixels belonging to foreground points are replaced with the pixels belonging to foreground points, thereby updating the first instance contour and obtaining an optimized third instance contour. This makes the third instance contour of the target image closer to the real instance contour, improving the accuracy of instance segmentation.
[0049] Specifically, in step S110, instance segmentation is first performed on the target image to obtain one or more first instance contours in the target image. The target image can be a color image in RGB format. By performing instance segmentation on the target image, the pixel regions containing all instance objects within the target image can be obtained, and the contours of these regions, i.e., the first instance contours, can be acquired. Instance segmentation is a combination of object detection and semantic segmentation. Compared to the bounding boxes of object detection, instance segmentation is accurate to the edges of objects; compared to semantic segmentation, instance segmentation can label different individuals of the same object in the image.
[0050] For example, Mask R-CNN (Mask Region-based Convolutional Neural Network) can be used for instance segmentation. Mask R-CNN is a neural network model that combines object detection and semantic segmentation, effectively detecting objects while outputting a high-quality instance segmentation mask, thereby achieving instance segmentation. However, it should be noted that the instance segmentation method used in the embodiments of the present invention is not limited to Mask R-CNN; other related instance segmentation models can also be used in the instance segmentation steps of the embodiments of the present invention.
[0051] Since instance contours obtained by simple instance segmentation algorithms often fail to perfectly match the true instance contours—some parts of the instance contour may not fully contain the pixels of the instance object itself, while others may contain pixels that do not belong to the instance object—this embodiment of the invention optimizes the first instance contour after obtaining it using the optimization method described below. For example, since a target image may contain multiple instance objects, after obtaining the first instance contours of all instance objects in the target image, all instance objects can be numbered and sorted from top to bottom and from left to right according to their position in the target image, and then their first instance contours can be optimized sequentially.
[0052] In step S120, the first instance contour is enlarged to obtain a second instance contour, i.e., the second instance contour is located outside the first instance contour and surrounds the first instance contour. The instance object obtained by the instance segmentation algorithm can be regarded as the foreground, and the area around the instance object can be regarded as the background. Therefore, after enlarging the first instance contour obtained by the original instance segmentation, the pixels on the enlarged second instance contour are likely to be background pixels, i.e., pixels that do not belong to the instance object.
[0053] For example, the method for expanding the first instance contour includes: moving the pixels on the first instance contour outward by a target distance along the normal direction to obtain the second instance contour, thereby ensuring that the first instance contour and the second instance contour have similar shapes.
[0054] like Figure 2A As shown, the normal direction of each pixel on the first instance contour O1 is obtained. The first instance contour can be treated as a curve, and the tangent line at each pixel on the curve is calculated. The direction perpendicular to the tangent line at that pixel is the normal direction at that point, and the positive normal direction is defined as pointing from the inside of the first instance contour to the outside. Next, each pixel on the first instance contour O1 is moved a certain distance along the positive normal direction to obtain the enlarged second instance contour O2. Referring to Formula 1, the distance the pixel moves is... It can be determined based on the area of the first instance's outline:
[0055] (Formula 1)
[0056] Where s is the area of the region contained in the first instance contour (in pixels), and λ is an adjustable parameter, for example, λ=0.01.
[0057] In addition to the above-described enlargement method, embodiments of the present invention may also employ other methods to enlarge the first instance outline. For example, the first instance outline may be enlarged proportionally with the center of the first instance outline as a reference to obtain the second instance outline.
[0058] Next, in step S130, the shortest path from each pixel within the second instance contour to the second instance contour is determined. The shorter the shortest path, the easier it is for the corresponding pixel to connect to the second instance contour.
[0059] Determining the shortest path from each pixel within the second instance contour to the second instance contour includes connecting the pixels within the second instance contour to obtain the shortest path from each pixel within the second instance contour to the second instance contour.
[0060] Specifically, firstly, using all pixels within the contour of the second instance as vertices, adjacent pixels are connected to construct a connected graph, as shown in the figure. Figure 2B As shown, a connected graph is constructed using pixels contained within the second instance contour as vertices, connecting vertices and edges between them. Taking pixel A in the diagram as an example, the paths from pixel A to pixel C on the second instance contour include AC, ABFC, and ADEC, where AC is the shortest path from pixel A to pixel C on the second instance contour. The construction of the connected graph can be based on any suitable method well-known to those skilled in the art, and is not specifically limited here. Next, the weight of the connected edge between each pair of adjacent pixels can be calculated. The weight reflects the proximity between two pixels; the shorter the distance between two pixels, the closer their pixel values, and the smaller the weight. Therefore, the weight of the connected edge between adjacent pixels can be determined based on the difference in coordinates and pixel values of adjacent pixels.
[0061] For example, the weight w of the connecting edge between two connected pixels i and j can be calculated according to Formula 2. ij ,
[0062]
[0063] (Formula 2)
[0064] In Formula 2, r, g, b, x, and y can all be normalized to [0, 1]. Specifically, the R, G, and B color channel values (each channel's value range is [0, 255]) corresponding to each pixel can be normalized as follows to obtain the values of r, g, and b:
[0065] (Formula 3)
[0066] (Formula 4)
[0067] (Formula 5)
[0068] Furthermore, the pixel coordinate values X and Y are normalized as follows to obtain x and y:
[0069] (Formula 6)
[0070] (Formula 7)
[0071] in, , These represent the width and height of the target image, respectively. The top left corner of the target image is the origin of the coordinate system, with the horizontal direction as the x-axis and the vertical direction as the y-axis.
[0072] In Formula 2, The value is used to control the color difference within the weight w. ij In one example, the proportion of the content is taken as follows: The default color difference accounts for a large proportion.
[0073] After constructing the connected graph, Dijkstra's algorithm can be used to search for the shortest path from each pixel to the second instance contour. Dijkstra's algorithm is used to search for the shortest path from one vertex to all other vertices, solving the shortest path problem in a weighted graph. The main characteristic of Dijkstra's algorithm is that it starts from the starting point and uses a greedy algorithm strategy, traversing the nearest unvisited vertex adjacent to the starting point each time, until it extends to the destination.
[0074] In step S140, the shortest path weights of the shortest paths corresponding to each pixel within the second instance contour are calculated. Specifically, the weights of each connected edge on the shortest path corresponding to each pixel within the second instance contour are weighted to obtain the shortest path weight. Since the second instance contour O2 can be considered a background point, the smaller the shortest path weight from a pixel within the second instance contour to the second instance contour, the closer the pixel is to the second instance contour, meaning the greater the probability that the pixel and the second instance contour belong to the same background point. Conversely, the larger the shortest path weight from a pixel within the second instance contour to the second instance contour, the lower the proximity of the pixel to the second instance contour, and therefore the greater the probability that the pixel belongs to the foreground point. Thus, foreground and background points within the second instance contour can be determined based on the shortest path weights.
[0075] For example, all pixels on the second instance contour can be connected to a virtual pixel vertex V, that is, each pixel on the second instance contour is connected to the virtual pixel vertex, i.e., through the weighted (w) constructed above. ijThe connected graph connects all pixels on the second instance contour to a virtual pixel vertex V. Since pixels on the second instance contour are considered background pixels by default, this virtual pixel vertex is called the virtual background vertex. Calculating the shortest path from a pixel vertex within the second instance contour to the edge of the second instance contour is equivalent to calculating the shortest path from that vertex to the virtual background vertex. The coordinates and pixel values of the virtual pixel vertex are the average of the coordinates and pixel values of all pixels on the second instance contour, respectively. That is, the r, g, b, x, and y values of the virtual pixel vertex are the average of the r, g, b, x, and y values of all pixels on the second instance contour O2. The weight of the connected edge formed by connecting pixels on the second instance contour O2 to the virtual pixel vertex V is also calculated using Formula 2 above. Calculating the weight of the shortest path from each pixel within the second instance contour to the second instance contour O2 is equivalent to calculating the weight of the shortest path from each pixel to the virtual pixel vertex V. For example, the shortest path from a pixel within the second instance contour to the virtual pixel vertex can also be determined based on Dijkstra's algorithm. The weights of each connected edge on the shortest path corresponding to each pixel within the second instance contour are weighted to obtain the shortest path weight, which is the shortest path weight P from pixel i to virtual pixel vertex V. i .
[0076] After obtaining the shortest path weight for each pixel within the second instance contour, the foreground saliency value of each pixel can be calculated based on the shortest path weight. The foreground saliency value represents the probability that a pixel belongs to the foreground; the larger the foreground saliency value, the higher the probability that the corresponding pixel belongs to the foreground, and vice versa. For example, the foreground saliency value of each pixel can be calculated according to the following formula 8:
[0077] (Formula 8)
[0078] In Formula 8, S i P represents the foreground saliency value of pixel i. i β represents the shortest path weight from pixel i to virtual pixel vertex V, and β is a control parameter, for example, β=0.01.
[0079] In step S150, the first instance contour is updated according to the shortest path weight corresponding to the pixel points in the second instance contour to obtain the third instance contour of the target image. Figure 2A The updated third instance outline is shown.
[0080] In one embodiment, the first instance contour can be updated based on the foreground saliency values corresponding to the pixels on the first instance contour. Since the foreground saliency values of all pixels inside the second instance contour were obtained in the previous step, and the second instance contour is obtained by expanding the first instance contour, the foreground saliency values of each pixel on the first instance contour are also included when calculating the foreground saliency values of all pixels inside the second instance contour.
[0081] Among the pixels on the first instance contour, pixels whose foreground saliency reaches a predefined foreground saliency threshold are retained, and pixels whose foreground saliency does not reach the foreground saliency threshold are defined as first pixels. The first pixels are then replaced with their surrounding second pixels whose foreground saliency reaches the foreground saliency threshold to obtain the third instance contour of the target image. Since all pixels on the third instance contour reach the foreground saliency threshold, its accuracy is higher than that of the first instance contour.
[0082] In one example, the foreground saliency threshold is 0.45. Pixels with a saliency greater than this threshold are designated as foreground pixels, while pixels with a saliency less than or equal to this threshold are designated as background pixels.
[0083] Furthermore, when replacing the first pixel with a second pixel whose foreground saliency value reaches the foreground saliency value threshold, the second pixel that is closest to the first pixel and whose foreground saliency value reaches the foreground saliency value threshold can be searched along the normal direction of the first pixel. The second pixel is then used to replace the first pixel, thereby forming a new optimized instance contour, namely the third instance contour.
[0084] like Figure 2A As shown, for the first pixel on the first instance contour O1 whose foreground saliency value does not reach the saliency threshold, along the normal line passing through that pixel (such as...) Figure 2A (As shown by the dashed line) Move to the location of the nearest second pixel that reaches the foreground saliency threshold. When searching for the second pixel along the normal, it cannot cross the expanded second instance contour O2. The movement direction can be along the positive or negative direction of the normal. For the first pixel whose foreground saliency does not reach the foreground saliency threshold, if no replacement second pixel is found, the first pixel is retained, thus forming the third instance contour O0. The third instance contour O0 has a high degree of fit with the actual instance contour, resulting in better final instance segmentation.
[0085] In summary, the method 100 for optimizing instance contours in this embodiment of the invention expands the first instance contour obtained from instance segmentation to obtain a second instance contour representing background points. Based on the shortest path weight from the pixels inside the second instance contour to the second instance contour, it determines whether the pixels inside the second instance contour belong to foreground or background points. The pixels belonging to foreground points are replaced with the pixels belonging to background points on the first instance contour, thereby updating the first instance contour and obtaining an optimized third instance contour. This makes the third instance contour closer to the real instance contour and improves the accuracy of instance segmentation.
[0086] This invention also provides an electronic device that can be used to implement the method 100 for optimizing instance contours described above. See also Figure 3 , Figure 3 A schematic block diagram of an electronic device 300 according to an embodiment of the present invention is shown.
[0087] like Figure 3 As shown, the electronic device 300 of this embodiment includes a memory 310, a processor 320, and a computer program stored in the memory 310 and running on the processor 320. When the processor 320 executes the computer program, it can implement the method 100 for optimizing instance contours as described above.
[0088] Specifically, the memory 310 may primarily include a program storage area and a data storage area. The program storage area may store the operating system, applications required for multiple functions, etc., while the data storage area may store image data. Furthermore, the memory 310 may include high-speed random access memory, and may also include non-volatile memory, such as hard disks, RAM, plug-in hard disks, smart memory cards, secure digital cards, flash memory cards, multiple disk storage devices, flash memory devices, or other volatile solid-state storage devices.
[0089] The processor 320 may be implemented by software, hardware, firmware, or a combination thereof, and may be a circuit, one or more of an application-specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a programmable logic device (PLD), a field-programmable gate array (FPGA), a central processing unit (CPU), a controller, a microcontroller, or a microprocessor, thereby enabling the electronic device 300 to perform some or all of the steps of the method 100 for optimizing the instance profile in the various embodiments of this application, or any combination thereof.
[0090] This invention also proposes a computer storage medium storing a computer program thereon, which, when executed, can implement the method 100 for optimizing the instance outline of this invention. The computer storage medium may include, for example, a memory card of a smartphone, a storage component of a tablet computer, a hard disk of a personal computer, a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a portable compact disc read-only memory (CD-ROM), a USB memory, or any combination of the above storage media. A computer-readable storage medium may be any combination of one or more computer-readable storage media.
[0091] According to an embodiment of this application, a computer program product is also provided, including a computer program / instruction that, when executed by a processor, implements the method 100 described above for optimizing the instance profile.
[0092] The electronic devices, computer storage media, and computer program products of the present invention are used to implement the methods described above, and therefore also have similar advantages.
[0093] Although exemplary embodiments have been described herein with reference to the accompanying drawings, it should be understood that the above exemplary embodiments are merely illustrative and are not intended to limit the scope of this application. Various changes and modifications can be made therein by those skilled in the art without departing from the scope and spirit of this application. All such changes and modifications are intended to be included within the scope of this application as claimed in the appended claims.
[0094] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0095] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed.
[0096] Numerous specific details are set forth in the specification provided herein. However, it will be understood that embodiments of this application may be practiced without these specific details. In some instances, well-known methods, structures, and techniques have not been shown in detail so as not to obscure the understanding of this specification.
[0097] Similarly, it should be understood that, in order to streamline this application and aid in understanding one or more of the various inventive aspects, features of this application may sometimes be grouped together in a single embodiment, figure, or description thereof in the description of exemplary embodiments of this application. However, this approach should not be construed as reflecting an intention that the claimed application requires more features than are expressly recited in each claim. Rather, as reflected in the corresponding claims, its inventive point lies in solving the corresponding technical problem with features fewer than all features of a single disclosed embodiment. Therefore, the claims following the detailed description are hereby expressly incorporated into that detailed description, wherein each claim itself is a separate embodiment of this application.
[0098] Those skilled in the art will understand that, apart from the mutual exclusion of features, all features disclosed in this specification (including the accompanying claims, abstract, and drawings) and all processes or elements of any method or apparatus so disclosed may be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstract, and drawings) may be replaced by an alternative feature that serves the same, equivalent, or similar purpose.
[0099] Furthermore, those skilled in the art will understand that although some embodiments described herein include certain features but not others included in other embodiments, combinations of features from different embodiments are intended to be within the scope of this application and form different embodiments. For example, in the claims, any one of the claimed embodiments can be used in any combination.
[0100] The various component embodiments of this application can be implemented in hardware, or as software modules running on one or more processors, or a combination thereof. Those skilled in the art will understand that microprocessors or digital signal processors (DSPs) can be used in practice to implement some or all of the functions of some modules according to the embodiments of this application. This application can also be implemented as an apparatus program (e.g., a computer program and computer program product) for performing part or all of the methods described herein. Such an implementation of this application can be stored on a computer-readable medium, or can be in the form of one or more signals. Such signals can be downloaded from an Internet website, provided on a carrier signal, or provided in any other form.
[0101] It should be noted that the above embodiments are illustrative of this application and not limiting of it, and that those skilled in the art can devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses should not be construed as limiting the claims. This application can be implemented by means of hardware comprising several different elements and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by the same item of hardware. The use of the words first, second, and third, etc., does not indicate any order. These words can be interpreted as names.
[0102] The above description is merely a specific embodiment or illustration of the embodiments of this application. The scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. The scope of protection of this application shall be determined by the scope of the claims.
Claims
1. A method for optimizing instance contours, characterized in that, The method includes: The target image is segmented to obtain a first instance contour in the target image; the first instance contour is enlarged to obtain a second instance contour. Determine the shortest path from the pixels within the second instance contour to the second instance contour; Calculate the shortest path weight of the shortest path corresponding to each pixel in the second instance contour; update the first instance contour according to the shortest path weight of the pixel in the second instance contour to obtain the third instance contour of the target image, specifically including: obtaining the foreground saliency value of the pixel in the second instance contour according to the shortest path weight of the pixel in the second instance contour, wherein the foreground saliency value represents the probability that the pixel belongs to the foreground point; Among the pixels on the first instance contour, a first pixel is identified whose foreground saliency value does not reach the foreground saliency value threshold. The first pixel is replaced with a second pixel whose foreground saliency value reaches the foreground saliency value threshold to obtain the third instance contour of the target image; The calculation of the shortest path weight for each pixel within the second instance contour includes: Determining the weight of the connected edge between adjacent pixels on the shortest path specifically includes: determining the weight of the connected edge between adjacent pixels based on the difference between the coordinate values and the difference between the pixel values of the adjacent pixels; The weights of each connected edge on the shortest path are weighted to obtain the shortest path weight.
2. The method for optimizing instance contours according to claim 1, characterized in that, The step of replacing the first pixel with a second pixel whose foreground salience value reaches the foreground salience value threshold includes: Search along the normal direction of the first pixel for the second pixel that is closest to the first pixel and whose foreground saliency value reaches the foreground saliency value threshold, and replace the first pixel with the second pixel.
3. The method for optimizing instance contours according to claim 1, characterized in that, The step of enlarging the first instance outline to obtain the second instance outline includes: The pixels on the first instance contour are moved a target distance outward along the normal direction to obtain the second instance contour.
4. The method for optimizing instance contours according to claim 3, characterized in that, Before expanding the first instance contour to obtain the second instance contour, the method further includes: determining the target distance based on the area of the first instance contour.
5. The method for optimizing instance contours according to claim 1, characterized in that, Determining the shortest path from a pixel within the second instance contour to the second instance contour includes connecting the pixels within the second instance contour to obtain the shortest path from the pixel within the second instance contour to the second instance contour.
6. The method for optimizing instance contours according to claim 5, characterized in that, The step of connecting the pixels within the second instance contour to obtain the shortest path from the pixels within the second instance contour to the second instance contour includes: Determine virtual pixel vertices and connect each pixel on the second instance contour to the virtual pixel vertex. Determine the shortest path from the pixel in the second instance contour to the second instance contour based on the shortest path from the pixel in the second instance contour to the virtual pixel vertex.
7. The method for optimizing instance contours according to claim 6, characterized in that, The determination of virtual pixel vertices includes: The coordinates and pixel values of each pixel on the second instance contour are averaged to obtain the coordinates and pixel values of the virtual pixel vertex.
8. The method for optimizing instance contours according to claim 6, characterized in that, The shortest path from the pixel point within the second instance contour to the virtual pixel vertex is determined based on Dijkstra's algorithm.
9. An electronic device, characterized in that, The electronic device includes a memory and a processor, the memory storing a computer program executed by the processor, the computer program performing the method for optimizing the instance profile as described in any one of claims 1-8 when executed by the processor.
10. A computer storage medium having a computer program stored thereon, characterized in that, When the computer program is executed, it implements the method for optimizing the instance profile as described in any one of claims 1-8.