Marking method and apparatus, and device and computer-readable storage medium

By acquiring the image of the object to be detected and comparing the size and automatically labeling it, the problem of inaccurate marking in industrial inspection is solved, and higher labeling accuracy and work efficiency are achieved.

WO2025139065A1PCT designated stage expired Publication Date: 2025-07-03CONTEMPORARY AMPEREX TECHNOLOGY CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/118530
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-12-26
Filing Date
2024-09-12
Publication Date
2025-07-03

AI Technical Summary

Technical Problem

In industrial testing, in the prior art, relying on intuitive labeling of objects to be tested is prone to missed marks or missed marks, resulting in inaccurate markings.

Method used

By acquiring the image of the object to be detected, comparing the size with the reference mark, determining whether the size of the object to be detected is greater than the preset size, and automatically marking it when it is greater than the preset size, including steps such as image scaling, alignment and size comparison.

Benefits of technology

It improves the accuracy of labeling objects to be tested, reduces missed marks and missed marks, and reduces the workload of personnel.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024118530_03072025_PF_FP_ABST
    Figure CN2024118530_03072025_PF_FP_ABST
Patent Text Reader

Abstract

Disclosed in the present application are a marking method and apparatus, and a device and a computer-readable storage medium. The marking method comprises: acquiring an image of an object to be tested; performing size comparison on said object in the image and a reference mark to obtain a size comparison result; on the basis of the size comparison result, determining whether the size of said object is larger than a preset size; and when the size of said object is larger than the preset size, marking said object in the image.
Need to check novelty before this filing date? Find Prior Art

Description

Marking method, device, equipment and computer-readable storage medium

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This application claims priority to Chinese patent application No. 202311810018.3, filed on December 26, 2023, entitled “Marking method, apparatus, device and computer-readable storage medium,” and the entire contents of that application are incorporated herein by reference. Technical Field

[0003] The present application relates to the field of annotation technology, and in particular to an annotation method, apparatus, device, and computer-readable storage medium. Background Art

[0004] In industrial inspection, it's often necessary to label objects. This labeling process may require labeling for some dimensions, while others may not. Related technologies often rely on the labeler's intuition, which can lead to omissions or mislabeling.

[0005] Summary of the Invention

[0006] The embodiments of the present application provide a labeling method, apparatus, device, and computer-readable storage medium, which can improve the accuracy of labeling objects to be detected and reduce the workload of personnel.

[0007] In a first aspect, an embodiment of the present application provides a labeling method, which includes: obtaining an image of an object to be detected; comparing the size of the object to be detected in the image with a reference mark to obtain a size comparison result; based on the size comparison result, determining whether the size of the object to be detected is larger than a preset size; if the size of the object to be detected is larger than the preset size, labeling the object to be detected in the image.

[0008] Based on the technical solution of the embodiment of the present application, the size of the object to be detected in the image is compared with the reference mark to obtain a size comparison result. Based on the size comparison result, it is possible to accurately determine whether the size of the object to be detected is larger than the preset size. If the size of the object to be detected is larger than the preset size, the object to be detected in the image is marked. In this way, it is possible to automatically mark objects to be detected in the image that are larger than the preset size, reduce the problem of missing or mislabeling objects to be detected, improve the accuracy of marking objects to be detected, and reduce the workload of personnel.

[0009] According to an implementation of the first aspect of the present application, before comparing the size of the object to be detected in the image with the reference mark to obtain the size comparison result, the annotation method also includes: obtaining a target scaling ratio of the image; scaling the image based on the target scaling ratio; comparing the size of the object to be detected in the image with the reference mark to obtain the size comparison result, including: comparing the size of the object to be detected in the scaled image with the reference mark to obtain the size comparison result.

[0010] According to any of the aforementioned embodiments of the first aspect of the present application, scaling an image based on a target scaling ratio includes: when the drawing ratio of the image is less than or equal to a first preset threshold, the target scaling ratio is greater than 1, and the image is enlarged; and / or, when the drawing ratio of the image is greater than a second preset threshold, the target scaling ratio is less than 1, and the image is reduced, and the second preset threshold is greater than or equal to the first preset threshold.

[0011] According to any of the aforementioned embodiments of the first aspect of the present application, the marking method further includes: when the image is scaled, the size of the reference mark remains unchanged.

[0012] According to any of the aforementioned embodiments of the first aspect of the present application, scaling an image based on a target scaling ratio includes: obtaining a current scaling ratio of the image; when the current scaling ratio is inconsistent with the target scaling ratio and the current scaling ratio is inconsistent with the initial scaling ratio of the image, restoring the image to the initial scaling ratio and then scaling the image based on the target scaling ratio; or, when the current scaling ratio is inconsistent with the target scaling ratio and the current scaling ratio is inconsistent with the initial scaling ratio of the image, calculating a conversion relationship between the target scaling ratio and the current scaling ratio, and scaling the image based on the conversion relationship.

[0013] According to any of the aforementioned embodiments of the first aspect of the present application, the size of the object to be detected in the image is compared with the reference mark to obtain a size comparison result, including: aligning the object to be detected with the reference mark; comparing the size of the aligned object to be detected with the size of the reference mark to obtain a size comparison result.

[0014] According to any of the aforementioned embodiments of the first aspect of the present application, the object to be detected and the reference mark are aligned, including: establishing an image coordinate system of the image; determining the position of the center point of the object to be detected in the image coordinate system based on the target image detection algorithm; and moving the reference mark according to the position of the center point of the object to be detected in the image coordinate system until the distance between the center point of the reference mark and the center point of the object to be detected is less than or equal to a third preset threshold.

[0015] According to any of the aforementioned embodiments of the first aspect of the present application, aligning the object to be detected with the reference mark includes: receiving an instruction to move the reference mark; in response to the instruction to move the reference mark, moving the reference mark to the position indicated by the instruction until the distance between the center point of the reference mark and the center point of the object to be detected is less than or equal to a third preset threshold.

[0016] According to any of the aforementioned embodiments of the first aspect of the present application, the reference mark includes a cross cursor, the cross cursor includes a horizontal cursor and a vertical cursor, and the horizontal cursor and the vertical cursor intersect at the center point of the reference mark; the size of the object to be detected in the image is compared with the reference mark to obtain a size comparison result, including: comparing a first length of the object to be detected along the extension direction of the horizontal cursor with the length of the horizontal cursor to obtain a first size comparison result; comparing a second length of the object to be detected along the extension direction of the vertical cursor with the length of the vertical cursor to obtain a second size comparison result.

[0017] According to any of the aforementioned embodiments of the first aspect of the present application, based on the size comparison result, it is determined whether the size of the object to be detected is greater than the preset size, including: when the first length is greater than or equal to the length of the horizontal cursor of a first preset multiple, and / or when the second length is greater than or equal to the length of the vertical cursor of a second preset multiple, determining that the size of the object to be detected is greater than the preset size.

