Training sample generation method, device, electronic device and readable storage medium
By performing multiple image processing on multiple candidate images, redetermine the correction bounding box of each preset object, and generate training samples, the problem of low detection accuracy caused by the larger panoramic image resolution and object distortion in the prior art is solved. A more efficient object detection model training is achieved.
Patent Information
- Application Number
- CN202411479466.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-23
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2044-10-23
AI Technical Summary
The panoramic images generated by the existing image stitching technology cannot accurately simulate the characteristics of the panoramic images due to the larger resolution and the distorted deformation of the object, resulting in the low detection accuracy of the target detection model.
By performing multiple image processing on multiple candidate images, including projection processing, cropping processing and stitching processing, or stitching processing, projecting processing and cropping processing, the correction boundary of each preset object in the intermediate image obtained by the image processing is re-determined. box, generate training samples.
The obtained training samples can more accurately simulate the image characteristics of the panoramic image synthesized by multiple candidate images, and then train the object detection model with higher detection accuracy.
Smart Images

Figure CN119027759B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a training sample generation method, device, electronic device and readable storage medium. Background Art
[0002] Image stitching technology is a major technology for generating panoramic images. It stitches together several overlapping images (which may be obtained at different times, different perspectives, or different sensors) into a seamless high-resolution image. Since the panoramic image obtained by image stitching has a wide viewing angle and ensures a high resolution, the panoramic image can provide a wider field of view and richer scene details in target detection, which can improve the efficiency of target detection.
[0003] Panoramic images generated by existing image stitching technology have higher resolution and objects in them will be greatly distorted, so they cannot simulate the image characteristics that panoramic images should have, resulting in low detection accuracy of target detection models trained using them as training samples. Summary of the invention
[0004] The present invention aims to provide a training sample generation method, device, electronic device and readable storage medium.
[0005] The embodiments of the present invention can be implemented as follows:
[0006] In a first aspect, the present invention provides a method for generating a training sample, the method comprising:
[0007] Acquire multiple candidate images and an original bounding box where each preset object in each candidate image is located;
[0008] Starting from the multiple candidate images, multiple image processings are performed, in each image processing, each current image is processed to obtain a corresponding intermediate image, and a corrected bounding box of each preset object in the intermediate image corresponding to the current image to which it belongs is determined according to a reference bounding box of each preset object in the current image to which it belongs, the multiple image processings include sequentially performing projection processing, cropping processing and splicing processing or the multiple image processings include sequentially performing splicing processing, projection processing and cropping processing;
[0009] After the multiple image processings are completed, the intermediate image obtained last time is used as a sample image of the training sample, and the corrected bounding box of each of the preset objects determined last time is used as a label corresponding to the sample image.
[0010] In an optional embodiment, when the secondary image processing is projection processing, when the multiple image processings include sequentially performing projection processing, cropping processing and stitching processing, the current image is multiple, and one current image is one candidate image; when the multiple image processings include sequentially performing stitching processing, projection processing and cropping processing, the current image is one, and the current image is an intermediate image obtained by stitching processing; the step of performing image processing on each current image to obtain a corresponding intermediate image includes:
[0011] Acquire a preset template image having the same size as each of the current images;
[0012] For any target pixel point among the multiple pixel points in each of the current images, performing cylindrical projection transformation on the coordinates of the target pixel point to obtain the target projection coordinates of the target pixel point;
[0013] If the target projection coordinates do not exceed the boundary of the preset template image, then the pixel value of the pixel point located at the target projection coordinates in the preset template image is updated with the pixel value of the target pixel point;
[0014] Each pixel point in each of the current images is used as the target pixel point one by one, the pixel value of the corresponding pixel point in the preset template image is updated, and the updated preset template image corresponding to each of the current images is used as the intermediate image corresponding to each of the current images.
[0015] In an optional implementation, the step of determining, based on a reference bounding box of each preset object in the current image to which it belongs, a corrected bounding box of each preset object in an intermediate image corresponding to the current image to which it belongs comprises:
[0016] Obtaining the coordinates of each vertex of each of the plurality of vertices of a reference bounding box of each of the preset objects in the current image to which it belongs in a preset image coordinate system;
[0017] Performing projection transformation on each vertex coordinate of the reference bounding box of each of the preset objects respectively to obtain transformation coordinates corresponding to each vertex coordinate of the reference bounding box of each of the preset objects;
[0018] The minimum value and the maximum value of all transformed coordinates of the reference bounding box of each preset object are respectively used as the upper left corner coordinate and the lower right corner coordinate to generate a corrected bounding box of each preset object in the intermediate image corresponding to the current image to which it belongs.
[0019] In an optional embodiment, when the secondary image processing is cropping processing, when the multiple image processings include sequentially performing projection processing, cropping processing and stitching processing, the current image is multiple, and one of the current images is an intermediate image obtained by performing projection processing on a candidate image; when the multiple image processings include sequentially performing stitching processing, projection processing and cropping processing, the current image is one, and the current image is an intermediate image obtained by the projection processing; the step of performing image processing on each current image to obtain a corresponding intermediate image includes:
[0020] Determine a first reference coordinate according to the width of the current image and a preset cylindrical radius used for cylindrical projection, and determine a first cropping range according to the first reference coordinate;
[0021] Determine a second reference coordinate according to the height of the current image and determine a second cropping range according to the second reference coordinate;
[0022] The current image is cropped along the x-axis direction and the y-axis direction in a preset image coordinate system according to the first cropping range and the second cropping range respectively, to obtain an intermediate image corresponding to the current image.
[0023] In an optional implementation, the step of determining, based on a reference bounding box of each preset object in the current image to which it belongs, a corrected bounding box of each preset object in an intermediate image corresponding to the current image to which it belongs comprises:
[0024] Acquire first vertex coordinates and second vertex coordinates of a first vertex and a second vertex of a reference bounding box for determining each of the preset objects in the current image to which the preset object belongs in a preset image coordinate system;
[0025] According to the first reference coordinates, respectively adjusting the x-axis coordinates of the first vertex coordinates and the x-axis coordinates of the second vertex coordinates of each of the preset objects to obtain a first x-axis coordinate and a second x-axis coordinate;
[0026] Respectively use the y-axis coordinates of the first vertex coordinates and the y-axis coordinates of the second vertex coordinates of each of the preset objects as the first y-axis coordinate and the second y-axis coordinate;
[0027] Determine a first coordinate point of each of the preset objects according to the first x-axis coordinate and the first y-axis coordinate of each of the preset objects, and determine a second coordinate point of each of the preset objects according to the second x-axis coordinate and the second y-axis coordinate of each of the preset objects;
[0028] A corrected bounding box of each preset object in an intermediate image corresponding to the current image to which the preset object belongs is generated according to the first coordinate point and the second coordinate point of each preset object.
[0029] In an optional implementation, when the secondary image processing is a stitching process, the step of performing image processing on each current image to obtain a corresponding intermediate image includes:
[0030] According to the preset height offset, each of the current images is sequentially spliced in the width direction to obtain a corresponding intermediate image.
[0031] In an optional implementation, the step of determining, based on the reference bounding box of each preset object in the current image to which it belongs, a corrected bounding box of each preset object in the intermediate image corresponding to the current image to which it belongs comprises:
[0032] Acquire first vertex coordinates and second vertex coordinates of a first vertex and a second vertex of a reference bounding box for determining each of the preset objects in the current image to which the preset object belongs in a preset image coordinate system;
[0033] According to the position of the current image of each of the preset objects in the intermediate image, respectively adjusting the x-axis coordinates of the first vertex coordinates and the x-axis coordinates of the second vertex coordinates of each of the preset objects to obtain the first x-axis coordinates and the second x-axis coordinates;
[0034] According to the preset height offset, the y-axis coordinates of the first vertex coordinates and the y-axis coordinates of the second vertex coordinates of each of the preset objects are adjusted respectively to obtain the first y-axis coordinate and the second y-axis coordinate;
[0035] Determine a first coordinate point of each of the preset objects according to the first x-axis coordinate and the first y-axis coordinate of each of the preset objects, and determine a second coordinate point of each of the preset objects according to the second x-axis coordinate and the second y-axis coordinate of each of the preset objects;
[0036] A corrected bounding box of each preset object in an intermediate image corresponding to the current image to which the preset object belongs is generated according to the first coordinate point and the second coordinate point of each preset object.
[0037] In a second aspect, the present invention provides a training sample generating device, the device comprising:
[0038] An acquisition module, used for acquiring a plurality of candidate images and an original bounding box where each preset object in each of the candidate images is located;
[0039] a processing module, configured to perform multiple image processings starting from the multiple candidate images, wherein in each image processing, each current image is processed to obtain a corresponding intermediate image, and a corrected bounding box of each preset object in the intermediate image corresponding to the current image to which it belongs is determined according to a reference bounding box of each preset object in the current image to which it belongs, wherein the multiple image processings include sequentially performing projection processing, cropping processing and splicing processing or sequentially performing splicing processing, projection processing and cropping processing;
[0040] The processing module is further used to, after the multiple image processings are completed, use the intermediate image obtained last time as a sample image of a training sample and use the corrected bounding box of each of the preset objects determined last time as a label corresponding to the sample image.
[0041] In a third aspect, the present invention provides an electronic device, comprising a processor and a memory, wherein the memory is used to store a program, and the processor is used to implement a training sample generation method as described in any one of the aforementioned embodiments when executing the program.
[0042] In a fourth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the training sample generation method as described in any one of the aforementioned embodiments.
[0043] The present invention sequentially projects, crops and splices a plurality of candidate images, or sequentially splices, projects and crops them. In each image processing, each current image is processed to obtain a corresponding intermediate image, and a corrected bounding box of each preset object in the corresponding intermediate image is determined according to a reference bounding box of the preset object in the current image to which it belongs. The intermediate image obtained last time is used as a sample image of a training sample, and the corrected bounding box of each preset object determined last time is used as a label corresponding to the sample image. Since the corrected bounding box of each preset object in the intermediate image obtained by image processing is re-determined for each image processing, the training samples obtained in this way can more accurately simulate the image features of a panoramic image synthesized by a plurality of candidate images, and then a higher accuracy model can be trained using the training samples. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0045] Figure 1 This is an example flowchart of the training sample generation method provided in this embodiment.
[0046] Figure 2 This is an example diagram of an image obtained by projecting and then cropping provided in this embodiment.
[0047] Figure 3 This is an example diagram of an image obtained after the stitching process provided in this embodiment.
[0048] Figure 4 This is a block diagram of an example of a training sample generating device provided in this embodiment.
[0049] Figure 5 An example block diagram of an electronic device provided in this embodiment.
[0050] Icons: 10 - electronic device; 11 - processor; 12 - memory; 13 - bus; 100 - training sample generating device; 110 - acquisition module; 120 - processing module. DETAILED DESCRIPTION
[0051] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0052] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0053] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0054] In the description of the present invention, it should be noted that if the terms "upper", "lower", "inside", "outside", etc. appear to indicate an orientation or position relationship, they are based on the orientation or position relationship shown in the accompanying drawings, or are the orientation or position relationship in which the product of the invention is usually placed when used. They are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention.
[0055] In addition, the terms “first”, “second”, etc., if used, are merely used to distinguish between the descriptions and should not be understood as indicating or implying relative importance.
[0056] It should be noted that, in the absence of conflict, the features in the embodiments of the present invention may be combined with each other.
[0057] The existing target detection model is trained using a single image (each image is taken from a single perspective). Therefore, when the trained target detection model is used to detect panoramic images, the resolution of the panoramic image becomes larger and the objects in it become smaller, making detection more difficult, resulting in a significant decrease in model accuracy.
[0058] If you want to improve the model accuracy of the target detection model, you can use data augmentation technology to generate training samples. Data augmentation is also called data amplification. In deep learning, data augmentation is to change the input data in a certain way to generate more training samples, thereby improving the generalization ability and effect of the model. Data augmentation can reduce the model's excessive dependence on certain features and reduce the risk of overfitting. However, image enhancement methods such as adding random noise, color jitter, and affine transformation cannot simulate the characteristics of panoramic images and cannot achieve the required model accuracy. You can also use panoramic images to retrain or fine-tune the model, but because it is time-consuming to collect enough panoramic images, or it is restricted by collection permissions, panoramic images cannot be collected at all, and image stitching technology is usually used to generate panoramic images.
[0059] In order to ensure visual consistency and overcome the distortion problem of plane stitching, the existing image stitching technology needs to project the images to be stitched into a standard coordinate system before stitching them together in order to make the stitched panorama look coherent. Image projection usually uses cylindrical projection or spherical projection. On the one hand, after the image is projected on a cylindrical or spherical surface, some objects will be greatly distorted, and the original target detection model cannot adapt to this change well. On the other hand, the stitched images obtained by the existing image stitching technology cannot simulate the characteristics of panoramic images, which increases the false alarm rate and missed alarm rate.
[0060] In view of this, the present embodiment provides a training sample generation method, device, electronic device and readable storage medium, wherein the generated training samples can more accurately simulate the characteristics of panoramic images, and the training samples generated by this method are used to train the target detection model, so that the trained target detection model with high detection accuracy can be obtained. It will be described in detail below.
[0061] Please refer to Figure 1 , Figure 1 This is a flow chart of an example of a training sample generation method provided in this embodiment, the method comprising the following steps:
[0062] Step S101 , obtaining a plurality of candidate images and an original bounding box where each preset object in each candidate image is located.
[0063] In this embodiment, each candidate image is an image acquired from a single viewing angle. Each candidate image contains its own preset object, and the preset object in each candidate image may be one or more.
[0064] In target detection application scenarios, the task of target detection is to find all the targets (objects) of interest in the image and determine their categories and locations. Therefore, a bounding box is usually used to describe the location of the target. The bounding box is a rectangular box that can be determined by the coordinates of the upper left corner and the lower right corner of the rectangular box in the preset image coordinate system. The original bounding box can be manually annotated or the recognition result obtained by using a trained model to perform target recognition on each candidate image.
[0065] Step S102, starting from multiple candidate images, multiple image processing is performed. In each image processing, each current image is processed to obtain a corresponding intermediate image, and a corrected bounding box of each preset object in the intermediate image corresponding to the current image to which it belongs is determined based on a reference bounding box of each preset object in the current image to which it belongs. The multiple image processing includes sequentially performing projection processing, cropping processing and splicing processing, or the multiple image processing includes sequentially performing splicing processing, projection processing and cropping processing.
[0066] In this embodiment, for projection processing and cropping processing, when there are multiple current images, each current image will be projected or cropped in the same way to obtain an intermediate image corresponding to each current image after processing. When there is only one current image, the current image will be projected or cropped to obtain an intermediate image corresponding to the current image after processing. For stitching processing, if there are multiple current images, the multiple current images will be stitched to obtain a stitched intermediate image. At this time, each current image corresponds to the same intermediate image.
[0067] In this embodiment, the reference bounding box of each preset object is the bounding box of each preset object in the current image to which it belongs before the current image processing, and the corrected bounding box of each preset object is the bounding box in the intermediate image obtained after the current image processing.
[0068] It should be noted that when generating training samples, only one of the two methods, namely, sequentially projecting, cropping and splicing, and sequentially splicing, projecting and cropping, can be used to generate training samples. Alternatively, training samples can be generated by sequentially projecting, cropping and splicing a part of the candidate images in the candidate image set, and training samples can be generated by sequentially splicing, projecting and cropping another part of the candidate images in the candidate image set. The training samples generated by these two methods can then be used as training sets to train the target detection model.
[0069] Step S103, after multiple image processings are completed, the intermediate image obtained last time is used as a sample image of a training sample, and the corrected bounding box of each preset object determined last time is used as a label corresponding to the sample image.
[0070] The above method provided in this embodiment performs multiple image processings, and each time the image is processed, the corrected bounding box of each preset object in the intermediate image obtained by the image processing will be re-determined. The training samples thus obtained can more accurately simulate the image features of the panoramic image synthesized from multiple candidate images, and then use the training samples to train a model with higher accuracy.
[0071] For the sake of clarity, this embodiment will use one image processing to illustrate the implementation process of image processing. In fact, this image processing can be one image processing in the manner of sequentially performing projection processing, cropping processing and splicing processing, or one image processing in the manner of sequentially performing splicing processing, projection processing and cropping processing. The implementation methods of the projection processing in these two methods are the same, the implementation methods of the cropping processing in these two methods are also the same, and the implementation methods of the splicing processing in these two methods are also the same. The complete method for generating training samples can include sequentially performing projection processing, cropping processing and splicing processing, and determining the correction bounding box of each preset object after each processing, or can include sequentially performing splicing processing, projection processing and cropping processing, and determining the correction bounding box of each preset object after each processing.
[0072] First, an implementation method when the secondary image processing is projection processing is introduced. In this implementation method, when multiple image processing includes sequential projection processing, cropping processing and splicing processing, there are multiple current images, and one current image is a candidate image; when multiple image processing includes sequential splicing processing, projection processing and cropping processing, there is one previous image, and the current image is an intermediate image obtained by the splicing processing; when the secondary image processing is projection processing, an implementation method of performing image processing on each current image to obtain a corresponding intermediate image is:
[0073] First, obtain a preset template image with the same size as each current image;
[0074] In this embodiment, when there are multiple current images, each current image corresponds to a preset template image of the same size. The preset template image is a blank image, in which the pixel value of each pixel can be set to a preset value, which can be 0 or 255.
[0075] Secondly, for any target pixel point among the multiple pixel points in each current image, a cylindrical projection transformation is performed on the coordinates of the target pixel point to obtain a target projection coordinate of the target pixel point;
[0076] In this embodiment, the current image The width and height of and Indicates that the coordinates of the target pixel in the preset image coordinate system ,in, , , the cylindrical projection transformation can be performed according to the following formula to obtain the target projection coordinates :
[0077] ,in, is the cylinder radius.
[0078] Third, if the target projection coordinates do not exceed the boundary of the preset template image, the pixel value of the pixel point located at the target projection coordinates in the preset template image is updated with the pixel value of the target pixel point;
[0079] In this embodiment, the preset template image is used express, ,in, For preset template images The mid-coordinate position is The pixel value of the pixel point, For the current image The mid-coordinate position is The pixel value of the pixel.
[0080] Finally, each pixel point in each current image is used as a target pixel point one by one, the pixel value of the corresponding pixel point in the preset template image is updated, and the updated preset template image corresponding to each current image is used as the intermediate image corresponding to each current image.
[0081] After performing the above-mentioned projection processing to obtain the intermediate image corresponding to each current image, in order to make the bounding box of each preset object in the obtained intermediate image be in the correct position, this embodiment further provides an implementation method for determining the corrected bounding box of each preset object in the intermediate image corresponding to the current image to which it belongs according to the reference bounding box of each preset object in the current image to which it belongs:
[0082] First, the coordinates of each vertex of a plurality of vertices of a reference bounding box of each preset object in the current image to which it belongs in the preset image coordinate system are obtained;
[0083] In this embodiment, each reference bounding box is generally a rectangular box, and the multiple vertices of the reference bounding box include an upper left vertex, a lower right vertex, a lower left vertex, and an upper right vertex of the reference bounding box.
[0084] Secondly, each vertex coordinate of the reference bounding box of each preset object is projected and transformed to obtain the transformation coordinates corresponding to each vertex coordinate of the reference bounding box of each preset object;
[0085] In this embodiment, each vertex coordinate is projected and transformed in the same manner. For any target vertex coordinate among the multiple vertex coordinates of the reference bounding box of any target preset object, the specific transformation method can be calculated using the following formula:
[0086] ,in, are the target vertex coordinates, is the transformation coordinate corresponding to the target vertex coordinate, is the cylinder radius, and They are respectively the width and height of the intermediate image corresponding to the current image to which the target preset object belongs. Since each current image is the same size as its corresponding preset template image, the intermediate image obtained according to the preset template image is also the same size as the corresponding current image.
[0087] Finally, the minimum and maximum values of all transformed coordinates of the reference bounding box of each preset object are respectively used as the upper left corner coordinate and the lower right corner coordinate to generate a corrected bounding box of each preset object in the intermediate image corresponding to the current image to which it belongs.
[0088] In this embodiment, for any target preset object, the reference bounding box is respectively Represents the transformed coordinates of the upper left corner vertex, the transformed coordinates of the lower right corner vertex, the transformed coordinates of the upper right corner vertex, and the transformed coordinates of the lower left corner vertex of the reference bounding box, then the corresponding upper left corner coordinates of the modified bounding box can be obtained using the following formula:
[0089] ,in, Corrects the upper left corner coordinates of the bounding box for the target prefab object.
[0090] The coordinates of the lower right corner can be obtained using the following formula:
[0091] ,in, Corrects the lower right corner coordinates of the bounding box for the target prefab object.
[0092] The corrected bounding box of each preset object can be obtained by using the above method, and the specific process will not be repeated here.
[0093] Since a black border will appear on the image after projection, in order to avoid the black border affecting the training accuracy, this embodiment also provides a cropping process for the projected image to remove the black border. This embodiment next introduces an implementation method when the secondary image processing is a cropping process. In this implementation method, when multiple image processing includes sequential projection processing, cropping processing and splicing processing, there are multiple current images, and one current image is an intermediate image obtained by projecting a candidate image; when multiple image processing includes sequential splicing processing, projection processing and cropping processing, there is one current image, and the current image is an intermediate image obtained by projection processing; when the secondary image processing is a cropping process, an implementation method of performing image processing on each current image to obtain a corresponding intermediate image is:
[0094] First, a first reference coordinate is determined according to the width of the current image and a preset cylindrical radius used for cylindrical projection, and a first cropping range is determined according to the first reference coordinate;
[0095] In this embodiment, the first reference coordinate can be calculated using the following formula:
[0096] ,in, is the first reference coordinate, is the width of the current image, is the cylinder radius.
[0097] The first clipping range can be expressed as: , which means intercepting the x-axis coordinate from arrive The current image between.
[0098] Secondly, determining a second reference coordinate according to the height of the current image and determining a second cropping range according to the second reference coordinate;
[0099] In this embodiment, the second reference coordinate can be calculated using the following formula:
[0100] ,in, is the second reference coordinate, is the cropping factor, , The width of the current image.
[0101] The second clipping range can be expressed as: , which means intercepting the y-axis coordinate from 0 to The current image between.
[0102] Finally, the current image is cropped along the x-axis direction and along the y-axis direction in the preset image coordinate system according to the first cropping range and the second cropping range, respectively, to obtain an intermediate image corresponding to the current image.
[0103] It should be noted that the first cropping range can be used to accurately crop according to the black border boundary in the current image; is an approximate value. =0.95, the black edge of the y-axis can almost be cut off. =1, it means that the black edge of the y-axis is not cropped. Because there is a small amount of black edge on the y-axis of the current image, it has little effect on the training model, so The value of can be appropriately relaxed.
[0104] After performing the above cropping process to obtain the intermediate image corresponding to each current image, in order to make the bounding box of each preset object in the obtained intermediate image be in the correct position, this embodiment further provides an implementation method for determining the corrected bounding box of each preset object in the intermediate image corresponding to the current image to which it belongs according to the reference bounding box of each preset object in the current image to which it belongs:
[0105] First, obtaining first vertex coordinates and second vertex coordinates of a first vertex and a second vertex of a reference bounding box for determining each preset object in the current image to which the preset object belongs in a preset image coordinate system;
[0106] In this embodiment, the first vertex and the second vertex may be the upper left vertex and the lower right vertex of the reference bounding box, respectively, or the upper right vertex and the lower left vertex of the reference bounding box.
[0107] Secondly, according to the first reference coordinates, the x-axis coordinates of the first vertex coordinates and the x-axis coordinates of the second vertex coordinates of each preset object are adjusted respectively to obtain the first x-axis coordinates and the second x-axis coordinates;
[0108] In this embodiment, taking the first vertex and the second vertex as the coordinates of the upper left corner and the lower right corner of the reference bounding box as an example, the first x-axis coordinate and the second x-axis coordinate can be calculated using the following formula:
[0109] , ,in, is the first reference coordinate, is the first x-axis coordinate, is the x-axis coordinate of the first vertex, is the second x-axis coordinate, The x-axis coordinate of the second vertex.
[0110] Third, the y-axis coordinates of the first vertex coordinates and the y-axis coordinates of the second vertex coordinates of each preset object are respectively used as the first y-axis coordinate and the second y-axis coordinate;
[0111] In this embodiment, taking the first vertex and the second vertex as the coordinates of the upper left corner and the lower right corner of the reference bounding box as an example, since the clipping of the y-axis starts from 0, the first y-axis coordinate and the second y-axis coordinate can be calculated using the following formula:
[0112] , ,in, is the first y-axis coordinate, is the y-axis coordinate of the first vertex, is the second y-axis coordinate, The y-axis coordinate of the second vertex.
[0113] Fourth, determining a first coordinate point of each preset object according to the first x-axis coordinate and the first y-axis coordinate of each preset object, and determining a second coordinate point of each preset object according to the second x-axis coordinate and the second y-axis coordinate of each preset object;
[0114] In this embodiment, the first coordinate point can be expressed as , the second coordinate point can be expressed as .
[0115] Finally, a corrected bounding box of each preset object in the intermediate image corresponding to the current image to which the preset object belongs is generated according to the first coordinate point and the second coordinate point of each preset object.
[0116] In this implementation, the coordinates of the upper left corner vertex and the coordinates of the lower right corner vertex of the modified bounding box may be the first coordinate point and the second coordinate point, respectively.
[0117] In this embodiment, in order to more intuitively show the changes of the image and the bounding box after the image is projected and cropped in sequence, please refer to Figure 2 , Figure 2 This is an example diagram of an image obtained by first projecting and then cropping provided in this embodiment. Figure 2The area obtained after cropping is shown in FIG. 5 , in which there are 5 preset objects. The solid line bounding box of each preset object is its bounding box before projection, and the dotted line bounding box is its bounding box after projection.
[0118] In this embodiment, in order to obtain a corresponding panoramic image according to an image of a single perspective, this embodiment will next introduce an implementation method when the secondary image processing is a stitching process. In this implementation method, when multiple image processing includes sequential projection processing, cropping processing and stitching processing, the stitching process is to stitch multiple images after the cropping process. When multiple image processing includes sequential stitching processing, projection processing and cropping processing, the stitching process is to stitch multiple candidate images. Although the stitching objects of the two are different, the stitching implementation method is the same, and the implementation method is:
[0119] According to the preset height offset, each current image is stitched in sequence in the width direction to obtain the corresponding intermediate image.
[0120] In this embodiment, the preset height offset can be set as needed, but the range of the preset height offset needs to be within In which, , n is the number of current images to be stitched, is the height of the i-th current image, when When , it means splicing along the upper left corner; when , it indicates center stitching.
[0121] As a way to achieve this, you can create a width ,high A blank picture, and paste the cropped pictures onto it one by one. is the width of the i-th current image, It is the sum of the widths of the n current images.
[0122] Since the position of the bounding box of each preset object in the stitched intermediate image will also change after stitching, this embodiment further provides an implementation method for determining the corrected bounding box of each preset object in the intermediate image corresponding to the current image to which it belongs according to the reference bounding box of each preset object in the current image to which it belongs:
[0123] First, obtaining first vertex coordinates and second vertex coordinates of a first vertex and a second vertex of a reference bounding box for determining each preset object in the current image to which the preset object belongs in a preset image coordinate system;
[0124] In this embodiment, the first vertex and the second vertex may be the upper left vertex and the lower right vertex of the reference bounding box, respectively, or the upper right vertex and the lower left vertex of the reference bounding box.
[0125] Secondly, according to the position of the current image of each preset object in the intermediate image, the x-axis coordinates of the first vertex coordinates and the x-axis coordinates of the second vertex coordinates of each preset object are adjusted respectively to obtain the first x-axis coordinates and the second x-axis coordinates;
[0126] In this embodiment, taking the first vertex and the second vertex as the coordinates of the upper left corner and the lower right corner of the reference bounding box as an example, the current image to which the preset object belongs is the i-th image among the multiple current images to be stitched, and the first x-axis coordinate and the second x-axis coordinate can be calculated using the following formula:
[0127] , ,in, is the first x-axis coordinate, is the x-axis coordinate of the first vertex coordinate of the reference bounding box of the preset object in the i-th current image, is the second x-axis coordinate, is the x-axis coordinate of the second vertex coordinate of the reference bounding box in the i-th current image, is the width of the i-th current image.
[0128] Third, according to the preset height offset, the y-axis coordinates of the first vertex coordinates and the y-axis coordinates of the second vertex coordinates of each preset object are adjusted respectively to obtain the first y-axis coordinate and the second y-axis coordinate;
[0129] In this embodiment, each current image corresponds to a preset height offset, and the y-axis coordinate of the reference bounding box of the preset object in each current image is adjusted, which is the preset height offset corresponding to the current image.
[0130] In this embodiment, taking the first vertex and the second vertex as the coordinates of the upper left corner and the lower right corner of the reference bounding box as an example, the first y-axis coordinate and the second y-axis coordinate can be calculated using the following formula:
[0131] , ,in, is the first y-axis coordinate, is the y-axis coordinate of the first vertex of the reference bounding box of the preset object in the i-th current image, is the second y-axis coordinate, is the y-axis coordinate of the second vertex coordinate of the reference bounding box in the i-th current image, The preset height offset of the i-th current image.
[0132] Fourth, determining a first coordinate point of each preset object according to the first x-axis coordinate and the first y-axis coordinate of each preset object, and determining a second coordinate point of each preset object according to the second x-axis coordinate and the second y-axis coordinate of each preset object;
[0133] In this embodiment, the first coordinate point can be expressed as , the second coordinate point can be expressed as .
[0134] Fifth, based on the first coordinate point and the second coordinate point of each preset object, a corrected bounding box of each preset object in the intermediate image corresponding to the current image to which the preset object belongs is generated.
[0135] In this implementation, the coordinates of the upper left corner vertex and the coordinates of the lower right corner vertex of the modified bounding box may be the first coordinate point and the second coordinate point, respectively.
[0136] In this embodiment, in order to more intuitively show the changes of the image and the bounding box after the image is stitched, please refer to Figure 3 , Figure 3 This is an example of an image obtained after the splicing process provided in this embodiment. Figure 3 The image obtained by stitching two images is shown in , there are 8 preset objects in the area, the solid line bounding box of each preset object is its bounding box before projection, and the dotted line bounding box is its bounding box after projection.
[0137] In order to execute the corresponding steps in the above embodiment and each possible implementation method, the following provides a method for implementing the training sample generation device 100. Figure 4 , Figure 4 This is a block diagram of the training sample generating device provided in this embodiment. It should be noted that the basic principle and technical effect of the training sample generating device 100 provided by the present invention are the same as those of the corresponding above-mentioned embodiments, which are not mentioned in this embodiment for the sake of brief description.
[0138] The training sample generating apparatus 100 includes an acquiring module 110 and a processing module 120 .
[0139] An acquisition module 110 is used to acquire a plurality of candidate images and an original bounding box where each preset object in each candidate image is located;
[0140] A processing module 120 is used to perform multiple image processings starting from the multiple candidate images, in each image processing, perform image processing on each current image to obtain a corresponding intermediate image, and determine a corrected bounding box of each preset object in the intermediate image corresponding to the current image to which it belongs according to a reference bounding box of each preset object in the current image to which it belongs, wherein the multiple image processings include sequentially performing projection processing, cropping processing and splicing processing or the multiple image processings include sequentially performing splicing processing, projection processing and cropping processing;
[0141] The processing module 120 is further configured to, after the multiple image processings are completed, use the intermediate image obtained last time as a sample image of a training sample, and use the corrected bounding box of each of the preset objects determined last time as a label corresponding to the sample image.
[0142] In an optional implementation, when the secondary image processing is projection processing, when the multiple image processings include sequentially performing projection processing, cropping processing, and stitching processing, the current image is multiple, and one current image is one candidate image; when the multiple image processings include sequentially performing stitching processing, projection processing, and cropping processing, the current image is one, and the current image is an intermediate image obtained by the stitching processing; the processing module 120 is specifically used to:
[0143] Acquire a preset template image having the same size as each of the current images;
[0144] For any target pixel point among the multiple pixel points in each of the current images, performing cylindrical projection transformation on the coordinates of the target pixel point to obtain the target projection coordinates of the target pixel point;
[0145] If the target projection coordinates do not exceed the boundary of the preset template image, then the pixel value of the pixel point located at the target projection coordinates in the preset template image is updated with the pixel value of the target pixel point;
[0146] Each pixel point in each of the current images is used as the target pixel point one by one, the pixel value of the corresponding pixel point in the preset template image is updated, and the updated preset template image corresponding to each of the current images is used as the intermediate image corresponding to each of the current images.
[0147] In an optional implementation manner, when the processing module 120 is used to determine the corrected bounding box of each preset object in the intermediate image corresponding to the current image to which it belongs according to the reference bounding box of each preset object in the current image to which it belongs, it is specifically used to:
[0148] Obtaining the coordinates of each vertex of each of the plurality of vertices of a reference bounding box of each of the preset objects in the current image to which it belongs in a preset image coordinate system;
[0149] Performing projection transformation on each vertex coordinate of the reference bounding box of each of the preset objects respectively to obtain transformation coordinates corresponding to each vertex coordinate of the reference bounding box of each of the preset objects;
[0150] The minimum value and the maximum value of all transformed coordinates of the reference bounding box of each preset object are respectively used as the upper left corner coordinate and the lower right corner coordinate to generate a corrected bounding box of each preset object in the intermediate image corresponding to the current image to which it belongs.
[0151] In an optional implementation, when the secondary image processing is cropping processing, when the multiple image processings include sequentially performing projection processing, cropping processing, and stitching processing, the current image is multiple, and one of the current images is an intermediate image obtained by performing projection processing on one candidate image; when the multiple image processings include sequentially performing stitching processing, projection processing, and cropping processing, the current image is one, and the current image is an intermediate image obtained by the projection processing; the processing module 120 is further specifically used for:
[0152] Determine a first reference coordinate according to the width of the current image and a preset cylindrical radius used for cylindrical projection, and determine a first cropping range according to the first reference coordinate;
[0153] Determine a second reference coordinate according to the height of the current image and determine a second cropping range according to the second reference coordinate;
[0154] The current image is cropped along the x-axis direction and the y-axis direction in a preset image coordinate system according to the first cropping range and the second cropping range respectively, to obtain an intermediate image corresponding to the current image.
[0155] In an optional implementation manner, the processing module 120 is further configured to determine, based on the reference bounding box of each preset object in the current image to which it belongs, a corrected bounding box of each preset object in the intermediate image corresponding to the current image to which it belongs:
[0156] Acquire first vertex coordinates and second vertex coordinates of a first vertex and a second vertex of a reference bounding box for determining each of the preset objects in the current image to which the preset object belongs in a preset image coordinate system;
[0157] According to the first reference coordinates, adjusting the x-axis coordinates of the first vertex coordinates and the x-axis coordinates of the second vertex coordinates of each of the preset objects respectively to obtain a first x-axis coordinate and a second x-axis coordinate;
[0158] Respectively use the y-axis coordinates of the first vertex coordinates and the y-axis coordinates of the second vertex coordinates of each of the preset objects as the first y-axis coordinate and the second y-axis coordinate;
[0159] Determine a first coordinate point of each of the preset objects according to the first x-axis coordinate and the first y-axis coordinate of each of the preset objects, and determine a second coordinate point of each of the preset objects according to the second x-axis coordinate and the second y-axis coordinate of each of the preset objects;
[0160] A corrected bounding box of each preset object in an intermediate image corresponding to the current image to which the preset object belongs is generated according to the first coordinate point and the second coordinate point of each preset object.
[0161] In an optional implementation manner, when the secondary image processing is a stitching process, the processing module 120 is further configured to:
[0162] According to the preset height offset, each of the current images is sequentially spliced in the width direction to obtain a corresponding intermediate image.
[0163] In an optional implementation manner, the processing module 120 is further configured to determine, based on the reference bounding box of each preset object in the current image to which it belongs, a corrected bounding box of each preset object in the intermediate image corresponding to the current image to which it belongs:
[0164] Acquire first vertex coordinates and second vertex coordinates of a first vertex and a second vertex of a reference bounding box for determining each of the preset objects in the current image to which the preset object belongs in a preset image coordinate system;
[0165] According to the position of the current image of each of the preset objects in the intermediate image, respectively adjusting the x-axis coordinates of the first vertex coordinates and the x-axis coordinates of the second vertex coordinates of each of the preset objects to obtain the first x-axis coordinates and the second x-axis coordinates;
[0166] According to the preset height offset, the y-axis coordinates of the first vertex coordinates and the y-axis coordinates of the second vertex coordinates of each of the preset objects are adjusted respectively to obtain the first y-axis coordinate and the second y-axis coordinate;
[0167] Determine a first coordinate point of each of the preset objects according to the first x-axis coordinate and the first y-axis coordinate of each of the preset objects, and determine a second coordinate point of each of the preset objects according to the second x-axis coordinate and the second y-axis coordinate of each of the preset objects;
[0168] A corrected bounding box of each preset object in an intermediate image corresponding to the current image to which the preset object belongs is generated according to the first coordinate point and the second coordinate point of each preset object.
[0169] The embodiment of the present invention also provides a block diagram of an electronic device 10. The electronic device 10 implements the training sample generation method of the above embodiment. Figure 5 , Figure 5 This is a block diagram of an electronic device 10 provided in this embodiment. The electronic device 10 includes a processor 11, a memory 12 and a bus 13. The processor 11 and the memory 12 are connected via the bus 13.
[0170] The processor 11 may be an integrated circuit chip having the ability to process signals. In the implementation process, each step of the training sample generation method of the above embodiment may be completed by an integrated logic circuit of hardware in the processor 11 or by instructions in the form of software. The above processor 11 may be a general-purpose processor, including a CPU (Central Processing Unit), a NP (Network Processor), etc.; it may also be a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Logic Gate Array) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
[0171] The memory 12 is used to store a program for implementing the training sample generation method. The program may be a software function module stored in the memory 12 in the form of software or firmware or fixed in the OS (Operating System) of the electronic device 10 .
[0172] After receiving the execution instruction, the processor 11 executes the program to implement the training sample generation method of the above embodiment.
[0173] An embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the training sample generation method described in any one of the aforementioned embodiments is implemented.
[0174] In summary, the embodiments of the present invention provide a training sample generation method, device, electronic device and readable storage medium, the method comprising: obtaining multiple candidate images and the original bounding box of each preset object in each candidate image; starting from the multiple candidate images, performing multiple image processing, in each image processing, performing image processing on each current image to obtain a corresponding intermediate image, and determining a corrected bounding box of each preset object in the intermediate image corresponding to the current image to which it belongs based on a reference bounding box of each preset object in the current image to which it belongs, the multiple image processing comprising sequentially performing projection processing, cropping processing and splicing processing, or the multiple image processing comprising sequentially performing splicing processing, projection processing and cropping processing; after the multiple image processing is completed, the intermediate image obtained last time is used as the sample image of the training sample, and the corrected bounding box of each preset object determined last time is used as the label corresponding to the sample image. Compared with the prior art, the present embodiment has at least the following advantages: (1) by performing multiple image processings, and each time performing image processing, the corrected bounding box of each preset object in the intermediate image obtained by image processing is re-determined, so that the training samples obtained in this way can more accurately simulate the image features of the panoramic image synthesized by multiple candidate images, and then use the training samples to train a model with higher accuracy; (2) using the training sample generation method provided by the present embodiment, it is possible to use existing images to generate a large number of samples with similar characteristics to the panoramic images for model training, thereby improving the detection accuracy of the model under panoramic images and also improving the training efficiency; (3) by determining the first reference coordinate according to the width of the image and the preset cylindrical radius used for cylindrical projection, and performing cropping based on the first cropping range determined by the first reference coordinate, it is possible to accurately crop along the x-axis according to the black border boundary in the current image, thereby avoiding the influence of the black border along the x-axis on the training model and further improving the accuracy of the model.
[0175] The above are only various embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A training sample generation method, characterized in that: The method comprises: Acquire multiple candidate images and an original bounding box where each preset object in each candidate image is located; Starting from the multiple candidate images, multiple image processings are performed, in each image processing, each current image is processed to obtain a corresponding intermediate image, and a corrected bounding box of each preset object in the intermediate image corresponding to the current image to which it belongs is determined according to a reference bounding box of each preset object in the current image to which it belongs, the multiple image processings include sequentially performing projection processing, cropping processing and splicing processing or the multiple image processings include sequentially performing splicing processing, projection processing and cropping processing; After the multiple image processings are completed, the intermediate image obtained last time is used as a sample image of a training sample, and the corrected bounding box of each of the preset objects determined last time is used as a label corresponding to the sample image; When the secondary image processing is projection processing, and when the multiple image processings include sequential projection processing, cropping processing, and stitching processing, the current image is multiple, and each current image is a candidate image; when the multiple image processings include sequential stitching processing, projection processing, and cropping processing, the current image is one, and the current image is an intermediate image obtained by stitching processing; the step of performing image processing on each current image to obtain a corresponding intermediate image includes: Acquire a preset template image having the same size as each of the current images; For any target pixel point among the multiple pixel points in each of the current images, performing cylindrical projection transformation on the coordinates of the target pixel point to obtain the target projection coordinates of the target pixel point; If the target projection coordinates do not exceed the boundary of the preset template image, then the pixel value of the pixel point located at the target projection coordinates in the preset template image is updated with the pixel value of the target pixel point; Taking each pixel point in each of the current images as the target pixel point, updating the pixel value of the corresponding pixel point in the preset template image, and taking the updated preset template image corresponding to each of the current images as the intermediate image corresponding to each of the current images; The step of determining the corrected bounding box of each preset object in the intermediate image corresponding to the current image to which it belongs according to the reference bounding box of each preset object in the current image to which it belongs comprises: Obtaining the coordinates of each vertex of each of the plurality of vertices of a reference bounding box of each of the preset objects in the current image to which it belongs in a preset image coordinate system; Performing projection transformation on each vertex coordinate of the reference bounding box of each of the preset objects respectively to obtain transformation coordinates corresponding to each vertex coordinate of the reference bounding box of each of the preset objects; The minimum value and the maximum value of all transformed coordinates of the reference bounding box of each preset object are respectively used as the upper left corner coordinate and the lower right corner coordinate to generate a corrected bounding box of each preset object in the intermediate image corresponding to the current image to which it belongs.
2. The training sample generation method according to claim 1, characterized in that: When the secondary image processing is cropping processing, and when the multiple image processings include sequential projection processing, cropping processing, and stitching processing, the current image is multiple, and one current image is an intermediate image obtained by projecting a candidate image; when the multiple image processings include sequential stitching processing, projection processing, and cropping processing, the current image is one, and the current image is an intermediate image obtained by projection processing; the step of performing image processing on each current image to obtain a corresponding intermediate image includes: Determine a first reference coordinate according to the width of the current image and a preset cylindrical radius used for cylindrical projection, and determine a first cropping range according to the first reference coordinate; Determine a second reference coordinate according to the height of the current image and determine a second cropping range according to the second reference coordinate; The current image is cropped along the x-axis direction and the y-axis direction in a preset image coordinate system according to the first cropping range and the second cropping range respectively, to obtain an intermediate image corresponding to the current image.
3. The training sample generation method according to claim 2, characterized in that: The step of determining the corrected bounding box of each preset object in the intermediate image corresponding to the current image to which it belongs according to the reference bounding box of each preset object in the current image to which it belongs comprises: Acquire first vertex coordinates and second vertex coordinates of a first vertex and a second vertex of a reference bounding box for determining each of the preset objects in the current image to which the preset object belongs in a preset image coordinate system; According to the first reference coordinates, adjusting the x-axis coordinates of the first vertex coordinates and the x-axis coordinates of the second vertex coordinates of each of the preset objects respectively to obtain a first x-axis coordinate and a second x-axis coordinate; Respectively use the y-axis coordinates of the first vertex coordinates and the y-axis coordinates of the second vertex coordinates of each of the preset objects as the first y-axis coordinate and the second y-axis coordinate; Determine a first coordinate point of each of the preset objects according to the first x-axis coordinate and the first y-axis coordinate of each of the preset objects, and determine a second coordinate point of each of the preset objects according to the second x-axis coordinate and the second y-axis coordinate of each of the preset objects; A corrected bounding box of each preset object in an intermediate image corresponding to the current image to which the preset object belongs is generated according to the first coordinate point and the second coordinate point of each preset object.
4. The training sample generation method according to claim 1, characterized in that: When the image processing is stitching processing, the step of performing image processing on each current image to obtain a corresponding intermediate image includes: According to the preset height offset, each of the current images is sequentially spliced in the width direction to obtain a corresponding intermediate image.
5. The training sample generation method according to claim 4, characterized in that: The step of determining the corrected bounding box of each preset object in the intermediate image corresponding to the current image to which it belongs according to the reference bounding box of each preset object in the current image to which it belongs comprises: Acquire first vertex coordinates and second vertex coordinates of a first vertex and a second vertex of a reference bounding box for determining each of the preset objects in the current image to which the preset object belongs in a preset image coordinate system; According to the position of the current image of each of the preset objects in the intermediate image, respectively adjusting the x-axis coordinates of the first vertex coordinates and the x-axis coordinates of the second vertex coordinates of each of the preset objects to obtain the first x-axis coordinates and the second x-axis coordinates; According to the preset height offset, the y-axis coordinates of the first vertex coordinates and the y-axis coordinates of the second vertex coordinates of each of the preset objects are adjusted respectively to obtain the first y-axis coordinate and the second y-axis coordinate; Determine a first coordinate point of each of the preset objects according to the first x-axis coordinate and the first y-axis coordinate of each of the preset objects, and determine a second coordinate point of each of the preset objects according to the second x-axis coordinate and the second y-axis coordinate of each of the preset objects; A corrected bounding box of each preset object in an intermediate image corresponding to the current image to which the preset object belongs is generated according to the first coordinate point and the second coordinate point of each preset object.
6. A training sample generating device, characterized in that: The device comprises: An acquisition module, used for acquiring a plurality of candidate images and an original bounding box where each preset object in each of the candidate images is located; a processing module, configured to perform multiple image processings starting from the multiple candidate images, wherein in each image processing, each current image is processed to obtain a corresponding intermediate image, and a corrected bounding box of each preset object in the intermediate image corresponding to the current image to which it belongs is determined according to a reference bounding box of each preset object in the current image to which it belongs, wherein the multiple image processings include sequentially performing projection processing, cropping processing and splicing processing or sequentially performing splicing processing, projection processing and cropping processing; The processing module is further configured to, after the multiple image processings are completed, use the intermediate image obtained last time as a sample image of a training sample, and use the corrected bounding box of each of the preset objects determined last time as a label corresponding to the sample image; When the secondary image processing is projection processing, and when the multiple image processings include sequential projection processing, cropping processing and stitching processing, the current images are multiple, and one current image is one candidate image; when the multiple image processings include sequential stitching processing, projection processing and cropping processing, the current image is one, and the processing module is specifically used to: obtain a preset template image of the same size as each of the current images; for any target pixel point among multiple pixel points in each of the current images, perform cylindrical projection transformation on the coordinates of the target pixel point to obtain the target projection coordinates of the target pixel point; if the target projection coordinates do not exceed the boundary of the preset template image, update the pixel value of the pixel point in the preset template image at the target projection coordinates with the pixel value of the target pixel point; use each pixel point in each of the current images as the target pixel point one by one, update the pixel value of the corresponding pixel point in the preset template image, and use the updated preset template image corresponding to each of the current images as the intermediate image corresponding to each of the current images; The processing module, when used to determine the corrected bounding box of each preset object in the intermediate image corresponding to the current image to which it belongs based on the reference bounding box of each preset object in the current image to which it belongs, is specifically used to: obtain each vertex coordinate of each of the multiple vertices of the reference bounding box of each preset object in the current image to which it belongs in the preset image coordinate system; perform a projection transformation on each vertex coordinate of the reference bounding box of each preset object respectively to obtain the transformed coordinates corresponding to each vertex coordinate of the reference bounding box of each preset object; use the minimum value and the maximum value of all transformed coordinates of the reference bounding box of each preset object as the upper left corner coordinate and the lower right corner coordinate respectively to generate a corrected bounding box of each preset object in the intermediate image corresponding to the current image to which it belongs.
7. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory is used to store a program, and the processor is used to implement the training sample generation method according to any one of claims 1 to 5 when executing the program.
8. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor, the training sample generation method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Rapid splicing method and system for photovoltaic module images
CN111311487A
Target clothing image processing method based on generative adversarial network model
CN111445426A