Picture segmentation method and device, electronic equipment and storage medium

By combining the rough search and fine search methods, the original image segmentation method is determined based on the storage unit size and the preset ratio, which solves the problem of large image processing calculations in the hardware accelerator and achieves faster image segmentation and more efficient simulation. radial transformation processing.

CN118628514APending Publication Date: 2024-09-10CANAAN CREATIVE (SH) CO LTD
View PDF 7 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In system-level chips, when the hardware accelerator processes images, due to SRAM size limitations, the original image needs to be split into multiple slices for calculation, resulting in a large amount of calculation and difficulty in meeting real-time requirements.

Method used

By combining the rough search and fine search methods, the initial sub-image size of the original image is determined based on the storage unit size, and multiple preset target sub-images are obtained based on the preset ratio and target image size, and affine transformation is performed to determine the final segmentation method. Avoid full traversal calculations.

Benefits of technology

It significantly reduces the amount of data calculation, improves segmentation efficiency, and meets the real-time requirements of the hardware accelerator.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118628514A
    Figure CN118628514A
Patent Text Reader

Abstract

The invention provides a picture segmentation method and device, electronic equipment and a storage medium, and the method comprises the steps: obtaining the initial sub-picture size of an original picture based on the size of a storage unit; based on the initial sub-image size of the original image, a preset ratio and the size of a preset target image, a plurality of preset target sub-images are obtained, the preset ratio is the ratio of the size of the preset target image to the size of the original image, and the preset target image is an image needed by a user; and based on the preset target image and the preset target sub-image, executing affine transformation, and determining a final segmentation mode of the original image. According to the method, rough search and fine search are combined, so that the whole search process can reach a convergence state more quickly, the calculation amount is remarkably reduced, and the real-time requirement of the hardware accelerator is well met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of image processing, and in particular to an image segmentation method, device, electronic device and storage medium. Background Art

[0002] In the design of a system on chip (SOC) for processing images, a hardware accelerator is generally added to complete various transformation processes on the image, such as affine transformation, size transformation, etc.

[0003] When using a hardware accelerator to process an image, the original image data is usually stored in a double data rate (DDR) memory. At the same time, in order to reduce the bandwidth pressure of DDR, an internal static random access memory (SRAM) module is usually added to the hardware accelerator to read the original image from DDR to SRAM before processing.

[0004] Considering that SRAM is generally not too large, it is often necessary to split the original image into multiple slices according to the SRAM size limit and calculate them separately to obtain the processing result of the entire image. In related technologies, the original image is often segmented by traversing and searching the preset target image from small to large, so that all slices need to be calculated in each round, which is very computationally intensive and difficult to meet the real-time requirements of the hardware accelerator. Summary of the invention

[0005] The embodiments of the present disclosure at least provide a method, device, electronic device and storage medium for image segmentation, which combine coarse search and fine search to achieve faster image segmentation, significantly reduce the amount of data calculation, and meet the real-time requirements of the hardware accelerator.

[0006] In a first aspect, an embodiment of the present disclosure provides a method for image segmentation, including:

[0007] Obtain the initial sub-image size of the original image based on the size of the storage unit;

[0008] Based on the size of the initial sub-image of the original image, the preset ratio, and the size of the preset target image, a plurality of preset target sub-images are obtained, wherein the preset ratio is the ratio of the size of the preset target image to the size of the original image, and the preset target image is the image required by the user;

[0009] Based on the preset target image and the preset target sub-image, an affine transformation is performed to determine a final segmentation method of the original image.

[0010] In a possible implementation, performing affine transformation based on the preset target image and the preset target sub-image to determine a final segmentation method of the original image includes:

[0011] Determine whether the preset target subgraph is a non-edge subgraph, and the non-edge subgraph is at a non-edge position of the preset target graph;

[0012] If there is at least one non-edge sub-image, determining a final segmentation method of the original image based on the non-edge sub-image;

[0013] If there is no non-edge sub-image, the final segmentation method of the original image is determined based on all the preset target sub-images.

[0014] In a possible implementation manner, the determining whether the preset target subgraph is a non-edge subgraph includes:

[0015] If the number of splits of the length and width of the preset target graph is greater than or equal to 3, then there is at least one non-edge subgraph;

[0016] If the number of splits of the length and / or width of the preset target graph is less than 3, there is no non-edge subgraph.

[0017] In a possible implementation manner, if there is at least one non-edge sub-image, determining a final segmentation method of the original image based on the non-edge sub-image includes:

[0018] Based on the non-edge sub-image, perform an affine transformation to obtain a first sub-image corresponding to the original image;

[0019] The size of the first sub-image is compared with the size of the storage unit to determine a final segmentation method of the original image.

[0020] In a possible implementation manner, comparing the size of the first sub-image with the size of the storage unit to determine the final segmentation method of the original image includes:

[0021] Setting a preset step size based on the size of the storage unit;

[0022] If the size of the first sub-image is smaller than the size of the storage unit, the size of the first sub-image is used as the target size, and the following steps are repeatedly performed until the target size is larger than the size of the storage unit:

[0023] After the target size is increased by the preset step size, it is used as the target size again.

[0024] In a possible implementation manner, increasing the target size by one of the preset step sizes and resetting the target size to the target size includes:

[0025] After the length and width of the target size are alternately increased by one of the preset step lengths, each time the length or width of the target size is increased, it is used as the target size again.

[0026] In a possible implementation manner, after increasing the target size by the preset step size and resetting it as the target size, the method further includes:

[0027] Using the first sub-image after final adjustment as the third sub-image;

[0028] The size of the third sub-image is used as the target size, and the following steps are performed repeatedly until the target size matches the size of the storage unit:

[0029] The length and width of the target size are alternately reduced by a fixed step size and then used as the target size again.

[0030] In a possible implementation manner, comparing the size of the first sub-image with the size of the storage unit to determine a final segmentation method of the original image further includes:

[0031] If the size of the first sub-image is larger than the size of the storage unit, the size of the first sub-image is used as the target size, and the following steps are repeatedly performed until the target size is smaller than the size of the storage unit:

[0032] After reducing the target size by the preset step size, the target size is used again as the target size.

[0033] In a possible implementation manner, reducing the target size by the preset step size and re-using it as the target size includes:

[0034] After the length and width of the target size are alternately reduced by one of the preset steps, each time the length or width of the target size is reduced, it is used as the target size again.

[0035] In a possible implementation manner, after reducing the target size by the preset step size and resetting it as the target size, the method further includes:

[0036] Using the first sub-image after final adjustment as the third sub-image;

[0037] The size of the third sub-image is used as the target size, and the following steps are performed repeatedly until the target size matches the size of the storage unit:

[0038] The length and width of the target size are alternately increased by a fixed step size and then used as the target size again.

[0039] In a possible implementation manner, if there is no non-edge sub-image, determining a final segmentation method of the original image based on all the preset target sub-images includes:

[0040] Based on each of the preset target sub-images, an affine transformation is performed to obtain a second sub-image corresponding to the original image respectively;

