Image annotation method and device used in three-dimensional simulation, and electronic equipment
By using a virtual camera and occlusion object judgment in three-dimensional simulation, automatic image annotation is achieved, which solves the problems of low annotation efficiency and low accuracy in the existing technology, and is suitable for multiple application fields.
Patent Information
- Application Number
- CN202111003690.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-30
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2041-08-30
AI Technical Summary
In the existing technology, image annotation mainly relies on manual and semi-automatic methods and cannot achieve full automation, resulting in low annotation efficiency and low accuracy.
Construct a scene in a three-dimensional simulation, use a virtual camera to acquire images, and determine whether the target object is within the field of view, generate detection points, and determine whether to label based on occluding objects to achieve automatic image labeling.
It achieves low-cost, high-speed image annotation, improves annotation accuracy and efficiency, and is suitable for areas such as vehicle automatic driving and vehicle-road collaborative technology.
Smart Images

Figure CN113763569B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data annotation, and in particular to an image annotation method and device, and electronic equipment used in three-dimensional simulation. Background Art
[0002] Image annotation, in simple terms, is to mark the type, location, speed and other attributes of the target object on the image as training data for deep models or other classifiers. To train an excellent algorithm, it is very important to have more data and obtain more accurate annotation information.
[0003] At present, training data mainly comes from on-site collection of physical sensors. Data collection is costly and difficult, and later annotation is mainly done manually. The advantage is that the environment in which the training data is collected is highly consistent with the working environment of the final model, which is very helpful for the recognition accuracy of the model. Recently, three-dimensional simulation technology has also been used to generate training data. The advantages of three-dimensional simulation are low cost and fast data generation. The disadvantage is that there are still some differences between simulation data and the real environment, which will affect the recognition accuracy of the model to a certain extent. Using simulation data as a supplement is a very good choice.
[0004] In the process of realizing the present invention, the inventors found that there are at least the following problems in the prior art: the current annotation method is mainly based on manual annotation, supplemented by semi-automatic annotation. Semi-automatic annotation is to first train a not very accurate primary model with a small amount of manually annotated data, and then use this primary model to automatically identify the target in the image, output the type, location and other attribute data of the target object, and then manually adjust the output annotations that are inaccurate. Then use more data to train a more accurate model... This can be repeated many times, spirally ascending. Summary of the invention
[0005] The purpose of the embodiments of the present application is to provide a method, an apparatus, and an electronic device to solve the technical problem existing in the related art that images cannot be fully automatically labeled.
[0006] According to a first aspect of an embodiment of the present application, there is provided an image annotation method for use in three-dimensional simulation, comprising:
[0007] Constructing a three-dimensional scene, wherein the three-dimensional scene includes a target object, a virtual camera, and an occluding object;
[0008] Acquire images within the field of view through a virtual camera;
[0009] Determine whether the target object is within the field of view of the virtual camera, and if the target object is within the field of view of the virtual camera, generate a detection point of the target object;
[0010] If any of the detection points is not blocked by the blocking object, the target object in the image is marked.
[0011] Further, determining whether the target object is within the field of view of the virtual camera, and if the target object is within the field of view of the virtual camera, generating a detection point of the target object includes:
[0012] Obtaining a three-dimensional bounding box of the target object, and calculating the physical coordinates of each vertex on the three-dimensional bounding box in the image according to the three-dimensional bounding box;
[0013] Calculating the physical coordinate boundary of the virtual camera according to the image and the field of view of the virtual camera;
[0014] If the image physical coordinates of any vertex are within the physical coordinate boundary of the virtual camera, then the target object is within the field of view of the virtual camera;
[0015] The detection points of the target object are generated according to the physical coordinates of the vertices, the physical coordinate boundaries of the virtual camera and the image.
[0016] Specifically, obtaining a three-dimensional bounding box of the target object, and calculating the physical coordinates of each vertex on the three-dimensional bounding box in the image according to the three-dimensional bounding box, includes:
[0017] Get the first world coordinates, first orientation, and length, width, and height of the three-dimensional bounding box of the target object;
[0018] Calculate the second world coordinates of the vertices on the three-dimensional bounding box of the target object according to the first world coordinates, the first orientation, and the length, width, and height of the three-dimensional bounding box;
[0019] Convert the second world coordinates into camera coordinates;
[0020] According to the above camera coordinates, the image physical coordinates of the vertex are calculated.
[0021] Specifically, generating detection points of the target object according to the physical coordinates of the vertices, the physical coordinate boundaries of the virtual camera and the image includes:
[0022] Calculate the image pixel coordinates of the vertex according to the image physical coordinates of the vertex, the physical coordinate boundary of the virtual camera and the output image pixel width and height;
[0023] Calculating the length and width of a two-dimensional bounding box of the target object according to the image pixel coordinates;
[0024] Calculate the diagonal length of the three-dimensional bounding box according to the length, width and height of the three-dimensional bounding box;
[0025] The shrinking step length is calculated according to the length and width of the two-dimensional bounding box and the diagonal length of the three-dimensional bounding box;
[0026] Shrinking the three-dimensional bounding box according to the shrinking step size and the body diagonal length of the three-dimensional bounding box;
[0027] A detection point of the target object is generated according to the shrunk three-dimensional bounding box and the center point of the target object.
[0028] Further, shrinking the three-dimensional bounding box according to the shrinking step size and the body diagonal length of the three-dimensional bounding box includes:
[0029] Calculating a shrinkage parameter according to the shrinkage step length and the body diagonal length of the three-dimensional bounding box;
[0030] Set the shrink ratio;
[0031] According to the shrinkage ratio, shrink the three-dimensional bounding box along the diagonal direction of the target object; update the shrinkage ratio, and use the difference between the shrinkage ratio and the shrinkage parameter as the new shrinkage ratio; repeat this step until the shrinkage ratio is less than or equal to zero.
[0032] Specifically, if any of the detection points is not blocked by the blocking object, marking the target object in the image includes:
[0033] Obtaining the third world coordinates of the virtual camera;
[0034] According to the third world coordinates and the world coordinates of the detection points, it is determined whether there is an occluding object between the virtual camera and the detection points. If any of the detection points is not occluded, the two-dimensional bounding box of the target object in the image is marked.
[0035] According to a second aspect of an embodiment of the present application, there is provided an image annotation device for use in three-dimensional simulation, comprising:
[0036] A construction module constructs a three-dimensional scene, wherein the three-dimensional scene includes a target object, a virtual camera, and an occluding object;
[0037] An acquisition module acquires images within the field of view through a virtual camera;
[0038] A generation module, for determining whether the target object is within the field of view of the virtual camera, and generating a detection point of the target object if the target object is within the field of view of the virtual camera;
[0039] The marking module marks the target object in the image if any of the detection points is not blocked by the blocking object.
[0040] According to a third aspect of an embodiment of the present application, there is provided an electronic device, including:
[0041] one or more processors;
[0042] A memory for storing one or more programs;
[0043] When the one or more programs are executed by the one or more processors, the one or more processors implement the method as described in the first aspect.
[0044] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, on which computer instructions are stored, and when the instructions are executed by a processor, the steps of the method described in the first aspect are implemented.
[0045] The technical solution provided by the embodiments of the present application may have the following beneficial effects:
[0046] It can be seen from the above embodiments that the present invention is an automatic image annotation method used in three-dimensional simulation applications, which adds a target object, a virtual camera and an occluding object to a three-dimensional scene; obtains an image within the field of view through a virtual camera; calculates whether the target object is in the field of view of the virtual camera, and if the target object is in the field of view of the virtual camera, generates a detection point of the target object; calculates whether there is an occlusion between the virtual camera and the detection point of the target object, and if any of the detection points of the target object is not blocked by the occluding object, the target appears in the image, and the target object in the image is annotated. The present invention realizes the continuous output of annotation information and image data through a low-cost three-dimensional simulation method, and is an important source for obtaining intelligent model training data. Compared with traditional methods, the annotation method of the present invention has many advantages such as low cost, high precision, and high speed, and can be applied to many fields such as vehicle automatic driving, vehicle-road collaborative technology, digital twins, and smart traffic intersections.
[0047] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0049] Figure 1 The figure is a flow chart showing an image annotation method used in three-dimensional simulation according to an exemplary embodiment.
[0050] Figure 2 is a flowchart of step S103 according to an exemplary embodiment;
[0051] Figure 3 is a flowchart of step S201 according to an exemplary embodiment;
[0052] Figure 4 is a schematic diagram showing a viewing angle of a virtual camera according to an exemplary embodiment;
[0053] Figure 5 is a flowchart of step S204 according to an exemplary embodiment;
[0054] Figure 6 is a flowchart of step S405 according to an exemplary embodiment;
[0055] Figure 7 is a flowchart of step S104 according to an exemplary embodiment;
[0056] Figure 8 The figure is a block diagram showing an image annotation device used in three-dimensional simulation according to an exemplary embodiment. DETAILED DESCRIPTION
[0057] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0058] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0059] It should be understood that although the terms first, second, third, etc. may be used in the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0060] Figure 1is a flowchart of an image annotation method used in three-dimensional simulation according to an exemplary embodiment. Figure 1 As shown, the following steps may be included:
[0061] Step S101: constructing a three-dimensional scene, wherein the three-dimensional scene includes a target object, a virtual camera, and an obstructing object;
[0062] Step S102: Acquire an image within a field of view through a virtual camera;
[0063] Step S103: determining whether the target object is within the field of view of the virtual camera, and if the target object is within the field of view of the virtual camera, generating a detection point of the target object;
[0064] Step S104: if any of the detection points is not blocked by the blocking object, the target object in the image is marked.
[0065] It can be seen from the above embodiments that the present invention is an automatic image annotation method used in three-dimensional simulation applications, which adds a target object, a virtual camera and an occluding object to a three-dimensional scene; obtains an image within the field of view through a virtual camera; calculates whether the target object is in the field of view of the virtual camera, and if the target object is in the field of view of the virtual camera, generates a detection point of the target object; calculates whether there is an occlusion between the virtual camera and the detection point of the target object, and if any of the detection points of the target object is not blocked by the occluding object, the target appears in the image, and the target object in the image is annotated. The present invention realizes the continuous output of annotation information and image data through a low-cost three-dimensional simulation method. Compared with traditional methods, the annotation method of the present invention has many advantages such as low cost, high precision, and high speed, and can be applied to many fields such as vehicle automatic driving, vehicle-road collaborative technology, digital twins, and smart traffic intersections.
[0066] In the specific implementation of step S101, a three-dimensional scene is constructed, wherein the three-dimensional scene includes a target object, a virtual camera, and an occluding object;
[0067] Specifically, a virtual or real-world 3D scene is created and imported into a virtual engine. Unreal Engine 4 (UE4) is used in this embodiment. Several movable target objects (mainly people, non-motor vehicles and motor vehicles) are added to the scene. The target objects should have the ability to move autonomously, such as moving along a set route, to ensure the diversity of output images. A virtual camera is installed, and camera parameters (including image resolution, field of view, etc.) and installation position (including coordinates and orientation) are set.
[0068] In order to provide rich scenes and accurately annotated image data. By creating virtual scenes, the scene of the image can be enriched; modeling a specific real environment can improve the algorithm performance in this scene. The autonomous movement of the target object is to ensure the diversity of the image, so as to ensure that the training data is rich enough.
[0069] In the specific implementation of step S102, an image within the field of view is acquired by a virtual camera;
[0070] Specifically, through UE4, a virtual camera is placed at a specific position in the above three-dimensional scene, and the corresponding image is output through graphics card calculation.
[0071] In the specific implementation of step S103, it is determined whether the target object is within the field of view of the virtual camera. If the target object is within the field of view of the virtual camera, a detection point of the target object is generated; specifically, Figure 2 As shown, this step includes the following sub-steps:
[0072] Step S201: Obtain a three-dimensional bounding box of the target object, and calculate the physical coordinates of each vertex on the three-dimensional bounding box in the image according to the three-dimensional bounding box; specifically, Figure 3 As shown, this step may include the following processes:
[0073] Step S301: Obtain the first world coordinates, the first orientation, and the length, width, and height of the three-dimensional bounding box of the target object;
[0074] Specifically, the first world coordinate (X i ,Y i ,Z i ), Pitch i ,Yaw i ,Roll i ), the length, width and height of the three-dimensional bounding box (W i ,H i ,L i ). The three-dimensional bounding box is specified when the target object is added in step S101, such as the length, width and height of the vehicle, and the coordinates and orientation of the target object will be continuously updated during the simulation.
[0075] Step S302: Calculate the second world coordinates of the vertices on the three-dimensional bounding box of the target object according to the first world coordinates, the first orientation, and the length, width, and height of the three-dimensional bounding box;
[0076] Specifically, according to the first world coordinate (X i ,Y i ,Z i ), Pitch i ,Yawi ,Roll i ) and the length, width and height of the 3D bounding box (W i ,H i ,L i ). Transform the target object to the local coordinate system:
[0077]
[0078]
[0079] In the local coordinate system, the center point of the target object (X i ,Y i ,Z i ) along the positive and negative directions of the X, Y, and Z axes, respectively, as follows:
[0080]
[0081]
[0082]
[0083]
[0084]
[0085]
[0086]
[0087]
[0088] Get the world coordinates of the eight vertices of the three-dimensional bounding box. The bounding box is the smallest cuboid that surrounds the target. Using the three-dimensional bounding box of the target object can make the subsequent calculation of whether the target object is in the camera's field of view more accurate.
[0089] Step S303: converting the second world coordinates into camera coordinates;
[0090] Specifically, the camera position coordinates are the third world coordinates (X s ,Y s ,Z s ); Take the vertex (X0, Y0, Z0) as an example and convert it to camera coordinates
[0091]
[0092] Among them, R is the same as S302.
[0093] The other vertices are transformed in the same way, and all vertices are represented as
[0094]
[0095] Step S304: Calculate the image physical coordinates of the vertex according to the camera coordinates.
[0096] Specifically, the virtual camera faces the x-axis by default, as follows Figure 4 As shown in the figure, the camera imaging plane corresponds to the yz plane. According to the camera imaging principle, the image physical coordinates of the vertex (x j ,y j ):
[0097]
[0098] The image pixel coordinates can be calculated only after the image physical coordinates are obtained.
[0099] Step S202: calculating the physical coordinate boundary of the virtual camera according to the image and the field of view of the virtual camera;
[0100] Specifically, according to the camera imaging principle, the physical coordinate boundary of the virtual camera is calculated using the following formula:
[0101]
[0102] Among them (W s ,H s ) is the pixel width and height of the output image, which is an adjustable parameter. For a virtual camera, it needs to be manually set during initialization. Generally, it can be (1920, 1080), (1280, 720), etc. Fov is the field of view, which is also a setting parameter. It can be 60 degrees, 90 degrees, etc., which are greater than 0 and less than 180. These parameters must be set when placing the camera at the beginning of the simulation. The physical coordinate boundary is calculated to compare whether the coordinates of the target object fall within the range of the camera.
[0103] Step S203: if the image physical coordinates of any vertex are within the physical coordinate boundary of the virtual camera, then the target object is within the field of view of the virtual camera;
[0104] Specifically, if x j In the range [-x limit ,x limit ] and y j In the range [-y limit ,y limit ], the current vertex is within the camera's field of view;
[0105] Step S204: Generate detection points of the target object according to the physical coordinates of the vertices, the physical coordinate boundaries of the virtual camera and the image. Figure 5 As shown, this step may include the following sub-steps:
[0106] Step S401: Calculate the image pixel coordinates of the vertex according to the image physical coordinates of the vertex, the physical coordinate boundary of the virtual camera and the output image pixel width and height;
[0107] Specifically, according to the similar triangle principle of camera imaging, the image pixel coordinates of the vertices are calculated using the following formula:
[0108]
[0109] It is deduced that
[0110]
[0111] Among them, (x j ,y j ) is the image physical coordinate of the vertex, x limit ,y limit is the physical coordinate boundary of the virtual camera, (W s ,H s ) is the pixel width and height of the output image.
[0112] Step S402: Calculate the length and width of the two-dimensional bounding box of the target object according to the image pixel coordinates;
[0113] Specifically, the two-dimensional bounding box is represented as: [u min ,v min ,u max ,v max ], calculated according to the following formula:
[0114]
[0115] Among them C F is the number of vertices of the target object in the field of view of the virtual camera, (u j , v j ) are the image pixel coordinates of the vertices; that is, in a two-dimensional image, the smallest rectangle that can enclose the target object is taken; the part that exceeds the image boundary is truncated according to the boundary.
[0116] The length and width of the 2D bounding box of the target object are calculated as follows:
[0117]
[0118] Given the maximum and minimum horizontal and vertical coordinates of the rectangular box, the above formula is obviously valid. The length and width of the two-dimensional bounding box are calculated for use in generating detection points. The larger the length and width, the closer the target object is to the camera, and the fewer detection points need to be generated.
[0119] Step S403: Calculate the diagonal length of the three-dimensional bounding box according to the length, width and height of the three-dimensional bounding box;
[0120] Specifically, the diagonal length of the target object's 3D bounding box can be calculated according to the following formula:
[0121]
[0122] Among them, W i is the length of the 3D bounding box, H i is the width of the 3D bounding box, L i is the height of the 3D bounding box.
[0123] Step S404: Calculate the shrinking step length according to the length and width of the two-dimensional bounding box and the diagonal length of the three-dimensional bounding box;
[0124] Specifically, the calculation formula for the contraction step length is as follows:
[0125]
[0126] α can take any positive value. In this embodiment, α takes a fixed value between [10, 100].
[0127] The smaller the value of α, the smaller the d, the more detections will be generated, the higher the calculation accuracy, and the larger the amount of calculation; conversely, the smaller the value of α, the larger the d, the smaller the detections will be generated, the lower the calculation accuracy, and the smaller the amount of calculation; at the same time, L u , L v The smaller α is, the larger d is, and the fewer detection points are generated; conversely, the more detection points are generated. It can be seen that α is a parameter for manually adjusting the number of detection points, while the imaging size of the target object (the distance from the camera) will automatically adjust the number of detection points.
[0128] Step S405: shrinking the three-dimensional bounding box according to the shrinking step size; further, Figure 6 As shown, this step may also include:
[0129] Step S501: Calculate a shrinkage parameter according to the shrinkage step length and the diagonal length of the three-dimensional bounding box;
[0130] Specifically, the shrinkage parameter k is calculated according to the following formula:
[0131]
[0132] Where d is the shrinking step size and D is the diagonal length of the 3D bounding box.
[0133] Step S502: setting the shrinkage ratio;
[0134] Specifically, the shrinkage ratio r=1 is set, which is the initial value of the cycle, that is, no shrinkage.
[0135] Step S503: shrinking the three-dimensional bounding box along the diagonal direction of the target object according to the shrinkage ratio; updating the shrinkage ratio, and taking the difference between the shrinkage ratio and the shrinkage parameter as a new shrinkage ratio; repeating this step until the shrinkage ratio is less than or equal to zero;
[0136] Specifically, along the diagonal direction of the target object, the three-dimensional bounding box is transformed from (W i , H i ,L i ) is contracted to (r×W i ,r×H i ,r×L i ); After the shrinkage is completed, update the shrinkage ratio r = rk; repeat this step until r ≤ 0; The purpose of shrinking the bounding box is to generate more evenly distributed detection points so that partially obscured targets can still be detected.
[0137] Step S406: generating a detection point of the target object according to the shrunk three-dimensional bounding box or the center point of the target object;
[0138] Specifically, the eight vertices of the shrunk three-dimensional bounding box or the center point of the target object (when r≤0) are used as the detection points of the target object; the generated detection points serve as the premise for subsequent detection of whether there is occlusion between the camera and the detection points.
[0139] It should be noted that in the above step S502, after each contraction, the contracted three-dimensional bounding box will generate detection points of the target object as described in step S406, that is, if the target object is contracted n times in step S502, 8×n+1 detection points are generated in step S406.
[0140] In the specific implementation of step S104, if any of the detection points is not blocked by the blocking object, the target object in the image is marked. Figure 7 As shown, this step includes the following sub-steps:
[0141] Step S601: obtaining the third world coordinates of the virtual camera;
[0142] Specifically, obtain the third world coordinate (X s ,Y s , Z s ); The camera coordinates are placed when the 3D simulation environment is created, and the coordinates are also determined.
[0143] Step S602: Based on the third world coordinates and the world coordinates of the detection point, determine whether there is an occluding object between the virtual camera and the detection point; if any of the detection points is not occluded, mark the two-dimensional bounding box of the target object in the image.
[0144] Specifically, a ray collision detection algorithm in the game engine is used to detect whether there is an obstructing object between the virtual camera and the detection point, wherein transparent obstructing objects (such as glass) and grid-like obstructing objects (such as wire mesh) can be set to be unobstructed to ensure that objects behind them can be detected; if any one of all the detection points of the target object is not obstructed, it means that the target object is not completely obstructed, and the two-dimensional bounding box of the target object is marked in the image described in the above step S102.
[0145] Corresponding to the aforementioned embodiment of an image annotation method used in three-dimensional simulation, the present application also provides an embodiment of an image annotation device used in three-dimensional simulation.
[0146] Figure 8 is a block diagram of an image annotation device used in three-dimensional simulation according to an exemplary embodiment. Figure 8 , the device comprises:
[0147] A construction module 21 constructs a three-dimensional scene, wherein the three-dimensional scene includes a target object, a virtual camera, and an obstructing object;
[0148] An acquisition module 22 acquires images within a field of view through a virtual camera;
[0149] A generating module 23, which determines whether the target object is within the field of view of the virtual camera, and generates a detection point of the target object if the target object is within the field of view of the virtual camera;
[0150] The marking module 24 marks the target object in the image if any of the detection points is not blocked by the blocking object.
[0151] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0152] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present application scheme. A person of ordinary skill in the art can understand and implement it without paying any creative work.
[0153] Correspondingly, the present application also provides an electronic device, comprising: one or more processors; a memory for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement an image annotation method used in three-dimensional simulation as described above.
[0154] Correspondingly, the present application also provides a computer-readable storage medium on which computer instructions are stored, characterized in that when the instructions are executed by a processor, an image annotation method used in three-dimensional simulation as described above is implemented.
[0155] Those skilled in the art will readily appreciate other embodiments of the present application after considering the description and practicing the contents disclosed herein. The present application is intended to cover any variations, uses or adaptations of the present application, which follow the general principles of the present application and include common knowledge or customary techniques in the art that are not disclosed in the present application. The description and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0156] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. An image annotation method used in three-dimensional simulation, It is characterized in that include: Constructing a three-dimensional scene, wherein the three-dimensional scene includes a target object, a virtual camera, and an occluding object; Acquire images within the field of view through a virtual camera; Determining whether the target object is within the field of view of the virtual camera, and if the target object is within the field of view of the virtual camera, generating a detection point of the target object; comprising: Acquire a three-dimensional bounding box of the target object, and calculate the physical coordinates of each vertex on the three-dimensional bounding box in the image according to the three-dimensional bounding box; including: Get the first world coordinates, first orientation, and length, width, and height of the three-dimensional bounding box of the target object; Calculate the second world coordinates of the vertices on the three-dimensional bounding box of the target object according to the first world coordinates, the first orientation, and the length, width, and height of the three-dimensional bounding box; Convert the second world coordinates into camera coordinates; According to the above camera coordinates, calculate the image physical coordinates of the vertex; Calculating the physical coordinate boundary of the virtual camera according to the image and the field of view of the virtual camera; If the image physical coordinates of any vertex are within the physical coordinate boundary of the virtual camera, then the target object is within the field of view of the virtual camera; Generate detection points of the target object according to the physical coordinates of the vertices, the physical coordinate boundaries of the virtual camera and the image; including: Calculate the image pixel coordinates of the vertex according to the image physical coordinates of the vertex, the physical coordinate boundary of the virtual camera and the output image pixel width and height; Calculating the length and width of a two-dimensional bounding box of the target object according to the image pixel coordinates; Calculate the diagonal length of the three-dimensional bounding box according to the length, width and height of the three-dimensional bounding box; The shrinking step length is calculated according to the length and width of the two-dimensional bounding box and the diagonal length of the three-dimensional bounding box; Shrinking the three-dimensional bounding box according to the shrinking step size and the body diagonal length of the three-dimensional bounding box; Generating a detection point of the target object according to the shrunk three-dimensional bounding box and the center point of the target object; If any of the detection points is not blocked by the blocking object, marking the target object in the image includes: Obtaining the third world coordinates of the virtual camera; According to the third world coordinates and the world coordinates of the detection points, it is determined whether there is an occluding object between the virtual camera and the detection points. If any of the detection points is not occluded, the two-dimensional bounding box of the target object in the image is marked.
2. The method according to claim 1, It is characterized in that Shrinking the three-dimensional bounding box according to the shrinking step size and the body diagonal length of the three-dimensional bounding box includes: Calculating a shrinkage parameter according to the shrinkage step length and the body diagonal length of the three-dimensional bounding box; Set the shrink ratio; According to the shrinkage ratio, shrink the three-dimensional bounding box along the diagonal direction of the target object; update the shrinkage ratio, and use the difference between the shrinkage ratio and the shrinkage parameter as the new shrinkage ratio; repeat this step until the shrinkage ratio is less than or equal to zero.
3. An image annotation device used in three-dimensional simulation, It is characterized in that include: A construction module constructs a three-dimensional scene, wherein the three-dimensional scene includes a target object, a virtual camera, and an occluding object; An acquisition module acquires images within the field of view through a virtual camera; A generation module, which determines whether the target object is within the field of view of the virtual camera, and if the target object is within the field of view of the virtual camera, generates a detection point of the target object; comprising: Acquire a three-dimensional bounding box of the target object, and calculate the physical coordinates of each vertex on the three-dimensional bounding box in the image according to the three-dimensional bounding box; including: Get the first world coordinates, first orientation, and length, width, and height of the three-dimensional bounding box of the target object; Calculate the second world coordinates of the vertices on the three-dimensional bounding box of the target object according to the first world coordinates, the first orientation, and the length, width, and height of the three-dimensional bounding box; Convert the second world coordinates into camera coordinates; According to the above camera coordinates, calculate the image physical coordinates of the vertex; Calculating the physical coordinate boundary of the virtual camera according to the image and the field of view of the virtual camera; If the image physical coordinates of any vertex are within the physical coordinate boundary of the virtual camera, then the target object is within the field of view of the virtual camera; Generate detection points of the target object according to the physical coordinates of the vertices, the physical coordinate boundaries of the virtual camera and the image; including: Calculate the image pixel coordinates of the vertex according to the image physical coordinates of the vertex, the physical coordinate boundary of the virtual camera and the output image pixel width and height; Calculating the length and width of a two-dimensional bounding box of the target object according to the image pixel coordinates; Calculate the diagonal length of the three-dimensional bounding box according to the length, width and height of the three-dimensional bounding box; The shrinking step length is calculated according to the length and width of the two-dimensional bounding box and the diagonal length of the three-dimensional bounding box; Shrinking the three-dimensional bounding box according to the shrinking step size and the body diagonal length of the three-dimensional bounding box; Generating a detection point of the target object according to the shrunk three-dimensional bounding box and the center point of the target object; The marking module, if any of the detection points is not blocked by the blocking object, marks the target object in the image, including: Obtaining the third world coordinates of the virtual camera; According to the third world coordinates and the world coordinates of the detection points, it is determined whether there is an occluding object between the virtual camera and the detection points. If any of the detection points is not occluded, the two-dimensional bounding box of the target object in the image is marked.
4. An electronic device, It is characterized in that include: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 2.
5. A computer-readable storage medium having computer instructions stored thereon, It is characterized in that When the instruction is executed by a processor, the steps of the method according to any one of claims 1 to 2 are implemented.
