Image identification and classification method and system based on SVM (Support Vector Machine) and eayocr

By using SVM and easyocr methods in image recognition and classification, the problem of identifying in the prior art that is not universal and classification effect is affected by image quality is solved, and high accuracy and fast image classification are achieved, which is suitable for bank counter business and other scenarios.

CN119600587APending Publication Date: 2025-03-11CHINA CITIC BANK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411774493.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-05
Publication Date
2025-03-11

AI Technical Summary

Technical Problem

In the image recognition and classification, the existing technology has problems such as not universal in recognition, the classification effect is greatly affected by the quality of the picture, the classification results cannot be automatically corrected, and the new demand needs need to be retrained and the transformation costs are high.

Method used

Image recognition and classification methods based on SVM and easyocr are adopted, and supervised training is carried out through SVM to generate key elements of classification and image ROI areas, and OCR recognition and correction are carried out when the confidence level is below the threshold to realize online supervised learning.

Benefits of technology

The accuracy of machine learning image classification is improved. Users can classify and identify new images through local parameter configuration, which is suitable for fast and accurate classification of bank counter business, with a classification accuracy of 99%, and a classification speed of 0.4s/piece.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119600587A_ABST
    Figure CN119600587A_ABST
Patent Text Reader

Abstract

The invention relates to an image recognition and classification method and system based on an SVM (Support Vector Machine) and easyocr. The method comprises the following steps: carrying out supervised training on an image sample through the SVM; generating classified key elements and an image ROI (Region of Interest) according to the features of the image; and carrying out classification by using a support vector machine (SVM), carrying out OCR identification again when the confidence is lower than a confidence threshold, and correcting a classification result according to an OCR identification result. According to the method, recognition can be carried out while classification is carried out, correction of an image classification result and online supervised learning are realized through OCR, and the accuracy of machine learning image classification is improved; according to image characteristics, classification and identification of newly added images are realized through a real-time local parameter configuration mode.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of machine learning, and in particular to a method and system for image recognition and classification based on SVM and EasyOCR. Background Art

[0002] Currently, OCR recognition on the client side is mainly based on template matching, which is used to realize the text content in specific areas of the image. Image classification is mainly achieved by machine learning. Common machine learning methods include: SVM, KNN, decision tree, naive Bayes, etc.

[0003] However, the character recognition method based on template matching can only recognize specific templates and is not universal for the recognition of different recognition formats in actual production; the classification effect of the image classification method based on machine learning is greatly affected by the quality of the picture; the image classification method based on machine learning cannot automatically correct the classification results; for new image recognition needs, retraining is required, the transformation cost is high, and it cannot quickly adapt to changes in demand. Summary of the invention

[0004] In order to overcome the shortcomings of the prior art, the present invention provides a method and system for image recognition and classification based on SVM and EasyOCR, which realizes the correction of image classification results and online supervised learning through OCR, thereby improving the accuracy of machine learning image classification. Users can realize the classification and recognition of new images according to the characteristics of the images through real-time local parameter configuration.

[0005] To achieve the above objectives, the technical solutions adopted by the present invention include:

[0006] A method for image recognition and classification based on SVM and easyocr, characterized by comprising:

[0007] S1. Perform supervised training on the image samples through support vector machine (SVM);

[0008] S2. Generate key elements of classification and image ROI area according to the characteristics of the image;

[0009] S3. Use support vector machine SVM for classification. When the confidence is lower than the confidence threshold, perform OCR recognition again and correct the classification result according to the OCR recognition result.

[0010] Furthermore, the image samples include personal IDs and public tickets.

[0011] Furthermore, the supervised training of the image samples by a support vector machine (SVM) includes:

[0012] Extract features from image samples;

[0013] The extracted features are input into the support vector machine SVM for supervised training;

[0014] Cross validation is used to optimize the support vector machine SVM;

[0015] Support vector machine (SVM) is used to distinguish different categories of image samples.

[0016] Furthermore, the features of the image include graphic logos, layouts, and titles.

[0017] Furthermore, the key elements of the classification and the image ROI area are configurable parameters.

[0018] Further, the re-performing OCR recognition includes:

[0019] Preprocess the input image, extract the region of interest, and use easyocr to perform full-text recognition on the extracted region of interest.

[0020] The present invention also relates to a system for image recognition and classification based on SVM and EasyOCR, characterized in that it comprises:

[0021] The training module is used to perform supervised training on the image samples through the support vector machine SVM;

[0022] Feature generation module, used to generate key elements of classification and image ROI area according to the features of the image;

[0023] The recognition and classification module is used to perform classification using a support vector machine (SVM). When the confidence level is lower than a confidence threshold, OCR recognition is performed again, and the classification result is corrected based on the OCR recognition result.

[0024] The present invention also relates to a computer-readable storage medium, characterized in that a computer program is stored on the storage medium, and the computer program implements the above method when executed by a processor.

[0025] The present invention also relates to an electronic device, characterized in that it comprises a processor and a memory;

[0026] The memory is used to store program instructions;

[0027] The processor is used to execute the above method by calling program instructions.

[0028] The present invention also relates to a computer program product, comprising a computer program and / or instructions, characterized in that the computer program and / or instructions implement the steps of the above method when executed by a processor.

[0029] The beneficial effects of the present invention are:

[0030] The method and system for image recognition and classification based on SVM and EasyOCR described in the present invention are used to correct image classification results and perform online supervised learning through OCR, thereby improving the accuracy of machine learning image classification; users can classify and recognize newly added images through real-time local parameter configuration according to image characteristics. The present invention can realize recognition while classifying. Through the invention, it is possible to realize fast and accurate classification of common scanned images in bank counter services, and realize automatic classification of local scanned images of bank business personnel, including classification of personal certificates and public ticket images. In practical applications, the classification accuracy of the present invention reaches 99%, and the classification speed is 0.4s / sheet. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in describing the embodiments of the present application are briefly introduced below.

[0032] Figure 1 A schematic diagram of a method flow of image recognition and classification based on SVM and easyocr of the present invention;

[0033] Figure 2 This is a schematic diagram of the system structure of image recognition and classification based on SVM and easyocr in the present invention;

[0034] Figure 3 The figure is a schematic structural diagram of an electronic device of the present invention. DETAILED DESCRIPTION

[0035] In order to make the purpose, technical solutions and advantages of the present application clearer, the technical solutions of the present application will be clearly and completely described below in conjunction with the specific embodiments of the present application and the corresponding drawings. It should be understood that the described embodiments are only part of the embodiments of the present application, rather than all of the embodiments, and these embodiments are only used to illustrate the present application and are not used to limit the scope of the present application. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.

[0036] The usual cnocr is a python 3 package for optical character recognition of Chinese characters. It can convert the text in the picture into computer-recognizable text data. The text detection and line separation modules currently built into cnocr cannot handle complex text typesetting and positioning; therefore, easyocr is used for recognition in the present invention. easyocr is an OCR recognition engine implemented based on Java language. easyocr can be development-oriented, provide localized development SDK integration, and has strong scalability.

[0037] like Figure 1 As shown, the embodiment of the present invention discloses a method for image recognition and classification based on SVM and easyOCR, and the steps of the process include:

[0038] Step S1: Perform supervised training on the image samples through support vector machine (SVM).

[0039] Specifically, the image samples are supervised by the support vector machine (SVM), including:

[0040] Extract features from image samples;

[0041] The extracted features are input into the support vector machine SVM for supervised training;

[0042] Cross validation is used to optimize the support vector machine SVM;

[0043] Support vector machine (SVM) is used to distinguish different categories of image samples.

[0044] The purpose of this step is to train a classification model to classify images. The specific steps of training include:

[0045] Collect image samples, which may include images of different categories such as personal IDs and public tickets, and label the images with the correct category labels for training classification;

[0046] Extract features from image samples. Features may include color, shape, line texture, etc. The training process focuses on image features.

[0047] Train the SVM based on the labeled image samples and corresponding features;

[0048] The SVM model is evaluated using methods such as cross-validation to ensure the generalization ability of the model, and the performance of the model is optimized by adjusting the parameters of the SVM classifier.

[0049] Step S2: Generate key elements for classification and image ROI areas according to the features of the image.

[0050] In the embodiment of the present invention, the features of the image include graphic logo, format, and title.