[0041] The size of the second sub-image is compared with the size of the storage unit to determine a final segmentation method of the original image.

[0042] In a possible implementation manner, comparing the size of the second sub-image with the size of the storage unit to determine a final segmentation method of the original image includes:

[0043] Setting a preset step size based on the size of the storage unit;

[0044] If the size of the second sub-image is smaller than the size of the storage unit, the size of the second sub-image is used as the target size, and the following steps are repeatedly performed until the target size is larger than the size of the storage unit:

[0045] After the target size is increased by the preset step size, it is used as the target size again.

[0046] In a possible implementation manner, increasing the target size by one of the preset step sizes and resetting the target size to the target size includes:

[0047] After the length and width of the target size are alternately increased by one of the preset step lengths, each time the length or width of the target size is increased, it is used as the target size again.

[0048] In a possible implementation manner, after increasing the target size by the preset step size and resetting it as the target size, the method further includes:

[0049] Using the second sub-image after final adjustment as the fourth sub-image;

[0050] The size of the fourth sub-image is used as the target size, and the following steps are performed repeatedly until the target size matches the size of the storage unit:

[0051] The length and width of the target size are alternately reduced by a fixed step size and then used as the target size again.

[0052] In a possible implementation manner, comparing the size of the second sub-image with the size of the storage unit to determine a final segmentation method of the original image further includes:

[0053] If the size of the second sub-image is larger than the size of the storage unit, the size of the second sub-image is used as the target size, and the following steps are repeatedly performed until the target size is smaller than the size of the storage unit:

[0054] After reducing the target size by the preset step size, the target size is used again as the target size.

[0055] In a possible implementation manner, reducing the target size by the preset step size and re-using it as the target size includes:

[0056] After the length and width of the target size are alternately reduced by one of the preset steps, each time the length or width of the target size is reduced, it is used as the target size again.

[0057] In a possible implementation manner, after reducing the target size by the preset step size and resetting it as the target size, the method further includes:

[0058] Using the second sub-image after final adjustment as the fourth sub-image;

[0059] The size of the fourth sub-image is used as the target size, and the following steps are performed repeatedly until the target size matches the size of the storage unit:

[0060] The length and width of the target size are alternately increased by a fixed step size and then used as the target size again.

[0061] In a possible implementation manner, setting a preset step size based on the size of the storage unit includes:

[0062] The size of the storage unit is converted from a two-dimensional size to a one-dimensional size to obtain the preset step size.

[0063] In a possible implementation manner, the fixed step size is 1.

[0064] In a second aspect, the present disclosure further provides a picture segmentation device, comprising:

[0065] An acquisition module, used for obtaining the initial sub-image size of the original image based on the size of the storage unit;

[0066] A first calculation module, configured to obtain a plurality of preset target sub-images based on the size of the original image initial sub-image, a preset ratio, and the size of a preset target image, wherein the preset ratio is the ratio of the size of the preset target image to the size of the original image, and the preset target image is the image required by the user;

[0067] The second calculation module is used to perform affine transformation based on the preset target image and the preset target sub-image to determine the final segmentation method of the original image.

[0068] In a third aspect, the present disclosure further provides an electronic device, comprising: a processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate through the bus, and when the machine-readable instructions are executed by the processor, the image segmentation method as described in any one of the first aspect and its various embodiments is performed.

[0069] In a fourth aspect, the present disclosure further provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the image segmentation method as described in any one of the first aspect and its various embodiments is executed.

[0070] By using the above-mentioned image segmentation method, device, electronic device and storage medium, when the size of the storage unit is obtained, the size of the initial sub-image of the original image can be determined based on the size, and multiple preset target sub-images can be obtained based on the size of the initial sub-image of the original image, the preset ratio, and the size of the preset target image. Specifically, this can be achieved by combining the preset ratio between the size of the preset target image and the size of the original image. The preset ratio can limit the search process to a more ideal search range to a certain extent, and then further perform a fine search on the basis of the coarse search. The final segmentation method executed in this way avoids the problem of huge computational complexity brought about by all existing traversal methods. The combination of coarse search and fine search allows the entire search process to reach a convergence state more quickly, and the computational complexity is significantly reduced, thereby meeting the real-time requirements of the hardware accelerator well.

[0071] Other advantages of the present disclosure will be explained in more detail with reference to the following description and accompanying drawings.

[0072] It should be understood that the above description is only an overview of the technical solution of the present disclosure, so that the technical means of the present disclosure can be more clearly understood and implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present disclosure more obvious and easy to understand, the specific implementation methods of the present disclosure are specifically described below. BRIEF DESCRIPTION OF THE DRAWINGS

[0073] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following is a brief introduction to the drawings required for use in the embodiments. The drawings herein are incorporated into the specification and constitute a part of the specification. These drawings illustrate embodiments consistent with the present disclosure and are used together with the specification to illustrate the technical solutions of the present disclosure. It should be understood that the following drawings only illustrate certain embodiments of the present disclosure and should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without creative work. Moreover, the same reference numerals are used to represent the same components throughout the drawings. In the drawings:

[0074] Figure 1(a) to Figure 1(b) A schematic diagram of affine transformation in an existing traversal search method is shown;

[0075] Figure 2 A flowchart of a picture segmentation method provided by an embodiment of the present disclosure is shown;

[0076] Figure 3(a) to Figure 3(b) A schematic diagram showing a method for determining a non-edge sub-image in a picture segmentation method provided in an embodiment of the present disclosure is shown;

[0077] Figure 4 A schematic diagram of a picture segmentation device provided by an embodiment of the present disclosure is shown;

[0078] Figure 5 A schematic diagram of an electronic device provided by an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0079] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

[0080] In the description of the embodiments of the present disclosure, it should be understood that terms such as "including" or "having" are intended to indicate the presence of features, numbers, steps, behaviors, components, parts, or a combination thereof disclosed in this specification, and are not intended to exclude the possibility of the presence of one or more other features, numbers, steps, behaviors, components, parts, or a combination thereof.

[0081] Unless otherwise specified, “ / ” means or. For example, A / B can mean A or B. The “and / or” in this article is merely a way to describe the association relationship between associated objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.

[0082] The terms "first", "second", etc. are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first", "second", etc. may explicitly or implicitly include one or more of such features. In the description of the embodiments of the present disclosure, unless otherwise specified, "plurality" means two or more.

[0083] Through research, it is found that in related technologies, the segmentation of the original image is often performed by traversing and searching the preset target image from small to large. Figure 1(a) to Figure 1(b) As shown in the schematic diagram of affine transformation, the inscribed rectangular box in FIG1(a) is the original image, and the circumscribed rectangular box of the original image includes four Slice rectangular sub-boxes; the inscribed rectangular box in FIG1(b) is the target image, and the circumscribed rectangular box of the target image includes four Slice rectangular sub-boxes.

[0084] Since the data of the original image and the target image are stored continuously in DDR, whether reading the original image or writing the target image generally only supports splitting of rectangles in the image.

