A sample generation method, sample training method and device

By obtaining the image of the target object and the associated template image to generate a sample image, the problem of low sample data collection efficiency is solved, the sample data can be quickly obtained in a variety of application scenarios, and the sample data collection efficiency is improved.

CN111783874BActive Publication Date: 2024-08-27LENOVO (BEIJING) LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010610060.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-29
Publication Date
2024-08-27
Estimated Expiration
2040-06-29

AI Technical Summary

Technical Problem

In the existing technology, obtaining sample data for big data analysis is inefficient and requires a lot of manpower and material resources.

Method used

By obtaining images with target objects and target template images associated with them, sample images are generated based on these images, and the template database is used to quickly obtain sample data in various application scenarios.

Benefits of technology

It achieves the rapid acquisition of a large amount of sample data through less sample data, reduces the sample data collection cycle, and improves the sample data collection efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111783874B
    Figure CN111783874B
Patent Text Reader

Abstract

The embodiment of the present application discloses a sample generation method, the method comprising: obtaining a first image having a first target object; obtaining a target template image associated with a first contour shape of the first target object; wherein the target template image includes a target application scene; and generating a sample image based on the target template image and the first image. The embodiment of the present application also discloses an information processing device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of big data technology, and in particular to a sample generation method, a sample training method and a device. Background Art

[0002] At present, with the advent of the cloud era, big data has also attracted more and more attention from R&D personnel. The application of big data, especially artificial intelligence based on big data, has had a significant impact on people's lives. Based on big data analysis, for example, by performing sample statistics on a certain type of sample data, the corresponding model is obtained, so that the model obtained by analysis can be used to quickly detect and analyze the object of this type in the future, thereby improving the efficiency of detection and analysis.

[0003] However, it currently takes a lot of manpower and material resources to obtain a large amount of sample data for statistical analysis, resulting in low efficiency in collecting sample data. Summary of the invention

[0004] The embodiments of the present application are intended to provide a sample generation method, a sample training method and a device.

[0005] In a first aspect, a sample generation method is provided, the method comprising:

[0006] Acquire a first image having a first target object;

[0007] Acquire a target template image associated with a first contour shape of the first target object; wherein the target template image includes a target application scene;

[0008] A sample image is generated based on the target template image and the first image.

[0009] Optionally, the acquiring a target template image associated with a first contour shape of the first target object includes:

[0010] Determine the template database;

[0011] The target template image is acquired from the template database.

[0012] Optionally, the method further includes:

[0013] Acquire a second image having a second target object in a specific application scenario; wherein the contour shape of the second target object is a second contour shape;

[0014] determining a target area of ​​the second contour shape in the second image;

[0015] generating a reference template image for the specific application scenario based on the target area of ​​the second image;

[0016] The reference template image is stored.

[0017] Optionally, the generating, based on the target area of ​​the second image, a reference template image in the specific application scenario includes:

[0018] Determine the target processing mode;

[0019] The target area of ​​the second image is processed using the target processing mode to obtain the reference template image.

[0020] Optionally, generating a sample image based on the target template image and the first image includes:

[0021] Determine a marked area in the target template image that is processed using a target processing mode;

[0022] Acquire a target image matching the identified area from the image area where the first target object is located;

[0023] The target image is displayed in the marked area of ​​the target template image to obtain the sample image.

[0024] Optionally, displaying the target image in a marked area of ​​the target template image to obtain the sample image includes:

[0025] The target image is used to replace or cover the object in the marked area of ​​the target template image to obtain the sample image.

[0026] Optionally, the method further includes:

[0027] Acquire identification information of the first target object;

[0028] Using the identification information to identify the sample image, to obtain a identified sample image;

[0029] The marked sample image is stored.

[0030] In a second aspect, a sample training method is provided, the method comprising:

[0031] Acquire a first image having a first target object;

[0032] Acquire a set of template images associated with the first contour shape of the first target object; wherein the set of template images includes a plurality of target template images with different application scenarios;

[0033] Based on the first image and the template image set, a sample set is generated; wherein the sample set includes different sample images;

[0034] The sample set is used to train the model to be trained to obtain a target model.

[0035] In a third aspect, a sample generation device is provided, the device comprising: a first acquisition unit, a second acquisition unit and a first generation unit, wherein:

