High-precision pixel-level labeling system for image anomaly detection
By designing image abnormal testing, a high -precision pixel -grade labeling system is used to integrate a variety of labeling tools, solving the problem of single -obtaining abnormal mask in the existing technologies, and cannot directly obtain abnormal mask. Directly generated with abnormal masks.
Patent Information
- Application Number
- CN202411298794.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-18
- Publication Date
- 2025-01-28
AI Technical Summary
When the existing image labeling software labels an image abnormal area, the labeling method is single and the exception mask on the image cannot be directly obtained.
A high -precision pixel -level labeling system is designed to design an image abnormal test, which integrates the menu bar module, toolbar module and working module. The rubber rubbing tool can complete the high -precision marking of the abnormal area on the image through these tools and directly obtain an abnormal mask.
A high -precision pixel -grade label of the image abnormal area can be quickly and accurately completed the labeling of different types of abnormal images, directly generate an abnormal mask in the image form, and support the production of image abnormal detection data sets.
Smart Images

Figure CN119379598A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image anomaly detection, and more specifically, to a high-precision pixel-level annotation system for image anomaly detection. Background Art
[0002] Image anomaly detection is a method that detects all abnormal images based on normal images and can predict abnormal areas on images. Image anomaly detection datasets are used to evaluate the performance of anomaly detection methods. They must include abnormal images and corresponding anomaly masks. The anomaly masks are obtained through image annotation software and identify abnormal areas on abnormal images.
[0003] The existing mainstream image annotation software includes LabelImg, Yolo_mark, VoTT, Labelme, CVAT, etc. Among them, LabelImg, VoTT, and Yolo_mark are mainly used for target detection tasks, and the annotation results are the coordinates of the rectangular box. Labelme and CVAT can complete the annotation of image areas. However, the existing mainstream image annotation software mainly annotates in the form of polylines, which is a relatively simple annotation method. In addition, the annotation results of Labelme and CVAT are both discrete coordinate points, rather than masks of the corresponding areas on the image.
[0004] Therefore, the present invention aims to provide a high-precision pixel-level annotation system for image anomaly detection, which is used to complete the annotation of abnormal areas on the image using a variety of annotation tools and directly obtain the abnormal mask of the abnormal area on the image. Summary of the invention
[0005] The purpose of the present invention is to provide a high-precision pixel-level annotation system for image anomaly detection. The present invention completes the annotation of abnormal areas on the image by using a variety of annotation tools, and can directly obtain an abnormal mask of the abnormal area on the image. On the abnormal mask, the grayscale value of the foreground area pixel is 255, indicating that the corresponding area is an abnormal area, and the grayscale value of the background area pixel is 0, indicating that the corresponding area is a normal area.
[0006] The above technical objectives of the present invention are achieved through the following technical solutions: A high-precision pixel-level annotation system for image anomaly detection, comprising a menu bar module, a toolbar module and a workspace module;
[0007] The menu bar module is used to interact with the user.
[0008] The toolbar module is used to manage various tools for image annotation;
[0009] The workspace module is used to provide an area for image annotation;
[0010] The menu bar module includes file options, view options, annotation options and help options;
[0011] The file options include an open path tool, a save path tool, a previous tool, and a next tool;
[0012] The view options include a zoom-in tool, a zoom-out tool, and an adaptive tool;
[0013] The annotation selection includes a cropping tool, a threshold tool, a magic wand tool, a lasso tool, a polygon tool, a brush tool and an eraser tool;
[0014] The help options include version information content and usage demonstration content.
[0015] The present invention is further configured as follows: the cropping tool is centered on a point selected on the original image to crop an image of a fixed size from the original image, and the algorithm flow is as follows:
[0016] S101, read the image and read the size L;
[0017] S102, selecting a point P on the image;
[0018] S103, taking P as the center and L as the side length to intercept the image;
[0019] S104, saving the captured image;
[0020] S105, judging whether the cutting is completed, if the cutting is completed, the operation ends, otherwise, jumping to step S102.
[0021] The present invention is further configured as follows: the threshold tool completes the labeling of abnormal areas of the image in a binarized manner, and is suitable for labeling images in which the normal area has a single color and the abnormal area has a significant color difference from the normal area. The algorithm flow is:
[0022] S201, read the image and convert it into a grayscale image;
[0023] S202, adjusting the threshold T using the mouse;
[0024] S203, setting the grayscale values of pixels whose grayscale values are greater than or equal to T on the image to 255, and setting the grayscale values of pixels whose grayscale values are less than T to 0, to obtain an abnormal mask;
[0025] S204, judging whether the mask meets expectations, if so, ending the operation, otherwise, jumping to step S202.
[0026] The present invention is further configured as follows: the magic wand tool sets the area with a gray value close to and connected to the point selected by the user as the mask foreground, which is suitable for marking images in which the normal area has a single color and the abnormal area has a significant color difference from the normal area. The algorithm flow is:
[0027] S301, read the image and read the threshold T;
[0028] S302, detecting whether there is a mask, if there is a mask, reading the mask, if there is no mask, generating an abnormal mask with grayscale values all being 0 to read the mask;
[0029] S303, select a point P on the image and obtain the gray value V of the point;
[0030] S304, obtaining an area on the image whose grayscale value is within the range of V+T and VT and connected to point P, and setting the value of the area to 255 on the mask;
[0031] S305, judging whether the mask meets expectations, if so, ending the operation, otherwise, jumping to step S303.
[0032] The present invention is further configured as follows: the lasso tool sets the closed area drawn by the user as the mask foreground, which is suitable for marking irregular images in abnormal areas, and the algorithm flow is as follows:
[0033] S401, read image;
[0034] S402, detecting whether there is a mask, if there is a mask, reading the mask, if there is no mask, generating an abnormal mask with grayscale values all being 0 to read the mask;
[0035] S403, hold down the left mouse button and drag the mouse;
[0036] S404, setting the grayscale value of the closed area formed by the pixels on the mask where the mouse slides over to 255;
[0037] S405, determine whether the left mouse button is released, if so, end the operation, otherwise, jump to step S403.
[0038] The present invention is further configured as follows: the polygon tool uses the polygon area drawn by the user as the mask foreground, and is suitable for marking abnormal areas with polygonal shapes. The algorithm flow is:
[0039] S501, read the graphics, set N = 0;
[0040] S502, detecting whether there is a mask, if there is a mask, reading the mask, if there is no mask, generating an abnormal mask with grayscale values all being 0 to read the mask;
[0041] S503, set N=N+1, and select the Nth point on the image;
[0042] S504, connecting the selected N points in sequence, and connecting the end point to the start point;
[0043] S505, setting the formed closed area as the mask foreground;
[0044] S506, judging whether the mask meets expectations, if so, ending the operation, otherwise, jumping to step S503.
[0045] The present invention is further configured as follows: the brush tool uses the line formed by the user's cursor as the mask foreground, which is suitable for marking line-shaped abnormal areas and finely correcting the marking results of various other tools. The algorithm flow is:
[0046] S601, read the image and read the brush diameter d;
[0047] S602, detecting whether there is a mask, if there is a mask, reading the mask, if there is no mask, generating an abnormal mask with grayscale values all being 0 to read the mask;
[0048] S603, press the left button of the mouse and move the mouse;
[0049] S604, draw a circle on the mask with the point where the cursor passes as the center and d as the diameter, and set the grayscale value of the pixels in the circle to 255;
[0050] S605, determine whether the left mouse button is in a pressed state, if so, jump to execute S604, otherwise, end the operation.
[0051] The present invention is further configured as follows: the eraser tool uses the line formed by the user's cursor as a mask background, which is suitable for fine correction of the marking results of various other tools. The algorithm flow is:
[0052] S701, read the image and read the eraser diameter d;
[0053] S702, detecting whether there is a mask, if there is a mask, reading the mask, if there is no mask, generating an abnormal mask with grayscale values all being 0 to read the mask;
[0054] S703, press the left button of the mouse and move the mouse;
[0055] S704, draw a circle on the mask with the point where the cursor passes as the center and d as the diameter, and set the gray value of the pixels in the circle to 0;
[0056] S705, determine whether the left mouse button is in a pressed state, if so, jump to execute S704, otherwise, end the operation.
[0057] In summary, the present invention has the following beneficial effects:
[0058] The present invention discloses a high-precision pixel-level annotation system for image anomaly detection, which is specially used for producing image anomaly detection data sets, can directly obtain anomaly masks in the form of images, and complete pixel-level anomaly annotation of images. At the same time, the present invention includes 7 annotation tools, which can realize fast and accurate annotation of different abnormal images. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] Figure 1 This is a schematic diagram of an interface of a high-precision pixel-level annotation system for image anomaly detection in an embodiment of the present invention;
[0060] Figure 2 is a program flow chart of a cutting tool in an embodiment of the present invention;
[0061] Figure 3 is a diagram showing the operation result of the cropping tool in an embodiment of the present invention;
[0062] Figure 4 is a program flow chart of a threshold tool in an embodiment of the present invention;
[0063] Figure 5 is a diagram of the annotation effect of the threshold tool in an embodiment of the present invention;
[0064] Figure 6 is a program flow chart of the magic wand tool in an embodiment of the present invention;
[0065] Figure 7 is a diagram of the marking effect of the magic wand tool in an embodiment of the present invention;
[0066] Figure 8 is a program flow chart of the lasso tool in an embodiment of the present invention;
[0067] Fig. 9 is a diagram of the annotation effect of the lasso tool in an embodiment of the present invention;
[0068] Fig.10 is a program flow chart of the polygon tool in an embodiment of the present invention;
[0069] Fig.11 is a diagram of the annotation effect of the polygon tool in an embodiment of the present invention;
[0070] Fig.12 is a program flow chart of the brush tool in an embodiment of the present invention;
[0071] Fig.13is a diagram of the marking effect of the brush tool in an embodiment of the present invention;
[0072] Fig.14 It is a program flow chart of the eraser tool in an embodiment of the present invention;
[0073] Fig.15 It is a marking effect diagram of the eraser tool in an embodiment of the present invention. DETAILED DESCRIPTION
[0074] The following is combined with Figure 1-15 The present invention is described in further detail.
[0075] Embodiment: A high-precision pixel-level annotation system for image anomaly detection includes a menu bar module, a toolbar module and a workspace module; the menu bar module includes four options, namely, a file menu, a view menu, an annotation menu and a help menu; the toolbar module includes various tools for image annotation in the software; and the workspace module is an area for users to annotate images. In the menu bar module, the file menu option includes 4 tools, namely, "Open Path", "Save Path", "Previous Image" and "Next Image", the view menu option includes 3 tools, namely, "Zoom In", "Zoom Out" and "Adaptive", the annotation menu option includes 7 tools, namely, "Crop", "Threshold", "Magic Wand", "Lasso", "Polygon", "Brush" and "Eraser", the help menu option includes the software's "Version Information", "Usage Demonstration" and other contents, and the toolbar module lists various annotation tools in the form of icons, and the functional description of each annotation tool is as follows:
[0076] Open the path tool, browse to the local folder, and read all the image data in the folder into the annotation software.
[0077] The Save Path tool allows you to browse to a local folder where the output images of the software will be saved.
[0078] Previous tool, switch to the previous picture.
[0079] Previous tool, switch to the next picture.
[0080] The zoom tool is used to zoom in on the image with the selected point as the center.
[0081] Zoom out tool, zoom out the image with the selected point as the center.
[0082] Adaptive tool that automatically scales the image to the size of the display window according to its native aspect ratio.
[0083] Cropping tool, cropping a fixed-size image from the original image.
[0084] The threshold tool performs image annotation by binarizing the image.
[0085] The lasso tool annotates images based on the closed area formed by the mouse movement trajectory.
[0086] The polygon tool is used to annotate images based on the polygonal area formed by clicking the mouse.
[0087] The Magic Wand tool sets pixels with grayscale values similar to the selected pixels as foreground for image annotation.
[0088] Brush tool, set the selected pixels as foreground and perform image annotation.
[0089] Eraser tool sets the selected pixels as background for image annotation.
[0090] In this embodiment, the cropping tool takes the point selected on the original image as the center and crops an image of a fixed size from the original image. The algorithm flow chart of the cropping tool is as follows: Figure 2 As shown, the cropping effect is as follows Figure 3 shown.
[0091] The threshold tool completes the labeling of abnormal areas in the image by binarizing the image. The threshold tool is mainly suitable for labeling images with a single color in the normal area and a significant color difference between the abnormal area and the normal area. The algorithm flow chart of the threshold tool is as follows: Figure 4 As shown, the annotation effect is as follows Figure 5 shown.
[0092] The magic wand tool sets the area with similar grayscale value to the point selected by the user and connected as the mask foreground. The magic wand tool is also mainly suitable for marking images with single color in normal area and significant color difference between abnormal area and normal area. The algorithm flow chart of the magic wand tool is as follows: Figure 6 As shown, the annotation effect is as follows Figure 7 shown.
[0093] The lasso tool sets the closed area drawn by the user as the mask foreground. The lasso tool is mainly suitable for marking irregular images in abnormal areas. The algorithm flow chart of the lasso tool is as follows: Figure 8 , the annotation effect is as follows Fig. 9 shown.
[0094] The polygon tool uses the polygon area drawn by the user as the mask foreground. The polygon tool is mainly suitable for marking abnormal areas with polygonal shapes. The algorithm flow chart of the polygon tool is as follows: Fig.10 As shown, the annotation effect is as follows Fig.11 shown.
[0095] The brush tool uses the line formed by the user's cursor as the mask foreground. The brush tool is mainly suitable for marking line-shaped abnormal areas, and is also suitable for fine-tuning the marking results of various other tools. The algorithm flow chart of the brush tool is as follows: Fig.12 As shown, the annotation effect is as follows Fig.13 shown.
[0096] The Eraser Tool uses the line formed by the user's cursor as the mask background. The Brush Tool is mainly used to fine-tune the annotation results of various other tools. The algorithm flow chart of the Eraser Tool is as follows: Fig.14 As shown, the annotation effect is as follows Fig.15 shown.
[0097] This specific embodiment is merely an explanation of the present invention and is not a limitation of the present invention. After reading this specification, those skilled in the art may make non-creative modifications to the present embodiment as needed. However, as long as they are within the scope of the claims of the present invention, they are protected by the patent law.
Claims
1. A high-precision pixel-level annotation system for image anomaly detection, characterized by: Includes menu bar module, toolbar module and workspace module; The menu bar module is used to interact with the user. The toolbar module is used to manage various tools for image annotation; The workspace module is used to provide an area for image annotation; The menu bar module includes file options, view options, annotation options and help options; The file options include an open path tool, a save path tool, a previous tool, and a next tool; The view options include a zoom-in tool, a zoom-out tool, and an adaptive tool; The annotation selection includes a cropping tool, a threshold tool, a magic wand tool, a lasso tool, a polygon tool, a brush tool and an eraser tool; The help options include version information content and usage demonstration content.
2. The high-precision pixel-level annotation system for image anomaly detection according to claim 1, characterized in that: The cropping tool is to crop a fixed-size image from the original image with the point selected on the original image as the center. The algorithm flow is as follows: S101, read the image and read the size L; S102, selecting a point P on the image; S103, taking P as the center and L as the side length to intercept the image; S104, saving the captured image; S105, judging whether the cutting is completed, if the cutting is completed, the operation ends, otherwise, jumping to step S102.
3. The high-precision pixel-level annotation system for image anomaly detection according to claim 1, characterized in that: The threshold tool completes the labeling of abnormal areas in the image by binarization. It is suitable for labeling images with a single color in the normal area and a significant color difference between the abnormal area and the normal area. The algorithm flow is as follows: S201, read the image and convert it into a grayscale image; S202, adjusting the threshold T using the mouse; S203, setting the grayscale values of pixels whose grayscale values are greater than or equal to T on the image to 255, and setting the grayscale values of pixels whose grayscale values are less than T to 0, to obtain an abnormal mask; S204, judging whether the mask meets expectations, if so, ending the operation, otherwise, jumping to step S202.
4. The high-precision pixel-level annotation system for image anomaly detection according to claim 1, characterized in that: The magic wand tool sets the area with similar and connected grayscale values to the point selected by the user as the mask foreground. It is suitable for marking images where the normal area has a single color and the abnormal area has a significant color difference from the normal area. The algorithm flow is as follows: S301, read the image and read the threshold T; S302, detecting whether there is a mask, if there is a mask, reading the mask, if there is no mask, generating an abnormal mask with grayscale values all being 0 to read the mask; S303, select a point P on the image and obtain the gray value V of the point; S304, obtaining an area on the image whose grayscale value is within the range of V+T and VT and connected to point P, and setting the value of the area to 255 on the mask; S305, judging whether the mask meets expectations, if so, ending the operation, otherwise, jumping to step S303.
5. The high-precision pixel-level annotation system for image anomaly detection according to claim 1, characterized in that: The lasso tool sets the closed area drawn by the user as the mask foreground, which is suitable for marking images with irregular abnormal areas. The algorithm flow is as follows: S401, read image; S402, detecting whether there is a mask, if there is a mask, reading the mask, if there is no mask, generating an abnormal mask with grayscale values all being 0 to read the mask; S403, hold down the left mouse button and drag the mouse; S404, setting the grayscale value of the closed area formed by the pixels on the mask where the mouse slides over to 255; S405, determine whether the left mouse button is released, if so, end the operation, otherwise, jump to step S403.
6. The high-precision pixel-level annotation system for image anomaly detection according to claim 1, characterized in that: The polygon tool uses the polygon area drawn by the user as the mask foreground and is suitable for marking abnormal areas with polygonal shapes. The algorithm flow is as follows: S501, read the graphics, set N = 0; S502, detecting whether there is a mask, if there is a mask, reading the mask, if there is no mask, generating an abnormal mask with grayscale values all being 0 to read the mask; S503, set N=N+1, and select the Nth point on the image; S504, connecting the selected N points in sequence, and connecting the end point to the start point; S505, setting the formed closed area as the mask foreground; S506, judging whether the mask meets expectations, if so, ending the operation, otherwise, jumping to step S503.
7. The high-precision pixel-level annotation system for image anomaly detection according to claim 1, characterized in that: The brush tool uses the line formed by the user's cursor as the mask foreground, which is suitable for marking line-shaped abnormal areas and fine-tuning the marking results of various other tools. The algorithm flow is as follows: S601, read the image and read the brush diameter d; S602, detecting whether there is a mask, if there is a mask, reading the mask, if there is no mask, generating an abnormal mask with grayscale values all being 0 to read the mask; S603, press the left button of the mouse and move the mouse; S604, draw a circle on the mask with the point where the cursor passes as the center and d as the diameter, and set the grayscale value of the pixels in the circle to 255; S605, determine whether the left mouse button is in a pressed state, if so, jump to execute S604, otherwise, end the operation.
8. The high-precision pixel-level annotation system for image anomaly detection according to claim 1, characterized in that: The eraser tool uses the line formed by the user's cursor as the mask background, which is suitable for fine correction of the marking results of various other tools. The algorithm flow is as follows: S701, read the image and read the eraser diameter d; S702, detecting whether there is a mask, if there is a mask, reading the mask, if there is no mask, generating an abnormal mask with grayscale values all being 0 to read the mask; S703, press the left button of the mouse and move the mouse; S704, draw a circle on the mask with the point where the cursor passes as the center and d as the diameter, and set the gray value of the pixels in the circle to 0; S705, determine whether the left mouse button is in a pressed state, if so, jump to execute S704, otherwise, end the operation.