[0018] According to any of the aforementioned embodiments of the first aspect of the present application, before comparing the size of the object to be detected in the image with the reference mark and obtaining the size comparison result, the labeling method also includes: setting the shape of the reference mark and the switch button of the reference mark; receiving an input instruction of the switch button of the reference mark; and displaying a reference mark of a preset shape in response to the input instruction of clicking the switch button of the reference mark.

[0019] According to any of the aforementioned embodiments of the first aspect of the present application, setting the shape of the reference mark includes: adding the shape of the reference mark to the function of setting the cursor shape of the mouse; displaying a reference mark of a preset shape in response to an input instruction of clicking a switch button of the reference mark, including: changing the cursor to the shape of the reference mark in response to an input instruction of clicking the switch button of the reference mark.

[0020] According to any of the aforementioned embodiments of the first aspect of the present application, when the size of the object to be detected is larger than a preset size, the object to be detected in the image is marked, including: when the size of the object to be detected is larger than the preset size, a target mark is generated in the image, and the target mark is used to mark the position of the object to be detected and / or the size of the object to be detected.

[0021] According to any of the aforementioned embodiments of the first aspect of the present application, the target marker includes a plurality of endpoints. When the size of the object to be detected is larger than a preset size, generating the target marker in the image includes: obtaining a first scaling ratio of the image; determining a second scaling ratio for the endpoints of the target marker based on the first scaling ratio, the second scaling ratio being smaller than the first scaling ratio; and adjusting the size of the endpoints based on the second scaling ratio.

[0022] In a second aspect, an embodiment of the present application provides a labeling device, which includes: an acquisition module for acquiring an image of an object to be detected; a comparison module for comparing the size of the object to be detected in the image with a reference mark to obtain a size comparison result; a judgment module for judging whether the size of the object to be detected is greater than a preset size based on the size comparison result; and a labeling module for labeling the object to be detected in the image if the size of the object to be detected is greater than the preset size.

[0023] In a third aspect, an embodiment of the present application provides an electronic device, which includes: a processor, a memory, and a computer program stored in the memory and runnable on the processor. When the computer program is executed by the processor, the steps of the marking method provided in the first aspect are implemented.

[0024] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the marking method provided in the first aspect are implemented. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0026] FIG1 is a schematic diagram of a flow chart of a marking method provided in an embodiment of the present application;

[0027] FIG2 is another flow chart of the marking method provided in an embodiment of the present application;

[0028] FIG3 is a flow chart of S202 in the marking method provided in an embodiment of the present application;

[0029] FIG4 is another schematic diagram of the process of step S202 in the labeling method provided in an embodiment of the present application;

[0030] FIG5 is another flowchart of S202 in the marking method provided in an embodiment of the present application;

[0031] FIG6 is a schematic diagram of a flow chart of S102 in the marking method provided in an embodiment of the present application;

[0032] FIG7 is a schematic diagram of a flow chart of S601 in the marking method provided in an embodiment of the present application;

[0033] FIG8 is a schematic diagram of an operation of S601 in the marking method provided in an embodiment of the present application;

[0034] FIG9 is another schematic diagram of a flow chart of S601 in the marking method provided in an embodiment of the present application;

[0035] FIG10 is a schematic diagram of an operation for comparing the size of an object to be detected with a reference mark;

[0036] FIG11 is a schematic diagram of another flow chart of the marking method provided in an embodiment of the present application;

[0037] FIG12 is a schematic diagram of an operation of S104 in the marking method provided in an embodiment of the present application;

[0038] FIG13 is a schematic diagram of a flow chart of S104 in the marking method provided in an embodiment of the present application;

[0039] FIG14 is a schematic structural diagram of a marking device provided in an embodiment of the present application;

[0040] FIG15 shows a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application.

[0041] In the accompanying drawings, the drawings are not necessarily drawn to scale. DETAILED DESCRIPTION

[0042] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is merely to provide a better understanding of the present application by illustrating the examples of the present application.

[0043] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, the elements defined by the phrase "comprising..." do not exclude the presence of other identical elements in the process, method, article, or device comprising the elements.

[0044] It should be understood that the term "and / or" as used herein is merely a description of the relationship between associated objects, indicating that three possible relationships exist. For example, "A and / or B" can represent: A exists alone, A and B exist simultaneously, or B exists alone. Furthermore, the character " / " in this document generally indicates that the associated objects are in an "or" relationship.

[0045] It will be apparent to those skilled in the art that various modifications and variations can be made in this application without departing from the spirit or scope of this application. Therefore, this application is intended to cover modifications and variations of this application that fall within the scope of the corresponding claims (technical solutions claimed for protection) and their equivalents. It should be noted that the embodiments provided in the examples of this application can be combined with each other without contradiction.

[0046] Before describing the technical solutions provided by the embodiments of the present application, in order to facilitate understanding of the embodiments of the present application, the present application first specifically describes the problems existing in the related art:

[0047] In industrial inspection, it's often necessary to label objects. This labeling process may require labeling for some dimensions, while others may not. Related technologies often rely on the labeler's intuition, which can lead to omissions or mislabeling.

[0048] In view of the above research findings of the inventors, the embodiments of the present application provide a labeling method, apparatus, device and computer-readable storage medium, which can improve the accuracy of labeling objects to be detected and reduce the workload of personnel.

[0049] The following first introduces the marking method provided in the embodiment of the present application.

[0050] Figure 1 is a flow chart of a marking method provided in an embodiment of the present application. As shown in Figure 1 , the marking method provided in an embodiment of the present application may include the following steps S101 to S104.

[0051] S101: Acquire an image of an object to be detected.

[0052] The object to be detected can be any object to be detected, and this application does not limit this. For example, in some embodiments, the object to be detected can be a molten bead, which is the residue splashed out during welding. Molten beads with relatively large sizes need to be cleaned up in time. Therefore, it is necessary to mark the molten beads with relatively large sizes in order to determine the position of the molten beads, so as to clean up the molten beads with relatively large sizes. Of course, in other embodiments, for example, the object to be detected can also be some smaller devices, such as sealing nails, and these smaller devices can be marked.

[0053] The image of the object to be detected can be collected, for example, by an image acquisition device (such as a camera). This application does not limit the method for collecting the image of the object to be detected.

[0054] S102 : performing size comparison between the object to be detected in the image and the reference mark to obtain a size comparison result.

[0055] The size of the reference mark can be determined, for example, a reference mark of a preset size can be generated. The shape and size of the reference mark can be flexibly adjusted according to actual conditions, and this application does not limit this. In S102, the size of the object to be detected in the image of the object to be detected can be compared with the reference mark to obtain a size comparison result.