[0036] The first acquisition unit is used to acquire a first image having a first target object;

[0037] The second acquisition unit is used to acquire a target template image associated with the first contour shape of the first target object; wherein the target template image includes a target application scene;

[0038] The first generating unit is used to generate a sample image based on the target template image and the first image.

[0039] In a fourth aspect, a sample training device is provided, the device comprising: a third acquisition unit, a fourth acquisition unit, a second processing unit and a training unit, wherein:

[0040] The third acquisition unit is used to acquire a first image having a first target object;

[0041] The fourth acquisition unit is used to acquire a set of template images associated with the first contour shape of the first target object; wherein the set of template images includes a plurality of target template images with different application scenarios;

[0042] The second processing unit is used to generate a sample set based on the first image and the template image set; wherein the sample set includes different sample images;

[0043] The training unit is used to train the model to be trained using the sample set to obtain a target model.

[0044] The sample generation method, sample training method and device provided by the embodiment of the present application obtain a first image with a first target object, obtain a target template image associated with a first contour shape of the first target object, and generate a sample image based on the target template image and the first image. In this way, by generating a sample image of the first target object through a target template image with a first contour shape, a large number of sample images corresponding to the first target object can be quickly obtained, which solves the problem that a large amount of manpower and material resources must be spent to obtain sample data, resulting in low sample data collection efficiency, and realizes the process of obtaining a large number of sample data samples through less sample data, reducing the sample data collection cycle and improving the sample data collection efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 A schematic diagram of a flow chart of a sample generation method provided in an embodiment of the present application;

[0046] Figure 2 is a flowchart of another sample generation method provided in an embodiment of the present application;

[0047] Figure 3 A schematic diagram of a flow chart of another sample generation method provided in an embodiment of the present application;

[0048] Figure 4 A second image including an application scenario of a hand-held can provided in an embodiment of the present application;

[0049] Figure 5 A reference template image including an application scenario of a handheld can-shaped can provided in an embodiment of the present application;

[0050] Figure 6 Another reference template image provided in the embodiment of the present application;

[0051] Figure 7 A schematic diagram of an application scenario provided for an embodiment of the present application;

[0052] Figure 8 A flow chart of a sample training method provided in an embodiment of the present application;

[0053] Fig. 9 A schematic diagram of the structure of a sample generation device provided in an embodiment of the present application;

[0054] Fig.10 A schematic diagram of the structure of another sample generation device provided in an embodiment of the present application;

[0055] Fig.11 A schematic diagram of the structure of a sample training device provided in an embodiment of the present application;

[0056] Fig.12 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0057] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.

[0058] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.

[0059] 1) Data mining is a computational process that uses the intersection of artificial intelligence, machine learning, statistics, and databases to discover patterns in relatively large data sets.

[0060] 2) Training data refers to the data used to train the data mining model during the data mining process. The selection of training data generally has the following requirements: the data sample should be as large as possible, the data should be diversified, and the data sample quality should be high.

[0061] The embodiment of the present application provides a sample generation method, referring to Figure 1 As shown, the method is applied to an electronic device, and the method comprises the following steps:

[0062] Step 101: Acquire a first image having a first target object.

[0063] In an embodiment of the present application, the first target object may be any product having a certain contour shape, and the first image is obtained by photographing the appearance of the first target object. The first image may be acquired by an image acquisition unit such as a camera that has a communication connection with the electronic device, or may be downloaded by the electronic device from the Internet. Correspondingly, the first image acquired by the electronic device may be an image currently acquired by the electronic device through the image acquisition unit, or an image acquired by the electronic device from a historical image acquisition unit of the storage unit corresponding to the electronic device, or an image acquired by the electronic device from the Internet. Alternatively, the first image may also be acquired by other electronic devices and sent to the electronic device.

[0064] The electronic device may be a server, a computer device, or an intelligent electronic device, etc. Intelligent electronic devices include devices such as smart phones and tablet computers.

[0065] Step 102: Acquire a target template image associated with a first contour shape of a first target object.

[0066] The target template image includes a target application scenario.

