Artificial intelligence-based annotated image detection method, device, equipment and medium
By judging the position and size of the annotation frame in the sample data, the problem in the existing technology of being unable to accurately detect the eligibility of the annotation frame is solved, the quality of the sample data and the recognition accuracy of the model are improved, and real-time feedback and accurate feedback to the annotation personnel are realized. Labeling guidance.
Patent Information
- Application Number
- CN202111433325.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-29
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2041-11-29
AI Technical Summary
The existing technology cannot accurately detect whether the position or size of the annotation box in the sample data is qualified, which affects the recognition accuracy of the model.
By obtaining the original sample image, intercepting the labeled area image, using edge information to determine its clarity, and combining the labeled frame and text coordinate information to determine the eligibility of the labeled frame, the samples are divided into positive sample sets and negative sample sets to generate a training sample set. , train the annotation detection model to detect the eligibility of the annotation box of the image to be detected.
It improves the quality of sample data annotation, improves the recognition accuracy of model training, reminds annotators to label correctly, and ensures the accuracy of sample data.
Smart Images

Figure CN114049540B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to an artificial intelligence-based annotated image detection method, device, equipment and storage medium. Background Art
[0002] Most of the sample data for training intelligent recognition models rely on manual marking of the areas to be recognized in the image. For example, when training an OCR recognition model, the text area is manually selected in the sample image. Whether the selected area of the text in the sample image is qualified will directly affect the recognition accuracy of the trained OCR model.
[0003] At present, most methods for detecting whether sample data annotations are qualified are through manual spot checks. Although there is a target detection model (SingleShot MultiBox Detector, SSD) in the prior art to detect whether the sample data annotation box is qualified, this method can only detect whether there is an annotation box in the sample data, and cannot detect whether the position or size of the annotation box is qualified. Summary of the invention
[0004] In view of the above, the present invention provides an artificial intelligence-based annotated image detection method, device, equipment and storage medium, which aims to solve the technical problem in the prior art that the position or size of the annotation box in the sample data cannot be accurately detected to see whether it is qualified.
[0005] To achieve the above object, the present invention provides an artificial intelligence-based annotated image detection method, the method comprising:
[0006] Acquire a preset number of original sample images, and extract annotated area images from the original sample images;
[0007] Determining whether the annotated area image is a clear image based on edge information of the annotated area image, and when the annotated area image is determined to be a clear image, determining whether the annotated area image is qualified based on coordinate information of the annotated area frame of the annotated area image and text coordinate information of the annotated area image;
[0008] When it is determined that the annotation box of the annotated area image is qualified, the original sample image is added to the positive sample set; when it is determined that the annotated area image is not a clear image, or when it is determined that the annotation box of the annotated area image is unqualified, the original sample image is added to the negative sample set, and a training sample set is generated based on the positive sample set and the negative sample set;
[0009] A pre-built model is trained based on the training sample set to obtain a label detection model, a label image to be detected input by a user is read, the label image to be detected is input into the label detection model to obtain a detection result, and the detection result is fed back to the user.
[0010] Preferably, the step of extracting the marked area image from the original sample image includes:
[0011] Based on the pixel value of the marked box in the original sample image, reading the coordinate information of the marked box;
[0012] The target area of the annotated area image is located according to the coordinate information of the annotated box, and the annotated area image corresponding to the annotated box is cut out from the original sample image based on the target area.
[0013] Preferably, judging whether the annotated area image is a clear image based on edge information of the annotated area image includes:
[0014] Using a Gaussian smoothing filter to perform a re-blurring process on the marked area image to obtain a re-blurred image;
[0015] After converting the annotated region image and the re-blurred image into grayscale images respectively, edge detection is performed on the grayscale images respectively to obtain an edge image corresponding to the annotated region image and an edge image corresponding to the re-blurred image;
[0016] Performing block processing on the edge image corresponding to the marked area image and the edge image corresponding to the re-blurred image to obtain a plurality of sub-blocks, and calculating the variance of each sub-block corresponding to the marked area image and the variance of each sub-block corresponding to the re-blurred image;
[0017] Based on the variance of each sub-block corresponding to the marked area image and the variance of each sub-block corresponding to the re-blurred image, the similarity between the marked area image and the re-blurred image is calculated, and when the similarity is greater than a preset threshold, the marked area image is determined to be a clear image.
[0018] Preferably, judging whether the annotation box of the annotation area image is qualified based on the coordinate information of the annotation box of the annotation area image and the text coordinate information of the annotation area image includes:
[0019] Detecting the boundary of the text area of the labeled area image by using the maximum stable extremum area algorithm, and reading the coordinate information of the boundary of the text area;
[0020] Based on the coordinate information of the annotation box and the coordinate information of the boundary of the text area, calculating the distance between each frame of the annotation box and each corresponding boundary of the text area;
[0021] When the distances are all within the preset interval, and when the boundaries of the text area are all within the range of the annotation box, it is determined that the annotation box of the annotation area image is qualified.
[0022] Preferably, feeding back the detection result to the user includes:
[0023] When the detection result shows that the labeled image to be detected is unqualified, feeding back first prompt information to the user, wherein the first prompt information is used to indicate that the labeled image to be detected is unqualified;
[0024] When the detection result shows that the labeled image to be detected is qualified, second prompt information is fed back to the user, where the second prompt information is used to indicate that the labeled image to be detected is qualified.
[0025] Preferably, the method further comprises:
[0026] When the detection result is that the annotated image to be detected is unqualified, prohibiting the user from performing an annotation operation on the next annotated image corresponding to the annotated image to be detected;
[0027] When the detection result shows that the annotated image to be detected is qualified, the user is allowed to perform an annotation operation on a next annotated image corresponding to the annotated image to be detected.
[0028] Preferably, the pre-built model is a resnet50 model, and the training process of the label detection model includes:
[0029] Annotating each original sample image in the training sample set with a preset detection label;
[0030] Input each original sample image in the training sample set into the resnet50 model to obtain a predicted label for each original sample image in the training sample set;
[0031] Reading a preset detection label of each original sample image in the training sample set;
[0032] The structural parameters of the label detection model are determined by minimizing the loss value between the predicted label and the preset detection label to obtain a trained label detection model.
[0033] To achieve the above object, the present invention further provides an artificial intelligence-based annotated image detection device, the artificial intelligence-based annotated image detection device comprising:
[0034] Interception module: used to obtain a preset number of original sample images, and intercept the marked area images from the original sample images;
[0035] A judging module: used for judging whether the marked area image is a clear image based on the edge information of the marked area image, and when the marked area image is judged to be a clear image, judging whether the marked area image is qualified based on the coordinate information of the marked area frame of the marked area image and the text coordinate information of the marked area image;
[0036] A generation module: used for adding the original sample image to a positive sample set when it is determined that the annotation box of the annotated area image is qualified, adding the original sample image to a negative sample set when it is determined that the annotated area image is not a clear image, or when it is determined that the annotation box of the annotated area image is unqualified, and generating a training sample set based on the positive sample set and the negative sample set;
[0037] Detection module: used to train a pre-built model based on the training sample set to obtain a labeled detection model, read the labeled image to be detected input by the user, input the labeled image to be detected into the labeled detection model to obtain a detection result, and feed back the detection result to the user.
[0038] To achieve the above object, the present invention further provides an electronic device, the electronic device comprising:
[0039] at least one processor; and,
[0040] a memory communicatively connected to the at least one processor; wherein,
[0041] The memory stores a program executable by the at least one processor, and the program is executed by the at least one processor so that the at least one processor can perform any step of the artificial intelligence-based labeled image detection method as described above.
[0042] To achieve the above-mentioned objectives, the present invention also provides a computer-readable storage medium, which stores an artificial intelligence-based labeled image detection program. When the artificial intelligence-based labeled image detection program is executed by a processor, any step of the artificial intelligence-based labeled image detection method as described above is implemented.
[0043] The artificial intelligence-based annotated image detection method, device, equipment and storage medium proposed in the present invention divide the samples in the original sample image into a positive sample set and a negative sample set and generate a training sample set by judging whether the annotated area image in the original sample image is clear and whether the annotation box of the annotated area image is qualified. The annotation detection model is trained using the training sample set, and it can be detected whether the annotation box annotated by the annotator on the sample data is qualified, so as to remind the annotator to correctly annotate the sample, improve the quality of the sample data annotation, and thus improve the training accuracy of the relevant model. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 It is a flowchart diagram of a preferred embodiment of the method for detecting annotated images based on artificial intelligence of the present invention;
[0045] Figure 2 It is a module schematic diagram of a preferred embodiment of the annotated image detection device based on artificial intelligence of the present invention;
[0046] Figure 3 A schematic diagram of a preferred embodiment of the electronic device of the present invention;
[0047] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0048] In order to make the purpose, technical scheme and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0049] The embodiments of the present invention can acquire and process relevant data based on artificial intelligence technology. Artificial Intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0050] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0051] The present invention provides a method for detecting annotated images based on artificial intelligence. Figure 1 FIG. 1 is a flow chart of an embodiment of a method for detecting annotated images based on artificial intelligence according to the present invention. The method may be performed by an electronic device, which may be implemented by software and / or hardware. The method for detecting annotated images based on artificial intelligence includes:
[0052] Step S10: obtaining a preset number of original sample images, and cutting out annotated area images from the original sample images.
[0053] The sample data for training the OCR recognition model mainly relies on manually selecting the text area in the image, and whether the selected area is qualified will directly affect the recognition accuracy of the trained OCR recognition model. This solution is explained by taking the example of detecting whether the selected area of the sample data used to train the OCR recognition model is qualified. The sample data can be images containing text in different fields, such as images of reimbursement documents, invoice documents, physical examination reports, and health records in the medical field.
[0054] In this embodiment, the manually annotated original sample image can be obtained from a local database or a third-party database. The original sample image has an annotation box and text selected by the annotation box. The annotation box can be an annotation box of a preset color (for example, red) to select the text in the image. According to the coordinate information of the annotation box in the original sample image, the annotation area image can be cut out from the original sample image. The annotation area image refers to an image with the annotation box as the outer boundary and containing the text information selected by the annotation box.
[0055] In one embodiment, the step of extracting the marked area image from the original sample image includes:
[0056] Based on the pixel value of the marked box in the original sample image, reading the coordinate information of the marked box;
[0057] The target area of the annotated area image is located according to the coordinate information of the annotated box, and the annotated area image corresponding to the annotated box is cut out from the original sample image based on the target area.
[0058] Before annotation, the annotation boxes in the original sample image can be uniformly configured to have the same RGB value, so that the area of the annotation box can be identified according to the pixel value of the annotation box, and the horizontal coordinate, vertical coordinate, width and height of the annotation box in the original sample image can be obtained by using the OpenCv toolkit. The coordinate information of the annotation box can be used to cut out the annotation area image corresponding to the annotation box from the original sample image. It can be understood that the height value of the intercepted annotation area image is greater than the height value of the annotation box, and the width value of the annotation area image is greater than the width value of the annotation box.
[0059] Step S20: judging whether the annotated area image is a clear image based on the edge information of the annotated area image; when the annotated area image is judged to be a clear image, judging whether the annotated area image is qualified based on the coordinate information of the annotated area frame of the annotated area image and the text coordinate information of the annotated area image.
[0060] In this embodiment, after the annotated region image in the original sample image is cut out, it is necessary to detect whether the annotated region image is a clear image. If the annotated region image is not a clear image (i.e., a blurred image), it means that the original sample image is an unqualified sample image. When the annotated region image is detected as a clear image, it is also necessary to detect whether the annotated region frame of the annotated region image is qualified based on the coordinate information of the annotated region frame and the text coordinate information of the annotated region image, for example, to detect whether the annotated region frame overlaps with the text region, and whether the distance between the annotated region frame and the text information in the annotated region frame is too loose or too close.
[0061] In one embodiment, judging whether the annotated area image is a clear image based on edge information of the annotated area image includes:
[0062] Using a Gaussian smoothing filter to perform a re-blurring process on the marked area image to obtain a re-blurred image;
[0063] After converting the annotated region image and the re-blurred image into grayscale images respectively, edge detection is performed on the grayscale images respectively to obtain an edge image corresponding to the annotated region image and an edge image corresponding to the re-blurred image;
[0064] Performing block processing on the edge image corresponding to the marked area image and the edge image corresponding to the re-blurred image to obtain a plurality of sub-blocks, and calculating the variance of each sub-block corresponding to the marked area image and the variance of each sub-block corresponding to the re-blurred image;
[0065] Based on the variance of each sub-block corresponding to the marked area image and the variance of each sub-block corresponding to the re-blurred image, the similarity between the marked area image and the re-blurred image is calculated, and when the similarity is greater than a preset threshold, the marked area image is determined to be a clear image.
[0066] The reblurring process is performed on the annotated region image by using a Gaussian smoothing filter, and the reblurred image corresponding to the annotated region image can be obtained. The annotated region image and the reblurred image are converted into grayscale images, and the grayscale values of the points on the image can be converted to 0 or 255. For example, the grayscale values greater than the threshold value 100 are set to 255, and the grayscale values less than 100 are set to 0. The grayscale of the image can greatly reduce the amount of data in the image, thereby highlighting the text contour, which is beneficial to the further processing of the image. Then, the Canny edge detection algorithm is used for edge detection to extract the edge image of the grayscale image, and the edge images corresponding to the annotated region image and the reblurred image are respectively subjected to sliding window block processing to obtain the corresponding sub-blocks. The size of the sliding window and the sliding step size during block division can be set according to actual needs, and then the variances of each sub-block of the annotated region image and each sub-block of the reblurred image are respectively calculated, that is, the grayscale value of each pixel point of the sub-block minus the square sum of the average grayscale value of the sub-block divided by the total number of pixels in the sub-block. The variance of each sub-block of the marked area image is subtracted from the variance of the sub-block corresponding to the re-blurred image, and the absolute value is taken. The average of each absolute value is taken as the similarity value. When the similarity is greater than a preset threshold (for example, 80%), the marked area image is judged to be a clear image.
[0067] In one embodiment, judging whether the annotation box of the annotation area image is qualified based on the coordinate information of the annotation box of the annotation area image and the text coordinate information of the annotation area image includes:
[0068] Detecting the boundary of the text area of the labeled area image by using the maximum stable extremum area algorithm, and reading the coordinate information of the boundary of the text area;
[0069] Based on the coordinate information of the annotation box and the coordinate information of the boundary of the text area, calculating the distance between each frame of the annotation box and each corresponding boundary of the text area;
[0070] When the distances are all within the preset interval, and when the boundaries of the text area are all within the range of the annotation box, it is determined that the annotation box of the annotation area image is qualified.
[0071] Since the color (or grayscale value) of the text area is consistent, the maximum stable extremum region algorithm (MSER algorithm) can be used to detect the text area of the labeled area image. Read the horizontal and vertical coordinates of the border of the text area, and calculate the upper border, lower border, left border and right border of the annotation box, and the distances from the upper border, lower border, left border and right border corresponding to the text area. When the distance between the border of the annotation box and the border corresponding to the text area is within a preset interval (for example, [5-20] pixels), and when the border of the text area is within the range of the annotation box border (that is, the text is in the annotation box), the annotation box of the labeled area image is judged to be qualified, otherwise the annotation box of the labeled area image is unqualified. For example, if the annotation box overlaps with the text, the distance between the annotation box and the text is too far, or the distance between the annotation box and the text is too close, the annotation box is judged to be unqualified.
[0072] Step S30: When it is determined that the annotation box of the annotated area image is qualified, the original sample image is added to the positive sample set; when it is determined that the annotated area image is not a clear image, or when it is determined that the annotation box of the annotated area image is unqualified, the original sample image is added to the negative sample set, and a training sample set is generated based on the positive sample set and the negative sample set.
[0073] In this embodiment, the sample images in the positive sample set are original sample images with clear images and qualified annotation boxes, and the sample images in the negative sample set are original sample images with blurred images or unqualified annotation boxes. A training sample set can be generated based on the positive sample set and the negative sample set, and each sample in the training sample set is labeled with a unique label of 1 or 0, representing "qualified" or "unqualified", and then the training sample set is split into a training set and a validation set according to a preset ratio (for example, 8:2) to train the model. Furthermore, the original sample image can be enhanced by randomly adding noise and color changes.
[0074] In one embodiment, the method further comprises: adjusting the size of each original sample image in the training sample set to a preset size.
[0075] The width of the original sample image in the training sample set is normalized to 224, and the normalization ratio is k (k = 224 / original image width). The height of the original sample image is multiplied by k, and then the upper and lower expansion values are 0 pixels to a height of 224 to obtain a sample image of size 224*224.
[0076] Step S40: training a pre-built model based on the training sample set to obtain a label detection model, reading the label image to be detected input by the user, inputting the label image to be detected into the label detection model to obtain a detection result, and feeding back the detection result to the user.
[0077] In this embodiment, the resnet50 model is trained according to the training sample set to obtain the annotation detection model, and the annotation detection model can detect whether the sample images manually annotated subsequently are qualified. When the user manually annotates the sample images for training the OCR recognition model at the terminal, the annotated image to be detected annotated by the user is read, and the annotated image to be detected is input into the annotation detection model to obtain the detection result and feedback to the user. The annotator can be reminded in real time to annotate correctly, thereby improving the quality of the samples used to train the OCR recognition model. Specifically, the training process of the annotation detection model includes:
[0078] Annotating each original sample image in the training sample set with a preset detection label;
[0079] Input each original sample image in the training sample set into the resnet50 model to obtain a predicted label for each original sample image in the training sample set;
[0080] Reading a preset detection label of each original sample image in the training sample set;
[0081] The structural parameters of the label detection model are determined by minimizing the loss value between the predicted label and the preset detection label to obtain a trained label detection model.
[0082] In one embodiment, feeding back the detection result to the user includes:
[0083] When the detection result shows that the labeled image to be detected is unqualified, feeding back first prompt information to the user, wherein the first prompt information is used to indicate that the labeled image to be detected is unqualified;
[0084] When the detection result shows that the labeled image to be detected is qualified, second prompt information is fed back to the user, where the second prompt information is used to indicate that the labeled image to be detected is qualified.
[0085] When the image annotated by the user is unqualified, a first prompt message is fed back to the user, such as "the image you annotated is unqualified, please annotate again". When the image annotated by the user is qualified, a second prompt message is fed back to the user, such as "the annotated image is qualified".
[0086] In one embodiment, the method further comprises:
[0087] When the detection result is that the annotated image to be detected is unqualified, prohibiting the user from performing an annotation operation on the next annotated image corresponding to the annotated image to be detected;
[0088] When the detection result shows that the annotated image to be detected is qualified, the user is allowed to perform an annotation operation on a next annotated image corresponding to the annotated image to be detected.
[0089] When it is detected that the labeled image to be detected is unqualified, the user is prohibited from labeling the next image until the user labels the current unqualified image as qualified. When it is detected that the labeled image to be detected is qualified, the user is allowed to label the next labeled image corresponding to the labeled image to be detected.
[0090] Reference Figure 2 , which is a schematic diagram of functional modules of the artificial intelligence-based annotated image detection device 100 of the present invention.
[0091] The artificial intelligence-based annotated image detection device 100 of the present invention can be installed in an electronic device. According to the functions to be implemented, the artificial intelligence-based annotated image detection device 100 can include an interception module 110, a judgment module 120, a generation module 130 and a detection module 140. The module described in the present invention can also be referred to as a unit, which refers to a series of computer program segments that can be executed by an electronic device processor and can complete fixed functions, which are stored in the memory of the electronic device.
[0092] In this embodiment, the functions of each module / unit are as follows:
[0093] The interception module 110 is used to obtain a preset number of original sample images and intercept the marked area images from the original sample images;
[0094] The judging module 120 is used to judge whether the marked area image is a clear image based on the edge information of the marked area image, and when the marked area image is judged to be a clear image, judge whether the marked area image is qualified based on the coordinate information of the marked area image and the text coordinate information of the marked area image;
[0095] Generating module 130: used for adding the original sample image to the positive sample set when it is determined that the annotation box of the annotated region image is qualified, adding the original sample image to the negative sample set when it is determined that the annotated region image is not a clear image, or when it is determined that the annotation box of the annotated region image is unqualified, and generating a training sample set based on the positive sample set and the negative sample set;
[0096] Detection module 140: used to train a pre-built model based on the training sample set to obtain a labeled detection model, read the labeled image to be detected input by the user, input the labeled image to be detected into the labeled detection model to obtain a detection result, and feed back the detection result to the user.
[0097] In one embodiment, the step of extracting the marked area image from the original sample image includes:
[0098] Based on the pixel value of the marked box in the original sample image, reading the coordinate information of the marked box;
[0099] The target area of the annotated area image is located according to the coordinate information of the annotated box, and the annotated area image corresponding to the annotated box is cut out from the original sample image based on the target area.
[0100] In one embodiment, judging whether the annotated area image is a clear image based on edge information of the annotated area image includes:
[0101] Using a Gaussian smoothing filter to perform a re-blurring process on the marked area image to obtain a re-blurred image;
[0102] After converting the annotated region image and the re-blurred image into grayscale images respectively, edge detection is performed on the grayscale images respectively to obtain an edge image corresponding to the annotated region image and an edge image corresponding to the re-blurred image;
[0103] Performing block processing on the edge image corresponding to the marked area image and the edge image corresponding to the re-blurred image to obtain a plurality of sub-blocks, and calculating the variance of each sub-block corresponding to the marked area image and the variance of each sub-block corresponding to the re-blurred image;
[0104] Based on the variance of each sub-block corresponding to the marked area image and the variance of each sub-block corresponding to the re-blurred image, the similarity between the marked area image and the re-blurred image is calculated, and when the similarity is greater than a preset threshold, the marked area image is determined to be a clear image.
[0105] In one embodiment, judging whether the annotation box of the annotation area image is qualified based on the coordinate information of the annotation box of the annotation area image and the text coordinate information of the annotation area image includes:
[0106] Detecting the boundary of the text area of the labeled area image by using the maximum stable extremum area algorithm, and reading the coordinate information of the boundary of the text area;
[0107] Based on the coordinate information of the annotation box and the coordinate information of the boundary of the text area, calculating the distance between each frame of the annotation box and each corresponding boundary of the text area;
[0108] When the distances are all within the preset interval, and when the boundaries of the text area are all within the range of the annotation box, it is determined that the annotation box of the annotation area image is qualified.
[0109] In one embodiment, feeding back the detection result to the user includes:
[0110] When the detection result shows that the labeled image to be detected is unqualified, feeding back first prompt information to the user, wherein the first prompt information is used to indicate that the labeled image to be detected is unqualified;
[0111] When the detection result shows that the labeled image to be detected is qualified, second prompt information is fed back to the user, where the second prompt information is used to indicate that the labeled image to be detected is qualified.
[0112] In one embodiment, the detection module 140 is further configured to:
[0113] When the detection result is that the annotated image to be detected is unqualified, prohibiting the user from performing an annotation operation on the next annotated image corresponding to the annotated image to be detected;
[0114] When the detection result shows that the annotated image to be detected is qualified, the user is allowed to perform an annotation operation on a next annotated image corresponding to the annotated image to be detected.
[0115] In one embodiment, the pre-built model is a resnet50 model, and the training process of the annotation detection model includes:
[0116] Annotating each original sample image in the training sample set with a preset detection label;
[0117] Input each original sample image in the training sample set into the resnet50 model to obtain a predicted label for each original sample image in the training sample set;
[0118] Reading a preset detection label of each original sample image in the training sample set;
[0119] The structural parameters of the label detection model are determined by minimizing the loss value between the predicted label and the preset detection label to obtain a trained label detection model.
[0120] Reference Figure 3 FIG. 1 is a schematic diagram of a preferred embodiment of an electronic device 1 of the present invention.
[0121] The electronic device 1 includes but is not limited to: a memory 11, a processor 12, a display 13 and a network interface 14. The electronic device 1 is connected to a network through the network interface 14 to obtain raw data. The network may be a wireless or wired network such as an intranet, the Internet, a global system of mobile communications (GSM), a wideband code division multiple access (WCDMA), a 4G network, a 5G network, Bluetooth, Wi-Fi, a call network, etc.
[0122] Among them, the memory 11 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 11 can be an internal storage unit of the electronic device 1, such as a hard disk or memory of the electronic device 1. In other embodiments, the memory 11 can also be an external storage device of the electronic device 1, such as a plug-in hard disk equipped with the electronic device 1, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the memory 11 can also include both the internal storage unit of the electronic device 1 and its external storage device. In this embodiment, the memory 11 is generally used to store the operating system and various application software installed on the electronic device 1, such as the program code of the annotated image detection program 10 based on artificial intelligence, etc. In addition, the memory 11 can also be used to temporarily store various types of data that have been output or are to be output.
[0123] In some embodiments, the processor 12 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip. The processor 12 is generally used to control the overall operation of the electronic device 1, such as performing control and processing related to data interaction or communication. In this embodiment, the processor 12 is used to run the program code stored in the memory 11 or process data, such as running the program code of the artificial intelligence-based annotated image detection program 10.
[0124] The display 13 may be referred to as a display screen or a display unit. In some embodiments, the display 13 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an organic light-emitting diode (OLED) touch device. The display 13 is used to display information processed in the electronic device 1 and to display a visual working interface, such as displaying the results of data statistics.
[0125] The network interface 14 may optionally include a standard wired interface, a wireless interface (such as a WI-FI interface), and the network interface 14 is generally used to establish a communication connection between the electronic device 1 and other electronic devices.
[0126] Figure 3 Only an electronic device 1 having components 11 - 14 and an artificial intelligence-based annotated image detection program 10 is shown, but it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.
[0127] Optionally, the electronic device 1 may further include a user interface, which may include a display (Display), an input unit such as a keyboard (Keyboard), and the optional user interface may also include a standard wired interface and a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an organic light-emitting diode (Organic Light-Emitting Diode, OLED) touch device, etc. Among them, the display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device 1 and to display a visual user interface.
[0128] The electronic device 1 may further include a radio frequency (RF) circuit, a sensor, an audio circuit, etc., which will not be described in detail here.
[0129] In the above embodiment, the processor 12 can implement the following steps when executing the artificial intelligence-based annotated image detection program 10 stored in the memory 11:
[0130] Acquire a preset number of original sample images, and extract annotated area images from the original sample images;
[0131] Determining whether the annotated area image is a clear image based on edge information of the annotated area image, and when the annotated area image is determined to be a clear image, determining whether the annotated area image is qualified based on coordinate information of the annotated area frame of the annotated area image and text coordinate information of the annotated area image;
[0132] When it is determined that the annotation box of the annotated area image is qualified, the original sample image is added to the positive sample set; when it is determined that the annotated area image is not a clear image, or when it is determined that the annotation box of the annotated area image is unqualified, the original sample image is added to the negative sample set, and a training sample set is generated based on the positive sample set and the negative sample set;
[0133] A pre-built model is trained based on the training sample set to obtain a label detection model, a label image to be detected input by a user is read, the label image to be detected is input into the label detection model to obtain a detection result, and the detection result is fed back to the user.
[0134] The storage device may be the memory 11 of the electronic device 1 , or may be another storage device that is communicatively connected to the electronic device 1 .
[0135] For a detailed description of the above steps, please refer to the above Figure 2 Functional module diagram of an embodiment of an artificial intelligence-based labeled image detection device 100 and Figure 1 Description of a flowchart of an embodiment of an annotated image detection method based on artificial intelligence.
[0136] In addition, an embodiment of the present invention further proposes a computer-readable storage medium, which may be non-volatile or volatile. The computer-readable storage medium may be any one or any combination of a hard disk, a multimedia card, an SD card, a flash memory card, an SMC, a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a portable compact disk read-only memory (CD-ROM), a USB memory, etc. The computer-readable storage medium includes a data storage area and a program storage area, the data storage area stores data created according to the use of the blockchain node, and the program storage area stores an artificial intelligence-based annotated image detection program 10, and the artificial intelligence-based annotated image detection program 10 is executed by the processor to implement the following operations:
[0137] Acquire a preset number of original sample images, and extract annotated area images from the original sample images;
[0138] Determining whether the annotated area image is a clear image based on edge information of the annotated area image, and when the annotated area image is determined to be a clear image, determining whether the annotated area image is qualified based on coordinate information of the annotated area frame of the annotated area image and text coordinate information of the annotated area image;
[0139] When it is determined that the annotation box of the annotated area image is qualified, the original sample image is added to the positive sample set; when it is determined that the annotated area image is not a clear image, or when it is determined that the annotation box of the annotated area image is unqualified, the original sample image is added to the negative sample set, and a training sample set is generated based on the positive sample set and the negative sample set;
[0140] A pre-built model is trained based on the training sample set to obtain a label detection model, a label image to be detected input by a user is read, the label image to be detected is input into the label detection model to obtain a detection result, and the detection result is fed back to the user.
[0141] The specific implementation of the computer-readable storage medium of the present invention is roughly the same as the specific implementation of the above-mentioned artificial intelligence-based labeled image detection method, and will not be repeated here.
[0142] In another embodiment, the artificial intelligence-based annotated image detection method provided by the present invention can further ensure the privacy and security of all the above-mentioned data, and all the above-mentioned data can also be stored in a blockchain node. For example, the annotated image to be detected and the original sample image, etc., can all be stored in the blockchain node.
[0143] It should be noted that the blockchain referred to in the present invention is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the blockchain underlying platform, platform product service layer, and application service layer.
[0144] It should be noted that the serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages and disadvantages of the embodiments. And the terms "including", "comprising" or any other variants thereof in this article are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "including a ..." does not exclude the presence of other identical elements in the process, device, article or method including the element.
[0145] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, including a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, an electronic device, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0146] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. An artificial intelligence-based annotated image detection method, applied to electronic equipment, characterized in that: The method comprises: Obtaining a preset number of manually annotated original sample images, and based on the coordinate information of the annotation boxes in the original sample images, intercepting the text area selected by the annotation boxes from the original sample images to obtain an annotation area image; Determining whether the labeled area image is a clear image based on edge information of the labeled area image, and when the labeled area image is determined to be a clear image, detecting whether the labeled box of the labeled area image is qualified, including: detecting the boundary of the text area of the labeled area image by using a maximum stable extremum area algorithm, reading the coordinate information of the boundary of the text area, and calculating the distances between each frame of the labeled box and each corresponding boundary of the text area based on the coordinate information of the labeled box and the coordinate information of the boundary of the text area, and when the distances are all within a preset interval and when the boundaries of the text area are all within the range of the labeled box, determining that the labeled box of the labeled area image is qualified; When it is determined that the annotation box of the annotated area image is qualified, the original sample image is added to the positive sample set; when it is determined that the annotated area image is not a clear image, or when it is determined that the annotation box of the annotated area image is unqualified, the original sample image is added to the negative sample set, and a training sample set is generated based on the positive sample set and the negative sample set; A pre-built model is trained based on the training sample set to obtain a label detection model, a label image to be detected input by a user is read, the label image to be detected is input into the label detection model to obtain a detection result, and the detection result is fed back to the user.
2. The method for detecting annotated images based on artificial intelligence according to claim 1, characterized in that: The method of capturing a text area selected by the annotation box from the original sample image according to the coordinate information of the annotation box in the original sample image to obtain an annotation area image includes: Based on the pixel value of the marked box in the original sample image, reading the coordinate information of the marked box; The target area of the annotated area image is located according to the coordinate information of the annotated box, and the annotated area image corresponding to the annotated box is cut out from the original sample image based on the target area.
3. The method for detecting annotated images based on artificial intelligence according to claim 1, characterized in that: The determining whether the annotated area image is a clear image based on edge information of the annotated area image comprises: Using a Gaussian smoothing filter to perform a re-blurring process on the marked area image to obtain a re-blurred image; After converting the annotated region image and the re-blurred image into grayscale images respectively, edge detection is performed on the grayscale images respectively to obtain an edge image corresponding to the annotated region image and an edge image corresponding to the re-blurred image; Performing block processing on the edge image corresponding to the marked area image and the edge image corresponding to the re-blurred image to obtain a plurality of sub-blocks, and calculating the variance of each sub-block corresponding to the marked area image and the variance of each sub-block corresponding to the re-blurred image; Based on the variance of each sub-block corresponding to the marked area image and the variance of each sub-block corresponding to the re-blurred image, the similarity between the marked area image and the re-blurred image is calculated, and when the similarity is greater than a preset threshold, the marked area image is determined to be a clear image.
4. The method for detecting annotated images based on artificial intelligence according to claim 1, characterized in that: Feeding back the detection result to the user includes: When the detection result shows that the labeled image to be detected is unqualified, feeding back first prompt information to the user, wherein the first prompt information is used to indicate that the labeled image to be detected is unqualified; When the detection result shows that the labeled image to be detected is qualified, second prompt information is fed back to the user, where the second prompt information is used to indicate that the labeled image to be detected is qualified.
5. The method for detecting annotated images based on artificial intelligence according to claim 4, characterized in that: The method further comprises: When the detection result is that the annotated image to be detected is unqualified, prohibiting the user from performing an annotation operation on the next annotated image corresponding to the annotated image to be detected; When the detection result shows that the annotated image to be detected is qualified, the user is allowed to perform an annotation operation on a next annotated image corresponding to the annotated image to be detected.
6. The method for detecting annotated images based on artificial intelligence according to any one of claims 1 to 5, characterized in that: The pre-built model is a resnet50 model, and the training process of the annotation detection model includes: Annotating each original sample image in the training sample set with a preset detection label; Input each original sample image in the training sample set into the resnet50 model to obtain a predicted label for each original sample image in the training sample set; Reading a preset detection label of each original sample image in the training sample set; The structural parameters of the label detection model are determined by minimizing the loss value between the predicted label and the preset detection label to obtain a trained label detection model.
7. An artificial intelligence-based annotated image detection device, characterized in that: The device comprises: A capture module is used to obtain a preset number of manually annotated original sample images, and capture the text area selected by the annotated box from the original sample image according to the coordinate information of the annotated box in the original sample image to obtain an annotated area image; A judgment module: used to judge whether the labeled area image is a clear image based on the edge information of the labeled area image, and when the labeled area image is judged to be a clear image, to detect whether the labeled box of the labeled area image is qualified, including: using the maximum stable extremum area algorithm to detect the boundary of the text area of the labeled area image, reading the coordinate information of the boundary of the text area, and based on the coordinate information of the labeled box and the coordinate information of the boundary of the text area, calculating the distance between each frame of the labeled box and each corresponding boundary of the text area, when the distances are all within the preset interval range, and when the boundaries of the text area are all within the range of the labeled box, it is judged that the labeled box of the labeled area image is qualified; A generation module: used for adding the original sample image to a positive sample set when it is determined that the annotation box of the annotated area image is qualified, adding the original sample image to a negative sample set when it is determined that the annotated area image is not a clear image, or when it is determined that the annotation box of the annotated area image is unqualified, and generating a training sample set based on the positive sample set and the negative sample set; Detection module: used to train a pre-built model based on the training sample set to obtain a labeled detection model, read the labeled image to be detected input by the user, input the labeled image to be detected into the labeled detection model to obtain a detection result, and feed back the detection result to the user.
8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores a program executable by the at least one processor, and the program is executed by the at least one processor so that the at least one processor can execute the artificial intelligence-based labeled image detection method as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores an artificial intelligence-based annotated image detection program, and when the artificial intelligence-based annotated image detection program is executed by a processor, the steps of the artificial intelligence-based annotated image detection method as described in any one of claims 1 to 6 are implemented.