[0056] S103: Based on the size comparison result, determine whether the size of the object to be detected is larger than a preset size.

[0057] Since the size of the reference mark is fixed, the size comparison result of the object to be detected in the image of the object to be detected and the reference mark can be used to determine whether the size of the object to be detected is larger than the preset size. The size of the preset size can be flexibly adjusted according to actual conditions and is not limited in this application.

[0058] S104 : When the size of the object to be detected is larger than a preset size, mark the object to be detected in the image.

[0059] When it is determined that the size of the object to be detected is larger than the preset size, the object to be detected in the image of the object to be detected may be marked.

[0060] The labeling method provided in the embodiments of the present application compares the size of the object to be detected in the image of the object to be detected with the reference mark to obtain a size comparison result. Based on the size comparison result, it can accurately determine whether the size of the object to be detected is larger than a preset size. If the size of the object to be detected is larger than the preset size, the object to be detected in the image is labeled. In this way, it is possible to automatically label objects to be detected in the image that are larger than the preset size, reduce the problem of missing or mislabeling objects to be detected, improve the accuracy of labeling objects to be detected, and reduce the workload of personnel.

[0061] FIG2 is another flow diagram of the labeling method provided in an embodiment of the present application. As shown in FIG2 , according to some embodiments of the present application, optionally, before step S102, comparing the size of the object to be detected in the image with the reference mark to obtain the size comparison result, the labeling method provided in an embodiment of the present application may further include the following steps S201 and S202.

[0062] S201: Obtain a target scaling ratio of an image.

[0063] The target scaling ratio is the scaling ratio that the image of the object to be detected is expected to achieve. In some examples, the target scaling ratio can be expressed as a percentage, for example, the target scaling ratio can be 10%, 30%, 50%, 100%, 150%, or 200%. The target scaling ratio can be flexibly adjusted according to actual circumstances and is not limited in this application. The above values ​​are for example only and do not constitute a limitation of this application.

[0064] S202: Scale the image based on the target scaling ratio.

[0065] After the target scaling ratio is determined, the image of the object to be detected can be scaled based on the target scaling ratio, that is, the scaling ratio of the image of the object to be detected is adjusted to the target scaling ratio.

[0066] Scaling includes reducing or enlarging. For example, if the current scaling ratio of the image of the object to be detected is 100%, when the target scaling ratio is less than 100%, it means that the image of the object to be detected is reduced; when the target scaling ratio is greater than 100%, it means that the image of the object to be detected is enlarged.

[0067] Accordingly, S102, comparing the size of the object to be detected in the image with the reference mark to obtain a size comparison result, may include the following steps:

[0068] The size of the object to be detected in the zoomed image is compared with the reference mark to obtain a size comparison result.

[0069] After the image of the object to be detected is scaled, the size of the object to be detected in the scaled image will also be scaled accordingly, so as to perform size comparison with the reference mark and obtain a size comparison result.

[0070] For example, if the size of the object to be detected in the image of the object to be detected is small, it may be difficult to compare the size of the object to be detected with the reference mark due to the small size of the object to be detected. In this case, by magnifying the image of the object to be detected, the size of the object to be detected in the image of the object to be detected can also be magnified, thereby facilitating the size comparison of the object to be detected with the reference mark and obtaining a size comparison result.

[0071] For example, when the size of the object to be detected in the image of the object to be detected is large, such as when the size of the object to be detected is several times larger than the size of the reference mark, it may be difficult to compare the size of the object to be detected with the reference mark due to the large size of the object to be detected. In this case, by reducing the image of the object to be detected, the size of the object to be detected in the image of the object to be detected can also be reduced, thereby facilitating the size comparison of the object to be detected with the reference mark and obtaining a size comparison result.

[0072] Thus, before comparing the size of the object to be detected in the image with the reference mark, the image of the object to be detected is first adjusted to the target zoom ratio, which can facilitate the size comparison between the object to be detected and the reference mark and obtain the size comparison result.

[0073] According to some embodiments of the present application, optionally, a zoom button for the image of the object to be detected can be set, and a text box for inputting a target zoom ratio of an instruction can be set. When an input instruction that triggers the zoom button is detected, the target zoom ratio of the instruction input in the text box can be obtained. Then, it can also be determined whether the target zoom ratio is within a preset range. When the target zoom ratio is within the preset range, the image of the object to be detected can be zoomed based on the target zoom ratio. When the target zoom ratio is not within the preset range, the image of the object to be detected can be not zoomed. The size of the preset range can be flexibly adjusted according to actual conditions, and this application does not limit this.

[0074] Figure 3 is a flow chart of S202 in the annotation method provided in an embodiment of the present application. As shown in Figure 3, according to some embodiments of the present application, optionally, S202, scaling the image based on the target scaling ratio, may include the following steps S301 and / or S302.

[0075] S301: When the drawing ratio of an image is less than or equal to a first preset threshold, and the target scaling ratio is greater than 1, the image is enlarged.

[0076] The image rendering ratio may represent the ratio between the size of the object to be detected in the image and the actual size of the object to be detected in the real environment. For example, when the image rendering ratio is 1:1, the size of the object to be detected in the image is equal to the actual size of the object to be detected in the real environment.

[0077] For example, when the image rendering ratio is 1:n1 (n1>1), that is, one-n1, the size of the object to be detected in the image is smaller than the actual size of the object to be detected in the real environment, and the size of the object to be detected in the image is one-n1 of the actual size of the object to be detected in the real environment. For example, when the image rendering ratio is n2:1 (n2>1), the size of the object to be detected in the image is larger than the actual size of the object to be detected in the real environment, and the size of the object to be detected in the image is n2 times the actual size of the object to be detected in the real environment.

[0078] When the image drawing ratio is less than or equal to the first preset threshold, the target scaling ratio can be set to be greater than 1, and the image of the object to be detected can be magnified. The first preset threshold can be flexibly adjusted according to actual conditions, and this application does not limit this. For example, in some examples, the first preset threshold can be 1:1. When the image drawing ratio is less than or equal to 1:1, such as 1:n1, the target scaling ratio can be set to be greater than 1, and the image of the object to be detected can be magnified.

[0079] When the drawing ratio of the image is less than or equal to the first preset threshold, it means that the size of the object to be detected in the image of the object to be detected may be small. The target scaling ratio can be set to be greater than 1, and the image of the object to be detected is enlarged, so that the size of the object to be detected in the image of the object to be detected is also enlarged, thereby facilitating size comparison between the object to be detected and the reference mark to obtain a size comparison result.

[0080] S302: When the drawing ratio of the image is greater than a second preset threshold, the target scaling ratio is less than 1, and the image is reduced, and the second preset threshold is greater than or equal to the first preset threshold.