[0067] In an embodiment of the present application, the first contour shape refers to the contour shape of the first target object in the first image. The target template image is a reference template image that is pre-made and stored in a storage area corresponding to the electronic device. The storage area for storing the target template image can be a local storage unit of the electronic device or a cloud storage unit accessible to the electronic device. The target template image that has an associated relationship with the first contour shape of the first target object refers to a reference template image that has a contour shape area that matches the first contour shape.

[0068] The electronic device obtains a reference template image having a contour area matching the first contour shape from a storage area corresponding to the electronic device to obtain a target template image.

[0069] Step 103: Generate a sample image based on the target template image and the first image.

[0070] In the embodiment of the present application, the target template image and the first image are processed to obtain a sample image. In this way, a sample image corresponding to the first target object in the target application scenario can be quickly obtained, so that the user does not need to spend a lot of time and energy to collect the sample image of the first target object in the target application scenario, which reduces the consumption of human and material resources of the user, and also reduces the time cost of the user to obtain the corresponding sample image, thereby improving the efficiency of the user in obtaining the sample image corresponding to the first target object in the target application scenario.

[0071] The sample generation method provided by the embodiment of the present application obtains a first image having a first target object, obtains a target template image associated with a first contour shape of the first target object, and generates a sample image based on the target template image and the first image. In this way, by generating a sample image of the first target object through a target template image having a first contour shape, a large number of sample images corresponding to the first target object can be quickly obtained, which solves the problem that a large amount of manpower and material resources must be spent to obtain sample data, resulting in low sample data collection efficiency, and realizes the process of obtaining a large number of sample data samples through less sample data, reducing the sample data collection cycle and improving the sample data collection efficiency.

[0072] Based on the above embodiments, the present application provides a sample generation method, referring to Figure 2 As shown, the method is applied to an electronic device, and the method comprises the following steps:

[0073] Step 201: Acquire a first image having a first target object.

[0074] In the embodiment of the present application, taking the first target object as the photographing object as an example for description, the electronic device photographs the first target object through an image acquisition unit provided on the electronic device to obtain a first image.

[0075] Step 202: Acquire a target template image associated with a first contour shape of a first target object.

[0076] In an embodiment of the present application, the electronic device obtains a target image template having a first contour shape from a corresponding storage unit.

[0077] In other embodiments of the present application, step 202 may be implemented by steps 202a to 202b:

[0078] Step 202a: Determine the template database.

[0079] In the embodiment of the present application, a database is stored in a storage unit corresponding to the electronic device. The database may be a large database, which includes multiple sub-databases, each of which corresponds to a reference template image of a contour shape in different application scenarios. Correspondingly, when the electronic device determines the template database, it may determine a sub-database from the database according to the first contour shape, and determine the determined sub-database as the template database.

[0080] Alternatively, the storage unit includes a plurality of databases for storing different data, one of which is a template database. Correspondingly, the electronic device determines the template database, that is, the electronic device determines the template database for storing the reference template image for obtaining the sample image from the plurality of different databases. At this time, the template database stores a large number of reference template images of different contour shapes in different application scenarios.

[0081] Step 202b: Obtain a target template image from a template database.

[0082] The target template image includes a target application scenario.

[0083] In an embodiment of the present application, the electronic device obtains a target template image having a first contour shape in a target application scenario from a template database.

[0084] Step 203: Generate a sample image based on the target template image and the first image.

[0085] In an embodiment of the present application, the electronic device performs a fusion process on the target image and the first image to generate a sample image corresponding to the first target object, so that the model to be trained can be subsequently used to perform sample training on the obtained sample image to implement model training and obtain a target model corresponding to the first target object.

[0086] In other embodiments of the present application, step 203 may be implemented by steps 203a to 203c:

[0087] Step 203a: determine the identification area in the target template image to be processed using the target processing mode.

[0088] In the embodiment of the present application, the target processing mode is a mode for processing the first contour shape area in the target template image, for example, the area where the first contour shape of the target template image is located is filled with green. The identification area is the area where the first contour shape is located in the target template image, and the target processing mode is used for processing.

[0089] Step 203b: Acquire a target image matching the identified area from the image area where the first target object is located.

[0090] In the embodiment of the present application, in some application scenarios, the identification area may be smaller than or equal to the image area where the first target object is located due to partial occlusion of the application scenario. Therefore, it is necessary to obtain a target image with a consistent identification area size and a consistent contour area from the image area where the first target object is located. The target image is an image including the first target object.