[0085] In Figure 1(a), the area outside the original image is the area where data cannot be obtained and needs to be eliminated when reading. The part outside the target image in Figure 1(b) is the data that needs to be filled according to specific requirements, cannot be eliminated, and needs to be written in sequence according to memory order.

[0086] The part inside each Slice rectangular sub-frame in Figure 1(a) is the position of the corresponding target image Slice rectangular sub-frame on the original image. The rectangular sub-frame outside each Slice rectangular sub-frame is the circumscribed rectangle (rectangle) calculated according to the Slice rectangular sub-frame. Combining the circumscribed rectangle calculated for the Slice rectangular sub-frame and the part where the original image is located, the size of the original image Slice that actually needs to be read after removing the invalid area (corresponding to the valid Slice area) can be determined.

[0087] Based on this, the search for splitting the original image is to find the largest valid area among all slices, so that the data volume of the valid area is closest to the total size of the designed SRAM, so that the size of the SRAM can be fully utilized and the number of slices can be minimized. Among them, the height and width of the effective area of ​​the slice are the results of the original image split search, and the height and width of the rectangular sub-frame of the slice in the target image are the results of the target image split search.

[0088] The conventional search strategy is: first set the height (dest_h) and width (dest_w) of the target graph Slice to 1, calculate the total number of split Slices as ceil(H' / dest_h)*ceil(W' / dest_w) according to the total size H' and W' of the target graph, and for each Slice of the target graph, obtain the coordinates of the four vertices in the Slice rectangular sub-box, and use the affine transformation formula to calculate the four vertices of the corresponding Slice rectangular sub-box on the original image.

[0089] Based on the four vertices of the determined Slice rectangular subframe, the position and size of the circumscribed rectangular subframe can be determined. Since the rectangular subframe may include an invalid area, it is necessary to take the rectangular part that intersects with the original image, that is, the valid area of ​​the Slice, as the Slice of the original image, and then calculate whether the size of this Slice exceeds the SRAM size. When all Slices complete the above calculations and meet the SRAM size, it means that the height (dest_h) and width (dest_w) settings of the target image Slice of this round are valid. Then add 1 to dest_h or dest_w, and repeat the above round of calculations until the largest Slice in the original image is found to be close to the total SRAM size. At this time, dest_h and dest_w are the final split search results.

[0090] It is known that the existing technology adopts an exhaustive method of searching from small to large. It requires multiple rounds of calculations to obtain the final split search size, and all slices need to be calculated in each round. The amount of calculation required is large and the speed is very slow, making it difficult to meet real-time requirements.

[0091] In order to at least partially solve one or more of the above problems and other potential problems, the present disclosure provides a solution that combines coarse search and fine search to achieve faster image segmentation, significantly reduces the amount of data calculation, and meets the real-time requirements of the hardware accelerator.

[0092] To facilitate understanding of the present embodiment, a picture segmentation method disclosed in the embodiment of the present disclosure is first introduced in detail. The execution subject of the picture segmentation method provided in the embodiment of the present disclosure is generally an electronic device with certain computing capabilities, and the electronic device includes, for example: a terminal device or a server or other processing device, and the terminal device may be a user equipment (User Equipment, UE), a mobile device, a user terminal, a personal digital assistant (Personal Digital Assistant, PDA), a computing device, etc. In some possible implementations, the picture segmentation method can be implemented by a processor calling a computer-readable instruction stored in a memory.

[0093] See also Figure 2 FIG. 2 is a flowchart of a method for image segmentation provided by an embodiment of the present disclosure, wherein the method includes steps S201 to S203, wherein:

[0094] S201: Obtaining an initial sub-image size of the original image based on the size of the storage unit;

[0095] S202: Based on the size of the initial sub-image of the original image, the preset ratio, and the size of the preset target image, a plurality of preset target sub-images are obtained, wherein the preset ratio is the ratio of the size of the preset target image to the size of the original image, and the preset target image is the image required by the user;

[0096] S203: Based on the preset target image and the preset target sub-image, perform affine transformation to determine the final segmentation method of the original image.

[0097] In order to facilitate understanding of the image segmentation method provided by the embodiment of the present disclosure, the application scenario of the method is briefly introduced first. The image segmentation method here can be mainly applied to related scenarios with affine transformation processing such as translation, rotation, and scaling of images, such as image recognition, image classification, etc., and no specific restrictions are made here. The following is mostly illustrated by examples of affine transformation processing itself.

[0098] Taking into account that in the related art, it is necessary to perform a traversal search on the preset target image from small to large to perform the segmentation of the original image, so that all Slices need to be calculated in each round, and the amount of calculation is very large, the embodiment of the present disclosure provides a picture segmentation solution that performs a coarse search based on the initial sub-image size of the original image and performs a fine search based on the coarse search, which significantly reduces the amount of data calculation and has a higher segmentation efficiency, thereby significantly improving the speed of related affine transformation processing.

[0099] Here, the size of the initial sub-image of the original image is first determined based on the size of the storage unit. The storage unit here can be, for example, SRAM, or other storage units adapted to DDR, and the embodiments of the present disclosure do not impose specific restrictions on this. The following examples are mostly described using SRAM as the storage unit.

[0100] A rough search can be performed by combining the size of the initial sub-image of the original image, the preset ratio, and the size of the preset target image to determine multiple preset target sub-images obtained by the rough search. The preset ratio refers to the ratio of the size of the preset target image to the size of the original image. The preset target image is the image required by the user, such as a target image that is enlarged 2 times relative to the original image.

[0101] The larger the preset ratio is, the larger the image formed by the user's affine transformation will be. At this time, the amount of original image information that needs to be occupied may also be more. Conversely, the smaller the preset ratio is, the smaller the image formed by the user's affine transformation will be. At this time, the amount of original image information that needs to be occupied may also be less. Based on this, a rough search can be performed based on the original image initial sub-image size as a reference.

[0102] The preset ratio set here can be not only the ratio of the size of the preset target image to the size of the original image, but also the height ratio between the height of the preset target image and the height of the original image, that is, the height ratio scale_h = H' / H, or the width ratio between the width of the preset target image and the width of the original image, that is, the width ratio scale_w = W' / W.

[0103] The embodiment of the present disclosure implements a coarse search based on the size of a storage unit. For ease of description, a 256*256 SRAM may be used as a storage unit for specific description.

[0104] First, assume that the height and width of the original image are half of the square root value M of the SRAM, and set the initial height and width to src_h_ini = 128 and src_w_ini = 128. Here, the height dest_h and width dest_w of the target image slice are obtained by multiplying them with the preset ratios scale_h and scale_w of the rough search.

[0105] The total number of slices (ie, preset target subgraphs) of the target graph is calculated according to the total sizes H' and W' of the target graph, which is Num_H*Num_W, wherein Num_H=ceil(H' / dest_h), and Num_W=ceil(W' / dest_w).

