Image labeling method, client, terminal equipment and storage medium

By calculating the image scaling ratio and offset in the object detection model and correcting the results, the labeling misalignment or distortion caused by the object detection model during image scaling is solved, and more accurate image annotation is achieved.

CN119963694AActive Publication Date: 2025-05-09SHENZHEN SMARTCITY TECH DEV GRP CO LTD

Patent Information

Application Number
CN202510430235.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-08
Publication Date
2025-05-09
Estimated Expiration
2045-04-08

AI Technical Summary

Technical Problem

The annotation information returned by the object detection model during image recognition and detection is based on the original image size, resulting in easy labeling misalignment or distortion during image scaling.

Method used

After rendering the image to be marked to the target container, the scaling ratio and offset before and after image rendering are calculated, the target detection is performed based on the preset object detection model, and the target detection results are corrected through the scaling ratio and offset, the target labeling information is obtained, and the image is marked based on this information.

Benefits of technology

By calculating the scaling ratio and offset and correcting the target detection results, we ensure the accuracy of the labeling information and are not affected by image scaling, and avoid labeling misalignment or distortion problems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119963694A_ABST
    Figure CN119963694A_ABST
Patent Text Reader

Abstract

The invention discloses an image annotation method, a client, terminal equipment and a storage medium, and relates to the technical field of image processing. The method is applied to a client and comprises the following steps: after a to-be-labeled image is rendered to a target container, calculating the scaling of the to-be-labeled image before and after rendering and the offset of the to-be-labeled image relative to the target container after the to-be-labeled image is rendered to the target container; performing target detection on the to-be-labeled image based on a preset target detection model to obtain a target detection result of the to-be-labeled image; correcting the target detection result through the offset and the scaling to obtain target annotation information of the to-be-annotated image; and according to the target annotation information, annotating the to-be-annotated image rendered into the target container. According to the invention, the accuracy of client image annotation can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to an image annotation method, a client, a terminal device and a storage medium. Background Art

[0002] Currently, when the target detection model recognizes and detects an image, the annotation information it returns is based on the original size of the image. When the client annotates the image based on this annotation information, if the image is scaled during the process of adapting to the display interface, the annotation may be misplaced or distorted. Summary of the invention

[0003] The main purpose of this application is to provide an image annotation method, a client, a terminal device and a storage medium, aiming to solve the technical problem of misalignment or distortion of image annotation based on target detection models in related technologies.

[0004] To achieve the above object, the present application provides an image annotation method, which is applied to a client and includes: After rendering the image to be annotated into the target container, calculating the scaling ratio of the image to be annotated before and after rendering, and the offset of the image to be annotated relative to the target container after rendering into the target container; Performing target detection on the image to be labeled based on a preset target detection model to obtain a target detection result of the image to be labeled; Correcting the target detection result by using the offset and the scaling ratio to obtain target labeling information of the image to be labeled; The image to be labeled rendered into the target container is labeled according to the target labeling information.

[0005] In one embodiment, the step of calculating the scaling ratio of the image to be annotated before and after rendering, and the offset of the image to be annotated relative to the target container after rendering to the target container, includes: Acquire the original size and logical size of the image to be annotated, and calculate the scaling ratio of the image to be annotated before and after rendering according to the original size and the logical size; Layout information of rendering the image to be annotated into the target container and the container size of the target container are obtained, and an offset of the image to be annotated relative to the target container after being rendered into the target container is calculated according to the layout information, the container size and the logical size.

[0006] In one embodiment, the client is in communication connection with a server, and a preset target detection model is deployed on the server; The step of performing target detection on the image to be labeled based on a preset target detection model to obtain a target detection result of the image to be labeled includes: Sending the image to be annotated to the server, so that the server performs target detection on the image to be annotated based on a preset target detection model, and generates a target detection result for the image to be annotated; Receive the target detection result returned by the server based on the image to be annotated.

[0007] In one embodiment, the target detection result includes initial annotation information of the image to be annotated, and the step of correcting the target detection result by using the offset and the scaling ratio to obtain the target annotation information of the image to be annotated includes: Performing scaling correction on the initial annotation information according to the scaling ratio to obtain first annotation information of the image to be annotated; Performing offset correction on the first annotation information according to the offset to obtain second annotation information of the image to be annotated; The second annotation information is determined as target annotation information of the image to be annotated.