[0081] The second preset threshold can be flexibly adjusted according to actual conditions, and this application does not impose any restrictions on this. When the image drawing ratio is greater than the second preset threshold, it indicates that the size of the object to be detected in the image of the object to be detected may be larger. The target scaling ratio can be set to less than 1, and the image of the object to be detected can be reduced, so that the size of the object to be detected in the image of the object to be detected is also reduced, thereby facilitating the size comparison of the object to be detected with the reference mark and obtaining a size comparison result.

[0082] In this way, the zoom ratio of the image of the object to be detected can be flexibly adjusted according to the drawing ratio of the image, and then the size of the object to be detected in the image of the object to be detected can be adjusted to facilitate size comparison between the object to be detected and the reference mark to obtain a size comparison result.

[0083] Figure 4 is another flow diagram of S202 in the annotation method provided in an embodiment of the present application. As shown in Figure 4, according to some embodiments of the present application, optionally, S202, scaling the image based on the target scaling ratio, may include the following steps S401 and S402.

[0084] S401: Obtain the current zoom ratio of the image.

[0085] The current zoom ratio of the image of the object to be detected may be the current zoom ratio of the image of the object to be detected.

[0086] S402: When the current zoom ratio is inconsistent with the target zoom ratio and the current zoom ratio is inconsistent with the initial zoom ratio of the image, the image is restored to the initial zoom ratio and then zoomed based on the target zoom ratio.

[0087] The initial scaling ratio of the image of the object to be detected may be a pre-set scaling ratio for the image of the object to be detected. The initial scaling ratio of the image of the object to be detected may be flexibly adjusted based on actual circumstances, and this application does not limit this. For example, in some examples, the initial scaling ratio of the image of the object to be detected may be 100%, i.e., 1. Of course, the initial scaling ratio of the image of the object to be detected may also be other values.

[0088] In some embodiments, the target scaling ratio can be relative to the initial scaling ratio. For example, the target scaling ratio can be n times larger or smaller than the initial scaling ratio, where n is an arbitrary value. Therefore, if the current scaling ratio is inconsistent with the target scaling ratio, and the current scaling ratio is inconsistent with the initial scaling ratio of the image of the object to be detected, the image of the object to be detected can be restored to the initial scaling ratio. Then, based on the target scaling ratio, the image of the object to be detected can be scaled so that the image of the object to be detected reaches the desired scaling ratio.

[0089] Figure 5 is another flow chart of S202 in the annotation method provided in an embodiment of the present application. As shown in Figure 5, according to other embodiments of the present application, optionally, S202, scaling the image based on the target scaling ratio, may include the following steps S501 and S502.

[0090] S501: Obtain the current zoom ratio of the image.

[0091] The current zoom ratio of the image of the object to be detected may be the current zoom ratio of the image of the object to be detected.

[0092] S502: If the current scaling ratio is inconsistent with the target scaling ratio and the current scaling ratio is inconsistent with the initial scaling ratio of the image, calculate a conversion relationship between the target scaling ratio and the current scaling ratio, and scale the image based on the conversion relationship.

[0093] For example, the current scaling ratio is x1 times the initial scaling ratio, and the target scaling ratio is x2 times the initial scaling ratio, where x1 ≠ x2. The conversion relationship between the target scaling ratio and the current scaling ratio can include the ratio of x2 to x1, i.e., x2 / x1. Then, based on the current scaling ratio, the image of the object to be inspected is scaled by x2 / x1, so that the image reaches the desired scaling ratio.

[0094] Figure 6 is a flow chart of S102 in the annotation method provided in an embodiment of the present application. As shown in Figure 6, according to some embodiments of the present application, S102, optionally comparing the size of the object to be detected in the image with the reference mark to obtain the size comparison result, can include the following steps S601 and S602.

[0095] S601: Align the object to be detected with the reference mark.

[0096] S602: Compare the size of the aligned object to be detected with the size of the reference mark to obtain a size comparison result.

[0097] In this way, the object to be detected is first aligned with the reference mark, and then the size of the aligned object to be detected is compared with the size of the reference mark to obtain a size comparison result, which can improve the accuracy of the size comparison result.

[0098] Figure 7 is a flow chart of S601 in the marking method provided in an embodiment of the present application. As shown in Figure 7, according to some embodiments of the present application, optionally, S601, aligning the object to be detected with the reference mark, may include the following steps S701 to S703.

[0099] S701: Establish an image coordinate system for the image.

[0100] FIG8 is an operational schematic diagram of S601 in the marking method provided in an embodiment of the present application. As shown in FIG8 , an image coordinate system 80 of the image of the object to be detected can be established. The image coordinate system 80 can be a plane rectangular coordinate system. The image coordinate system 80 can include an origin O, a horizontal axis X, and a vertical axis Y. It should be noted that the image of the object to be detected in FIG8 is only a schematic diagram of the image of the object to be detected. The image of the object to be detected can include one or more objects to be detected 81. Exemplarily, the object to be detected 81 can be, for example, a molten bead or a sealing nail.

[0101] S702 : Determine the position of the center point of the object to be detected in the image coordinate system based on the target image detection algorithm.

[0102] In S702, based on the target image detection algorithm, the position of the center point o1 of the object to be detected 81 in the image coordinate system 80 can be determined, that is, the coordinates of the center point o1 of the object to be detected 81 in the image coordinate system 80. This application does not limit the type of target image detection algorithm, and the target image detection algorithm can be, for example, an image detection algorithm based on deep learning.

[0103] S703 : Move the reference mark according to the position of the center point of the object to be detected in the image coordinate system until the distance between the center point of the reference mark and the center point of the object to be detected is less than or equal to a third preset threshold.

[0104] As shown in Figure 8, after determining the position of the center point o1 of the object to be detected 81 in the image coordinate system 80, the reference mark 82 can be moved according to the position of the center point o1 of the object to be detected 81 in the image coordinate system 80 until the distance between the center point o2 of the reference mark 82 and the center point o1 of the object to be detected 81 is less than or equal to the third preset threshold. The size of the third preset threshold can be flexibly adjusted according to actual conditions, and this application does not limit this. For example, in some examples, the reference mark 82 can be moved until the center point o2 of the reference mark 82 coincides with the center point o1 of the object to be detected 81, that is, the distance between the center point o2 of the reference mark 82 and the center point o1 of the object to be detected 81 is less than or equal to 0.

[0105] In this way, through the above steps S701 to S703, the automatic alignment of the object to be detected and the reference mark can be achieved, which reduces the workload of manual alignment and reduces the error of manual alignment.

[0106] Figure 9 is another flow diagram of S601 in the marking method provided in an embodiment of the present application. As shown in Figure 9, according to other embodiments of the present application, optionally, S601, aligning the object to be detected with the reference mark, may include the following steps S901 and S902.

[0107] S901: Receive an instruction to move a reference marker.