[0106] Then, a further search can be performed in combination with the preset target image and the determined target image segmentation situation, so as to determine the final segmentation method suitable for the original image.

[0107] In the actual process of image segmentation, it is necessary to refer to the position information of the preset target sub-image in the entire preset target image, and the actual number of segmentation blocks of corresponding height and / or width for specific implementation. This is mainly due to the fact that when the number of split blocks (corresponding to the number of preset target sub-images) is greater than or equal to 3*3, that is, Num_H>=3 and Num_W>=3, the circumscribed square sub-frame of a Slice in the middle of the original image coincides with the valid area of ​​the original image Slice, does not contain invalid values, and is the largest valid area of ​​all Slices. Therefore, it is only necessary to calculate the size of the circumscribed square sub-frame of this Slice to terminate the calculation; however, whether it is height segmentation or width segmentation, the number of blocks is less than 3, that is, when either Num_H or Num_W is less than 3, at this time, it is impossible to directly determine the largest valid area of ​​all Slices, and further judgment is required.

[0108] Considering the influence of the position information of the preset target sub-graph in the entire preset target graph on the final segmentation result, the final segmentation method will be determined in combination with the judgment result of whether the preset target sub-graph is a non-edge sub-graph, including the following steps:

[0109] Step 1: determine whether the preset target sub-graph is a non-edge sub-graph, and the non-edge sub-graph is at a non-edge position of the preset target graph;

[0110] Step 2: If there is at least one non-edge sub-graph, determine the final segmentation method of the original image based on the non-edge sub-graph;

[0111] Step 3: If there is no non-edge sub-image, the final segmentation method of the original image is determined based on all preset target sub-images.

[0112] The non-edge subgraph in the embodiment of the present disclosure is located at a non-edge position of the preset target graph. Here, if the number of splits is large enough, there will certainly be a non-edge subgraph at a non-edge position, and compared with the edge subgraph, the non-edge subgraph here occupies the largest storage space.

[0113] like Figure 3(a) to 3(b) The schematic diagram of affine transformation is shown in FIG3(a), wherein the rectangular box in FIG3(a) is the original image, and there is an external rectangular box outside the original image, and the rectangular box in FIG3(b) is the target image, and there is a rectangular box outside the target image. Referring to the relevant description of affine transformation in 1(a) to 1(b), the corresponding area of ​​the middle rectangular area in FIG3(a) in FIG3(b) is the above-mentioned non-edge sub-image.

[0114] When implementing temporary storage of data based on storage units, non-edge subgraphs need to be taken into consideration; conversely, if the number of splits is not large or even there are no non-edge subgraphs, then each preset target subgraph needs to be analyzed to determine the final segmentation method.

[0115] Here, if the number of splits of the length and width of the preset target graph is greater than or equal to 3, it is determined that there is at least one non-edge subgraph; if the number of splits of the length and / or width of the preset target graph is less than 3, it is determined that there is no non-edge subgraph.

[0116] Next, the segmentation process for the two cases of having non-edge subgraphs and having no non-edge subgraphs will be described in detail through the following two aspects.

[0117] In the first aspect, when there is at least one non-edge sub-image, the final segmentation method of the original image is determined according to the following steps:

[0118] Step 1: Based on the non-edge sub-image, perform affine transformation to obtain the first sub-image corresponding to the original image;

[0119] Step 2: Compare the size of the first sub-image with the size of the storage unit to determine the final segmentation method of the original image.

[0120] The affine transformation here can be expressed as multiplying the transformation item to be performed (that is, the non-edge subgraph here) by a matrix (linear transformation) and then adding a vector (translation) calculation, so the affine transformation can be used to implement operations such as rotation, translation, and scaling. A 2*3 matrix is ​​usually used to represent the affine transformation:

[0121]

[0122] Among them, the affine transformation of the image is actually a linear transformation from two-dimensional coordinates to two-dimensional coordinates, which can be expressed as:

[0123]

[0124] The corresponding first sub-image can be determined from the original image through affine transformation, and then the size of the first sub-image is compared with the size of the storage unit to determine the final segmentation method of the original image, which specifically includes the following steps:

[0125] Step 1: Setting a preset step size based on the size of the storage unit;

[0126] Step 2: If the size of the first sub-image is smaller than the size of the storage unit, the size of the first sub-image is used as the target size, and the following steps are repeatedly performed until the target size is larger than the size of the storage unit: the target size is increased by a preset step size and is used again as the target size;

[0127] Step 3: If the size of the first sub-image is larger than the size of the storage unit, the size of the first sub-image is used as the target size, and the following steps are executed repeatedly until the target size is smaller than the size of the storage unit: the target size is reduced by a preset step size and then used again as the target size.

[0128] It can be known that when it is determined that the size of the first sub-image is smaller than the storage unit, the search for the largest Slice effective area can be achieved by increasing the preset step size to determine that the storage space utilization of the storage unit reaches the optimal target size; similarly, when it is determined that the size of the first sub-image is larger than the storage unit, the search for the largest Slice effective area can be achieved by reducing the preset step size to determine that the storage space utilization of the storage unit reaches the optimal target size.

[0129] The preset step size in the disclosed embodiment can be obtained by converting the size of the storage unit from a two-dimensional size to a one-dimensional size, and specifically can be the square root value after expanding the length and width of the storage unit, that is, the step size here can be based on the square root value M of the size of the storage unit, for example, set to [M / 4, M / 8,...], or other settings, which are not specifically limited here. Here, a 256*256 size SRAM is still used as a storage unit for example, and the search step size that can be set is step_list=[64,32,16,8,4,2], so it can be known that the coarse search is fixed to 7 rounds.

[0130] For each round of search, when all the original image slices (corresponding to the first sub-image) complete the above calculation, if the size of all slices meets the SRAM size, the search result flag of this round is set to True. When the search result flag is True, the initial search size src_h_ini and src_w_ini of the original image are added with the first value 64 of the step_list, modified to 192*192, and enter the next round of search.

[0131] Repeat the above process until the step length step_list takes the value of 2, completing 7 rounds of searching.

[0132] In the actual search process, the length and width of the target size can be alternately increased by a preset step size, and each time the length or width of the target size is increased, it is used as the target size again. For example, the target size can be increased in sequence according to the step size step_list = [64, 32, 16, 8, 4, 2] in the above example, first increase by 64, and if the search result flag is still True, increase by 32, and so on to perform the search.

[0133] In the embodiment of the present disclosure, after determining the first sub-image adjusted by the above-mentioned rough search process, a fine search may be further performed until no larger original image slice can be found, which may be specifically achieved by the following steps:

[0134] Step 1: Use the first sub-image after final adjustment as the third sub-image;

[0135] Step 2: The size of the third sub-image is used as the target size, and the following steps are performed repeatedly until the target size matches the size of the storage unit:

[0136] The length and width of the target size are alternately reduced by a fixed step size and then used as the target size again.

[0137] Based on the search result flag of the last rough search, dest_h or dest_w of the target graph Slice is subtracted by a fixed step size (such as 1), and then the next round of search is performed. Each round of search is the same as the rough search process.