[0008] In one embodiment, the step of annotating the image to be annotated rendered into the target container according to the target annotation information includes: Annotating the image to be annotated rendered into the target container on a preset transparent canvas according to the target annotation information; The transparent canvas completely overlaps with the target container, and the transparent canvas is located on an upper layer of the target container.

[0009] In one embodiment, before the step of annotating the image to be annotated rendered into the target container on a preset transparent canvas according to the target annotation information, the method further includes: Detecting whether a transparent canvas completely overlapping the target container is provided on an upper layer of the target container; If the upper layer of the target container is not provided with a transparent canvas that completely overlaps with the target container, a transparent canvas that completely overlaps with the target container is provided on the upper layer of the target container.

[0010] In one embodiment, after the step of detecting whether a transparent canvas completely overlapping with the target container is disposed on the upper layer of the target container, the method further includes: If a transparent canvas completely overlapping the target container is disposed on the upper layer of the target container, detecting whether a mark is drawn on the transparent canvas; If a mark is drawn on the transparent canvas, the transparent canvas is cleared, and a transparent canvas completely overlapping the target container is reset on the upper layer of the target container.

[0011] In addition, to achieve the above purpose, the present application also provides a client, the client comprising: A calculation module, used for calculating the scaling ratio of the image to be labeled before and after rendering, and the offset of the image to be labeled relative to the target container after rendering the image to be labeled to the target container after rendering the image to be labeled to the target container; A detection module, used to perform target detection on the image to be labeled based on a preset target detection model to obtain a target detection result of the image to be labeled; A correction module, used to correct the target detection result by using the offset and the scaling ratio to obtain target labeling information of the image to be labeled; A labeling module is used to label the image to be labeled rendered into the target container according to the target labeling information.

[0012] In addition, to achieve the above-mentioned purpose, the present application also provides a terminal device, which includes: a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the computer program is executed by the processor, the steps of the image annotation method as described above are implemented.

[0013] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the image annotation method as described above are implemented.

[0014] The present application provides an image annotation method, a client, a terminal device and a storage medium, and relates to the field of image processing technology. The method is applied to the client, and includes: after rendering the image to be annotated to the target container, calculating the scaling ratio of the image to be annotated before and after rendering, and the offset of the image to be annotated relative to the target container after rendering the image to be annotated to the target container; performing target detection on the image to be annotated based on a preset target detection model to obtain the target detection result of the image to be annotated; correcting the target detection result by the offset and scaling ratio to obtain the target annotation information of the image to be annotated; and annotating the image to be annotated rendered into the target container according to the target annotation information. The present application can improve the accuracy of client image annotation. BRIEF DESCRIPTION OF THE DRAWINGS

[0015] 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.

[0016] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying any creative work.

[0017] Figure 1 Schematic diagram of the process of the image annotation method in the embodiment of the present application; Figure 2 This is a schematic diagram of the calculation process of the scaling ratio and the offset in the embodiment of the present application; Figure 3 Schematic diagram of the correction process of the target detection result in the embodiment of the present application; Figure 4 This is a schematic diagram of the module structure of the client in the embodiment of the present application; Figure 5 Schematic diagram of the device structure of the hardware operating environment involved in the image annotation method in the embodiment of the present application.

[0018] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0019] 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.

[0020] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.

[0021] Currently, when the target detection model recognizes and detects an image, the annotation information it returns is based on the original size of the image. When the client annotates the image based on this annotation information, if the image is scaled during the process of adapting to the display interface, the annotation may be misplaced or distorted.

[0022] In response to this technical problem, the main solution of the present application is an image annotation method, which is applied to a client and includes: after rendering the image to be annotated into a target container, calculating the scaling ratio of the image to be annotated before and after rendering, and the offset of the image to be annotated relative to the target container after rendering the image to be annotated into the target container; performing target detection on the image to be annotated based on a preset target detection model to obtain a target detection result of the image to be annotated; correcting the target detection result by the offset and the scaling ratio to obtain target annotation information of the image to be annotated; and annotating the image to be annotated rendered into the target container according to the target annotation information.

[0023] This application calculates the scaling ratio and offset and uses these parameters to correct the target detection results, ensuring that even if the image changes in size or position when rendered to the container, the annotation can still be accurately reflected in the correct position on the image, greatly improving the accuracy of the annotation and avoiding the misalignment problem that may occur in traditional methods.