[0091] Step 203c: display the target image in the marked area of ​​the target template image to obtain a sample image.

[0092] In the embodiment of the present application, the electronic device sets the target image in the identification area of ​​the target template image for display, thereby obtaining a sample image.

[0093] It should be noted that, for the description of the same steps and the same contents in this embodiment as those in other embodiments, reference can be made to the description in other embodiments and will not be repeated here.

[0094] The sample generation method provided by the embodiment of the present application obtains a first image having a first target object, obtains a target template image associated with a first contour shape of the first target object, and generates a sample image based on the target template image and the first image. In this way, by generating a sample image of the first target object through a target template image having a first contour shape, a large number of sample images corresponding to the first target object can be quickly obtained, which solves the problem that a large amount of manpower and material resources must be spent to obtain sample data, resulting in low sample data collection efficiency, and realizes the process of obtaining a large number of sample data samples through less sample data, reducing the sample data collection cycle and improving the sample data collection efficiency.

[0095] Based on the above embodiments, the present application provides a sample generation method, referring to Figure 3 As shown, the method is applied to an electronic device, and the method comprises the following steps:

[0096] Step 301: Acquire a second image having a second target object in a specific application scenario.

[0097] The contour shape of the second target object is a second contour shape.

[0098] In the embodiment of the present application, the second image is acquired in the same manner as the first image, that is, the second image may be acquired by an image acquisition unit such as a camera that has a communication connection with the electronic device, or may be downloaded by the electronic device from the Internet. Correspondingly, the second image acquired by the electronic device may be an image currently acquired by the electronic device through the image acquisition unit, an image acquired by the electronic device from a storage unit corresponding to the electronic device, or an image acquired by the electronic device from the Internet. Alternatively, the second image may also be acquired by other electronic devices and then sent to the electronic device.

[0099] Step 302: Determine a target area of ​​the second contour shape in the second image.

[0100] In the embodiment of the present application, the target area is the area where the second contour shape is located in the second image.

[0101] Step 303: Generate a reference template image for a specific application scenario based on the target area of ​​the second image.

[0102] In an embodiment of the present application, a target area of ​​the second image is processed using a target processing mode to obtain a reference template image in a specific application scenario.

[0103] Step 304: Store the reference template image.

[0104] In an embodiment of the present application, the electronic device may store the reference template image in a pre-established template database for storing reference template images. The template database may be stored in a local storage area of ​​the electronic device or in a cloud storage area accessible to the electronic device.

[0105] In the embodiment of the present application, the electronic device repeatedly performs steps 301 to 304 to obtain a large number of reference template images. If a large number of reference template images are stored in a pre-established database for storing images, a template database that can be used later can be obtained. In this way, since a template database with a large number of reference template images is pre-established, the reference template images in the template database can be quickly called, which improves the efficiency of obtaining sample images and ensures the quality of sample images.

[0106] It should be noted that in some implementations, steps 301 to 304 can be implemented separately as needed. In some implementations, each time steps 305 to 313 are executed, steps 301 to 304 do not need to be executed every time, that is, steps 301 to 304 are executed in advance, and when steps 305 to 313 are executed, the corresponding reference template image has been stored in the corresponding template database as the target template image corresponding to the second image. In some application scenarios, the electronic device that executes steps 301 to 304 and the electronic device that executes steps 305 to 313 may not be the same electronic device.

[0107] Step 305: Acquire a first image having a first target object.

[0108] Step 306: Determine the template database.

[0109] Step 307: Obtain a target template image from a template database.

[0110] The target template image includes a target application scenario.

[0111] Step 308: Determine the identification area in the target template image to be processed using the target processing mode.

[0112] Step 309: Acquire a target image matching the identified area from the image area where the first target object is located.

[0113] Step 310: Display the target image in the marked area of ​​the target template image to obtain a sample image.

[0114] In other embodiments of the present application, step 310 may be implemented by the following steps: using the target image to replace or cover the object in the identification area of ​​the target template image to obtain a sample image.