[0138] Among them, dest_h or dest_w is decremented by 1 in an alternating order, that is, in the first round, only dest_w is decremented by 1, in the second round, dest_h is decremented by 1, and in the third round, dest_w is decremented by 1, and so on, until no larger slice can be found, that is, the size of the third subgraph adjusted by the final search reaches the best adaptation state with the size of the storage unit.

[0139] For each round of search, when all the original image slices (corresponding to the first sub-image) complete the above calculation, as long as one slice exceeds the size of SRAM, the search result flag of this round is set to False. When the search result flag is False, the initial search size src_h_ini and src_w_ini of the original image are both subtracted from the first value 64 of the step_list, modified to 64*64, and enter the next round of search.

[0140] Repeat the above process until the step length step_list takes the value of 2, completing 7 rounds of searching.

[0141] In the actual search process, the length and width of the target size can be alternately reduced by a preset step size, and each time the length or width of the target size is reduced, it is used as the target size again. For example, the target size can be reduced in sequence according to the step size step_list=[64,32,16,8,4,2] in the above example, first by reducing it by 64, and if the search result flag is still False, it can be reduced by 32, and so on to perform the search.

[0142] In the embodiment of the present disclosure, after determining the first sub-image adjusted by the above-mentioned rough search process, a fine search may be further performed until no larger original image slice can be found, which may be specifically achieved by the following steps:

[0143] Step 1: Use the first sub-image after final adjustment as the third sub-image;

[0144] Step 2: The size of the third sub-image is used as the target size, and the following steps are performed repeatedly until the target size matches the size of the storage unit:

[0145] The length and width of the target size are alternately increased by a fixed step size and then used as the target size again.

[0146] Based on the search result flag of the last rough search, add a fixed step size (such as 1) to the dest_h or dest_w of the target graph Slice, and then perform the next round of search. Each round of search is the same as the rough search process.

[0147] Among them, the addition of 1 to dest_h or dest_w is performed in an alternating order, that is, in the first round, only dest_w is added by 1, in the second round, dest_h is added by 1, and in the third round, dest_w is added by 1, and so on, until no larger slice can be found, that is, the size of the third subgraph adjusted by the final search is optimally matched to the size of the storage unit. Here, according to the final step size set by the coarse search, it can be concluded that the fine search requires at most 4 rounds.

[0148] Secondly, in the absence of non-edge sub-graphs, the final segmentation method of the original image is determined according to the following steps:

[0149] Step 1: Based on each preset target sub-image, perform affine transformation to obtain a second sub-image corresponding to the original image;

[0150] Step 2: Compare the size of the second sub-image with the size of the storage unit to determine the final segmentation method of the original image.

[0151] The affine transformation process for the preset target sub-image can refer to the aforementioned affine transformation process for the non-edge sub-image, which will not be described in detail here.

[0152] Similarly, here, the final segmentation method is determined by comparing the size of the second sub-image obtained by affine transformation of the preset target sub-image with the size of the storage unit, which specifically includes the following steps:

[0153] Step 1: Setting a preset step size based on the size of the storage unit;

[0154] Step 2: If the size of the second sub-image is smaller than the size of the storage unit, the size of the second sub-image is used as the target size, and the following steps are repeatedly performed until the target size is larger than the size of the storage unit: the target size is increased by a preset step size and is used again as the target size;

[0155] Step 3: If the size of the second sub-image is larger than the size of the storage unit, the size of the second sub-image is used as the target size, and the following steps are executed repeatedly until the target size is smaller than the size of the storage unit: the target size is reduced by a preset step size and then used again as the target size.

[0156] It can be known that when it is determined that the size of the second sub-image is smaller than the storage unit, the search for the largest Slice effective area can be achieved by increasing the preset step size to determine that the storage space utilization of the storage unit reaches the optimal target size; similarly, when it is determined that the size of the second sub-image is larger than the storage unit, the search for the largest Slice effective area can be achieved by reducing the preset step size to determine that the storage space utilization of the storage unit reaches the optimal target size.

[0157] Similarly, the step size here can also be based on the square root value M of the size of the storage unit, for example, set to [M / 4, M / 8,...], or other settings, which are not specifically limited here.

[0158] In the actual search process, the length and width of the target size can be alternately increased by a preset step size, and each time the length or width of the target size is increased, it is used as the target size again. For example, the target size can be increased in sequence according to the step size step_list=[64,32,16,8,4,2] in the above example, first increase by 64, and if the search result flag is still True, increase by 32, and so on to perform the search. The specific search process is described above and will not be repeated here.

[0159] Similarly, after determining the second sub-graph adjusted by the above rough search process, further fine search can be performed until no larger original graph slice can be found, which can be achieved by the following steps:

[0160] Step 1: Use the final adjusted second sub-image as the fourth sub-image;

[0161] Step 2: The size of the fourth sub-image is used as the target size, and the following steps are performed repeatedly until the target size matches the size of the storage unit:

[0162] The length and width of the target size are alternately reduced by a fixed step size and then used as the target size again.

[0163] Based on the search result flag of the last rough search, dest_h or dest_w of the target graph Slice is subtracted by a fixed step size (such as 1), and then the next round of search is performed. Each round of search is the same as the rough search process.

[0164] Among them, dest_h or dest_w is decremented by 1 in an alternating order, that is, in the first round, only dest_w is decremented by 1, in the second round, dest_h is decremented by 1, and in the third round, dest_w is decremented by 1, and so on, until no larger slice can be found, that is, the size of the fourth subgraph adjusted by the final search reaches the best adaptation state with the size of the storage unit.

[0165] In the actual search process, the length and width of the target size can be alternately reduced by a preset step size, and each time the length or width of the target size is reduced, it is used as the target size again. For example, the target size can be reduced in sequence according to the step size step_list=[64,32,16,8,4,2] in the above example, first by reducing it by 64, and if the search result is still marked as False, it can be reduced by 32, and so on to perform the search. The specific search process can be found in the above description, which will not be repeated here.

[0166] Similarly, after determining the second sub-graph adjusted by the above rough search process, further fine search can be performed until no larger original graph slice can be found, which can be achieved by the following steps:

[0167] Step 1: Use the final adjusted second sub-image as the fourth sub-image;

[0168] Step 2: The size of the fourth sub-image is used as the target size, and the following steps are performed repeatedly until the target size matches the size of the storage unit:

[0169] The length and width of the target size are alternately increased by a fixed step size and then used as the target size again.

[0170] Based on the search result flag of the last rough search, add a fixed step size (such as 1) to the dest_h or dest_w of the target graph Slice, and then perform the next round of search. Each round of search is the same as the rough search process.

[0171] Among them, the addition of 1 to dest_h or dest_w is performed in an alternating order, that is, in the first round, only dest_w is added by 1, in the second round, dest_h is added by 1, and in the third round, dest_w is added by 1, and so on, until no larger slice can be found, that is, the size of the fourth subgraph adjusted by the final search reaches the best adaptation state with the size of the storage unit.