[0051] In the embodiment of the present invention, the key elements of classification and the image ROI area are configurable parameters.

[0052] In the embodiment of the present invention, the generated key elements and features can be used in combination with image segmentation or region detection algorithms to determine the ROI region. For example, a contour-based method or a region growing algorithm can be used to locate the ROI region.

[0053] Step S3: Use support vector machine (SVM) for classification. When the confidence level is lower than the confidence level threshold, perform OCR recognition again and correct the classification result according to the OCR recognition result.

[0054] In the embodiment of the present invention, the confidence threshold can be set to 70%. When the confidence is less than 70% after the image is classified, OCR recognition needs to be performed again. This step can correct the image classification result and improve the classification accuracy.

[0055] Specifically, OCR recognition is performed again, including:

[0056] Preprocess the input image, extract the region of interest, and use easyocr to perform full-text recognition on the extracted region of interest.

[0057] In the embodiment of the present invention, by intercepting a specific region of interest (ROI) and then using easyocr to perform full-text recognition on the region of interest, the recognition speed can be improved and can be applied to real-time transaction scenarios.

[0058] like Figure 2 As shown, the embodiment of the present invention discloses a system for image recognition and classification based on SVM and easyOCR, and its structure includes:

[0059] The training module is used to perform supervised training on the image samples through the support vector machine SVM;

[0060] Feature generation module, used to generate key elements of classification and image ROI area according to the features of the image;

[0061] The recognition and classification module is used to perform classification using a support vector machine (SVM). When the confidence level is lower than a confidence threshold, OCR recognition is performed again, and the classification result is corrected based on the OCR recognition result.

[0062] By using this system, the above-mentioned operation processing method can be executed and the corresponding technical effects can be achieved.

[0063] In an embodiment of the present invention, the above-mentioned method and its corresponding system integration can also be packaged into an executable file. Due to the use of easyocr recognition, the executable file can be applicable to Windows or Xinchuang UOS system, and can also be applied to Android and IOS porting, which is convenient for operation and use.

[0064] An embodiment of the present invention also provides a computer-readable storage medium capable of implementing all the steps in the method in the above embodiment, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, all the steps in the method in the above embodiment are implemented.

[0065] The embodiment of the present invention further provides an electronic device for executing the above method, as a device for implementing the method, and its structure is as follows: Figure 3 As shown, the electronic device 300 includes: a processor 301 and a memory 303. The processor 301 and the memory 303 are connected, such as through a bus 302. Optionally, the electronic device 300 may also include a transceiver 304. It should be noted that in actual applications, the transceiver 304 is not limited to one. It is understandable that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on the specific structure of the electronic device 300. In other embodiments of the present application, the electronic device 300 may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware. Optionally, the electronic device may also include a display screen 305 for displaying images, or receiving user operation instructions when necessary.

[0066] The processor 301 is applied in the embodiment of the present application to implement the method shown in the above method embodiment. The transceiver 304 may include a receiver and a transmitter. The transceiver 304 is applied in the embodiment of the present application to implement the function of the electronic device of the embodiment of the present application communicating with other devices when executed.

[0067] Processor 301 may be a CPU (Central Processing Unit), a general purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. It may implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. Processor 301 may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, etc.

[0068] The processor 301 may also include one or more processing units, for example, the processor 301 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processor (NPU). Among them, different processing units may be independent devices or integrated into one or more processors. Among them, the controller may be the nerve center and command center of the electronic device 300. The controller may generate an operation control signal according to the instruction opcode and the timing signal to complete the control of fetching and executing instructions. A memory may also be set in the processor 301 for storing instructions and data. In some embodiments, the memory in the processor 301 is a high-speed cache memory. The memory may store instructions or data that the processor 301 has just used or circulated. If the processor 301 needs to use the instruction or data again, it may be directly called from the memory. Repeated access is avoided, the waiting time of the processor 301 is reduced, and the efficiency of the system is improved.

[0069] The processor 301 can run the method provided in the embodiment of the present application. The processor 301 can include different devices. For example, when a CPU and a GPU are integrated, the CPU and the GPU can cooperate to execute the method provided in the embodiment of the present application, for example, part of the algorithm in the method is executed by the CPU, and another part of the algorithm is executed by the GPU to obtain faster processing efficiency.