[0115] In the embodiment of the present application, the electronic device performs image synthesis processing on the target image and the target template image, specifically, the target image is used to replace the object in the identification area of ​​the target template image, that is, after deleting the object in the identification area, the target image is synthesized to the target area, thereby obtaining a sample image, so that the size of the sample image can be reduced. Alternatively, the target image is used to cover the object in the identification area of ​​the target template image, thereby obtaining a sample image. Since the object in the identification area does not need to be deleted, the process of obtaining the sample image is relatively simple, shortening the operation process.

[0116] Step 311: Obtain identification information of the first target object.

[0117] In the embodiment of the present application, the identification information of the first target object is identity information used to uniquely identify the first target object, for example, it may be product identification information corresponding to the first target object.

[0118] In other embodiments of the present application, step 311 may be implemented through steps a11 to a12:

[0119] Step a11: receiving identification information of a first target object sent by a client device.

[0120] In the embodiment of the present application, the client device may be a computer device, or an intelligent electronic device including a smart phone, a tablet computer, etc. The identification information of the first target object may be barcode information or QR code information for identifying the first target object.

[0121] The user performs corresponding operations on the client device, such as inputting the product name of the first target object on the client device, or collecting the barcode information or QR code information of the first target object through the image acquisition unit of the client device. In this way, the client device can obtain the identification information of the first target object and send the obtained identification information to the electronic device.

[0122] Step a12: Determine identification information of the first target object according to the identification information.

[0123] In the embodiment of the present application, the electronic device identifies the identification information sent by the client device to determine the identification information of the first target object. In some application scenarios, the user can also directly enter the identification information of the first target object in the client device, such as the product name of the first target object, so that the client device can directly send the product name of the first target object to the electronic device.

[0124] Step 312: Use the identification information to identify the sample image to obtain the identified sample image.

[0125] In the embodiment of the present application, the electronic device may identify the sample image by naming the sample image using identification information.

[0126] Step 313: store the marked sample image.

[0127] In an embodiment of the present application, the electronic device stores the labeled sample images so that the sample images can be used for model training later.

[0128] In some application scenarios, when the electronic device is executing step 307, if the application scenario included in the first image is not in the template database, or if the first contour shape of the first target object included in the first image is not in the template database, the area where the first contour shape of the first target object of the first image is located can be processed using the target processing mode to obtain the corresponding reference template image and store it in the corresponding template database, thereby realizing automatic updating of the template database. The specific implementation process of processing the area where the first contour shape of the first target object of the first image is located using the target processing mode to obtain the corresponding reference template image and store it in the corresponding template database can refer to steps 301 to 304, which will not be described in detail here.

[0129] Based on the above embodiments, the present application embodiment provides an application scenario for generating a reference template image, such as Figure 4 As shown, it is a second image of the application scene of the handheld canned product 1 captured by the electronic device, wherein the second target object is a canned product. Figure 4 The second image shown in FIG. 1 is processed, and the obtained reference template image can be Figure 5 As shown. Figure 5 In the example, the target area is the filling area A, and the target processing mode used may be the green filling processing mode, that is, the target area A is filled with a color with a red, green, and blue (RGB) pixel value of (0, 255, 0), thereby obtaining a reference template image of a handheld can. Figure 5 The reference template image shown in FIG. 1 is stored in the template database. In the template database, in addition to storing Figure 5 In addition to the reference template image of the can-shaped can shown in FIG. Figure 6 The reference template images of contour shapes B and C in different application scenarios are shown.

[0130] In the client device, the user can log in to the corresponding user interface webpage through the client device and enter product information in the user interface webpage, and the product information includes at least one of the following: product name, barcode and product type; in some application scenarios, the user can also select the type and size of the product packaging; the user uploads a certain number of product images according to the prompt information generated by the user interface webpage, wherein the number of uploaded product images is determined by the user interface webpage according to the packaging type.

[0131] On the electronic equipment side, such as Figure 7 As shown, D1 is a certain number of product images sent by the client device and received by the electronic device; the electronic device determines the contour shape of the product in the product image; based on the determined product contour shape, retrieves at least one corresponding target template image from the template database, such as Figure 7 As shown in D2 in the figure; obtain the target image in the product contour shape area from the product image; replace the image in the marked area in the target template image with the target image, and obtain the sample image corresponding to the product as shown in Figure 7 As shown in D3 in . In this way, batches of sample images can be obtained quickly.