[0172] It can be seen that the image segmentation method provided by the embodiment of the present disclosure can determine the step size of the coarse search according to the set total SRAM size to quickly find the possible value of the largest Slice, and then complete the determination of the specific Slice size through a fine search. It can also be determined whether the search needs to traverse each Slice based on the total number of Slices to further reduce the computational complexity of the search, thereby completing the entire search task.

[0173] When the size of SRAM is 256*256=65536, the conventional solution may require 65536 rounds of search to complete the search task, while the embodiment of the present disclosure only needs 11 rounds of search at most to complete it, which greatly improves the search efficiency. Moreover, the larger the SRAM, the greater the search performance improvement, which can well meet the real-time requirements.

[0174] In the description of this specification, the description with reference to the terms "some possible embodiments", "some embodiments", "examples", "specific examples", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present disclosure. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, unless they are contradictory.

[0175] About the method flow chart of the embodiment of the present disclosure, some operations are described as different steps performed in a certain order. Such flow chart is illustrative and not restrictive. Some steps described in this article can be grouped together and performed in a single operation, some steps can be divided into multiple sub-steps, and some steps can be performed in an order different from that shown in this article. The various steps shown in the flow chart can be implemented in any way by any circuit structure and / or tangible mechanism (for example, by software running on a computer device, hardware (for example, a logical function implemented by a processor or chip), etc., and / or any combination thereof).

[0176] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.

[0177] Based on the same inventive concept, an image segmentation device corresponding to the image segmentation method is also provided in the embodiment of the present disclosure. Since the principle of solving the problem by the device in the embodiment of the present disclosure is similar to the above-mentioned image segmentation method in the embodiment of the present disclosure, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.

[0178] Reference Figure 4 FIG. 4 is a schematic diagram of a picture segmentation device provided by an embodiment of the present disclosure, the device includes: an acquisition module 401, a first calculation module 402, and a second calculation module 403; wherein,

[0179] An acquisition module 401 is used to obtain an initial sub-image size of the original image based on the size of the storage unit;

[0180] A first calculation module 402 is used to obtain a plurality of preset target sub-images based on the size of the original image initial sub-image, the preset ratio, and the size of the preset target image, wherein the preset ratio is the ratio of the size of the preset target image to the size of the original image, and the preset target image is the image required by the user;

[0181] The second calculation module 403 is used to perform affine transformation based on the preset target image and the preset target sub-image to determine the final segmentation method of the original image.

[0182] By using the above-mentioned image segmentation device, when the size of the storage unit is obtained, the size of the initial sub-image of the original image can be determined based on the size, and multiple preset target sub-images can be obtained based on the size of the initial sub-image of the original image, the preset ratio, and the size of the preset target image. Specifically, this can be achieved by combining the preset ratio between the size of the preset target image and the size of the original image. The preset ratio can limit the search process to a more ideal search range to a certain extent, and then further perform a fine search on the basis of the coarse search. The final segmentation method executed in this way avoids the problem of huge computational complexity brought about by all existing traversal methods. The combination of coarse search and fine search allows the entire search process to reach a convergence state more quickly, and the computational complexity is significantly reduced, thereby meeting the real-time requirements of the hardware accelerator well.

[0183] In a possible implementation, the second calculation module 403 is specifically configured to perform affine transformation according to the following steps to determine the final segmentation mode of the original image:

[0184] Determine whether the preset target subgraph is a non-edge subgraph, and the non-edge subgraph is at a non-edge position of the preset target graph;

[0185] If there is at least one non-edge sub-graph, the final segmentation method of the original image is determined based on the non-edge sub-graph;

[0186] If there is no non-edge sub-graph, the final segmentation method of the original image is determined based on all preset target sub-graphs.

[0187] In a possible implementation, the second calculation module 403 is specifically configured to determine whether the preset target subgraph is a non-edge subgraph according to the following steps;

[0188] If the number of splits of the length and width of the preset target graph is greater than or equal to 3, it has at least one non-edge subgraph;

[0189] If the number of splits of the length and / or width of the preset target graph is less than 3, there is no non-edge subgraph.

[0190] In a possible implementation manner, if there is at least one non-edge sub-image, the second calculation module 403 is specifically configured to determine the final segmentation mode of the original image based on the non-edge sub-image according to the following steps:

[0191] Based on the non-edge sub-image, perform affine transformation to obtain the first sub-image corresponding to the original image;

[0192] The size of the first sub-image is compared with the size of the storage unit to determine the final segmentation method of the original image.

[0193] In a possible implementation manner, the second calculation module 403 is specifically configured to compare the size of the first sub-image with the size of the storage unit according to the following steps to determine the final segmentation method of the original image:

[0194] Setting a preset step size based on the size of the storage unit;

[0195] If the size of the first sub-image is smaller than the size of the storage unit, the size of the first sub-image is used as the target size, and the following steps are performed repeatedly until the target size is larger than the size of the storage unit:

[0196] After increasing the target size by a preset step size, it is used as the target size again.

[0197] In a possible implementation manner, the second calculation module 403 is specifically configured to increase the target size by a preset step size according to the following steps and use the target size again:

[0198] After the length and width of the target size are alternately increased by a preset step size, each time the length or width of the target size is increased, it is used as a new target size.

[0199] In a possible implementation manner, the second calculation module 403 is further configured to:

[0200] After increasing the target size by a preset step size and resetting it to the target size, the first sub-image after the final adjustment is used as the third sub-image;

[0201] The size of the third sub-image is used as the target size, and the following steps are repeated until the target size matches the size of the storage unit:

[0202] The length and width of the target size are alternately reduced by a fixed step size and then used as the target size again.

[0203] In a possible implementation manner, the second calculation module 403 is specifically configured to compare the size of the first sub-image with the size of the storage unit according to the following steps to determine the final segmentation method of the original image:

[0204] If the size of the first sub-image is larger than the size of the storage unit, the size of the first sub-image is used as the target size, and the following steps are performed repeatedly until the target size is smaller than the size of the storage unit:

[0205] After reducing the target size by a preset step size, it is used as the target size again.

[0206] In a possible implementation manner, the second calculation module 403 is specifically configured to reduce the target size by a preset step size according to the following steps and use it as the target size again:

[0207] After the length and width of the target size are alternately reduced by a preset step size, each time the length or width of the target size is reduced, it is used as a new target size.

[0208] In a possible implementation manner, the second calculation module 403 is further configured to:

[0209] After reducing the target size by a preset step size and resetting it to the target size, the finally adjusted first sub-image is used as the third sub-image;

[0210] The size of the third sub-image is used as the target size, and the following steps are repeated until the target size matches the size of the storage unit:

[0211] The length and width of the target size are alternately increased by a fixed step size and then used as the target size again.

[0212] In a possible implementation manner, if there is no non-edge sub-image, the second calculation module 403 is specifically configured to determine the final segmentation method of the original image based on all preset target sub-images according to the following steps:

[0213] Based on each preset target sub-image, perform affine transformation to obtain a second sub-image corresponding to the original image;

[0214] The size of the second sub-image is compared with the size of the storage unit to determine the final segmentation method of the original image.

[0215] In a possible implementation manner, the second calculation module 403 is specifically configured to compare the size of the second sub-image with the size of the storage unit according to the following steps to determine the final segmentation method of the original image:

[0216] Setting a preset step size based on the size of the storage unit;

[0217] If the size of the second sub-image is smaller than the size of the storage unit, the size of the second sub-image is used as the target size, and the following steps are performed repeatedly until the target size is larger than the size of the storage unit:

[0218] After increasing the target size by a preset step size, it is used as the target size again.

[0219] In a possible implementation manner, the second calculation module 403 is specifically configured to increase the target size by a preset step size according to the following steps and use the target size again:

[0220] After the length and width of the target size are alternately increased by a preset step size, each time the length or width of the target size is increased, it is used as a new target size.

[0221] In a possible implementation manner, the second calculation module 403 is further configured to:

[0222] After increasing the target size by a preset step size and resetting it as the target size, the second sub-image after the final adjustment is used as the fourth sub-image;

[0223] The size of the fourth sub-image is used as the target size, and the following steps are repeated until the target size matches the size of the storage unit:

[0224] The length and width of the target size are alternately reduced by a fixed step size and then used as the target size again.

[0225] In a possible implementation manner, the second calculation module 403 is specifically configured to compare the size of the second sub-image with the size of the storage unit according to the following steps to determine the final segmentation method of the original image:

[0226] If the size of the second sub-image is larger than the size of the storage unit, the size of the second sub-image is used as the target size, and the following steps are performed repeatedly until the target size is smaller than the size of the storage unit:

[0227] After reducing the target size by a preset step size, it is used as the target size again.

[0228] In a possible implementation manner, the second calculation module 403 is specifically configured to reduce the target size by a preset step size according to the following steps and use it as the target size again:

[0229] After the length and width of the target size are alternately reduced by a preset step size, each time the length or width of the target size is reduced, it is used as a new target size.

[0230] In a possible implementation manner, the second calculation module 403 is further configured to:

[0231] After reducing the target size by a preset step size and resetting it to the target size, the second sub-image after the final adjustment is used as the fourth sub-image;

[0232] The size of the fourth sub-image is used as the target size, and the following steps are repeated until the target size matches the size of the storage unit:

[0233] The length and width of the target size are alternately increased by a fixed step size and then used as the target size again.

[0234] In a possible implementation, the second calculation module 403 is specifically configured to set the preset step size based on the size of the storage unit according to the following steps:

[0235] The size of the storage unit is converted from a two-dimensional size to a one-dimensional size to obtain a preset step size.

[0236] In a possible implementation, the fixed step size is 1.

[0237] It should be noted that the device in the embodiment of the present disclosure can implement each process of the embodiment of the aforementioned method and achieve the same effects and functions, which will not be repeated here.

[0238] The present disclosure also provides an electronic device, such as Figure 5 , which is a schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure, includes: a processor 501, a memory 502, and a bus 503. The memory 502 stores machine-readable instructions executable by the processor 501 (for example, Figure 4 The device acquires the execution instructions corresponding to the module 401, the first calculation module 402, and the second calculation module 403, etc.), when the electronic device is running, the processor 501 communicates with the memory 502 through the bus 503, and the machine-readable instructions are executed by the processor 501 to perform the following processing:

[0239] Obtain the initial sub-image size of the original image based on the size of the storage unit;

[0240] Based on the size of the initial sub-image of the original image, the preset ratio, and the size of the preset target image, a plurality of preset target sub-images are obtained, wherein the preset ratio is the ratio of the size of the preset target image to the size of the original image, and the preset target image is the image required by the user;

[0241] Based on the preset target image and the preset target sub-image, an affine transformation is performed to determine the final segmentation method of the original image.

[0242] The present disclosure also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the image segmentation method described in the above method embodiment are executed. The storage medium may be a volatile or non-volatile computer-readable storage medium.

[0243] The embodiments of the present disclosure also provide a computer program product, which carries a program code. The instructions included in the program code can be used to execute the steps of the image segmentation method described in the above method embodiment. For details, please refer to the above method embodiment, which will not be repeated here.

[0244] The computer program product may be implemented in hardware, software or a combination thereof. In one optional embodiment, the computer program product is implemented as a computer storage medium. In another optional embodiment, the computer program product is implemented as a software product, such as a software development kit (SDK).

[0245] Each embodiment in the present disclosure is described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device, equipment, and computer-readable storage medium embodiments, since they are basically similar to the method embodiments, their descriptions are simplified, and the relevant parts can be referred to the partial description of the method embodiments.

[0246] The apparatus, device and computer-readable storage medium provided in the embodiments of the present disclosure correspond one-to-one to the method. Therefore, the apparatus, device and computer-readable storage medium also have similar beneficial technical effects as the corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the apparatus, device and computer-readable storage medium will not be repeated here.

[0247] It will be appreciated by those skilled in the art that the embodiments of the present disclosure may be provided as methods, devices (equipment or system), or computer-readable storage media. Therefore, the present disclosure may be in the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present disclosure may be in the form of a computer-readable storage medium implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0248] The present disclosure is described with reference to the flowchart and / or block diagram of the method, device (equipment or system) and computer-readable storage medium according to the embodiment of the present disclosure. It should be understood that each process and / or box in the flowchart and / or block diagram, and the combination of the process and / or box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for implementing the function specified in one process or multiple processes in the flowchart and / or one box or multiple boxes in the block diagram.

[0249] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0250] These computer program instructions may also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.

[0251] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0252] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.

[0253] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. In addition, although the operations of the disclosed method are described in a particular order in the accompanying drawings, this does not require or imply that these operations must be performed in this particular order, or that all the operations shown must be performed to achieve the desired results. Additionally or alternatively, some steps can be omitted, multiple steps can be combined into one step, and / or one step can be decomposed into multiple steps.

[0254] Although the spirit and principle of the present disclosure have been described with reference to several specific embodiments, it should be understood that the present disclosure is not limited to the disclosed specific embodiments, and the division of various aspects does not mean that the features in these aspects cannot be combined to benefit, and such division is only for the convenience of expression. The present disclosure is intended to cover various modifications and equivalent arrangements included in the spirit and scope of the attached claims.

Claims

1. A method for image segmentation, characterized in that: include: Obtain the initial sub-image size of the original image based on the size of the storage unit; Based on the size of the initial sub-image of the original image, the preset ratio, and the size of the preset target image, a plurality of preset target sub-images are obtained, wherein the preset ratio is the ratio of the size of the preset target image to the size of the original image, and the preset target image is the image required by the user; Based on the preset target image and the preset target sub-image, an affine transformation is performed to determine a final segmentation method of the original image.