[0024] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.

[0025] Please refer to Figure 1 , Figure 1 Schematic diagram of the process of the image annotation method in the embodiment of the present application.

[0026] In this embodiment, the image annotation method is applied to the client, and the method includes steps S100 to S400: Step S100, after rendering the image to be annotated into the target container, calculating the scaling ratio of the image to be annotated before and after rendering, and the offset of the image to be annotated relative to the target container after rendering into the target container; It should be noted that, in this embodiment, the client may be a web browser or a mobile application. The image to be annotated refers to the image that needs to be annotated on the client. The target container refers to a specific area in the client for displaying the image to be annotated, which may be a element, a view controller of a mobile app, etc.

[0027] It should also be noted that the scaling ratio refers to the change ratio of the image to be annotated from its original size to the size after rendering, which can be specifically divided into height scaling ratio and width scaling ratio. The offset refers to the displacement of the position of the image to be annotated in the target container relative to the upper left corner of the target container after it is rendered into the target container, including two components in the horizontal direction and the vertical direction.

[0028] Specifically, in one example, Figure 2 As shown, the step of calculating the scaling ratio of the image to be annotated before and after rendering, and the offset of the image to be annotated relative to the target container after rendering to the target container in step S100 includes steps S110 to S120: Step S110, obtaining the original size and logical size of the image to be annotated, and calculating the scaling ratio of the image to be annotated before and after rendering according to the original size and the logical size; Step S120, obtaining layout information of the image to be annotated rendered into the target container and the container size of the target container, and calculating the offset of the image to be annotated relative to the target container after being rendered into the target container according to the layout information, container size and logical size.

[0029] It should be noted that, in this embodiment, the original size refers to the actual width and height of the image to be annotated in its original file, usually in pixels. The logical size refers to the size of the image to be annotated calculated according to the design or preset rules when it is rendered into the target container. For example, when the image to be annotated is rendered into the target container in a Web (World Wide Web) web page, the logical size of the image to be annotated can be set directly or indirectly through CSS (Cascading Style Sheets). The container size refers to the logical width and height of the target container. For example, when the target container is created in a Web page, the container size of the target container can be set through CSS. The layout information may include but is not limited to the positioning method of the image to be annotated in the target container (such as centering, left alignment, etc.), margin settings, inner margins, etc., all of which will affect the position of the final image in the container.

[0030] In this example, first, the client needs to know the original size of the image to be annotated and the logical size it should be rendered at. This step is necessary because only by knowing these two sizes can we accurately calculate how much the image is scaled. Once we have the original size and the logical size, we can use simple math to find the scaling ratio. For example, if the original width is 800 pixels and the logical width is 400 pixels, then the width scaling ratio is 0.5. The height scaling ratio can also be calculated.

[0031] Through step S110, this example ensures that the subsequent target detection results can be adjusted according to the actual display situation of the image to be annotated, thereby ensuring that the accuracy of the annotation is not affected by image scaling.

[0032] In this example, layout information and container size are involved in understanding how the image is placed within the target container. Different layout strategies will result in different offsets. For example, if the image is centered, its horizontal offset will be determined by half the difference between the container width and the image width. At the same time, the container size also determines the maximum possible offset range of the image.

[0033] Using layout information, container size, and logical size, this example can determine the specific offset of the image relative to the upper left corner of the container through some geometric calculations, ensuring that even if the image is shifted in the container, the client can still accurately know its exact position in the container.

[0034] By accurately calculating the scaling and offset, the method in this example effectively solves the problem of misaligned annotations caused by image size changes. It allows the image to be labeled consistently and accurately when displayed in a web browser or a mobile application. This method enhances the flexibility and robustness of the system, improves the user experience, and is particularly critical for applications that rely on high-precision image analysis.

[0035] It is not difficult to understand that in addition to the scaling ratio and offset calculation methods provided in the above examples, the scaling ratio and offset can also be calculated or obtained by other methods. For example, when the image to be annotated is rendered into the target container, the relationship between the logical width of the image to be annotated and the logical width of the target container is set to 100% through CSS, and the ratio between the height and width of the image to be annotated remains unchanged and is centered in the target container. The scaling ratio can be directly determined by obtaining the relationship between the width in CSS, and the offset can be calculated based on the layout information, container size and aspect ratio of the image to be annotated.