[0132] It should be noted that, for the description of the same steps and the same contents in this embodiment as those in other embodiments, reference can be made to the description in other embodiments and will not be repeated here.

[0133] The sample generation method provided in the embodiment of the present application obtains a first image having a first target object, obtains a target template image associated with a first contour shape of the first target object, and generates a sample image based on the target template image and the first image. In this way, by generating a sample image of the first target object through a target template image having a first contour shape, a large number of sample images corresponding to the first target object can be quickly obtained, which solves the problem that a large amount of manpower and material resources must be spent to obtain sample data, resulting in low efficiency in collecting sample data. The process of obtaining a large number of sample data samples through less sample data is realized, the cycle of sample data collection is reduced, and the efficiency of collecting sample data is improved. Furthermore, the reference template image stored in the template database can be automatically generated by an electronic device, which improves the generation efficiency of the reference template image.

[0134] Based on the above embodiments, the present application provides a sample training method. Figure 8 As shown, the method is applied to an electronic device, and the method comprises the following steps:

[0135] Step 401: Acquire a first image having a first target object.

[0136] Step 402: Acquire a set of template images associated with a first contour shape of a first target object.

[0137] The template image set includes multiple target template images with different application scenarios.

[0138] In the embodiment of the present application, the template image set associated with the first contour shape of the first target object can be obtained by the electronic device from a template database. The process of obtaining each target template image in the template image set can refer to steps 301 to 304 in the aforementioned embodiment, which will not be described in detail here.

[0139] Step 403: Generate a sample set based on the first image and the template image set.

[0140] The sample set includes different sample images.

[0141] In an embodiment of the present application, the electronic device determines an identification area in each target template image in a template image set that is processed using a target processing mode; obtains a target image matching each identification area from an image area where a first target object included in a first image is located; and displays each target image in the identification area of ​​the corresponding target template image, thereby obtaining a sample image set corresponding to the first target object.

[0142] Step 404: Use the sample set to train the to-be-trained model to obtain a target model.

[0143] In the embodiment of the present application, the target model may be a model for identifying a product. Correspondingly, step 404 may be implemented by using a model training method.

[0144] In some application scenarios, after obtaining the target model, the user inputs an image of a product through a client device, and the target model can quickly output the identification information of the product, such as the product name and / or the type of the product.

[0145] It should be noted that, for the description of the same steps and the same contents in this embodiment as those in other embodiments, reference can be made to the description in other embodiments and will not be repeated here.

[0146] The sample training method provided in the embodiment of the present application obtains a first image with a first target object, obtains a set of template images associated with the first contour shape of the first target object, generates a sample set based on the first image and the set of template images, and uses the sample set to train the model to be trained to obtain a target model. In this way, by obtaining a set of template images associated with the first contour shape of the first target object and a first image with the first template object, a sample set is generated, and the sample set is used to train the model to be trained to obtain a target model, which solves the problem that a large amount of manpower and material resources must be spent to obtain sample data, resulting in low efficiency in sample data collection, and realizes the process of obtaining a large number of sample data samples through less sample data, reducing the cycle of sample data collection and improving the efficiency of sample data collection. Furthermore, a rapidly generated sample set is used to train the model to be trained to obtain a target model, thereby improving the efficiency of model training.

[0147] Based on the above embodiments, the embodiments of the present application provide a sample generation device, which can be applied to Figures 1 to 3 In the sample generation method provided in the corresponding embodiment, refer to Fig. 9 As shown, the sample generating device 5 comprises: a first acquiring unit 51, a second acquiring unit 52 and a first generating unit 53; wherein:

[0148] A first acquisition unit 51 is used to acquire a first image having a first target object;

[0149] A second acquisition unit 52 is used to acquire a target template image associated with a first contour shape of a first target object; wherein the target template image includes a target application scene;

[0150] The first generating unit 53 is configured to generate a sample image based on the target template image and the first image.

[0151] In other embodiments of the present application, the second acquisition unit 52 includes: a first determination module and a first acquisition module; wherein:

[0152] A determination module, used for determining a template database;

[0153] The first acquisition module is used to acquire a target template image from a template database.

