Paper image cutting method and device, storage medium and equipment
Through the pre-trained paper detection model and position information processing of the collection cycle, combined with the identification threshold, the problem of handheld device jitter affecting the paper image cropping accuracy is solved, and higher image recognition accuracy and stability are achieved.
Patent Information
- Application Number
- CN202310194250.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-01
- Publication Date
- 2024-09-03
AI Technical Summary
In the prior art, when the paper image is acquired, the image outline is unclear due to the shaking of the handheld device, which affects the recognition accuracy and results in low precision in paper image cropping.
The pre-trained paper detection model is used to combine the position information and identification threshold of the collection cycle to determine the accuracy of image cropping by recording and clearing position information to ensure that image cropping is performed when the threshold is met to avoid the impact of unstable collection environment.
It improves the accuracy of paper image cropping, reduces the low recognition accuracy caused by the accuracy of collected images, and enhances the stability and accuracy of image recognition.
Smart Images

Figure CN118587407A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image recognition, and in particular to a paper image cutting method, device, storage medium and equipment. Background Art
[0002] The current method of acquiring paper images mainly involves performing target detection on an image containing paper to determine the area information of the paper in the image, and then cropping the image to obtain an image of the area where the paper is located.
[0003] However, in the process of target detection in images, the accuracy of the detection results is easily affected by the input image, especially when the user captures the image by a handheld image acquisition device. The shaking of the hand can easily cause the image contour to be unclear, affecting the accuracy of image recognition. Summary of the invention
[0004] The embodiments of the present application provide a paper image cropping method, device, storage medium and equipment, which can effectively improve the accuracy of paper image cropping. The technical solution is as follows:
[0005] In a first aspect, an embodiment of the present application provides a paper image cutting method, comprising the following steps:
[0006] Acquire the image to be identified according to a preset acquisition cycle;
[0007] Using a pre-trained paper detection model, first position information of a region where paper is located in the image to be identified is obtained;
[0008] If the deviation between the first position information of the current acquisition cycle and the first position information of the previous acquisition cycle is less than a preset threshold, the first position information of the current acquisition cycle is recorded and the acquisition identifier is increased by a first set value; otherwise, the first position information of each recorded acquisition cycle is cleared and the acquisition identifier is set to an initial value;
[0009] If the acquisition mark is greater than the mark threshold, the image to be identified in the acquisition period is cropped based on the first position information of the latest acquisition period to obtain the paper image.
[0010] In a second aspect, an embodiment of the present application provides a paper image cutting device, comprising:
[0011] An image acquisition module, used to acquire the image to be identified according to a preset acquisition cycle;
[0012] A position information acquisition module is used for a first position information acquisition module, which is used to obtain first position information of an area where a paper in an image to be identified is located by using a pre-trained paper detection model;
[0013] A recording module, configured to record the first position information of the current collection period and increase the collection identifier by a first set value if the deviation value between the first position information of the current collection period and the first position information of the previous collection period is less than a preset threshold; otherwise, clear the recorded first position information of each collection period and set the collection identifier to an initial value;
[0014] The cropping module is used to crop the image to be identified in the acquisition period based on the first position information of the latest acquisition period to obtain the paper image if the acquisition mark is greater than the mark threshold.
[0015] In a third aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the paper image cutting method as described in any one of the above.
[0016] In a fourth aspect, an embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable by the processor;
[0017] When the processor executes the computer program, the steps of any one of the above-mentioned paper image cutting methods are implemented.
[0018] In an embodiment of the present application, a pre-trained paper detection model is used to obtain the first position information of the area where the paper is located in the image to be identified in each acquisition cycle. If the deviation value between the first position information of the current acquisition cycle and the first position information of the previous acquisition cycle is less than a preset threshold, the first position information of the current acquisition cycle is recorded and the acquisition identifier is increased by a first set value. Otherwise, the first position information of each recorded acquisition cycle is cleared and the acquisition identifier is cleared. Whether the acquired image meets the cropping condition is determined based on whether the acquisition identifier is greater than the identification threshold. When the acquisition identifier is greater than the identification threshold, the image to be identified in the acquisition cycle is cropped based on the first position information of the latest acquisition cycle to obtain the paper image, thereby avoiding the low recognition accuracy of the paper image due to the accuracy of the acquired image and improving the cropping accuracy of the paper image.
[0019] For better understanding and implementation, the present invention is described in detail below with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 A flowchart of a paper image cutting method according to an embodiment of the present invention;
[0021] Figure 2 is a flow chart of step S120 in one embodiment of the present invention;
[0022] Figure 3is a schematic diagram of a display interface of an electronic device in one embodiment of the present invention;
[0023] Figure 4 is a schematic diagram of a display interface of an electronic device in another embodiment of the present invention;
[0024] Figure 5 is a flowchart of step S122 in one embodiment of the present invention;
[0025] Figure 6 is a flowchart of step S122 in another embodiment of the present invention;
[0026] Figure 7 It is a structural schematic diagram of a paper image cutting device in one embodiment of the present invention;
[0027] Figure 8 The figure is a schematic diagram of the structure of an electronic device in one embodiment of the present invention. DETAILED DESCRIPTION
[0028] In order to make the objectives, technical solutions and advantages of the present application more clear, the embodiments of the present application will be further described in detail below with reference to the accompanying drawings.
[0029] It should be clear that the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the embodiments of the present application.
[0030] The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the embodiments of the present application. The singular forms of "a", "said" and "the" used in the embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.
[0031] When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims. In the description of the present application, it should be understood that the terms "first", "second", "third", etc. are only used to distinguish similar objects, and do not have to be used to describe a specific order or sequence, nor can they be understood as indicating or implying relative importance. For those of ordinary skill in the art, the specific meanings of the above terms in the present application can be understood according to the specific circumstances.
[0032] In addition, in the description of this application, unless otherwise specified, "several" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects are in an "or" relationship.
[0033] The paper image cutting method of the present application can be applied to identify any image containing paper, so as to cut out the image of the area where the paper is located from the image.
[0034] Specifically, in one embodiment, the paper image cropping method of the present application can be applied to a scanner or other electronic device that needs to convert a paper document into an electronic document. After obtaining the cropped paper image through the method of the present application, the text content in the paper image can be extracted by utilizing character recognition technology or text recognition technology, thereby digitizing the content of the paper document and obtaining an electronic file corresponding to the paper document, thereby facilitating the electronic processing of paper documents and improving office efficiency.
[0035] See also Figure 1 , the embodiment of the present application provides a paper image cutting method, the method comprising the following steps:
[0036] S110: Acquire an image to be recognized according to a preset acquisition cycle;
[0037] The acquisition cycle is used to determine the time interval for acquiring the image to be identified. When the image to be identified is an image acquired in real time by an image acquisition device, the acquisition cycle can be used to determine the time interval for the image acquisition device to continuously acquire images, wherein the image acquisition device can be a camera or other equipment, and the acquisition cycle can be the time interval for the camera to continuously shoot. Alternatively, the image to be identified can also be an image uploaded by a user through a transmission means such as a network.
[0038] The image to be identified in this application may be an image containing paper. The paper may contain text or characters, etc. In particular, the paper in this application may be a paper document such as an examination paper or a student's answer sheet. When acquiring the image to be identified, the paper document may be placed within the shooting range of the camera to obtain the image to be identified including the paper document.
[0039] S120: using a pre-trained paper detection model to obtain first position information of a region where paper in the image to be identified is located;
[0040] Each time an image to be identified is collected, the pre-trained paper detection model is used to obtain first position information of a region where the paper in the image to be identified is located.
[0041] The paper detection model is used to obtain the first position information of the area where the paper is located in the image to be identified. The paper detection model can be constructed based on existing target detection algorithms such as SSD and YOLO. After the paper detection model is constructed, multiple images marked with paper information collected in advance by the user can be used as training samples to pre-train the paper detection model until the detection accuracy of the pre-trained paper detection model can meet the accuracy requirements preset by the user.
[0042] Specifically, before using the pre-trained paper detection model to obtain the first position information of the area where the test paper is located in the image to be identified, the following steps are also included:
[0043] Build a paper detection model based on the yolov5 model;
[0044] The paper detection model is pre-trained based on training samples until the detection accuracy of the paper detection model meets a preset accuracy requirement; wherein the training samples include images containing paper and images not containing paper.
[0045] The yolov5 model includes an input end, a Backone module, a Neck module, and a Prediction module. The input end is used to perform data enhancement on the input image, the Backone module is used to aggregate and form image features at different image granularities, the Neck module is used to mix and combine image features and pass them to the Prediction module, and the Prediction module is used to predict image features and obtain information such as the coordinates, width, height, and confidence of the center point of the prediction box. Compared with other target detection algorithms, the detection speed based on the yolov5 model is faster and more conducive to real-time detection results.
[0046] Preferably, the training samples may include images with paper and images without paper, with images with paper as positive samples and images without paper as negative samples, so as to improve the training effect and detection accuracy of the paper detection model.
[0047] After pre-training the paper detection model, tensorflowjs can be used to convert the trained paper detection model into a web model so that the paper detection model can be called by the web. In actual application, you only need to upload the image to be identified through the web, and then you can automatically use the pre-trained paper detection model to obtain the first position information of the area where the paper is located in the image to be identified. TensorFlow.js is a browser-based machine learning js framework accelerated by WebGL. In this application, tensorflowjs is used to convert the trained paper detection model into a web model, so that users can use the paper detection model directly on the web, thereby improving the convenience of paper detection.
[0048] In an embodiment of the present application, the area included in the prediction box obtained using the paper detection model is the area where the paper of the present application is located, and the first position information of the area where the paper is located can be obtained based on information such as the coordinates, width and height of the prediction box.
[0049] S130: If the deviation between the first position information of the current collection period and the first position information of the previous collection period is less than a preset threshold, record the first position information of the current collection period and increase the collection flag by a first set value; otherwise, clear the recorded first position information of each collection period and set the collection flag to an initial value;
[0050] The deviation value between the first position information of the current acquisition cycle and the first position information of the previous acquisition cycle is used to determine whether the area where the paper is located in the image to be identified in the current acquisition cycle and the previous cycle has changed.
[0051] In the present application, since the image to be identified is an image continuously acquired according to a fixed acquisition cycle, if the area where the paper is located in the image to be identified in the acquisition cycle and the previous cycle has changed significantly, it means that the current acquisition environment is unstable. For example, when the user is holding the image acquisition device to acquire, there may be hand shaking and the like. At this time, if paper detection and cropping are still performed based on the unstable image, the quality of the obtained paper image is poor. Therefore, in the embodiment of the present application, the deviation value between the first position information of the current acquisition cycle and the first position information of the previous acquisition cycle is less than a preset threshold as a paper detection condition. The paper detection condition can be used to determine the stability of the acquired image to be identified. If the deviation value between the first position information of the current acquisition cycle and the first position information of the previous acquisition cycle is less than the preset threshold, it is determined that the paper detection result meets the paper detection condition, the first position information of the current acquisition cycle is recorded, and the acquisition identifier is increased by a first set value; if the deviation value between the first position information of the current acquisition cycle and the first position information of the previous acquisition cycle is greater than or equal to the preset threshold, it is determined that the paper detection result does not meet the paper detection condition, by clearing the first position information of each recorded acquisition cycle and clearing the acquisition identifier, by reacquiring the image to be identified and performing paper detection, until the paper detection result meets the paper detection condition.
[0052] When the current collection cycle is the first collection cycle, the collection identifier can be set to an initial value. When the current collection cycle is the collection cycle after the first collection cycle, whether the first position information of the current collection cycle needs to be recorded and the value of the collection identifier needs to be adjusted based on whether the deviation value between the first position information of the current collection cycle and the first position information of the previous collection cycle is less than a preset threshold.
[0053] The collection flag can be used to determine the number of consecutive times that the paper detection result meets the paper detection condition. For example, when the collection flag is 2, it means that the paper detection results meet the paper detection condition twice in a row. In this application, when the paper detection result of the collection cycle meets the paper detection condition, the collection flag is increased by the first set value. Among them, the initial value of the collection flag can be set according to the actual needs of the user. For example, the initial value of the collection flag in the embodiment of the present application can be 0.
[0054] The first position information and collection identification of each collection cycle in the present application can be stored in the cache area of the electronic device. Each time the first position information of the current collection cycle is obtained, the first position information and collection identification of the previous collection cycle are called from the cache area.
[0055] Clearing the first position information of each collection period recorded may be clearing the first position information of each collection period stored in a buffer area of the electronic device.
[0056] The first set value is used to determine the value added to the collection mark, and can be set according to the actual needs of the user. In the embodiment of the present application, the first set value can be 1.
[0057] S140: If the collection identifier is greater than the identifier threshold, based on the first position information of the latest collection period, the image to be identified in the collection period is cropped to obtain a paper image;
[0058] Specifically, the size relationship between the acquisition identifier and the identifier threshold can be used as the image cropping condition for image cropping. When the acquisition identifier is greater than the identifier threshold, it is determined that the image cropping condition is met, and based on the first position information of the latest acquisition cycle, the image to be identified in the acquisition cycle is cropped to obtain the paper image; when the acquisition identifier is less than or equal to the identifier threshold, it is determined that the image cropping condition is not met, and steps S110-130 are repeated until the acquisition identifier is greater than the identifier threshold.
[0059] If the acquisition mark of the current acquisition cycle increases by the first set value and is greater than the mark threshold, the current acquisition cycle is the latest acquisition cycle, and the image to be identified in the current acquisition cycle is cropped according to the first position information of the current acquisition cycle to obtain a paper image.
[0060] The paper image is an image of the area where the paper is located.
[0061] In an embodiment of the present application, an image to be identified is acquired according to a preset acquisition cycle, and a pre-trained paper detection model is used to acquire first position information of an area where paper is located in the image to be identified in each acquisition cycle. If a deviation between the first position information of a current acquisition cycle and the first position information of a previous acquisition cycle is less than a preset threshold, the first position information of the current acquisition cycle is recorded and an acquisition identifier is increased by a first set value. Otherwise, the first position information of each recorded acquisition cycle is cleared and the acquisition identifier is reset to zero. Whether the acquired image meets the cropping condition is determined based on whether the acquisition identifier is greater than the identification threshold. When the acquisition identifier is greater than the identification threshold, the image to be identified in the acquisition cycle is cropped based on the first position information of the latest acquisition cycle to acquire a paper image, thereby avoiding the low recognition accuracy of the paper image due to the accuracy of the acquired image and improving the cropping accuracy of the paper image.
[0062] The image to be identified obtained in step S110 may be an image containing paper or an image not containing paper. When the image to be identified is an image not containing paper, if the steps of the above embodiment of the present application are still followed to perform paper detection and cropping of the image, it will cause a waste of computer resources.
[0063] Therefore, in a preferred embodiment, before performing paper detection and cropping of an image, it is possible to detect whether there is paper in the image. When there is no paper in the image, there is no need to perform paper detection and cropping on the image to be identified, thereby reducing the waste of computer resources.
[0064] Specifically, in step S120, the paper detection model may include a first detection model and a second detection model; the first detection model is used to detect whether there is paper in the image to be identified; the second detection model is used to obtain first position information of the area where the paper is located in the image to be identified;
[0065] like Figure 2 As shown, the step of using the pre-trained paper detection model to obtain the first position information of the area where the paper in the image to be identified is located specifically includes:
[0066] S121: Detecting whether there is paper in the image to be identified by using the first detection model;
[0067] S122: If there is paper in the image to be identified, using the second detection model to obtain first position information of a region where the paper in the image to be identified is located;
[0068] S123: Otherwise, clear the first position information of each recorded collection period and set the collection flag to an initial value.
[0069] The first detection model can be constructed based on existing target detection algorithms such as SSD and YOLO. After the first detection model is constructed, the first detection model can be pre-trained using multiple images annotated with paper information collected in advance by the user as training samples, until the detection accuracy of the pre-trained first detection model can meet the user's preset accuracy requirements.
[0070] Preferably, the training samples may include images with paper and images without paper, with images with paper as positive samples and images without paper as negative samples, so as to improve the training effect and detection accuracy of the first detection model.
[0071] like Figure 3 As shown, in a preferred embodiment, it is a schematic diagram of a display interface of an electronic device in an embodiment, and the electronic device includes a memory, a processor, and a computer program stored in the memory and executable by the processor, and when the processor executes the computer program, the steps of the paper image cutting method of the present application are implemented.
[0072] When the first detection model detects that there is no paper in the image to be identified, a first prompt text “Please spread the paper to the designated area” may be displayed on the display interface of the electronic device, where the designated area may be the acquisition area of the camera.
[0073] The first prompt text is used to prompt the user that there is no paper in the image to be identified, so that the user can place the paper document to be digitized to a specified location to obtain the image to be identified containing the paper.
[0074] In an embodiment of the present application, a first detection model is first used to detect whether there is paper in the image to be identified. When paper exists in the image to be identified, the second detection model is used to obtain the first position information of the area where the paper is located in the image to be identified. Otherwise, the first position information of each recorded acquisition cycle is directly cleared and the acquisition flag is cleared. By first detecting whether there is paper in the image, there is no need to detect and crop paper for images where no paper exists, thereby reducing the waste of computer resources and improving the efficiency of computer resource utilization.
[0075] like Figure 4 As shown, it is a schematic diagram of a display interface of an electronic device in an embodiment. In addition to the paper 102, the image to be identified may also contain other objects, such as a human hand 103, etc. When there are foreign objects other than paper in the image to be identified, the foreign objects may affect the detection and cutting of the paper image. Therefore, in one embodiment, the paper detection model also includes a third detection model; the third detection model is used to detect whether there is a target object in the image to be identified;
[0076] like Figure 5 As shown, the step of using the second detection model to obtain the first position information of the area where the paper in the image to be identified is located specifically includes:
[0077] S1221: Detecting whether there is a target object in the image to be identified by using the third detection model;
[0078] S1221: If there is no target object in the image to be identified, using the second detection model to obtain first position information of a region where the paper in the image to be identified is located;
[0079] S1223: Otherwise, clear the first position information of each recorded collection period and set the collection flag to an initial value.
[0080] The target object of the present application can be set according to the foreign matter that may exist in the actual application scenario of the paper image. Specifically, when the paper image is a test paper image, or when the paper image is an answer sheet image, the target object can be a human hand.
[0081] The third detection model can be constructed based on existing target detection algorithms such as SSD and YOLO. After the third detection model is constructed, the third detection model can be pre-trained using multiple images annotated with hand information collected in advance by the user as training samples, until the detection accuracy of the pre-trained third detection model can meet the user's preset accuracy requirements.
[0082] Preferably, the training samples may include images with target objects and images without target objects, with images with target objects as positive samples and images without target objects as negative samples, so as to improve the training effect and detection accuracy of the third detection model.
[0083] like Figure 4 As shown, when a target object is detected in the image to be identified, a second prompt content 104 "Please lay the paper flat in the specified area" can be displayed on the display interface of the electronic device. The second prompt content 104 is used to prompt the user that a target object is detected in the image to be identified, thereby reminding the user to adjust the paper image acquisition method in time to obtain an image to be identified without the target object.
[0084] In an embodiment of the present application, a third detection model is used to detect whether there is a target object in the image to be identified. When there is a target object other than paper in the image to be identified, in order to avoid the target object affecting the detection and cropping of the paper image, the detection and cropping of the paper image are stopped by clearing the first position information of each recorded acquisition cycle and resetting the acquisition flag until the image to be identified without the target object is re-captured, thereby improving the accuracy of the acquired paper image.
[0085] When there are foreign objects other than paper in the image to be identified, the foreign objects may not affect the detection and cropping of the paper image. For example, when the foreign objects are far away from the area where the paper is located, a complete paper image can still be obtained after paper detection and cropping of the image to be identified.
[0086] Therefore, if Figure 7 As shown, in another embodiment, the paper detection model further includes a fourth detection model; the fourth detection model is used to detect the second position information of the area where the target object is located in the image to be identified;
[0087] The step of using the second detection model to obtain first position information of the area where the paper in the image to be identified is located specifically includes:
[0088] S122a: Acquire second position information of a region where the target object in the image to be identified is located by using the fourth detection model;
[0089] S122b: determining, based on the first position information and the second position information, whether the position of the target object in the image to be identified coincides with the position of the paper in the image to be identified;
[0090] S122c: If the position of the target object in the image to be identified coincides with the position of the paper in the image to be identified, clear the first position information of each recorded acquisition cycle and set the acquisition flag to an initial value;
[0091] S122d: If the position of the target object in the image to be identified does not coincide with the position of the paper in the image to be identified, and the deviation between the first position information of the current acquisition cycle and the first position information of the previous acquisition cycle is less than a preset threshold, record the first position information of the current acquisition cycle and increase the acquisition identifier by a first set value; otherwise, clear the recorded first position information of each acquisition cycle and set the acquisition identifier to an initial value.
[0092] The fourth detection model can be constructed based on existing target detection algorithms such as SSD and YOLO. After the fourth detection model is constructed, the first detection model can be pre-trained using multiple images annotated with target information collected in advance by the user as training samples until the detection accuracy of the pre-trained fourth detection model can meet the user's preset accuracy requirements.
[0093] Preferably, the training samples may include images with target objects and images without target objects, with images with target objects as positive samples and images without target objects as negative samples, so as to improve the training effect and detection accuracy of the fourth detection model.
[0094] In an embodiment of the present application, a fourth detection model is used to obtain second position information of the area where the target object in the image to be identified is located, and whether the target object in the image to be identified coincides with the paper is determined based on the first position information and the second position information. When it is determined that the target object in the image to be identified coincides with the paper, the detection and cropping of the paper image are stopped by clearing the first position information of each recorded acquisition cycle and resetting the acquisition flag to zero, thereby reducing the occupancy of computer resources. When the target object does not coincide with the paper and the acquisition flag is greater than the identification threshold, the image to be identified in the acquisition cycle is cropped based on the first position information of the latest acquisition cycle, thereby improving the accuracy of the cropped paper image.
[0095] The image to be identified in the present application may be an image containing a test paper or an answer sheet. After the image to be identified is cropped using the paper image cropping method of the present application, a test paper image or an answer sheet image may be obtained.
[0096] In one embodiment, after acquiring the paper image, the method further includes the following steps:
[0097] Character recognition is performed on the paper image to obtain the character content in the paper image.
[0098] Specifically, an existing character recognition algorithm may be used to recognize character content in a paper image, and the character content may include test paper titles and / or student answers.
[0099] By performing character recognition on paper images, the character content contained in the paper image can be obtained, and the electronic file corresponding to the paper file, such as an electronic test paper or an electronic answer sheet, can be obtained, thereby facilitating editing, processing, searching and other operations on the electronic file, for example, facilitating teachers to correct homework, or students to search for questions based on the character content.
[0100] In one embodiment, the paper image may include at least one target object; to improve the efficiency and accuracy of character recognition of the paper image, the target objects included in the paper image may be segmented again to obtain images of target areas corresponding to each target object.
[0101] The paper image is segmented using a pre-trained image segmentation model to obtain an image of a target area corresponding to the target object.
[0102] The image segmentation model can be used to perform target detection and image segmentation on the target object in the paper image. The image segmentation model may include a target detection layer and an image segmentation layer. After the paper image is input into the target detection layer, a target detection frame for selecting the target area corresponding to the target object is obtained, and then the image segmentation layer segments the image of the target area corresponding to the target detection frame from the paper image.
[0103] The paper image may be an image including one or more titles, the target object may be a single title, and the image obtained after segmentation may be an image of a region corresponding to the single title.
[0104] In an embodiment of the present application, a pre-trained image segmentation model is used to segment the target objects contained in the paper image to obtain an image of a target area corresponding to a single target object, so that when character recognition technology is subsequently used to perform character recognition on the image of the target area, the data processing amount of character recognition can be reduced, thereby improving the efficiency and accuracy of character recognition.
[0105] See also Figure 7 The present application also provides a paper image cutting device, comprising:
[0106] The image acquisition module 201 is used to acquire the image to be identified according to a preset acquisition cycle;
[0107] The position information acquisition module 202 is used as a first position information acquisition module, which is used to obtain the first position information of the area where the paper in the image to be identified is located by using a pre-trained paper detection model;
[0108] The recording module 203 is used to record the first position information of the current collection period and increase the collection flag by a first set value if the deviation value between the first position information of the current collection period and the first position information of the previous collection period is less than a preset threshold; otherwise, clear the recorded first position information of each collection period and set the collection flag to an initial value;
[0109] The cropping module 204 is configured to crop the image to be identified in the acquisition period based on the first position information of the latest acquisition period to obtain a paper image if the acquisition identifier is greater than the identifier threshold.
[0110] It should be noted that the paper image cutting device provided in the above embodiment only uses the division of the above functional modules as an example when executing the paper image cutting method. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the paper image cutting device provided in the above embodiment and the paper image cutting method in the above embodiment belong to the same concept, and the implementation process thereof is detailed in the method embodiment, which will not be repeated here.
[0111] The present application also 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 paper image cutting method as described in any one of the above are implemented.
[0112] The present application may take the form of a computer program product implemented on one or more storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing program code. Computer-readable storage media include permanent and non-permanent, removable and non-removable media, and information storage can be achieved by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include but are not limited to: phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.
[0113] See also Figure 8 , the present application further provides an electronic device 300, comprising a memory 301, a processor 302, and a computer program stored in the memory 301 and executable by the processor 302;
[0114] When the processor 302 executes the computer program, the steps of any one of the above-mentioned paper image cutting methods are implemented.
[0115] Those skilled in the art should understand that Figure 8 The structure of the electronic device shown does not constitute a limitation of the embodiments of the present application, and may be either a bus structure or a star structure. The electronic device 300 may also include more or less other hardware or software than shown in the figure, or a different component arrangement.
[0116] In some embodiments, the electronic device 300 is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application-specific integrated circuits, programmable gate arrays, digital processors, and embedded devices. The electronic device 300 may also include client devices, which include but are not limited to any electronic product that can interact with a client through a keyboard, mouse, remote control, touchpad, or voice-controlled device, such as a personal computer, tablet computer, smart phone, digital camera, etc.
[0117] It should be noted that the electronic device 300 is only an example, and other existing or future electronic products that are suitable for the present application should also be included in the protection scope of the present application and included here by reference.
[0118] The memory 301 includes a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable programmable read-only memory (EEPROM), a compact disc (CD-ROM) or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium that can be used to carry or store data.
[0119] The processor 302 is the control core (Control Unit) of the electronic device 300. It uses various interfaces and lines to connect various components of the entire electronic device 300, and executes various functions and processes data of the electronic device 300 by running or executing programs or modules stored in the memory 301, and calling data stored in the memory 301. For example, when the processor 302 executes the computer program stored in the memory 301, it implements all or part of the steps of the paper image cutting method described in the embodiment of the present application; or implements all or part of the functions of the paper image cutting device. The processor 302 can be composed of an integrated circuit, for example, it can be composed of a single packaged integrated circuit, or it can be composed of multiple integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and a combination of various control chips.
[0120] The present invention is not limited to the above-mentioned embodiments. If various changes or modifications to the present invention do not depart from the spirit and scope of the present invention, and if these changes and modifications fall within the scope of the claims and equivalent technologies of the present invention, the present invention is also intended to include these changes and modifications.
Claims
1. A paper image cutting method, characterized in that: The following steps are involved: Acquire the image to be identified according to a preset acquisition cycle; Using a pre-trained paper detection model, first position information of a region where paper is located in the image to be identified is obtained; If the deviation between the first position information of the current acquisition cycle and the first position information of the previous acquisition cycle is less than a preset threshold, the first position information of the current acquisition cycle is recorded and the acquisition identifier is increased by a first set value; otherwise, the first position information of each recorded acquisition cycle is cleared and the acquisition identifier is set to an initial value; If the acquisition mark is greater than the mark threshold, the image to be identified in the acquisition period is cropped based on the first position information of the latest acquisition period to obtain the paper image.
2. The paper image cutting method according to claim 1, characterized in that: The paper detection model includes a first detection model and a second detection model; the first detection model is used to detect whether there is paper in the image to be identified; the second detection model is used to obtain first position information of the area where the paper is located in the image to be identified; The step of using the pre-trained paper detection model to obtain the first position information of the area where the paper in the image to be identified is located specifically includes: Using the first detection model to detect whether there is paper in the image to be identified; If there is paper in the image to be identified, using the second detection model to obtain first position information of a region where the paper in the image to be identified is located; Otherwise, the first position information of each recorded acquisition period is cleared and the acquisition identifier is set to an initial value.
3. The paper image cutting method according to claim 2, characterized in that: The paper detection model also includes a third detection model; the third detection model is used to detect whether there is a target object in the image to be identified; The step of using the second detection model to obtain first position information of the area where the paper in the image to be identified is located specifically includes: Using the third detection model to detect whether there is a target object in the image to be identified; If there is no target object in the image to be identified, using the second detection model to obtain first position information of the area where the paper in the image to be identified is located; Otherwise, the first position information of each recorded acquisition period is cleared and the acquisition identifier is set to an initial value.
4. The paper image cutting method according to claim 2, characterized in that: The paper detection model further includes a fourth detection model; the fourth detection model is used to detect second position information of the area where the target object is located in the image to be identified; The step of using the second detection model to obtain first position information of the area where the paper in the image to be identified is located specifically includes: Using the fourth detection model to obtain second position information of the area where the target object in the image to be identified is located; Using the second detection model to obtain first position information of a region where the paper in the image to be identified is located; Determining, according to the first position information and the second position information, whether the position of the target object in the image to be identified coincides with the position of the paper in the image to be identified; If the position of the target object in the image to be identified coincides with the position of the paper in the image to be identified, clearing the first position information of each recorded acquisition cycle and setting the acquisition flag to an initial value; If the position of the target object in the image to be identified does not coincide with the position of the paper in the image to be identified, and the deviation value between the first position information of the current acquisition cycle and the first position information of the previous acquisition cycle is less than a preset threshold, the first position information of the current acquisition cycle is recorded and the acquisition identifier is increased by a first set value; otherwise, the first position information of each recorded acquisition cycle is cleared and the acquisition identifier is set to an initial value.
5. The paper image cutting method according to claim 1, characterized in that: The paper image is a test paper image, or the paper image is an answer sheet image; after acquiring the paper image, the following steps are also included: Character recognition is performed on the paper image to obtain the character content in the paper image.
6. The paper image cutting method according to claim 1, characterized in that: The paper image includes at least one target object; The paper image is segmented using a pre-trained image segmentation model to obtain an image of a target area corresponding to the target object.
7. The paper image cutting method according to claim 6, characterized in that: The target object is a topic, and the target area is an area containing a single topic.
8. A paper image cutting device, characterized in that: include: An image acquisition module, used to acquire the image to be identified according to a preset acquisition cycle; A position information acquisition module is used for a first position information acquisition module, which is used to obtain first position information of an area where a paper in an image to be identified is located by using a pre-trained paper detection model; A recording module, configured to record the first position information of the current collection period and increase the collection identifier by a first set value if the deviation value between the first position information of the current collection period and the first position information of the previous collection period is less than a preset threshold; otherwise, clear the recorded first position information of each collection period and set the collection identifier to an initial value; The cropping module is used to crop the image to be identified in the acquisition period based on the first position information of the latest acquisition period to obtain the paper image if the acquisition mark is greater than the mark threshold.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the paper image cutting method as described in any one of claims 1 to 7 are implemented.
10. An electronic device, characterized in that: comprising a memory, a processor, and a computer program stored in the memory and executable by the processor; When the processor executes the computer program, the steps of the paper image cutting method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Gesture jittering identification method and device, and gesture identification method
CN108446657A
Image recognition method and device, computer equipment and storage medium
CN110223322A
Target identification tracking method and device, computer readable medium and electronic equipment
CN114187327A
Paper state change detection method and system
CN115534540A
Detection method of the stability of digital photography device, and the digital photography device
TW201040882A