[0036] Step S200, performing target detection on the image to be labeled based on a preset target detection model to obtain a target detection result of the image to be labeled; It should be noted that the preset target detection model is a trained machine learning or deep learning model that can identify specific types of targets in an image and provide their location information (such as a bounding box). The target detection result refers to the output of the target detection model after performing target detection on the image to be labeled, which may include the target category detected by the target detection model from the image to be labeled and its corresponding location information, sequence number, confidence level, etc.

[0037] Specifically, in one example, the client is connected to the server for communication, and the preset target detection model is deployed on the server; like Figure 3 As shown, step S200 may include steps S210 to S220: Step S210, sending the image to be annotated to the server, so that the server performs target detection on the image to be annotated based on a preset target detection model, and generates a target detection result for the image to be annotated; Step S220: receiving the target detection result returned by the server based on the image to be annotated.

[0038] In this example, the target detection model is deployed on the server, and the client and the server are connected to each other, so that the image processing and target detection tasks are handed over to the server, which effectively reduces the computing burden on the client. Especially for devices with limited computing resources (such as mobile phones and tablets), it helps to improve the overall performance of the application and ensure that it can run smoothly even on low-end devices.

[0039] In addition, since the object detection model is deployed on the server, it can be easily updated or maintained through centralized management without the need for users to download new application versions. This is very important for keeping the system up to date and secure.

[0040] In this example, once the server completes the target detection, it can quickly return the results to the client, allowing the user to see the annotation effect almost immediately. The fast response time improves the user experience and makes the user feel that the operation is immediate and effective. And compared to running a simplified or outdated model on the client, this example can ensure higher detection accuracy and provide more reliable target detection results by using high-performance server hardware and the latest target detection model, thereby achieving more accurate image annotation.

[0041] Through the collaboration between the client and the server, the method in this example not only achieves efficient image object detection, but also improves the flexibility, maintainability and user experience of the system. In addition, the separation of computationally intensive tasks and server processing also enables the system to better adapt to future expansion and technological progress.

[0042] Step S300, correcting the target detection result by using the offset and the scaling ratio to obtain target labeling information of the image to be labeled; It should be noted that, in this embodiment, since the target detection result generated by the target detection model is based on the original size of the image to be annotated, after scaling and displacement occur in the process of rendering the image to be annotated into the target container, if the annotation information in the target detection result is directly used to annotate the image to be annotated rendered into the target container, annotation misalignment or distortion may easily occur. Therefore, this embodiment adaptively corrects the target detection result according to the scaling ratio and offset in the process of rendering the image to be annotated into the target container, and can obtain annotation information that matches the image to be annotated currently rendered into the target container, that is, the target annotation information.

[0043] Exemplarily, in one example, the target detection result includes initial annotation information of the image to be annotated, and step S300 may include steps S310 to S330: Step S310, scaling and correcting the initial annotation information according to the scaling ratio to obtain first annotation information of the image to be annotated; Step S320, performing offset correction on the first annotation information according to the offset to obtain second annotation information of the image to be annotated; Step S330: determine the second annotation information as target annotation information of the image to be annotated.

[0044] It should be noted that the initial annotation information refers to the annotation information generated by the target detection model based on the original size of the image to be annotated, the first annotation information refers to the annotation information obtained after applying the scaling ratio to perform scaling correction on the initial annotation information, and the first annotation information is consistent in size with the image to be annotated rendered in the target container, and the second annotation information refers to the annotation information obtained after applying the offset to perform offset correction on the first annotation information, and the second annotation information is consistent not only in size with the image to be annotated rendered in the target container, but also in the degree of offset.

[0045] It should also be noted that scaling correction refers to adjusting the position parameters in the annotation information according to the calculated scaling ratio to adapt to the logical size of the image after rendering, and offset correction refers to adjusting the position parameters in the annotation information according to the calculated offset to ensure that the annotation information can accurately reflect the exact position of the image in the target container, correcting the annotation misalignment problem caused by the displacement of the image in the container (i.e. center alignment, left alignment, etc.).