[0108] In some examples, a user input instruction may be received, such as an instruction to move a reference marker.

[0109] S902 : In response to an instruction to move the reference marker, move the reference marker to a position indicated by the instruction until a distance between a center point of the reference marker and a center point of the object to be detected is less than or equal to a third preset threshold.

[0110] For example, in some examples, a user can input a command to move the reference marker using an input device such as a mouse. In response to the command to move the reference marker, the reference marker can be moved to the position indicated by the command. Ultimately, the distance between the center point of the reference marker and the center point of the object to be inspected can be less than or equal to a third preset threshold, thereby achieving alignment between the object to be inspected and the reference marker.

[0111] Thus, in the embodiment shown in FIG. 9 , by receiving an instruction to move the reference mark and responding to the instruction to move the reference mark, the reference mark is moved to the position indicated by the instruction, thereby also achieving alignment between the object to be detected and the reference mark.

[0112] Figure 10 is a schematic diagram of an operation for comparing the dimensions of an object to be inspected with a reference mark. As shown in Figure 10 , according to some embodiments of the present application, the reference mark 82 may optionally include a crosshair cursor, which may include a horizontal cursor xg and a vertical cursor yg. The horizontal cursor xg and the vertical cursor yg may intersect at the center point o2 of the reference mark 82. It should be noted that the reference mark 82 may also have other shapes, which are not limited by the present application. For example, in other examples, the reference mark 82 may have a rectangular or circular shape.

[0113] S102, comparing the size of the object to be detected in the image with the reference mark to obtain a size comparison result, which may include the following steps 1 and 2.

[0114] Step 1: Compare a first length of the object to be detected along the extension direction of the horizontal cursor with the length of the horizontal cursor to obtain a first size comparison result.

[0115] As shown in FIG10 , a first length d1 (hereinafter referred to as the first length d1) of the object to be detected 81 along the extension direction FX of the horizontal cursor xg can be compared with the length xd of the horizontal cursor xg to obtain a first size comparison result. In some examples, the first size comparison result may include whether the first length d1 is greater than or equal to the length xd of the horizontal cursor xg at a first preset multiple. The size of the first preset multiple can be flexibly adjusted according to actual conditions and is not limited in this embodiment of the present application.

[0116] Step 2: Compare the second length of the object to be detected along the extending direction of the vertical cursor with the length of the vertical cursor yg to obtain a second size comparison result.

[0117] As shown in FIG10 , a second length d2 (hereinafter referred to as second length d2) of the object to be detected 81 along the extension direction FY of the vertical cursor yg can be compared with the length yd of the vertical cursor yg to obtain a second size comparison result. In some examples, the second size comparison result may include whether the second length d2 is greater than or equal to the length yd of the vertical cursor yg at a second preset multiple. The size of the second preset multiple can be flexibly adjusted according to actual conditions and is not limited in this embodiment of the present application.

[0118] According to some embodiments of the present application, optionally, S103, judging whether the size of the object to be detected is larger than a preset size based on the size comparison result, may include the following steps:

[0119] When the first length is greater than or equal to the length of the horizontal cursor at a first preset multiple, and / or when the second length is greater than or equal to the length of the vertical cursor at a second preset multiple, it is determined that the size of the object to be detected is greater than the preset size.

[0120] As shown in Figure 10 , if the first length d1 is greater than or equal to the length xd of the horizontal cursor xg at a first preset multiple, and / or if the second length d2 is greater than or equal to the length yd of the vertical cursor yg at a second preset multiple, the size of the object to be inspected 81 is determined to be greater than the preset size. In other words, the object to be inspected 81 needs to be labeled. It should be noted that the first preset multiple can be greater than 0 and less than or equal to 1. The second preset multiple can be greater than 0 and less than or equal to 1.

[0121] According to some embodiments of the present application, optionally, the annotation method provided by the embodiments of the present application may further include the following steps: when the image is scaled, the size of the reference mark remains unchanged.

[0122] In practical applications, because the object to be detected is relatively small, the image of the object to be detected may be magnified several times. In this case, if the reference marker is also magnified several times, the reference marker may be too large, making it difficult to compare the size of the object to be detected with the reference marker. Therefore, when scaling the image based on the target scaling ratio, the size of the reference marker can remain unchanged, which facilitates the size comparison between the object to be detected and the reference marker.

[0123] According to some embodiments of the present application, optionally, the first preset multiple and the second preset multiple may be positively correlated with the scaling ratio of the image of the object to be detected (such as the target scaling ratio). For example, when the target scaling ratio is 100%, the first preset multiple may be c1; when the target scaling ratio is 200%, the first preset multiple may be c2. c1 and c2 are positive numbers, and c2 may be greater than c1. In some examples, c2 may be equal to 2c1. For example, when the target scaling ratio is 100%, the second preset multiple may be c3; when the target scaling ratio is 200%, the second preset multiple may be c4. c3 and c4 are positive numbers, and c4 may be greater than c3. In some examples, c4 may be equal to 2c3.

[0124] In this way, when the size of the reference mark remains unchanged, the first preset magnification and the second preset magnification can be positively correlated with the scaling ratio of the image of the object to be detected (such as the target scaling ratio), which can improve the accuracy of the size comparison result.

[0125] FIG11 is another flow chart of the labeling method provided in an embodiment of the present application. As shown in FIG11 , according to some embodiments of the present application, optionally, before S102 , comparing the size of the object to be detected in the image with the reference mark to obtain the size comparison result, the labeling method provided in an embodiment of the present application may further include S1101 to S1103.

[0126] S1101. Set the shape of the reference mark and the switch button of the reference mark.

[0127] As previously mentioned, the shape of the reference mark can be flexibly adjusted according to actual circumstances, and this application does not impose any restrictions thereon. The reference mark can be in the shape of a crosshair cursor, a rectangle, a circle, or the like. In S1101, the shape of the reference mark and a reference mark switch button can be set. The reference mark switch button can be used to turn the reference mark on or off, i.e., to switch the display of the reference mark on or off.

[0128] S1102: Receive an input instruction of a switch button with a reference mark.

[0129] S1103 : In response to an input instruction of clicking a switch button of a reference mark, displaying a reference mark of a preset shape.

[0130] When the reference mark is turned off, if an input instruction of clicking a switch button of the reference mark is received, the reference mark can be turned on, that is, the reference mark of a preset shape is displayed.

[0131] In this way, by setting a switch button for the reference mark, the reference mark can be flexibly turned on or off.

[0132] According to some embodiments of the present application, optionally, S1101, setting the shape of the reference mark, may include the following steps:

[0133] Add the shape of the reference mark to the function that sets the mouse cursor shape.

[0134] Specifically, a code for setting the shape of the reference mark may be added to the function or code for setting the shape of the mouse cursor, thereby adding the shape of the reference mark to the function for setting the shape of the mouse cursor.