2. The method according to claim 1, characterized in that The performing of affine transformation based on the preset target image and the preset target sub-image to determine the final segmentation method of the original image includes: Determine whether the preset target subgraph is a non-edge subgraph, and the non-edge subgraph is at a non-edge position of the preset target graph; If there is at least one non-edge sub-image, determining a final segmentation method of the original image based on the non-edge sub-image; If there is no non-edge sub-image, the final segmentation method of the original image is determined based on all the preset target sub-images.

3. The method according to claim 2, characterized in that The determining whether the preset target subgraph is a non-edge subgraph comprises: If the number of splits of the length and width of the preset target graph is greater than or equal to 3, then there is at least one non-edge subgraph; If the number of splits of the length and / or width of the preset target graph is less than 3, there is no non-edge subgraph.

4. The method according to claim 2, characterized in that: If there is at least one non-edge sub-graph, determining the final segmentation method of the original image based on the non-edge sub-graph includes: Based on the non-edge sub-image, perform an affine transformation to obtain a first sub-image corresponding to the original image; The size of the first sub-image is compared with the size of the storage unit to determine a final segmentation method of the original image.

5. The method according to claim 4, characterized in that The comparing the size of the first sub-image with the size of the storage unit to determine the final segmentation method of the original image includes: Setting a preset step size based on the size of the storage unit; If the size of the first sub-image is smaller than the size of the storage unit, the size of the first sub-image is used as the target size, and the following steps are repeatedly performed until the target size is larger than the size of the storage unit: After the target size is increased by the preset step size, it is used as the target size again.

6. The method according to claim 5, characterized in that The step of increasing the target size by one of the preset steps and resetting the target size to the target size comprises: After the length and width of the target size are alternately increased by one of the preset step lengths, each time the length or width of the target size is increased, it is used as the target size again.

7. The method according to claim 6, characterized in that After increasing the target size by the preset step size and resetting it as the target size, the method further includes: Using the first sub-image after final adjustment as the third sub-image; The size of the third sub-image is used as the target size, and the following steps are performed repeatedly until the target size matches the size of the storage unit: The length and width of the target size are alternately reduced by a fixed step size and then used as the target size again.

8. The method according to claim 5, characterized in that The comparing the size of the first sub-image with the size of the storage unit to determine a final segmentation method of the original image further includes: If the size of the first sub-image is larger than the size of the storage unit, the size of the first sub-image is used as the target size, and the following steps are repeatedly performed until the target size is smaller than the size of the storage unit: After reducing the target size by the preset step size, the target size is used again as the target size.

9. The method according to claim 8, characterized in that The reducing the target size by the preset step size and re-using it as the target size comprises: After the length and width of the target size are alternately reduced by one of the preset steps, each time the length or width of the target size is reduced, it is used as the target size again.

10. The method according to claim 9, characterized in that After reducing the target size by the preset step size and resetting it as the target size, the method further includes: Using the first sub-image after final adjustment as the third sub-image; The size of the third sub-image is used as the target size, and the following steps are performed repeatedly until the target size matches the size of the storage unit: The length and width of the target size are alternately increased by a fixed step size and then used as the target size again.

11. The method according to claim 2, characterized in that If there is no non-edge sub-image, determining a final segmentation method of the original image based on all the preset target sub-images includes: Based on each of the preset target sub-images, an affine transformation is performed to obtain a second sub-image corresponding to the original image respectively; The size of the second sub-image is compared with the size of the storage unit to determine a final segmentation method of the original image.

12. The method according to claim 11, characterized in that The comparing the size of the second sub-image with the size of the storage unit to determine a final segmentation method of the original image includes: Setting a preset step size based on the size of the storage unit; If the size of the second sub-image is smaller than the size of the storage unit, the size of the second sub-image is used as the target size, and the following steps are repeatedly performed until the target size is larger than the size of the storage unit: After the target size is increased by the preset step size, it is used as the target size again.

13. The method according to claim 12, characterized in that The step of increasing the target size by one of the preset steps and resetting the target size to the target size comprises: After the length and width of the target size are alternately increased by one of the preset step lengths, each time the length or width of the target size is increased, it is used as the target size again.

14. The method according to claim 13, characterized in that After increasing the target size by the preset step size and resetting it as the target size, the method further includes: Using the second sub-image after final adjustment as the fourth sub-image; The size of the fourth sub-image is used as the target size, and the following steps are performed repeatedly until the target size matches the size of the storage unit: The length and width of the target size are alternately reduced by a fixed step size and then used as the target size again.

15. The method according to claim 11, characterized in that The comparing the size of the second sub-image with the size of the storage unit to determine the final segmentation method of the original image further includes: If the size of the second sub-image is larger than the size of the storage unit, the size of the second sub-image is used as the target size, and the following steps are repeatedly performed until the target size is smaller than the size of the storage unit: After reducing the target size by the preset step size, the target size is used again as the target size.

16. The method according to claim 15, characterized in that The reducing the target size by the preset step size and re-using it as the target size comprises: After the length and width of the target size are alternately reduced by one of the preset steps, each time the length or width of the target size is reduced, it is used as the target size again.

17. The method according to claim 16, characterized in that After reducing the target size by the preset step size and resetting it as the target size, the method further includes: Using the second sub-image after final adjustment as the fourth sub-image; The size of the fourth sub-image is used as the target size, and the following steps are performed repeatedly until the target size matches the size of the storage unit: The length and width of the target size are alternately increased by a fixed step size and then used as the target size again.

18. The method according to claim 5 or 12, characterized in that: The step of setting a preset step size based on the size of the storage unit comprises: The size of the storage unit is converted from a two-dimensional size to a one-dimensional size to obtain the preset step size.

19. The method according to any one of claims 7, 10, 15 and 17, characterized in that: The fixed step size is 1.

20. A picture segmentation device, characterized in that: include: An acquisition module, used for obtaining the initial sub-image size of the original image based on the size of the storage unit; A first calculation module, configured to obtain a plurality of preset target sub-images based on the size of the initial sub-image of the original image, a preset ratio, and the size of a preset target image, wherein the preset ratio is the ratio of the size of the preset target image to the size of the original image, and the preset target image is the image required by the user; The second calculation module is used to perform affine transformation based on the preset target image and the preset target sub-image to determine the final segmentation method of the original image.

21. An electronic device, characterized in that: include: A processor, a memory and a bus, wherein the memory stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor and the memory communicate via the bus, and when the machine-readable instructions are executed by the processor, the image segmentation method as described in any one of claims 1 to 19 is executed.

22. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the image segmentation method according to any one of claims 1 to 19 is executed.

Citation Information

Patent Citations

  • Coarse-to-fine search method and image processing device

    CN107851327A

  • A self-adaptive affine transformation processing method and device

    CN109886866A

  • Multi-target behavior action recognition and prediction method, electronic equipment and storage medium

    CN110689041A

  • Data processing system based on FPGA affine inverse transformation

    CN115880141A

  • Picture processing method and device, electronic equipment and storage medium

    CN115984090A