[0046] In this example, scale correction ensures that the annotation information is consistent with the logical size of the image. Even if the image is enlarged or reduced during the rendering process, the annotation can still accurately correspond to the correct size in the image. Offset correction solves the problem of annotation misalignment caused by the movement of the image within the container (referring to different layouts). Whether the image is centered, left-aligned, or right-aligned, or there are margin settings, offset correction can ensure that the annotation information matches the actual position of the image.

[0047] This example effectively solves the annotation problems caused by image size changes and position movements by introducing two steps: scaling correction and offset correction. This ensures that even if the image changes in size or position when displayed, the annotations can still be accurately reflected in the correct position on the image. This improves the accuracy and reliability of annotations, enhances the flexibility and robustness of the system, and provides users with a more efficient and intuitive image annotation solution.

[0048] Step S400 : annotating the image to be annotated rendered into the target container according to the target annotation information.

[0049] In an example, step S400 may include step S410: Step S410, annotating the image to be annotated rendered into the target container on a preset transparent canvas according to the target annotation information; The transparent canvas completely overlaps with the target container, and the transparent canvas is located on the upper layer of the target container.

[0050] It should be noted that the transparent canvas is a layer located above the target container. While completely overlapping with the target container, it is transparent itself and will not block the target container and image below. The transparent canvas is used to draw annotation information.

[0051] In this embodiment, the transparent canvas may be set on the target container in advance, so as to complete drawing of the marking information on the transparent canvas.

[0052] It should be noted that the transparent canvas completely overlaps with the target container, indicating that the logical size of the transparent canvas is consistent with that of the target container, and the logical position is consistent with that of the target container. Therefore, when annotating the image to be annotated rendered in the target container on the transparent canvas, the target annotation information can be directly applied without misalignment or distortion of the annotation.

[0053] This example achieves visual separation of annotation information from the original image by using a transparent canvas. This not only enables users to clearly distinguish between image content and annotation information, but also allows users to adjust the color, style, etc. of the annotation information as needed without affecting the display quality of the image itself. In addition, as an independent layer, the transparent canvas allows users to dynamically modify or delete annotation information without re-rendering the entire image, significantly reducing the client's computing burden, speeding up the response speed of annotation drawing, and improving the flexibility of user interaction, making the annotation process more intuitive and convenient.

[0054] In this example, step S410 uses a transparent canvas as the carrier of annotation, and combines the target annotation information calculated previously to achieve accurate annotation of the image to be annotated. This method not only maintains the original appearance of the image, but also provides a clear, flexible and efficient annotation interface. Through features such as visual separation, interactive friendliness and accuracy assurance, the user experience and work efficiency are greatly improved. At the same time, the application of transparent canvas also lays the foundation for performance optimization and function expansion of the system, making the image annotation solution more complete and advanced.

[0055] Furthermore, in a feasible implementation manner, before step S410, steps A10 to A20 may also be included: Step A10, detecting whether a transparent canvas completely overlapping the target container is provided on the upper layer of the target container; Step A20: If the upper layer of the target container is not provided with a transparent canvas that completely overlaps with the target container, a transparent canvas that completely overlaps with the target container is provided on the upper layer of the target container.

[0056] Before executing step S410, this embodiment first needs to ensure that a transparent canvas that completely overlaps the target container already exists in the upper layer. For example, in Web technology, it can be determined whether the transparent canvas already exists by checking whether there is an element with a specific identifier or class name in the DOM (Document Object Model) structure.

[0057] When it is confirmed in step A10 that there is no transparent canvas that meets the requirements above the target container, this embodiment needs to create a new transparent canvas above the target container. Exemplarily, in Web technology, this can be achieved through Canvas API (Canvas Application Programming Interface).

[0058] This implementation introduces steps A10 and A20 to ensure that a new transparent canvas is created only when necessary, thereby avoiding unnecessary consumption of system resources, thereby reducing the initial loading time of the interface, improving the startup speed of the application, and making the entire process more robust and efficient.

[0059] In addition, when the size of the target container changes during actual application, this process can also dynamically adjust or rebuild the transparent canvas to ensure that it always completely overlaps with the target container, thereby maintaining a high-quality annotation experience.

[0060] Furthermore, in another feasible implementation manner, after step A10, steps A30 to A40 may also be included: Step A30: if a transparent canvas completely overlapping the target container is provided on the upper layer of the target container, then detecting whether a mark is drawn on the transparent canvas; Step A40: If a mark is drawn on the transparent canvas, the transparent canvas is cleared, and a transparent canvas that completely overlaps with the target container is reset on the upper layer of the target container.