[0135] Accordingly, S1103, in response to an input instruction of clicking a switch button of a reference mark, displaying a reference mark of a preset shape may include the following steps:

[0136] In response to an input instruction of clicking the reference mark switch button, the mouse cursor changes to the shape of the reference mark. If the reference mark switch button is turned on, the mouse cursor shape changes to the reference mark. If the reference mark switch button is turned off, the mouse cursor shape can be restored to its original default shape, such as an arrow.

[0137] In this way, by adding the shape of the reference mark to the function of setting the shape of the mouse cursor, the mouse cursor can be switched to the reference mark through the switch button of the reference mark, which makes it easier to control the movement of the reference mark through the mouse.

[0138] According to some embodiments of the present application, optionally, S104, when the size of the object to be detected is larger than a preset size, marking the object to be detected in the image, may include the following steps:

[0139] When the size of the object to be detected is larger than the preset size, a target mark is generated in the image.

[0140] Specifically, when the size of the object to be detected is larger than a preset size, a target mark can be generated in the image of the object to be detected. The target mark can be used to mark the position of the object to be detected and / or the size of the object to be detected. The shape of the target mark can be flexibly adjusted according to actual conditions, and this application does not limit this. For example, in some examples, the shape of the mark can be, for example, a circle, a polygon, or a broken line.

[0141] Figure 12 is a schematic diagram of an operation of S104 in the labeling method provided in an embodiment of the present application. As shown in Figure 12, according to some embodiments of the present application, optionally, for example, the target mark 120 is shown as a circle, and the target mark 120 may include multiple endpoints p, that is, the target mark 120 may be composed of multiple endpoints p.

[0142] Figure 13 is a flow chart of step S104 in the labeling method provided in an embodiment of the present application. As shown in Figure 13, according to some embodiments of the present application, optionally, step S104, generating a target mark in the image when the size of the object to be detected is larger than a preset size, may include the following steps S1301 to S1303.

[0143] S1301: Obtain a first zoom ratio of an image.

[0144] The first scaling ratio of the image of the object to be detected may be a scaling ratio to be switched to the image of the object to be detected, such as the target scaling ratio mentioned above.

[0145] S1302: Determine a second scaling ratio for the endpoint of the target mark according to the first scaling ratio, where the second scaling ratio is smaller than the first scaling ratio.

[0146] After determining the first scaling ratio, a scaling ratio smaller than the first scaling ratio can be used as the second scaling ratio adopted by the endpoint of the target mark. The difference between the first scaling ratio and the second scaling ratio can be flexibly adjusted according to actual conditions, and this application does not limit this.

[0147] S1303: Adjust the size of the endpoint based on the second scaling ratio.

[0148] That is, based on the second scaling ratio, the size of the endpoint of the target mark may be scaled.

[0149] For example, when an image of an object to be detected is magnified, the endpoints may also become larger as the image is magnified. If the endpoints are too large, they will cover some useful information in the image. Therefore, when the image of the object to be detected is magnified, these endpoints can be adjusted to a smaller scale than the first scale of the image rather than the first scale of the image. This can reduce the coverage of useful information in the image by the endpoints of the target marker.

[0150] Based on the marking method provided in the above embodiment, the present application also provides a specific implementation of the marking device. Please refer to the following embodiment.

[0151] FIG14 is a schematic diagram of a structure of a marking device provided in an embodiment of the present application. As shown in FIG14 , the marking device 140 provided in an embodiment of the present application may include the following modules:

[0152] An acquisition module 141 is used to acquire an image of the object to be detected;

[0153] A comparison module 142 is used to compare the size of the object to be detected in the image with the reference mark to obtain a size comparison result;

[0154] A judgment module 143 is used to judge whether the size of the object to be detected is larger than a preset size based on the size comparison result;

[0155] The marking module 144 is configured to mark the object to be detected in the image when the size of the object to be detected is larger than a preset size.

[0156] The labeling device provided in the embodiment of the present application compares the size of the object to be detected in the image of the object to be detected with the reference mark to obtain a size comparison result. Based on the size comparison result, it can accurately determine whether the size of the object to be detected is larger than a preset size. If the size of the object to be detected is larger than the preset size, the object to be detected in the image is labeled. In this way, it is possible to automatically label objects to be detected in the image that are larger than the preset size, reduce the problem of missing or mislabeling objects to be detected, improve the accuracy of labeling objects to be detected, and reduce the workload of personnel.

[0157] According to some embodiments of the present application, the labeling device 140 provided in the embodiments of the present application may optionally further include a scaling module for obtaining a target scaling ratio of the image and scaling the image based on the target scaling ratio. The comparison module 142 is specifically configured to compare the size of the object to be detected in the scaled image with the reference mark to obtain a size comparison result.

[0158] According to some embodiments of the present application, optionally, the scaling module is specifically configured to, when the drawing ratio of the image is less than or equal to a first preset threshold, have a target scaling ratio greater than 1, and enlarge the image; and / or, when the drawing ratio of the image is greater than a second preset threshold, have a target scaling ratio less than 1, and reduce the image, and the second preset threshold is greater than or equal to the first preset threshold.

[0159] According to some embodiments of the present application, optionally, when the image is scaled, the size of the reference mark remains unchanged.

[0160] According to some embodiments of the present application, optionally, the scaling module is specifically used to obtain the current scaling ratio of the image; when the current scaling ratio is inconsistent with the target scaling ratio and the current scaling ratio is inconsistent with the initial scaling ratio of the image, the image is restored to the initial scaling ratio, and then the image is scaled based on the target scaling ratio; or, when the current scaling ratio is inconsistent with the target scaling ratio and the current scaling ratio is inconsistent with the initial scaling ratio of the image, a conversion relationship between the target scaling ratio and the current scaling ratio is calculated, and the image is scaled based on the conversion relationship.

[0161] According to some embodiments of the present application, optionally, the comparison module 142 is specifically configured to align the object to be detected with the reference mark; and compare the size of the aligned object to be detected with the size of the reference mark to obtain a size comparison result.

[0162] According to some embodiments of the present application, optionally, the comparison module 142 is specifically used to establish an image coordinate system of the image; based on the target image detection algorithm, determine the position of the center point of the object to be detected in the image coordinate system; according to the position of the center point of the object to be detected in the image coordinate system, move the reference mark until the distance between the center point of the reference mark and the center point of the object to be detected is less than or equal to a third preset threshold.

[0163] According to some embodiments of the present application, optionally, the comparison module 142 is specifically used to receive an instruction to move the reference mark; in response to the instruction to move the reference mark, the reference mark is moved to the position indicated by the instruction until the distance between the center point of the reference mark and the center point of the object to be detected is less than or equal to a third preset threshold.

