Data enhancement method, training method and related device for instance segmentation model
By using affine transformation in the instance segmentation model to generate candidate instances and selecting the one with the largest grayscale difference to add to the original image, combined with image repair technology to generate an enhanced image, the problem of poor segmentation accuracy in existing instance segmentation methods is solved. Significantly improves the segmentation accuracy and robustness of the instance segmentation model.
Patent Information
- Application Number
- CN202080006082.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-31
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2040-07-31
AI Technical Summary
Existing instance segmentation methods have the problem of poor segmentation accuracy in the field of computer vision, and cannot meet the requirements for instance segmentation accuracy in computer vision tasks.
By obtaining the instance contour information in the image, performing affine transformation to generate candidate instances, and selecting the one with the largest grayscale difference to add to the original image, combined with image repair technology to generate an enhanced image, which is used to train the instance segmentation model and improve segmentation accuracy. .
The segmentation accuracy of the instance segmentation model is significantly improved, making the instance segmentation model more robust and anti-interference ability in computer vision tasks.
Smart Images

Figure CN114375460B
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer vision, and, more specifically, to a data enhancement method, a training method and related devices for an instance segmentation model. Background Art
[0002] The instance segmentation task is the current end-point research direction of deep learning in the field of computer vision. It mainly studies the location and category of detected image instances (such as portraits, animals, or specified objects), segments the instances from the image, and outputs pixel-level masks to display the segmented examples.
[0003] Instance segmentation has been widely used in various tasks in the field of computer vision, such as autonomous driving, robot control, etc. However, in the application of instance segmentation, it is found that the current instance segmentation methods always have the problem of poor example segmentation accuracy.
[0004] In order to solve the above problems, those skilled in the art have proposed a solution, which is to construct new training samples using the existing dataset of the instance segmentation model, thereby expanding the existing dataset in quantity and quality, and using the new dataset for training the instance segmentation model.
[0005] Specifically, in the method proposed by a technician in this field, the contour information of the instance in the image of the original data set is obtained, and the instance is cut from the image based on the contour information; then the instance is pasted to other area positions in the image with the highest pixel similarity with the instance, and the image restoration technology is used to fill the background of the image content in the original position of the instance in the image, so as to obtain a new image. The new image can be used as an enhanced image to expand the original data set to obtain a new data set; finally, the new data set is used to train the instance segmentation model, which can improve the segmentation accuracy of the instance segmentation model.
[0006] After analysis, it is found that although the above method can improve the segmentation accuracy of the instance segmentation model to a certain extent, the improvement effect is limited. In many scenarios, it still cannot meet the requirements of instance segmentation accuracy for various tasks in the field of computer vision. Summary of the invention
[0007] The present application provides a data enhancement method, a training method and related devices for an instance segmentation model, which can improve the segmentation accuracy of the instance segmentation model.
[0008] In a first aspect, the present application provides a data enhancement method for an instance segmentation model. The enhancement method comprises: acquiring a first image; performing multiple affine transformations on a first instance in the first image to obtain multiple candidate instances, wherein the multiple candidate instances correspond one-to-one to the multiple affine transformations; selecting the best candidate instance from the multiple candidate instances, wherein the best candidate instance has the largest grayscale difference among the multiple candidate instances, and the grayscale difference of each candidate instance in the multiple candidate instances is the grayscale difference between each candidate instance and its neighborhood in the first image; and adding the best candidate instance to the first image to obtain a second image after the first image is enhanced.
[0009] In this method, when the first image is enhanced, the best candidate instance with the largest grayscale difference between the best candidate instance and its designated neighborhood in the first image is selected from multiple candidate instances of the first instance in the first image, and the best candidate instance is added to the first image. This makes the contrast between the best candidate instance and its neighborhood larger in the second image obtained by data enhancement of the first image, so that the best candidate instance is clearer in the first image. In this case, the contour information of the best candidate instance can be considered to be very reasonable contour information. The second annotation information of the second image is obtained based on the reasonable contour information, and the instance segmentation model is trained based on the second image and the second annotation information. This can obtain an instance segmentation model with more accurate segmentation accuracy, or significantly improve the segmentation accuracy of the instance segmentation model.
[0010] Among them, optionally, the method may also include: obtaining first label information of the first image, the first label information including first contour information of the first instance; and obtaining second label information of the second image according to the candidate instance corresponding to the maximum grayscale difference, the second label information including second contour information of the candidate instance corresponding to the maximum grayscale difference.
[0011] In some possible implementations of the first aspect, the grayscale difference between each candidate instance and a neighborhood of each candidate instance is determined according to a pixel value variance between each candidate instance and the neighborhood of each candidate instance, wherein the pixel value variance between each candidate instance and the neighborhood of each candidate instance is calculated as follows:
[0012] g=w0×(u0-u) 2 +w1×(u1-u) 2 =w0×w1×(u0-u1) 2
[0013] u=w0×u0+w1×u1
[0014] Among them, u0 represents the average grayscale of each candidate instance, w0 represents the ratio of the number of pixels of each candidate instance to the total number of pixels of each candidate instance and the neighborhood of each candidate instance, u1 represents the average grayscale of the neighborhood of each candidate instance, w1 represents the ratio of the number of pixels of the neighborhood of each candidate instance to the total number of pixels, u represents the average grayscale of each candidate instance and the neighborhood of each candidate instance, and g represents the pixel value variance.
[0015] In some possible implementations of the first aspect, the method further includes: performing contrast enhancement processing on a first region of interest in the second image to obtain a third image, wherein the first region of interest includes a second instance in the second image and a neighborhood of the second instance.
[0016] In this implementation, contrast enhancement technology is used to perform local adaptive contrast enhancement on the instance and its neighborhood in the second image, which can make the inter-class variance of the local image formed by the instance and the neighborhood larger, so as to achieve a more obvious local image contrast effect. This makes the instance segmentation model trained based on the third image after local adaptive contrast enhancement more robust and more resistant to interference.
[0017] The first region of interest is a partial region of the second image. The second image may include multiple different regions of interest, and different regions of interest may include different instances, and each region of interest is a partial region of the second image. Contrast enhancement processing is performed on different regions of interest respectively.
[0018] An example of the neighborhood of the second instance is the neighborhood of the circumscribed rectangular frame of the second instance. The first region of interest including the neighborhood of the second instance can be understood as the first region of interest being larger than the neighborhood of the second instance, and the degree of largerness can be preset. For example, the first region of interest can be 10 pixels larger than the neighborhood of the second instance in length and width.
[0019] In some possible implementations of the first aspect, the method further includes: training an instance segmentation model according to the third image.
[0020] In some possible implementations of the first aspect, the first image is one of a first data set. The method further includes: training an instance segmentation model according to a fourth image in the first data set, and the training is performed simultaneously with the process of obtaining the second image based on the first image; and training the instance segmentation model using the second image or the third image.
[0021] In this implementation, image processing and model training are performed simultaneously, so that when the first data set changes, the processed image can still be obtained based on the latest first data set, and the instance segmentation model can be trained based on the processed image. In other words, this implementation can improve the performance of the instance segmentation model without adding additional latency.
[0022] In the second aspect, the present application provides a training method for an instance segmentation model. The method includes: obtaining a first data set, wherein the first data set includes multiple images; while training the instance segmentation model based on images in the multiple images, performing multiple affine transformations on the first instance in the first image to obtain multiple candidate instances, wherein the multiple candidate instances correspond one to one with the multiple affine transformations; selecting the best candidate instance from the multiple candidate instances, wherein the best candidate instance has the largest grayscale difference among the multiple candidate instances, and the grayscale difference of each candidate instance in the multiple candidate instances is the grayscale difference between each candidate instance and its neighborhood in the first image; adding the best candidate instance to the first image to obtain a second image after enhancing the first image; and training the instance segmentation model based on the second image.
[0023] In this training method, image processing and model training are performed simultaneously, so that when the first data set changes, the processed image can still be obtained based on the latest first data set, and the instance segmentation model can be trained based on the processed image. In other words, this implementation method can improve the performance of the instance segmentation model without adding additional latency.
[0024] In some possible implementations of the second aspect, the grayscale difference between each candidate instance and the neighborhood of each candidate instance is determined according to the pixel value variance between each candidate instance and the neighborhood of each candidate instance, wherein the pixel value variance between each candidate instance and the neighborhood of each candidate instance is calculated as follows:
[0025] g=w0×(u0-u) 2 +w1×(u1-u) 2 =w0×w1×(u0-u1) 2
[0026] u=w0×u0+w1×u1
[0027] Among them, u0 represents the average grayscale of each candidate instance, w0 represents the ratio of the number of pixels of each candidate instance to the total number of pixels of each candidate instance and the neighborhood of each candidate instance, u1 represents the average grayscale of the neighborhood of each candidate instance, w1 represents the ratio of the number of pixels of the neighborhood of each candidate instance to the total number of pixels, u represents the average grayscale of each candidate instance and the neighborhood of each candidate instance, and g represents the pixel value variance.
[0028] In some possible implementations of the second aspect, the training of the instance segmentation model based on the second image includes: performing contrast enhancement processing on a first region of interest in the second image to obtain a third image, wherein the first region of interest includes a second instance in the second image and a neighborhood of the second instance; and training the instance segmentation model based on the third image.
[0029] In a third aspect, the present application provides a data enhancement device for an instance segmentation model, the device comprising a module for executing the method in the above-mentioned first aspect or any one of the implementations thereof.
[0030] For example, the device includes: an acquisition module, configured to acquire a first image; a processing module, configured to: perform multiple affine transformations on a first instance in the first image to obtain multiple candidate instances, wherein the multiple candidate instances correspond one-to-one to the multiple affine transformations; select a best candidate instance from the multiple candidate instances, wherein the best candidate instance has the largest grayscale difference among the multiple candidate instances, and the grayscale difference of each candidate instance in the multiple candidate instances is the grayscale difference between each candidate instance and its neighborhood in the first image; and add the best candidate instance to the first image to obtain a second image after enhancing the first image.
[0031] Optionally, the grayscale difference between each candidate instance and the neighborhood of each candidate instance is determined according to the pixel value variance between each candidate instance and the neighborhood of each candidate instance, wherein the pixel value variance between each candidate instance and the neighborhood of each candidate instance is calculated as follows:
[0032] g=w0×(u0-u) 2 +w1×(u1-u) 2 =w0×w1×(u0-u1) 2
[0033] u=w0×u0+w1×u1
[0034] Among them, u0 represents the average grayscale of each candidate instance, w0 represents the ratio of the number of pixels of each candidate instance to the total number of pixels of each candidate instance and the neighborhood of each candidate instance, u1 represents the average grayscale of the neighborhood of each candidate instance, w1 represents the ratio of the number of pixels of the neighborhood of each candidate instance to the total number of pixels, u represents the average grayscale of each candidate instance and the neighborhood of each candidate instance, and g represents the pixel value variance.
[0035] Optionally, the processing module is further used to: perform contrast enhancement processing on a first region of interest in the second image to obtain a third image, wherein the first region of interest includes the second instance in the second image and a neighborhood of the second instance.
[0036] Optionally, the device further includes a training module, and the training module is used to train an instance segmentation model according to the third image.
[0037] Optionally, the first image is one of the first data set. The device further includes a training module, the training module being used to: train the instance segmentation model according to the fourth image in the first data set, and the training is performed simultaneously with the processing process of the aforementioned processing module obtaining the second image based on the first image; and train the instance segmentation model using the second image or the third image.
[0038] In a fourth aspect, the present application provides a training device for an instance segmentation model, the device comprising a module for executing the method in the above-mentioned second aspect or any one of the implementations thereof.
[0039] For example, the training device includes: an acquisition module, used to acquire a first data set, wherein the first data set includes multiple images; a training module, used to train an instance segmentation model based on images in the multiple images; a processing module, used to perform multiple affine transformations on a first instance in a first image to obtain multiple candidate instances while the training module trains the instance segmentation model based on images in the multiple images, wherein the multiple candidate instances correspond one-to-one to the multiple affine transformations; selecting a best candidate instance from the multiple candidate instances, wherein the best candidate instance has the largest grayscale difference among the multiple candidate instances, and the grayscale difference of each candidate instance in the multiple candidate instances is the grayscale difference between each candidate instance and its neighborhood in the first image; and adding the best candidate instance to the first image to obtain a second image after the first image is enhanced.
[0040] Optionally, the grayscale difference between each candidate instance and the neighborhood of each candidate instance is determined according to the pixel value variance between each candidate instance and the neighborhood of each candidate instance, wherein the pixel value variance between each candidate instance and the neighborhood of each candidate instance is calculated as follows:
[0041] g=w0×(u0-u) 2 +w1×(u1-u) 2 =w0×w1×(u0-u1) 2
[0042] u=w0×u0+w1×u1
[0043] Among them, u0 represents the average grayscale of each candidate instance, w0 represents the ratio of the number of pixels of each candidate instance to the total number of pixels of each candidate instance and the neighborhood of each candidate instance, u1 represents the average grayscale of the neighborhood of each candidate instance, w1 represents the ratio of the number of pixels of the neighborhood of each candidate instance to the total number of pixels, u represents the average grayscale of each candidate instance and the neighborhood of each candidate instance, and g represents the pixel value variance.
[0044] Optionally, the training module is specifically used to: perform contrast enhancement processing on a first region of interest in the second image to obtain a third image, wherein the first region of interest includes a second instance in the second image and a neighborhood of the second instance; and train the instance segmentation model based on the third image.
[0045] In a fifth aspect, the present application provides a data enhancement device for an instance segmentation model, the device comprising: a memory for storing programs; a processor for executing the programs stored in the memory, when the program stored in the memory is executed, the processor is used to execute the method in the first aspect or any one of the implementations thereof.
[0046] In a sixth aspect, the present application provides a training device for an instance segmentation model, the device comprising: a memory for storing programs; a processor for executing the programs stored in the memory, when the program stored in the memory is executed, the processor is used to execute the method in the second aspect or any one of the implementations thereof.
[0047] In a seventh aspect, a computer-readable medium is provided, wherein the computer-readable medium stores a program code for execution by a device, wherein the program code is used to execute the method in the first aspect or any one of the implementations thereof.
[0048] According to an eighth aspect, a computer-readable medium is provided, wherein the computer-readable medium stores a program code for execution by a device, wherein the program code is used to execute the method according to the second aspect or any one of the implementations thereof.
[0049] In a ninth aspect, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute the method in the first aspect or any one of the implementations thereof.
[0050] In a tenth aspect, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute the method in the second aspect or any one of the implementations thereof.
[0051] In an eleventh aspect, a chip is provided, comprising a processor and a data interface, wherein the processor reads instructions stored in a memory through the data interface to execute the method in the first aspect or any one of the implementations thereof.
[0052] Optionally, as an implementation method, the chip may also include a memory, in which instructions are stored, and the processor is used to execute the instructions stored in the memory. When the instructions are executed, the processor is used to execute the method in the first aspect or any one of the implementation methods.
[0053] In a twelfth aspect, a chip is provided, comprising a processor and a data interface, wherein the processor reads instructions stored in a memory through the data interface to execute the method in the above-mentioned second aspect or any one of the implementations thereof.
[0054] Optionally, as an implementation method, the chip may also include a memory, in which instructions are stored, and the processor is used to execute the instructions stored in the memory. When the instructions are executed, the processor is used to execute the method in the second aspect or any one of the implementation methods.
[0055] In the thirteenth aspect, a computing device is provided, which includes: a memory for storing programs; a processor for executing the programs stored in the memory, when the program stored in the memory is executed, the processor is used to execute the method in the first aspect or any one of the implementations thereof.
[0056] In a fourteenth aspect, a computing device is provided, comprising: a memory for storing programs; and a processor for executing the programs stored in the memory, wherein when the programs stored in the memory are executed, the processor is used to execute the method in the second aspect or any one of the implementations thereof.
[0057] In a fifteenth aspect, the present application provides an instance segmentation method, the method comprising: performing instance segmentation on an image using the instance segmentation model trained in the first aspect or the second aspect.
[0058] In a sixteenth aspect, the present application provides an instance segmentation device, which includes a module for executing the method in the above fifteenth aspect or any one of the implementations thereof.
[0059] In the seventeenth aspect, the present application provides an instance segmentation device, which includes: a memory for storing programs; a processor for executing the programs stored in the memory, when the program stored in the memory is executed, the processor is used to execute the method in the fifteenth aspect or any one of the implementations thereof.
[0060] In an eighteenth aspect, a computer-readable medium is provided, which stores a program code for execution by a device, wherein the program code is used to execute the method in the fifteenth aspect or any one of the implementations thereof.
[0061] In a nineteenth aspect, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute the method in the fifteenth aspect or any one of the implementations thereof.
[0062] In the twentieth aspect, a chip is provided, comprising a processor and a data interface, wherein the processor reads instructions stored in a memory through the data interface to execute the method in the fifteenth aspect or any one of the implementations thereof.
[0063] Optionally, as an implementation method, the chip may also include a memory, in which instructions are stored, and the processor is used to execute the instructions stored in the memory. When the instructions are executed, the processor is used to execute the method in aspect fifteen or any one of the implementation methods therein.
[0064] In the twenty-first aspect, a computing device is provided, which includes: a memory for storing programs; a processor for executing the programs stored in the memory, when the program stored in the memory is executed, the processor is used to execute the method in the fifteenth aspect or any one of the implementations thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] Figure 1 It is a schematic diagram of the relevant concepts of an embodiment of the present application.
[0066] Figure 2 It is a schematic scene diagram of an instance segmentation model to which an embodiment of the present application can be applied.
[0067] Figure 3It is a schematic architecture diagram of a system to which the methods of various embodiments of the present application can be applied.
[0068] Figure 4 It is a schematic flow chart of a data enhancement method according to an embodiment of the present application.
[0069] Figure 5 It is a schematic flow chart of a data enhancement method according to another embodiment of the present application.
[0070] Figure 6 It is a schematic structural diagram of a data enhancement device according to an embodiment of the present application.
[0071] Figure 7 It is a schematic structural diagram of a device according to an embodiment of the present application.
[0072] Figure 8 It is a schematic structural diagram of a computer program product according to an embodiment of the present application.
[0073] Fig. 9 Schematic diagram of a region of interest according to an embodiment of the present application. DETAILED DESCRIPTION
[0074] In order to facilitate the understanding of the embodiments of the present application, Figure 1 Introduce several concepts related to the embodiments of the present application. Figure 1 In the example, the picture contains 1 person, 2 sheep and 1 dog. It should be understood that Figure 1 This is for illustration only and not limitation.
[0075] like Figure 1 As shown in the upper left corner, image classification refers to determining the category to which an instance belongs. For example, in the dataset, there are four categories: person, sheep, dog, and cat. Image classification is to obtain (or output) which categories a given image contains. Figure 1 In the example above, the output of the image classification task is to label the categories in the picture: people, sheep, dogs.
[0076] like Figure 1 As shown in the upper right corner, object detection is simply to find out what objects are in the image and their locations (for example, enclosing the object in a rectangular frame, which can be called a detection frame). Figure 1 In the example, the output of the object detection task is to label the bounding boxes of 1 person, 2 sheep, and 1 dog in the picture (such as Figure 1 rectangle in the upper right corner of the picture).
[0077] like Figure 1As shown in the lower left corner, semantic segmentation means that every pixel in the image needs to be distinguished, rather than just enclosing the target with a rectangular box, but different instances of the same object do not need to be segmented separately. Figure 1 In the example, the output of the semantic segmentation task is to label the people, sheep, and dogs in the picture, but there is no need to label sheep 1 and sheep 2. Semantic segmentation is also target segmentation in the usual sense.
[0078] like Figure 1 As shown in the lower right corner, instance segmentation refers to the combination of object detection and semantic segmentation. Compared with the bounding box of object detection, instance segmentation can accurately identify the edge of the object. Compared with semantic segmentation, instance segmentation needs to mark different instances of the same object in the image. For example, in Figure 1 In the example, there is 1 instance of a person, 2 instances of a sheep, and 1 instance of a dog. The instance segmentation task is to mark all these instances. The prediction result of instance segmentation can be called a segmentation mask. The quality of the segmentation mask can characterize the quality of the prediction result of instance segmentation.
[0079] Figure 2 FIG. 1 is a framework diagram of an exemplary application scenario of the instance segmentation model of the present application. The exemplary application scenario is the smooth call service of a mobile phone. Figure 2 As shown, the Changlian call service is implemented by the user layer, application layer and computing layer. It should be understood that the following embodiments are introduced with mobile phones as the application scenario. In fact, the solution is not limited to mobile phones, but can also be applied to other types of electronic devices such as computers, servers or wearable devices.
[0080] Among them, the user layer may include a Changlian call interface, through which mobile phone users can access the Changlian call service; the application layer can provide users with basic call services and special services through the Changlian call interface. The basic call services may include services such as logging into an account, initiating a call, ending a call, and / or switching between the front and rear cameras. The special services may include services such as skin beautification effects, low-light high definition, time and space conversion, and protagonist locking; the computing layer includes a variety of chip underlying interfaces, and provides functions to the application layer through these interfaces to realize various services of the application layer.
[0081] For example, the main character lock means that the main character portrait specified by the user is retained, and other portraits and backgrounds are removed. At this time, only the pixels of the main character portrait are retained in the video. Time-space transformation is an operation that retains the portrait part of the video and replaces the background during a video call to achieve the effect of time-space transformation.
[0082] As an example, the instance segmentation model of the present application can be applied to the spatiotemporal transformation application and the protagonist locking application in the mobile phone service. These two applications rely on the instance segmentation results of the high-precision portrait instance segmentation algorithm, especially when multiple portraits are occluded by each other or the portrait is occluded by other objects, the instance segmentation accuracy of the instance segmentation algorithm will be higher.
[0083] Figure 3 FIG. 3 is an exemplary structural diagram of a system architecture 300 to which the instance segmentation model of the embodiment of the present application can be applied. Figure 3 In the example, the data acquisition device 360 is used to acquire training data. Taking the system architecture for instance segmentation as an example, the training data may include a training image and contour information of an instance in the training image, wherein the contour information of the instance in the training image may be the result of manual pre-annotation, and the contour information may be referred to as annotation information of the training image.
[0084] After collecting the training data, the data collection device 360 stores the training data in the database 330. The training device 320 obtains the target model 301 based on the training data maintained in the database 330. The target model 301 may be an instance segmentation model. The target model in this application may also be replaced by a target rule.
[0085] In some implementations, after the data acquisition device 360 acquires the training data, the data processing device 370 may further process the training data to improve the performance of the target model 301. For example, the data processing device 370 may perform data enhancement on the training images in the database 330 to expand the training images in the database 330, so that the training device 320 can train an instance segmentation model with higher segmentation accuracy based on the expanded database 330.
[0086] The following describes how the training device 320 obtains the target model 301 based on the training data. Taking the system architecture for instance segmentation as an example, the training device 320 performs instance segmentation on the input original image, compares the instance contour result obtained by segmentation with the annotation information of the original image, and adjusts the parameters of the target model 301 according to the comparison result until the difference between the contour information output by the training device 320 and the annotation information of the original image is less than a certain threshold, thereby completing the training of the target model 301.
[0087] It is understandable that, in actual applications, the training data maintained in the database 330 is not necessarily all collected by the data acquisition device 360, but may also be received from other devices. In addition, the training device 320 does not necessarily have to train the target model 301 entirely based on the training data maintained by the database 330, and may also obtain training data from the cloud or other places for model training. The above description should not be used as a limitation on the embodiments of the present application.
[0088] It can be understood that in this system architecture, the training device 320 and the data processing device 370 can be the same device.
[0089] The target model 301 obtained by training the training device 320 can be applied to different systems or devices, such as Figure 3 The execution device 310 shown in FIG. 310 may be a terminal, such as a mobile phone terminal, a tablet computer, a laptop computer, an augmented reality (AR) / virtual reality (VR), a vehicle terminal, etc., or a resource-constrained server or a resource-constrained cloud device, etc. For example, an example of the execution device 310 may include Figure 2 An exemplary structure of a mobile phone is shown.
[0090] exist Figure 3 In the example, the execution device 310 is configured with an input / output (I / O) interface 312 for data interaction with an external device, and a user can input data to the I / O interface 312 through a client device 340. Taking the system architecture for instance segmentation as an example, the input data may include: an image captured by a camera of the client device 340.
[0091] Understandably, Figure 3 In the system architecture shown, the execution device 310 and the client device 340 may be the same device.
[0092] When the execution device 310 preprocesses the input data, or when the computing module 311 of the execution device 310 performs calculations and other related processing, the execution device 310 can call the data, code, etc. in the data storage system 350 for corresponding processing, and can also store the data, instructions, etc. obtained from the corresponding processing into the data storage system 350.
[0093] Finally, the I / O interface 312 returns the processing result, taking instance segmentation as an example, the instance segmentation result of the image to be segmented to the client device 340 , so as to provide it to the user.
[0094] exist Figure 3In the case shown, the user can manually give input data, and the manual giving can be operated through the interface provided by the I / O interface 312. In another case, the client device 340 can automatically send input data to the I / O interface 312. If the client device 340 is required to automatically send input data and needs to obtain the user's authorization, the user can set the corresponding authority in the client device 340. The user can view the results output by the execution device 310 on the client device 340, and the specific presentation form can be a specific method such as display, sound, action, etc. The client device 340 can also be used as a data acquisition terminal to collect the input data of the input I / O interface 312 and the output results of the output I / O interface 312 as new sample data, and store them in the database 330. Of course, it is also possible not to collect through the client device 340, but the I / O interface 312 directly stores the input data of the input I / O interface 312 and the output results of the output I / O interface 312 as new sample data in the database 330.
[0095] Understandably, Figure 3 This is only a schematic diagram of a system architecture provided by an embodiment of the present application. The positional relationship between the devices, components, modules, etc. shown in the figure does not constitute any limitation. For example, in Figure 3 In the embodiment, the data storage system 350 is an external memory relative to the execution device 310. In other cases, the data storage system 350 can also be placed in the execution device 310.
[0096] Figure 4 FIG. 1 is an exemplary flow chart of a data enhancement method for an instance segmentation model according to an embodiment of the present application. Figure 4 As shown, the method may include S410 and S420. An example of an execution subject of the method is Figure 3 Data processing device 370 in the system architecture shown.
[0097] S410, obtaining a first image. In this embodiment, the first image may include one or more instances. The first image may be an image in an instance segmentation dataset such as a coco dataset or a cityscape dataset.
[0098] In this embodiment, when acquiring the first image, the annotation information of the first image may also be acquired. The annotation information of the first image may be referred to as first annotation information. The first annotation information may record the contour information of each instance in the first image. An example of the first annotation information is a set of coordinate points of the outer contour of each instance.
[0099] In this embodiment, acquiring the first image can be understood as reading the first image from an image storage device. Figure 3Taking the data processing device 370 in FIG. 3 as an example, the data processing device 370 can read the first image and the first annotation information from the database 330 .
[0100] In some implementations of this embodiment, after acquiring the first image and the first annotation information, contour information at the pixel level of each instance in the first image may be extracted according to the first annotation information. This process may be referred to as preprocessing of the first image.
[0101] For example, the outer contour information of the instance is converted from a set of coordinate points into a mask matrix that can be efficiently processed by a computer. In the mask matrix, the pixels corresponding to the instance can be set to 1, and the pixels corresponding to the background can be set to 0. In this embodiment, the instance can also be called the foreground or the foreground part, and the neighborhood of the instance can be called the background or the background part of the instance. The neighborhood is an area adjacent to the instance, including but not limited to adjacent areas of various shapes, such as a subsequent circumscribed rectangular neighborhood.
[0102] Taking the first image as a coco dataset and the annotation information of the image in the dataset as json text as an example, the data processing device 370 can use the "findContour()" function of opencv for extracting outer contours to extract pixel-level contour information of the instance in the first image.
[0103] S420, performing multiple affine transformations on the first instance in the first image to obtain multiple candidate instances, and the multiple candidate instances correspond one-to-one to the multiple affine transformations. In this embodiment, the first instance can be any instance in the first image. In the case where the first image contains multiple instances, each instance can be regarded as a first instance, and then multiple affine transformations are performed on each instance to obtain multiple candidate instances of each instance, each of the multiple candidate instances is an instance obtained by processing the first instance using the corresponding affine transformation in the multiple affine transformations.
[0104] For example, each of a plurality of affine transformations may be used to operate on the mask matrix of the first instance, thereby obtaining a mask matrix corresponding to the affine transformation, and the instance described by the mask matrix is the candidate instance corresponding to the affine transformation.
[0105] In this embodiment, performing an affine transformation on the instance may include performing one or more transformations of translation, rotation, scaling, reflection, shearing, and any combination of the foregoing transformations on the instance in the first image. In this embodiment, the above-mentioned multiple affine transformations may be pre-configured. As an example, a rule for affine transformation may be preset, and multiple affine transformation matrices may be generated based on the rule, each of the multiple affine transformation matrices corresponding to an affine transformation; as another example, the multiple affine transformation matrices may be directly preset.
[0106] An exemplary representation of an affine transformation matrix is as follows:
[0107]
[0108] Among them, t x Indicates the horizontal offset, t y It represents the offset in the vertical direction (or called the vertical direction), s represents the scaling factor, and r represents the rotation angle.
[0109] Taking the above-mentioned affine transformation matrix as an example, the following describes an exemplary implementation method for obtaining multiple affine transformation matrices. In this implementation method, the horizontal width w of the external matrix frame of the first example can be obtained, and t x The value range of is set to -20%*w to +20%*w, and the step size is set to 2; in order to avoid pixel artifacts caused by semantic ambiguity of image pixels, t y The value range of the scaling scale s can be set to 0.8 to 1.2, and the step size can be set to 0.05, that is, the instance after affine transformation is 80% to 120% of the original instance; the value range of the rotation angle r can be set to -10 degrees to +10 degrees, and the step size can be set to 1 degree. According to the above affine transformation rules, multiple affine transformation matrices can be obtained, and these multiple affine transformation matrices can form an affine transformation candidate matrix set.
[0110] Understandably, t y Fixed to zero is just an example, t y Compared with not fixing to zero, fixing to zero can avoid too large a difference between the enhanced image and the image before enhancement, thereby avoiding affecting the training effect of the trained instance segmentation model when using the enhanced image to train the instance segmentation model, which helps to improve the performance of the instance segmentation model.
[0111] S430, selecting the best candidate instance from the multiple candidate instances, the best candidate instance having the largest grayscale difference among the multiple candidate instances, the grayscale difference of each candidate instance in the multiple candidate instances being the grayscale difference between each candidate instance and its neighborhood in the first image.
[0112] In this embodiment, after performing multiple affine transformations on the first instance to obtain multiple candidate instances, the best candidate instance of the first instance in the first image should be selected from the multiple candidate instances. In this embodiment, the best candidate instance refers to the candidate instance with the largest grayscale difference between the multiple candidate instances and its neighbor in the first image, that is, the grayscale difference between the best candidate instance and the neighbor in the first image of the best transformed instance is greater than the grayscale difference between any other candidate instance in the multiple candidate instances and the neighbor in the first image of the any candidate instance.
[0113] In order to determine the best candidate instance from the multiple candidate instances, the grayscale difference between each candidate instance in the multiple candidate instances and the specified neighborhood of the candidate instance in the first image can be obtained first, and finally multiple grayscale differences corresponding to the multiple candidate instances can be obtained.
[0114] For example, for each of the multiple candidate instances, the circumscribed rectangular neighborhood of each candidate instance in the first image can be obtained, thereby obtaining multiple neighborhoods corresponding to the multiple candidate instances one by one, and the multiple neighborhoods can be called a contour neighborhood set.
[0115] The bounding rectangle neighborhood of each candidate instance can be understood as the neighborhood formed by the pixel points in the bounding rectangle of the candidate instance except the transformed instance. Fig. 9 As shown, the first instance in the first image is a cloud, and the oblique line portion in the circumscribed rectangular frame of the cloud outline represents the circumscribed rectangular neighborhood of the first instance of the cloud. The first image may also include other contents, such as other instances. Fig. 9 It is understood that using the circumscribed rectangular neighborhood of each candidate instance as the domain of the candidate instance is only an example, and the present application does not limit the shape of the neighborhood of the candidate instance. For example, the neighborhood of the candidate instance in the present application may also be the circumscribed circular neighborhood of the candidate instance.
[0116] In one possible implementation, for each neighborhood in the contour neighborhood set, the candidate instance corresponding to the neighborhood can be used as the foreground, and the neighborhood can be used as the background. The variance of the pixel values of the foreground and the background is calculated to obtain the variance corresponding to the neighborhood, which can be used as the grayscale difference between the neighborhood and the candidate instance.
[0117] For each neighborhood, an exemplary formula for calculating its corresponding variance is as follows:
[0118] g=w0×(u0-u) 2 +w1×(u1-u) 2 =w0×w1×(u0-u1) 2
[0119] u=w0×u0+w1×u1
[0120] Among them, u0 represents the average grayscale of the foreground, w0 represents the ratio of the number of pixels in the foreground to the total number of pixels in the foreground and background, u1 represents the average grayscale of the background, w1 represents the ratio of the number of pixels in the background to the total number of pixels, u represents the average grayscale of the foreground and background, and g represents the variance of the foreground and background.
[0121] In the above example, the pixel value variance of the foreground and the background is regarded as the grayscale difference between the candidate instance and the neighborhood of the candidate instance, which is only an example. In this embodiment, the grayscale difference between the foreground and the background can be obtained by other methods, for example, the 1-norm or infinite norm of the pixel value of each foreground and its corresponding background can be calculated, and the 1-norm or infinite norm of the pixel value of the foreground and the background is regarded as the grayscale difference between the foreground and the background.
[0122] In the above steps, after obtaining multiple grayscale differences corresponding to multiple candidate instances, the maximum grayscale difference can be determined from the multiple grayscale differences, and the candidate instance corresponding to the maximum grayscale difference can be determined as the best candidate instance, and the neighborhood corresponding to the maximum grayscale difference in the first image can be determined as the best neighborhood, which can also be called the target neighborhood. In this embodiment, the candidate instance corresponding to the maximum grayscale difference refers to the candidate instance based on which the maximum grayscale difference is calculated, and the neighborhood corresponding to the maximum grayscale difference refers to the neighborhood based on which the maximum grayscale difference is calculated.
[0123] S440, adding the best candidate instance to the first image to obtain a second image after the first image is enhanced. After obtaining the best candidate instance and the best neighborhood of the first instance, the best candidate instance can be added to the first image, and the position of adding the best candidate instance should be such that the neighborhood of the best candidate instance in the first image is exactly the best neighborhood.
[0124] In this embodiment, the processing method of the image content at the position of the first instance in the first image can refer to the existing technology. For example, the image content at the position of the first instance in the first image can be processed using image restoration technology so as to fill the image content at the position as the background of the instance in the first image.
[0125] In this embodiment, one or more instances in the first image may be regarded as the first instance. Figure 4 The method shown obtains the best transformation instance corresponding to each of the one or more instances, and adds the best transformation instance to the first image, thereby finally obtaining the second image.
[0126] In this embodiment, when the second image is acquired, the annotation information of the second image can also be acquired. For example, when the best candidate instance is implemented in the form of a mask matrix, the mask matrix can be transformed into a set of coordinate points, and the set of coordinate points can be used as the contour information of the target instance. If the annotation information of the second image is called second annotation information, the contour information of the best candidate instance can be recorded in the second annotation information.
[0127] After the training data set of the instance segmentation model is processed using the method of this embodiment, the instance segmentation model can be trained using the processed training data set. Figure 3 After the data processing device 370 performs first image processing on the first image in the database 330 , the training device 320 can use the processed second image to train the instance segmentation model to obtain the target model 301 .
[0128] Furthermore, after the instance segmentation model is obtained by training the second image, the instance segmentation model can be used to perform instance segmentation. Figure 3 After the training device 320 in the embodiment uses the second image to train and obtain an instance segmentation model, the execution device 310 can execute the instance segmentation service based on the instance segmentation model. Figure 2 Taking the illustrated architecture as an example, the execution device 310 can implement the principal actor locking and spatiotemporal transformation services based on the instance segmentation model.
[0129] The method of this embodiment, when enhancing the first image, selects the best candidate instance with the largest grayscale difference between itself and its designated neighborhood in the first image from multiple candidate instances of the first instance in the first image, and adds the best candidate instance to the first image. This makes the contrast between the best candidate instance and its neighborhood larger in the second image obtained by data enhancement of the first image, so that the best candidate instance is clearer in the first image. In this case, the contour information of the best candidate instance can be considered to be very reasonable contour information. The second annotation information of the second image is obtained based on the reasonable contour information, and the instance segmentation model is trained based on the second image and the second annotation information. This can obtain an instance segmentation model with more accurate segmentation accuracy, or significantly improve the segmentation accuracy of the instance segmentation model.
[0130] Figure 5 FIG. 1 is an exemplary flow chart of a data enhancement method according to another embodiment of the present application. Figure 5As shown, the method may include S410 to S440 and S450. S450: performing contrast enhancement processing on a first region of interest in the second image to obtain a third image, wherein the first region of interest includes a second instance in the second image and a neighborhood of the second instance.
[0131] In this embodiment, the second image may include one or more regions of interest (ROIs), each of which may include an instance and a neighborhood of the instance. The regions of interest of the second image may form a set of regions of interest.
[0132] For the convenience of description, the region of interest in the second image is referred to as a first region of interest, the instance in the first region of interest is referred to as a second instance, and the neighborhood of the second instance is referred to as a second neighborhood.
[0133] In this embodiment, the second neighborhood may include the circumscribed rectangular neighborhood of the second instance, or in other words, the circumscribed rectangular frame of the second instance is located in the second neighborhood, or in other words, the second neighborhood includes pixel points outside the circumscribed rectangular neighborhood of the third instance in addition to pixel points within the circumscribed rectangular neighborhood of the second instance.
[0134] For each first region of interest in the set of regions of interest of the second image, as an example, a low-frequency part in the first region of interest can be obtained by a Gaussian low-pass filter. For example, the "GaussianBlur()" function in the open source opencv algorithm can be used to implement the Gaussian low-pass filter. Specifically, the pixels in the first region of interest can be passed into the Gaussian low-pass filter, so that the high-frequency part of each pixel can be filtered out to obtain the low-frequency part of each pixel.
[0135] After the low-frequency part in the first region of interest is acquired through the Gaussian low-pass filter, the low-frequency part may be subtracted from the original pixels of the first region of interest to obtain the high-frequency part of the first region of interest.
[0136] After obtaining the low-frequency part and the high-frequency part in the first region of interest, for each pixel point in the first region of interest, the pixel value of the high-frequency part after enhancement can be calculated according to the gain value of the high-frequency part, and the pixel value of the low-frequency part after enhancement can be calculated according to the gain value of the low-frequency part to obtain a contrast-enhanced image.
[0137] For example, by traversing each pixel point in the first area of interest, if the pixel point is a pixel point in the high-frequency part, it can be considered that the mean square error of the pixel value between the pixel point and the surrounding pixels is large. At this time, the pixel value of the pixel point can be reduced by a smaller gain value to alleviate the phenomenon that the pixel point is too bright; if the pixel point is a pixel point in the low-frequency part, it can be considered that the mean square error of the pixel value between the pixel point and the surrounding pixels is small. At this time, the high-frequency part can be amplified by a larger gain value to make the detailed features around the pixel point more obvious, thereby alleviating the image blur problem.
[0138] In an example, the gain values of the high-frequency part and the low-frequency part can be preset as needed, for example, the gain value of the high-frequency part can be set to 0.5, and the gain value of the low-frequency part can be set to 2. An implementation method of calculating the enhanced pixel value of the pixel point of the high-frequency part according to the gain value of the high-frequency part or calculating the enhanced pixel value of the pixel point of the low-frequency part according to the gain value of the low-frequency part is: taking the product of the gain value and the pixel value of the pixel point as the enhanced pixel value of the pixel point.
[0139] In this embodiment, after the above-mentioned adaptive contrast enhancement process is performed on each region of interest in the second image, a third image with local adaptive contrast enhancement can be obtained. Figure 5 After each second image is processed by the method shown, a training data set with image contrast enhanced can be obtained.
[0140] Furthermore, the method of this embodiment may also include: using the training data set to train the instance segmentation model. For example, Figure 3 After the data processing device 370 performs second image processing on the second image in the database 330 , the training device 320 can use the processed third image to train the instance segmentation model to obtain the target model 301 .
[0141] Furthermore, the method of this embodiment may also include: performing instance segmentation using the trained instance segmentation model. For example, Figure 3 After the training device 320 in the embodiment uses the third image to train and obtain an instance segmentation model, the execution device 310 can execute the instance segmentation service based on the instance segmentation model. Figure 2 Taking the illustrated architecture as an example, the execution device 310 can implement the principal actor locking and spatiotemporal transformation services based on the instance segmentation model.
[0142] The instance segmentation model trained using the training data set with image contrast enhancement in this embodiment has high robustness, strong anti-interference ability and high tolerance to noise in images in noisy scenes.
[0143] In one embodiment of the present application, it is possible to use Figure 4 or Figure 5 The data enhancement method shown processes the images in the original training data set to obtain the processed training data set, and then uses the processed training data set to train the instance segmentation model. The processing of the original training data set in this embodiment can be called offline data enhancement.
[0144] In another embodiment of the present application, the instance segmentation model can be trained using the original training data set while using Figure 4 or Figure 5 The original training dataset is processed by the method. After the instance segmentation model is trained using the original training dataset and Figure 4 or Figure 5 After the original training data set is processed by the method, the training data set obtained by the image processing is used to train the instance segmentation model. The method of this embodiment can be called an online data enhancement training method.
[0145] Among them, since the training iteration time of the instance segmentation model is usually much longer than the image processing time, the method of this embodiment does not increase the extra time consumption, and can obtain the latest enhanced training data set in real time, thereby further improving the accuracy of the instance segmentation model. For example, no matter how the original training data set of the instance segmentation model changes, the method of this embodiment can obtain the latest enhanced training data set based on the original training data set, thereby obtaining an instance segmentation model with better performance.
[0146] The following is implemented based on the TensorFlow open source framework Figure 4 or Figure 5 Taking the data enhancement method as an example, an exemplary implementation of the online data enhancement training method is introduced.
[0147] In the existing open source training framework, the image processing operations are all completed in the constructor of the data_generator object. When using the method of this embodiment, first read the original training data set, use the "imread" function in the opencv library to read the first image and the first annotation information in the original training data set, and use the "loadAnns" function of the coco data set to read the first annotation information, and implement it in the constructor of the data_generator object. Figure 4 or Figure 5The data enhancement method can output a data_generator object, and the above operation is performed by the image processing thread; then, the data_generator object is transmitted as a parameter to the training thread of the Tensorflow model, wherein the training thread and the image processing thread are executed in parallel, and the image processing thread is executed independently, and the processed second image or third image is output, and the second annotation information is output to the common storage area. Before each training iteration, the training process goes to the common storage area to read the processed second image or third image and output the second annotation information to realize the training of the instance segmentation model.
[0148] Figure 6 FIG. 6 is a schematic structural diagram of a data enhancement device 600 for an instance segmentation model according to an embodiment of the present application. The device 600 may be Figure 3 An example of a data processing device 370 in the system architecture shown. The apparatus 600 may include an acquisition module 610 and a processing module 620, and optionally, may also include a training module. The apparatus 600 may be used to implement the data enhancement method of the instance segmentation model in any of the above embodiments, for example, Figure 4 or Figure 5 For example, the acquisition module 610 may be used to execute S410, and the processing module 620 may be used to execute S420 to S440. Optionally, the processing module 620 may also be used to execute S450.
[0149] The schematic structure of the training device of the instance segmentation model of one embodiment of the present application is similar to the structure of the device 600 including the training module, which will not be described in detail here. The training device can be used to execute the above-mentioned online data enhancement training method.
[0150] Figure 7 The schematic structural diagram of an apparatus 700 according to an embodiment of the present application includes a processor 702 , a communication interface 703 , and a memory 704 .
[0151] The device 700 may be a chip or a computing device. For example, the device 700 may be Figure 3 The data processing device 370 in the system architecture shown may be an example of a chip that can be applied to the data processing device 370. For another example, the apparatus 700 may be Figure 3 The training device 320 in the illustrated system architecture may be an example of a chip that can be applied to the training device 320 .
[0152] The processor 702, the memory 704 and the communication interface 703 can communicate with each other via a bus. The memory 704 stores executable code, and the processor 702 reads the executable code in the memory 704 to execute the corresponding method. The memory 704 may also include an operating system and other software modules required for running processes. The operating system may be LINUX TM , UNIX TM , WINDOWS TM wait.
[0153] For example, the executable code in the memory 704 is used to implement the method described in any of the above embodiments (such as Figure 4 or Figure 5 The processor 702 reads the executable code in the memory 704 to execute the method described in any of the above embodiments (such as Figure 4 or Figure 5 method shown).
[0154] The processor 702 may include a CPU. The memory 704 may include a volatile memory (volatile memory), such as a random access memory (random access memory, RAM). The memory 704 may also include a non-volatile memory (2 non-volatile memory, 2 NVM), such as a read-only memory (2 read-only memory, 2 ROM), a flash memory, a hard disk drive (hard disk drive, HDD) or a solid state disk (solid state disk, SSD).
[0155] In some embodiments of the present application, the disclosed methods may be implemented as computer program instructions encoded in a machine-readable format on a computer-readable storage medium or encoded on other non-transitory media or articles of manufacture. Figure 8 Schematically illustrates a conceptual partial view of an example computer program product arranged according to any of the above embodiments, the example computer program product comprising a computer program for executing a computer process on a computing device. In one embodiment, the example computer program product 800 is provided using a signal bearing medium 801. The signal bearing medium 801 may include one or more program instructions 802, which when executed by one or more processors may provide the functions or part of the functions described in any of the above embodiments. Thus, for example, Figure 5 In the embodiment shown in , one or more features of S410 to S430 may be undertaken by one or more instructions associated with the signal bearing medium 801 .
[0156] In some examples, the signal bearing medium 801 may include a computer readable medium 803, such as, but not limited to, a hard drive, a compact disk (CD), a digital video disk (DVD), a digital tape, a memory, a read-only memory (ROM) or a random access memory (RAM), etc. In some embodiments, the signal bearing medium 801 may include a computer recordable medium 804, such as, but not limited to, a memory, a read / write (R / W) CD, a R / W DVD, etc. In some embodiments, the signal bearing medium 801 may include a communication medium 805, such as, but not limited to, a digital and / or analog communication medium (e.g., a fiber optic cable, a waveguide, a wired communication link, a wireless communication link, etc.). Thus, for example, the signal bearing medium 801 may be communicated by a wireless form of the communication medium 805 (e.g., a wireless communication medium that complies with the IEEE 802.11 standard or other transmission protocol). One or more program instructions 802 may be, for example, computer executable instructions or logic implementation instructions. In some examples, the aforementioned computing device may be configured to provide various operations, functions, or actions in response to program instructions 802 communicated to the computing device by one or more of computer-readable media 803, computer-recordable media 804, and / or communication media 805. It should be understood that the arrangement described herein is only for the purpose of example. Thus, it will be appreciated by those skilled in the art that other arrangements and other elements (e.g., machines, interfaces, functions, sequences, and functional groups, etc.) can be used instead, and some elements can be omitted together according to the desired results. In addition, many of the described elements are functional terms that can be implemented as discrete or distributed components, or in any appropriate combination and position in conjunction with other components to implement.
[0157] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example 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 performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0158] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0159] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0160] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0161] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0162] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory, a random access memory, a magnetic disk, or an optical disk.
[0163] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A data enhancement method for an instance segmentation model, characterized in that: include: acquiring a first image; Performing multiple affine transformations on the first instance in the first image to obtain multiple candidate instances, where the multiple candidate instances correspond one-to-one to the multiple affine transformations; Selecting a best candidate instance from the multiple candidate instances, the best candidate instance having the largest grayscale difference among the multiple candidate instances, the grayscale difference of each candidate instance in the multiple candidate instances being a grayscale difference between each candidate instance and a neighborhood of each candidate instance in the first image; The best candidate instance is added to the first image to obtain a second image after enhancing the first image.
2. The method according to claim 1, characterized in that The grayscale difference between each candidate instance and the neighborhood of each candidate instance is determined according to the pixel value variance between each candidate instance and the neighborhood of each candidate instance, wherein the pixel value variance between each candidate instance and the neighborhood of each candidate instance is calculated as follows: g=w0×(u0-u) 2 +w1×(u1-u) 2 =w0×w1×(u0-u1) 2 u=w0×u0+w1×u1 Among them, u0 represents the average grayscale of each candidate instance, w0 represents the ratio of the number of pixels of each candidate instance to the total number of pixels of each candidate instance and the neighborhood of each candidate instance, u1 represents the average grayscale of the neighborhood of each candidate instance, w1 represents the ratio of the number of pixels of the neighborhood of each candidate instance to the total number of pixels, u represents the average grayscale of each candidate instance and the neighborhood of each candidate instance, and g represents the pixel value variance.
3. The method according to claim 1 or 2, characterized in that: The method further comprises: A contrast enhancement process is performed on a first region of interest in the second image to obtain a third image, wherein the first region of interest includes a second instance in the second image and a neighborhood of the second instance.
4. A training method for an instance segmentation model, characterized in that: The method comprises the method as claimed in any one of claims 1 to 3, wherein, while executing the method, it also comprises: training an instance segmentation model using multiple images, the multiple images including the first image.
5. The training method according to claim 4, characterized in that: The training method further comprises: The instance segmentation model is trained using the second image.
6. A data enhancement device for an instance segmentation model, characterized in that: include: An acquisition module, used for acquiring a first image; A processing module, configured to: perform multiple affine transformations on the first instance in the first image to obtain multiple candidate instances, wherein the multiple candidate instances correspond one-to-one to the multiple affine transformations; Selecting a best candidate instance from the multiple candidate instances, the best candidate instance having the largest grayscale difference among the multiple candidate instances, the grayscale difference of each candidate instance in the multiple candidate instances being a grayscale difference between each candidate instance and a neighborhood of each candidate instance in the first image; The best candidate instance is added to the first image to obtain a second image after the first image is enhanced.
7. The device according to claim 6, characterized in that The grayscale difference between each candidate instance and the neighborhood of each candidate instance is determined according to the pixel value variance between each candidate instance and the neighborhood of each candidate instance, wherein the pixel value variance between each candidate instance and the neighborhood of each candidate instance is calculated as follows: g=w0×(u0-u) 2 +w1×(u1-u) 2 =w0×w1×(u0-u1) 2 u=w0×u0+w1×u1 Among them, u0 represents the average grayscale of each candidate instance, w0 represents the ratio of the number of pixels of each candidate instance to the total number of pixels of each candidate instance and the neighborhood of each candidate instance, u1 represents the average grayscale of the neighborhood of each candidate instance, w1 represents the ratio of the number of pixels of the neighborhood of each candidate instance to the total number of pixels, u represents the average grayscale of each candidate instance and the neighborhood of each candidate instance, and g represents the pixel value variance.
8. The device according to claim 6 or 7, characterized in that The processing module is also used for: A contrast enhancement process is performed on a first region of interest in the second image to obtain a third image, wherein the first region of interest includes a second instance in the second image and a neighborhood of the second instance.
9. A training device for an instance segmentation model, characterized in that: It comprises a device as described in any one of claims 6 to 8 and a training module, wherein, while the device implements the function of the device, the training module is used to train an instance segmentation model using multiple images, and the multiple images include the first image.
10. The training device according to claim 9, characterized in that The training module is also used to train the instance segmentation model according to the second image.
11. A data enhancement device for an instance segmentation model, characterized in that: include: a processor coupled to the memory; The memory is used to store instructions; The processor is configured to execute instructions stored in the memory, so that the apparatus implements the method according to any one of claims 1 to 3.
12. A training device for an instance segmentation model, characterized in that: include: a processor coupled to the memory; The memory is used to store instructions; The processor is configured to execute instructions stored in the memory so that the device implements the method according to claim 4 or 5.
13. A computer readable medium, characterized in that The method comprises instructions, which, when executed on a processor, cause the processor to implement the method according to any one of claims 1 to 3.
14. A computer readable medium, characterized in that The method comprises instructions which, when executed on a processor, cause the processor to implement the method according to claim 4 or 5.
15. A computer program product, characterized in that The computer program product comprises instructions, which, when executed on a computer, cause the computer to implement the method according to any one of claims 1 to 3.
16. A computer program product, characterized in that The computer program product comprises instructions, which, when executed on a computer, cause the computer to implement the method according to claim 4 or 5.