[0061] After confirming in step A10 that a transparent canvas completely overlaps the target container, the next step in this embodiment is to check in step A30 whether any annotation information has been drawn on the transparent canvas. For example, in Web technology, it is possible to determine whether there are any non-default drawing operations by querying the state of the Canvas drawing context or traversing the saved drawing command records. In some cases, a Boolean value or flag may be directly stored to indicate whether the canvas has been modified.

[0062] In this embodiment, the purpose of step A30 is to determine the state of the current transparent canvas so as to determine the subsequent operation. If the transparent canvas has been used for annotation, then the processing method of these annotations needs to be considered; if not, then the next stage can be directly entered.

[0063] In this embodiment, if it is found through step A30 that there are indeed annotations (whether one or more) on the transparent canvas, it is necessary to clear these annotations through step A40 and reset a new transparent canvas to ensure that each time a new annotation task is started, one can work on a clean, uncontaminated transparent canvas.

[0064] Through this implementation, whenever a new image to be annotated is rendered into the target container for drawing, the previously used transparent canvas can be cleared and a new transparent canvas can be provided for annotation and drawing.

[0065] It is not difficult to understand that when a new image to be annotated is rendered into a target container, the original image to be annotated will be cleared synchronously.

[0066] In addition, it should be noted that, in this embodiment, when the image to be annotated is rendered into the target container, the logical size of the image to be annotated should not be larger than the container size of the target container to avoid the image to be annotated overflowing the target container. Preferably, in this embodiment, when the image to be annotated is rendered into the target container, it is set as follows: without changing the aspect ratio of the image to be annotated, the image to be annotated is centered in the target container, and the logical width or height is the same as that of the target container.

[0067] This application calculates the scaling ratio and offset and uses these parameters to correct the target detection results, ensuring that even if the image changes in size or position when rendered to the container, the annotation can still be accurately reflected in the correct position on the image, greatly improving the accuracy of the annotation and avoiding the misalignment problem that may occur in traditional methods.

[0068] In addition, please refer to Figure 4 , Figure 4 This is a schematic diagram of the module structure of the client in the embodiment of the present application.

[0069] The present application also provides a client, which includes: The calculation module 10 is used to calculate the scaling ratio of the image to be annotated before and after rendering, and the offset of the image to be annotated relative to the target container after rendering the image to be annotated to the target container. A detection module 20, configured to perform target detection on the image to be labeled based on a preset target detection model to obtain a target detection result of the image to be labeled; A correction module 30, used to correct the target detection result by using an offset and a scaling ratio to obtain target annotation information of the image to be annotated; The labeling module 40 is used to label the image to be labeled rendered into the target container according to the target labeling information.

[0070] In one embodiment, the calculation module 10 is further used for: Obtain the original size and logical size of the image to be annotated, and calculate the scaling ratio of the image to be annotated before and after rendering based on the original size and logical size; The layout information of the image to be annotated rendered into the target container and the container size of the target container are obtained, and the offset of the image to be annotated relative to the target container after being rendered into the target container is calculated according to the layout information, container size and logical size.

[0071] In one embodiment, the client is connected to the server for communication, and the preset target detection model is deployed on the server; The detection module 20 is also used for: The image to be labeled is sent to the server, so that the server performs target detection on the image to be labeled based on a preset target detection model and generates a target detection result for the image to be labeled; Receive the target detection results returned by the server based on the image to be annotated.

[0072] In one embodiment, the target detection result includes initial annotation information of the image to be annotated, and the correction module 30 is further used to: Performing scaling correction on the initial annotation information according to the scaling ratio to obtain first annotation information of the image to be annotated; Performing offset correction on the first annotation information according to the offset to obtain second annotation information of the image to be annotated; The second annotation information is determined as target annotation information of the image to be annotated.

[0073] In one embodiment, the marking module 40 is further used for: According to the target annotation information, the image to be annotated rendered into the target container is annotated on a preset transparent canvas; The transparent canvas completely overlaps with the target container, and the transparent canvas is located on the upper layer of the target container.

[0074] In one embodiment, the marking module 40 is further used for: Detect whether a transparent canvas that completely overlaps with the target container is set on the upper layer of the target container; If a transparent canvas that completely overlaps with the target container is not disposed on the upper layer of the target container, a transparent canvas that completely overlaps with the target container is disposed on the upper layer of the target container.