[0164] According to some embodiments of the present application, the reference mark may optionally include a crosshair cursor, the crosshair cursor including a horizontal cursor and a vertical cursor, the horizontal cursor and the vertical cursor intersecting at the center point of the reference mark. The comparison module 142 is specifically configured to compare a first length of the object to be detected along the direction in which the horizontal cursor extends with the length of the horizontal cursor to obtain a first size comparison result; and to compare a second length of the object to be detected along the direction in which the vertical cursor extends with the length of the vertical cursor to obtain a second size comparison result.

[0165] According to some embodiments of the present application, optionally, the judgment module 143 is specifically used to determine that the size of the object to be detected is greater than the preset size when the first length is greater than or equal to the length of the horizontal cursor of a first preset multiple, and / or when the second length is greater than or equal to the length of the vertical cursor of a second preset multiple.

[0166] According to some embodiments of the present application, optionally, according to some embodiments of the present application, optionally, the marking device 140 provided by the embodiments of the present application may also include: a setting module for setting the shape of the reference mark and the switch button of the reference mark; a receiving module for receiving an input instruction of the switch button of the reference mark; and a display module for displaying a reference mark of a preset shape in response to an input instruction of clicking the switch button of the reference mark.

[0167] According to some embodiments of the present application, the setting module is optionally configured to add a reference mark shape to a function for setting a mouse cursor shape. The display module is configured to change the cursor to the reference mark shape in response to an input instruction of clicking a switch button of the reference mark.

[0168] According to some embodiments of the present application, optionally, the marking module 144 is specifically used to generate a target mark in the image when the size of the object to be detected is larger than a preset size, and the target mark is used to mark the position and / or size of the object to be detected.

[0169] According to some embodiments of the present application, the target marker may optionally include multiple endpoints. The annotation module 144 is specifically configured to obtain a first scaling ratio of the image; determine a second scaling ratio for the endpoints of the target marker based on the first scaling ratio, the second scaling ratio being smaller than the first scaling ratio; and adjust the size of the endpoints based on the second scaling ratio.

[0170] Each module / unit in the device shown in Figure 14 has the function of implementing each step in the marking method provided by the above method embodiment and can achieve its corresponding technical effect. For the sake of concise description, it will not be repeated here.

[0171] Based on the marking method provided in the above embodiment, the present application also provides a specific implementation of the electronic device. Please refer to the following embodiment.

[0172] FIG15 shows a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application.

[0173] The electronic device may include a processor 1501 and a memory 1502 storing computer program instructions.

[0174] Specifically, the processor 1501 may include a central processing unit (CPU) or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.

[0175] Memory 1502 may include a large-capacity memory for data or instructions. By way of example and not limitation, memory 1502 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive, or a combination of two or more of these. In one example, memory 1502 may include removable or non-removable (or fixed) media, or memory 1502 may be a non-volatile solid-state memory. Memory 1502 may be internal or external to the electronic device.

[0176] In one example, the memory 1502 may be a read-only memory (ROM). In one example, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM), or a flash memory, or a combination of two or more of these.

[0177] The memory 1502 may include read-only memory (ROM), random access memory (RAM), magnetic disk storage media devices, optical storage media devices, flash memory devices, electrical, optical or other physical / tangible memory storage devices. Thus, generally, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to an aspect of the present application.

[0178] The processor 1501 implements the method / steps in the above-mentioned method embodiment by reading and executing the computer program instructions stored in the memory 1502, and achieves the corresponding technical effects achieved by the method embodiment executing its method / steps. For the sake of brevity, it will not be repeated here.

[0179] In one example, the electronic device may further include a communication interface 1503 and a bus 1510. As shown in FIG15 , the processor 1501, the memory 1502, and the communication interface 1503 are connected via the bus 1510 and communicate with each other.

[0180] The communication interface 1503 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.

[0181] Bus 1510 includes hardware, software or both, couples the parts of electronic equipment to each other.For example, but not limitation, bus may include Accelerated Graphics Port (AGP) or other graphics buses, Enhanced Industry Standard Architecture (EISA) bus, Front Side Bus (FSB), Hyper Transport (HT) interconnection, Industry Standard Architecture (ISA) bus, InfiniBand interconnection, Low Pin Count (LPC) bus, memory bus, Micro Channel Architecture (MCA) bus, Peripheral Component Interconnect (PCI) bus, PCI-Express (PCI-X) bus, Serial Advanced Technology Attachment (SATA) bus, Video Electronics Standards Association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 1510 may include one or more buses. Although the present application embodiment describes and shows specific bus, the application considers any suitable bus or interconnection.

[0182] In addition, in combination with the annotation method in the above embodiment, the embodiment of the present application can provide a computer-readable storage medium for implementation. The computer-readable storage medium stores computer program instructions; when the computer program instructions are executed by a processor, any of the annotation methods in the above embodiment is implemented. Examples of computer-readable storage media include non-transitory computer-readable storage media, such as electronic circuits, semiconductor memory devices, ROM, random access memory, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, and hard disks.

[0183] It should be understood that the present application is not limited to the specific configurations and processes described above and illustrated in the figures. For the sake of brevity, a detailed description of known methods is omitted here. In the above embodiments, several specific steps are described and illustrated as examples. However, the method process of the present application is not limited to the specific steps described and illustrated. Those skilled in the art can make various changes, modifications, and additions, or change the order of the steps after understanding the spirit of the present application.

[0184] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link via a data signal carried in a carrier wave. "Machine-readable medium" can include any medium that can store or transmit information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROMs, flash memories, erasable ROMs (EROMs), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segments can be downloaded via computer networks such as the Internet, intranets, etc.

[0185] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps. In other words, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.

[0186] Aspects of the present application have been described above with reference to the flowcharts and / or block diagrams of the methods, devices (systems) and computer program products according to the embodiments of the present application. It should be understood that each box in the flowchart and / or block diagram and the combination of each box in the flowchart and / or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer or other programmable data processing device to produce a machine so that these instructions executed via the processor of the computer or other programmable data processing device enable the implementation of the function / action specified in one or more boxes of the flowchart and / or block diagram. This processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor or a field programmable logic circuit. It is also understood that each box in the block diagram and / or the flowchart and the combination of the boxes in the block diagram and / or the flowchart can also be implemented by the dedicated hardware that performs the specified function or action, or can be implemented by the combination of dedicated hardware and computer instructions.

[0187] The above description is only a specific embodiment of the present application. Those skilled in the art will clearly understand that for the convenience and brevity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the scope of protection of the present application is not limited thereto. Any person skilled in the art can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the scope of protection of the present application.

Claims

1. A marking method, comprising: Obtaining an image of an object to be detected; Comparing the size of the object to be detected in the image with a reference mark to obtain a size comparison result; Based on the size comparison result, determining whether the size of the object to be detected is greater than a preset size; When the size of the object to be detected is greater than the preset size, marking the object to be detected in the image.