[0154] In other embodiments of the present application, refer to Fig.10 As shown, the sample generation device further includes: a fifth acquisition unit 54, a determination unit 55, a second generation unit 56 and a storage unit 57; wherein:

[0155] A fifth acquisition unit 54 is used to acquire a second image having a second target object in a specific application scenario; wherein the contour shape of the second target object is a second contour shape;

[0156] A determination unit 55, configured to determine a target area of ​​the second contour shape in the second image;

[0157] A second generating unit 56, configured to generate a reference template image in a specific application scenario based on the target area of ​​the second image;

[0158] The storage unit 57 is used to store the reference template image.

[0159] In other embodiments of the present application, the second generating unit includes: a second determining module and a first processing module; wherein:

[0160] A second determination module is used to determine a target processing mode;

[0161] The first processing module is used to process the target area of ​​the second image using a target processing mode to obtain a reference template image.

[0162] In other embodiments of the present application, the first generating unit includes: a third determining module, a second acquiring module and a second processing module; wherein:

[0163] A third determination module is used to determine a marked area in the target template image that is processed using the target processing mode;

[0164] A second acquisition module is used to acquire a target image matching the marked area from the image area where the first target object is located;

[0165] The second processing module is used to display the target image in the marked area of ​​the target template image to obtain a sample image.

[0166] In other embodiments of the present application, the second processing module is specifically used to implement the following steps:

[0167] The target image is used to replace or cover the object in the marked area of ​​the target template image to obtain a sample image.

[0168] In other embodiments of the present application, refer to Fig.10 As shown, the sample generation device further includes: a sixth acquisition unit 58 and an identification unit 59; wherein:

[0169] A sixth acquisition unit 58, configured to acquire identification information of the first target object;

[0170] An identification unit 59 is used to identify the sample image using the identification information to obtain the identified sample image;

[0171] The storage unit 57 is also used to store the marked sample images.

[0172] It should be noted that the explanation of the steps between the modules or units in the embodiments of the present application can refer to Figures 1 to 3 The implementation process of the sample generation method provided in the corresponding embodiment will not be repeated here.

[0173] The sample generation device provided in the embodiment of the present application generates a sample image of the first target object by using a target template image having a first contour shape, and can quickly obtain a large number of sample images corresponding to the first target object, thereby solving the problem that a large amount of manpower and material resources must be spent to obtain sample data, resulting in low efficiency in collecting sample data. The device realizes the process of obtaining a large number of sample data samples from less sample data, reduces the cycle of sample data collection, and improves the efficiency of collecting sample data.

[0174] Based on the above embodiments, the present application provides a sample training device, which can be applied to Figure 8 In the sample training method provided in the corresponding embodiment, refer to Fig.11 As shown, the sample training device 11 includes: a third acquisition unit 61, a fourth acquisition unit 62, a second processing unit 63 and a training unit 64, wherein:

[0175] A third acquisition unit 61 is used to acquire a first image having a first target object;

[0176] A fourth acquisition unit 62 is used to acquire a set of template images associated with the first contour shape of the first target object; wherein the set of template images includes a plurality of target template images with different application scenarios;

[0177] The second processing unit 63 is used to generate a sample set based on the first image and the template image set; wherein the sample set includes different sample images;

[0178] The training unit 64 is used to train the to-be-trained model using the sample set to obtain a target model.

[0179] It should be noted that the explanation of the steps between the modules or units in the embodiments of the present application can refer to Figure 8 The implementation process of the sample training method provided in the corresponding embodiment will not be repeated here.

[0180] The embodiment of the present application provides a sample training device, which generates a sample set by acquiring a template image set associated with a first contour shape of a first target object and a first image having a first template object, and uses the sample set to train a model to be trained to obtain a target model, thereby solving the problem that a large amount of manpower and material resources must be spent to obtain sample data, resulting in low efficiency in sample data collection, and realizing the process of obtaining a large number of sample data samples through less sample data, thereby reducing the cycle of sample data collection and improving the efficiency of sample data collection. Furthermore, a rapidly generated sample set is used to train a model to be trained to obtain a target model, thereby improving the efficiency of model training.

[0181] Based on the above embodiments, the present application also provides an electronic device, which can be used to implement the following Figures 1 to 3 The sample generation method shown, or Figure 8 The sample training method shown is shown in Fig.12 As shown, the electronic device 7 may include: a processor 71, a memory 72 and a communication bus 73, wherein:

[0182] Memory 72, including storage of sample generation program and / or sample training program;

[0183] A communication bus 73, used to realize the communication connection between the processor 71 and the memory 72;

[0184] The processor 71 is used to execute the sample generation program and / or the sample training program stored in the memory 72, and is specifically implemented as follows: Figures 1 to 3 The sample generation method shown, or Figure 8 The sample training method shown will not be described in detail here.

[0185] Based on the foregoing embodiments, the embodiments of the present application further provide a computer-readable storage medium, which stores one or more programs, and the one or more programs can be executed by one or more processors to implement the following. Figures 1 to 3 The sample generation method shown, or Figure 8 The sample training method shown will not be described in detail here.

[0186] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of hardware embodiments, software embodiments, or embodiments in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) that contain computer-usable program code.

[0187] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes 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 generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0188] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0189] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0190] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application.

Claims

1. A sample generation method, the method comprising: Acquire a first image having a first target object; Acquire a target template image associated with a first contour shape of the first target object; wherein the target template image includes a target application scene; Determine a marked area in the target template image that is processed using a target processing mode; the marked area is a region in the target template image where the first contour shape is located; Acquire a target image matching the identified area from the image area where the first target object is located; The target image is used to replace or cover the object in the marked area of ​​the target template image to obtain a sample image.

2. The method according to claim 1, wherein obtaining a target template image associated with a first contour shape of the first target object comprises: Determine the template database; The target template image is acquired from the template database.

3. The method according to claim 1, further comprising: Acquire a second image having a second target object in a specific application scenario; wherein the contour shape of the second target object is a second contour shape; determining a target area of ​​the second contour shape in the second image; generating a reference template image for the specific application scenario based on the target area of ​​the second image; The reference template image is stored.

4. The method according to claim 3, wherein generating a reference template image in the specific application scenario based on the target area of ​​the second image comprises: Determine the target processing mode; The target area of ​​the second image is processed using the target processing mode to obtain the reference template image.

5. The method according to claim 1 or 3, further comprising: Acquire identification information of the first target object; Using the identification information to identify the sample image, to obtain a identified sample image; The marked sample image is stored.

6. A sample training method, the method comprising: Acquire a first image having a first target object; Acquire a set of template images associated with the first contour shape of the first target object; wherein the set of template images includes a plurality of target template images with different application scenarios; Determine a marked area in each target template image in the template image set that is processed using a target processing mode; the marked area is an area in the target template image where the first contour shape is located; Acquire a target image matching each of the identified areas from an image area where a first target object included in the first image is located; Using each of the target images to replace or cover the object in the identification area of ​​the corresponding target template image to obtain a sample set; wherein the sample set includes different sample images; The sample set is used to train the model to be trained to obtain a target model.

7. A sample generation device, the device comprising: A first acquisition unit, a second acquisition unit and a first generation unit, wherein: The first acquisition unit is used to acquire a first image having a first target object; The second acquisition unit is used to acquire a target template image associated with the first contour shape of the first target object; wherein the target template image includes a target application scene; The first generating unit is used to determine an identification area in the target template image that is processed using a target processing mode; the identification area is the area in the target template image where the first contour shape is located; obtain a target image that matches the identification area from the image area where the first target object is located; and use the target image to replace or cover the object in the identification area of ​​the target template image to obtain a sample image.

8. A sample training device, comprising: A third acquisition unit, a fourth acquisition unit, a second processing unit and a training unit, wherein: The third acquisition unit is used to acquire a first image having a first target object; The fourth acquisition unit is used to acquire a set of template images associated with the first contour shape of the first target object; wherein the set of template images includes a plurality of target template images with different application scenarios; The second processing unit is used to determine the identification area processed by the target processing mode in each target template image in the template image set; the identification area is the area where the first contour shape is located in the target template image; from the image area where the first target object included in the first image is located, obtain a target image matching each of the identification areas; use each of the target images to replace or cover the object in the identification area of ​​the corresponding target template image to obtain a sample set; wherein the sample set includes different sample images; The training unit is used to train the model to be trained using the sample set to obtain a target model.