[0075] In one embodiment, the marking module 40 is further used for: If a transparent canvas completely overlapping the target container is provided on the upper layer of the target container, then it is detected whether a mark is drawn on the transparent canvas; If a markup is drawn on the transparent canvas, the transparent canvas is cleared, and a new transparent canvas is set on the upper layer of the target container to completely overlap with the target container.

[0076] The client provided by this application adopts the image annotation method in the above embodiment, which can solve the technical problem of misalignment or distortion of image annotation based on the target detection model in the related technology. Compared with the prior art, the beneficial effects of the client provided by this application are the same as those of the image annotation method in the above embodiment, and other technical features of the client are the same as those disclosed by the image annotation method in the above embodiment, which will not be repeated here.

[0077] In addition, please refer to Figure 5 , Figure 5 Schematic diagram of the device structure of the hardware operating environment involved in the image annotation method in the embodiment of the present application.

[0078] The present application also provides a terminal device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the steps of the image annotation method in the above-mentioned embodiment.

[0079] Reference below Figure 5 , which shows a schematic diagram of the structure of a terminal device suitable for implementing the embodiment of the present application. The terminal device in the embodiment of the present application may include but is not limited to mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions: tablet computers), PMPs (Portable Media Players: portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs (Televisions, televisions), desktop computers, etc., or any terminal device that can implement the above functions. Figure 5 The terminal device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.

[0080] like Figure 5 As shown, the terminal device may include a processing device 1001 (such as a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the terminal device are also stored. The processing device 1001, ROM1002 and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the terminal device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows a terminal device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or provided instead.

[0081] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.

[0082] The terminal device provided by the present application adopts the image annotation method in the above embodiment, which can solve the technical problem of misalignment or distortion of image annotation based on the target detection model in the related technology. Compared with the prior art, the beneficial effects of the terminal device provided by the present application are the same as those of the image annotation method in the above embodiment, and other technical features in the terminal device are the same as those disclosed in the above embodiment method, which will not be repeated here.

[0083] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.

[0084] The above are only specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the above claims.

[0085] In addition, the present application also provides a storage medium, which is a computer-readable storage medium having computer-readable program instructions (ie, computer programs) stored thereon, and the computer-readable program instructions are used to execute the steps of the image annotation method in the above-mentioned embodiment.

[0086] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM: Random Access Memory), a read-only memory (ROM: Read Only Memory), an erasable programmable read-only memory (EPROM: Erasable Programmable Read Only Memory or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM: CD-Read Only Memory), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency: Radio Frequency), etc., or any suitable combination of the above.

[0087] The computer-readable storage medium may be included in the client; or may exist independently without being installed in the client.

[0088] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by a client, the client: after rendering the image to be labeled into a target container, calculates the scaling ratio of the image to be labeled before and after rendering, and the offset of the image to be labeled relative to the target container after rendering the image to be labeled into the target container; performs target detection on the image to be labeled based on a preset target detection model to obtain a target detection result of the image to be labeled; corrects the target detection result by the offset and the scaling ratio to obtain target labeling information of the image to be labeled; and labels the image to be labeled rendered into the target container according to the target labeling information.

[0089] Computer program code for performing the operations of the present application may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0090] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0091] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.

[0092] The storage medium provided by the present application stores computer-readable program instructions for executing the steps of the above-mentioned image annotation method, which can solve the technical problem of misalignment or distortion in image annotation based on the target detection model in the related art. Compared with the prior art, the beneficial effects of the storage medium provided by the present application are the same as those of the image annotation method in the above-mentioned embodiment, and will not be described in detail here.

[0093] In addition, an embodiment of the present application further provides a program product, which is a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the steps of the image annotation method in the above embodiment are implemented.

[0094] The program product provided by this application can solve the technical problem of misalignment or distortion in image annotation based on target detection models in related technologies. Compared with the prior art, the beneficial effects of the program product provided by the embodiment of this application are the same as the beneficial effects of the image annotation method in the above embodiment, which will not be repeated here.

[0095] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect applications in other related technical fields are included in the patent protection scope of the present application.

Claims