[0070] The bus 302 may include a path to transmit information between the above components. The bus 302 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus 302 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0071] The memory 303 may be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, or an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact Disc Read Only Memory), or may include a high-speed random access memory, or may include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), or other optical disk storage, optical disk storage (including compressed optical disk, laser disk, optical disk, digital versatile disk, Blu-ray disk, etc.), a disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited to this.

[0072] Optionally, the memory 303 is used to store application code for executing the solution of the present application, and the execution is controlled by the processor 301. The processor 301 is used to execute the application code stored in the memory 303 to implement the method provided in any embodiment of the present application.

[0073] The memory 303 can be used to store computer executable program codes, which include instructions. The processor 301 executes various functional applications and data processing of the electronic device 300 by running the instructions stored in the memory 303. The memory 303 may include a program storage area and a data storage area. Among them, the program storage area may store the code of the operating system, application program, etc. The data storage area may store data created during the use of the electronic device 300 (such as images, videos, etc. collected by the camera application), etc.

[0074] The memory 303 may also store one or more computer programs corresponding to the method provided in the embodiment of the present application. The one or more computer programs are stored in the above-mentioned memory 303 and are configured to be executed by the one or more processors 301. The one or more computer programs include instructions, and the above-mentioned instructions can be used to execute each step in the above-mentioned corresponding embodiment.

[0075] Of course, the code of the method provided in the embodiment of the present application can also be stored in an external memory. In this case, the processor 301 can run the code of the method stored in the external memory through the external memory interface, and the processor 301 can control the running process.

[0076] The display screen 305 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 300 may include 1 or N display screens 305, where N is a positive integer greater than 1. The display screen 305 can be used to display information input by a user or information provided to a user and various graphical user interfaces (GUI). For example, the display screen 305 can display photos, videos, web pages, or files.

[0077] The electronic device provided in the embodiment of the present application is applicable to any embodiment of the above method. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method provided above, which will not be repeated here.

[0078] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0079] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A system that specifies the functions of a box or multiple boxes.

[0080] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction system, which is implemented in the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0081] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps of the functions specified in a box or multiple boxes. Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they know the basic creative concept. Therefore, the attached claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.

[0082] The above is only a preferred specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A method for image recognition and classification based on SVM and easyocr, characterized in that: include: S1. Perform supervised training on the image samples through support vector machine (SVM); S2. Generate key elements of classification and image ROI area according to the characteristics of the image; S3. Use support vector machine SVM for classification. When the confidence is lower than the confidence threshold, perform OCR recognition again and correct the classification result according to the OCR recognition result.

2. The method according to claim 1, characterized in that The image samples include personal IDs and public tickets.

3. The method according to claim 1, characterized in that The supervised training of the image samples by a support vector machine (SVM) includes: Extract features from image samples; The extracted features are input into the support vector machine SVM for supervised training; Cross validation is used to optimize the support vector machine SVM; Support vector machine (SVM) is used to distinguish different categories of image samples.

4. The method according to claim 1, characterized in that The features of the image include graphic logo, layout, and title.

5. The method according to claim 1, characterized in that The key elements of the classification and the image ROI area are configurable parameters.

6. The method according to claim 1, characterized in that The re-performing OCR recognition includes: Preprocess the input image, extract the region of interest, and use easyocr to perform full-text recognition on the extracted region of interest.

7. A system for image recognition and classification based on SVM and easyocr, characterized in that: include: The training module is used to perform supervised training on the image samples through the support vector machine SVM; Feature generation module, used to generate key elements of classification and image ROI area according to the features of the image; The recognition and classification module is used to perform classification using a support vector machine (SVM). When the confidence level is lower than a confidence threshold, OCR recognition is performed again, and the classification result is corrected based on the OCR recognition result.

8. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

9. An electronic device, characterized in that: including a processor and a memory; The memory is used to store program instructions; The processor is configured to execute the method according to any one of claims 1 to 6 by calling program instructions.

10. A computer program product comprising a computer program and / or instructions, characterized in that: When the computer program and / or the instructions are executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.