2. The annotation method according to claim 1, wherein, Before comparing the size of the object to be detected in the image with a reference mark to obtain a size comparison result, the marking method further comprises: Obtaining a target scaling ratio of the image; Scaling the image based on the target scaling ratio; The comparing the size of the object to be detected in the image with a reference mark to obtain a size comparison result includes: Comparing the size of the object to be detected in the scaled image with the reference mark to obtain the size comparison result.

3. The annotation method according to claim 2, wherein, The scaling the image based on the target scaling ratio includes: When the drawing ratio of the image is less than or equal to a first preset threshold, the target scaling ratio is greater than 1, and the image is enlarged.

4. The annotation method according to claim 2 or 3, wherein The scaling the image based on the target scaling ratio includes: When the drawing ratio of the image is greater than a second preset threshold, the target scaling ratio is less than 1, and the image is reduced.

5. The labeling method according to claim 2, wherein, The marking method further comprises: when scaling the image, the size of the reference mark remains unchanged.

6. The annotation method according to any one of claims 2 to 5, wherein The scaling the image based on the target scaling ratio includes: Obtaining the current scaling ratio of the image; When the current scaling ratio is inconsistent with the target scaling ratio and the current scaling ratio is inconsistent with the initial scaling ratio of the image, restoring the image to the initial scaling ratio, and then scaling the image based on the target scaling ratio.

7. The annotation method according to any one of claims 2 to 5, wherein The scaling the image based on the target scaling ratio includes: Obtaining the current scaling ratio of the image; When the current scaling ratio is inconsistent with the target scaling ratio and the current scaling ratio is inconsistent with the initial scaling ratio of the image, calculating the conversion relationship between the target scaling ratio and the current scaling ratio, and scaling the image based on the conversion relationship.

8. The annotation method according to any one of claims 1 to 5, wherein The comparing the size of the object to be detected in the image with a reference mark to obtain a size comparison result includes: Aligning the object to be detected with the reference mark; Comparing the size of the aligned object to be detected with the size of the reference mark to obtain the size comparison result.

9. The annotation method according to claim 8, wherein The aligning the object to be detected with the reference mark includes: Establishing an image coordinate system of the image; Based on a target image detection algorithm, determining the position of the center point of the object to be detected in the image coordinate system; According to the position of the center point of the object to be detected in the image coordinate system, moving the reference mark until the distance between the center point of the reference mark and the center point of the object to be detected is less than or equal to a third preset threshold.

10. The annotation method according to claim 8, wherein, Aligning the object to be detected with the reference marker includes: Receiving an instruction to move the reference marker; In response to the instruction to move the reference marker, moving the reference marker to the position indicated by the instruction until the distance between the center point of the reference marker and the center point of the object to be detected is less than or equal to a third preset threshold.

11. The annotation method according to any one of claims 1 to 5, wherein The reference marker includes a cross cursor, the cross cursor includes a horizontal cursor and a vertical cursor, and the horizontal cursor and the vertical cursor intersect at the center point of the reference marker; Comparing the size of the object to be detected in the image with the reference marker to obtain a size comparison result includes: Comparing the first length of the object to be detected in the extending direction of the horizontal cursor with the length of the horizontal cursor to obtain a first size comparison result; Comparing the second length of the object to be detected in the extending direction of the vertical cursor with the length of the vertical cursor to obtain a second size comparison result.

12. The annotation method according to claim 11, wherein, Based on the size comparison result, determining whether the size of the object to be detected is greater than a preset size includes: When the first length is greater than or equal to a first preset multiple of the length of the horizontal cursor, and / or when the second length is greater than or equal to a second preset multiple of the length of the vertical cursor, determining that the size of the object to be detected is greater than the preset size.

13. The labeling method according to any one of claims 1 to 5, wherein, Before comparing the size of the object to be detected in the image with the reference marker to obtain a size comparison result, the annotation method further includes: Setting the shape of the reference marker and the switch button of the reference marker; Receiving an input instruction of the switch button of the reference marker; In response to the input instruction of the switch button of the reference marker, displaying the reference marker in a preset shape.

14. The labeling method according to claim 13, wherein, Setting the shape of the reference marker includes: Adding the shape of the reference marker to the function for setting the cursor shape of the mouse; In response to the input instruction of the switch button of the reference marker, displaying the reference marker in a preset shape includes: In response to the input instruction of the switch button of the reference marker, changing the cursor to the shape of the reference marker.

15. The annotation method according to any one of claims 1 to 5, wherein, When the size of the object to be detected is greater than the preset size, annotating the object to be detected in the image includes: When the size of the object to be detected is greater than the preset size, generating a target marker in the image, and the target marker is used to annotate the position and / or the size of the object to be detected.

16. The labeling method according to claim 15, wherein The target marker includes a plurality of endpoints; When the size of the object to be detected is greater than the preset size, generating a target marker in the image includes: Obtaining a first scaling ratio of the image; According to the first scaling ratio, determining a second scaling ratio adopted by the endpoints of the target marker, and the second scaling ratio is less than the first scaling ratio; Adjusting the size of the endpoints based on the second scaling ratio.

17. An annotation device includes: An acquisition module for acquiring an image of an object to be detected; A comparison module for comparing the size of the object to be detected in the image with a reference marker to obtain a size comparison result; A judgment module, configured to judge whether the size of the object to be detected is greater than a preset size based on the size comparison result; A labeling module, configured to label the object to be detected in the image when the size of the object to be detected is greater than the preset size.

18. The labeling device according to claim 17, wherein, The labeling device further includes a scaling module, configured to: Before comparing the size of the object to be detected in the image with a reference mark to obtain a size comparison result, obtain a target scaling ratio of the image; Scale the image based on the target scaling ratio; The comparison module is specifically configured to: Compare the size of the object to be detected in the scaled image with the reference mark, to obtain the size comparison result.

19. An electronic device, the electronic device comprising: A processor, a memory, and a computer program stored on the memory and executable on the processor, where when the computer program is executed by the processor, the steps of the labeling method according to any one of claims 1 to 16 are implemented.

20. A computer-readable storage medium, on which a computer program is stored, where when the computer program is executed by a processor, the steps of the labeling method according to any one of claims 1 to 16 are implemented.

Citation Information

Patent Citations

  • Minimum target detection method, apparatus and device, and computer readable medium

    CN114550256A

  • Defect detection method and device, electronic equipment and readable storage medium

    CN114627092A

  • Defect detection method based on feature correlation and related device

    CN116152166A

  • Offset detection method and device for chip packaging, equipment and storage medium

    CN116884869A

  • Labeling method, device and equipment and computer readable storage medium

    CN117474908A