1. An image annotation method, characterized in that: The method is applied to a client, and the method comprises: After rendering the image to be annotated into the target container, calculating the scaling ratio of the image to be annotated before and after rendering, and the offset of the image to be annotated relative to the target container after rendering into the target container; Performing target detection on the image to be labeled based on a preset target detection model to obtain a target detection result of the image to be labeled; Correcting the target detection result by using the offset and the scaling ratio to obtain target labeling information of the image to be labeled; The image to be labeled rendered into the target container is labeled according to the target labeling information.

2. The image annotation method according to claim 1, characterized in that: The step of calculating the scaling ratio of the image to be annotated before and after rendering, and the offset of the image to be annotated relative to the target container after rendering to the target container, comprises: Acquire the original size and the logical size of the image to be annotated, and calculate the scaling ratio of the image to be annotated before and after rendering according to the original size and the logical size; Layout information of rendering the image to be annotated into the target container and the container size of the target container are obtained, and an offset of the image to be annotated relative to the target container after being rendered into the target container is calculated according to the layout information, the container size and the logical size.

3. The image annotation method according to claim 2, characterized in that: The client is connected to the server for communication, and the preset target detection model is deployed on the server; The step of performing target detection on the image to be labeled based on a preset target detection model to obtain a target detection result of the image to be labeled includes: Sending the image to be annotated to the server, so that the server performs target detection on the image to be annotated based on a preset target detection model, and generates a target detection result for the image to be annotated; Receive the target detection result returned by the server based on the image to be annotated.

4. The image annotation method according to claim 3, characterized in that: The target detection result includes initial annotation information of the image to be annotated, and the step of correcting the target detection result by using the offset and the scaling ratio to obtain the target annotation information of the image to be annotated includes: Performing scaling correction on the initial annotation information according to the scaling ratio to obtain first annotation information of the image to be annotated; Performing offset correction on the first annotation information according to the offset to obtain second annotation information of the image to be annotated; The second annotation information is determined as target annotation information of the image to be annotated.

5. The image annotation method according to claim 4, characterized in that: The step of annotating the image to be annotated rendered into the target container according to the target annotation information includes: Annotating the image to be annotated rendered into the target container on a preset transparent canvas according to the target annotation information; The transparent canvas completely overlaps with the target container, and the transparent canvas is located on an upper layer of the target container.

6. The image annotation method according to claim 5, characterized in that: Before the step of annotating the image to be annotated rendered into the target container on a preset transparent canvas according to the target annotation information, the method further includes: Detecting whether a transparent canvas completely overlapping the target container is provided on an upper layer of the target container; If the upper layer of the target container is not provided with a transparent canvas that completely overlaps with the target container, a transparent canvas that completely overlaps with the target container is provided on the upper layer of the target container.

7. The image annotation method according to claim 5, characterized in that: After the step of detecting whether a transparent canvas completely overlapping with the target container is disposed on the upper layer of the target container, the method further includes: If a transparent canvas completely overlapping the target container is disposed on the upper layer of the target container, detecting whether a mark is drawn on the transparent canvas; If a mark is drawn on the transparent canvas, the transparent canvas is cleared, and a transparent canvas completely overlapping the target container is reset on the upper layer of the target container.

8. A client, characterized in that: The client comprises: A calculation module, used for calculating the scaling ratio of the image to be labeled before and after rendering, and the offset of the image to be labeled relative to the target container after rendering the image to be labeled to the target container after rendering the image to be labeled to the target container; A detection module, used to perform target detection on the image to be labeled based on a preset target detection model to obtain a target detection result of the image to be labeled; A correction module, used to correct the target detection result by using the offset and the scaling ratio to obtain target labeling information of the image to be labeled; A labeling module is used to label the image to be labeled rendered into the target container according to the target labeling information.

9. A terminal device, characterized in that: The terminal device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps of the image annotation method according to any one of claims 1 to 7 when executed by the processor.

10. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of the image annotation method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Image pre-labeling method and device, electronic equipment and medium

    CN112418287A

  • Image labeling method, image labeling system, electronic device and storage medium

    CN114398571A

  • Image annotation method and device, electronic equipment and storage medium

    CN117974790A

  • Image labeling method, device and system, electronic equipment and storage medium

    CN118429484A

  • Picture labeling method and device, equipment and storage medium

    CN118915947A

Cited By

  • Cross-layer annotation correction and real-time rendering method and application thereof

    CN121981927A