Image recognition method and device, electronic equipment and storage medium

By using a pre-trained handwritten date recognition model and image style transfer technology, the problem of low accuracy in handwritten date recognition in historical documents was solved, and accurate recognition of images containing noise was achieved, thus improving the recognition accuracy.

CN116884023BActive Publication Date: 2026-07-07GUANGDONG POWER GRID CO LTD +1

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
GUANGDONG POWER GRID CO LTD
Filing Date
2023-05-10
Publication Date
2026-07-07

AI Technical Summary

Technical Problem

In existing technologies, handwritten date recognition methods suffer from low accuracy in historical documents, especially online and offline methods, which struggle to accurately recognize handwritten dates when faced with image noise.

Method used

A pre-trained handwritten date recognition model is used, which combines a content feature extraction network, an image feature extraction network, and a date handwriting classification network. The model recognizes handwritten dates through feature splicing and uses an image style transfer model for data augmentation to improve recognition accuracy.

Benefits of technology

It achieves accurate recognition of handwritten date images containing image noise, thus improving the accuracy of handwritten date recognition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116884023B_ABST
    Figure CN116884023B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose an image recognition method and device, electronic equipment and storage medium. The method comprises: obtaining a handwritten date image to be recognized, wherein the handwritten date image to be recognized contains image noise; inputting the handwritten date image to be recognized into a handwritten date recognition model pre-trained to obtain a date recognition result of the handwritten date image to be recognized. The technical scheme of the embodiments of the present application solves the technical problem of low accuracy of handwritten date recognition of the prior art for the handwritten date image to be recognized containing image noise, realizes relatively accurate recognition of the handwritten date in the handwritten date image to be recognized containing image noise, and thus improves the accuracy of handwritten date recognition.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to an image recognition method, apparatus, electronic device and storage medium. Background Technology

[0002] Currently, the review process for power grid construction archive images often involves handwritten date recognition. Related technologies for handwritten date recognition mainly include online and offline methods. Firstly, online methods require specialized equipment (e.g., touchscreens) to capture and record stroke data for date recognition, which may result in the inability to recognize handwritten dates in historical documents. Secondly, offline methods typically require manual recognition by staff. Because historical documents are often exposed to various noises such as blurring, distortion, and lighting during storage, and because historical documents contain diverse handwriting types, human error is prone to occur, thus reducing the accuracy of offline handwritten date recognition. Summary of the Invention

[0003] This invention provides an image recognition method, apparatus, electronic device, and storage medium to achieve more accurate recognition of handwritten dates in images containing image noise, thereby improving the accuracy of handwritten date recognition.

[0004] To more accurately identify handwritten dates in images of handwritten dates.

[0005] According to one aspect of the present invention, an image recognition method is provided, the method comprising:

[0006] Obtain an image of a handwritten date to be recognized, wherein the handwritten date image contains image noise;

[0007] The handwritten date image to be recognized is input into a pre-trained handwritten date recognition model to obtain the date recognition result of the handwritten date image to be recognized.

[0008] Optionally, the handwritten date recognition model includes a content feature extraction network, an image feature extraction network, and a date handwriting classification network. The step of inputting the handwritten date image to be recognized into the pre-trained handwritten date recognition model to obtain the date recognition result for the handwritten date image includes: inputting the handwritten date image to be recognized into the content feature extraction network to obtain the content features of the handwritten date image; inputting the handwritten date image to be recognized into the image feature extraction network to obtain the image features of the handwritten date image; performing feature concatenation processing on the content features and image features of the handwritten date image to obtain the concatenated features; and inputting the concatenated features into the date handwriting classification network to obtain the date recognition result for the handwritten date image.

[0009] Optionally, the method further includes: acquiring a sample dataset, wherein the sample dataset includes labeled handwritten date images, unlabeled handwritten date images, and style-transferred handwritten date images corresponding to the labeled handwritten date images; and training an initial network model based on the labeled handwritten date images and the style-transferred handwritten date images to obtain the handwritten date recognition model.

[0010] Optionally, the method further includes: inputting the labeled handwritten date image and the unlabeled handwritten date image into a pre-trained image style transfer model to obtain a style-transferred handwritten date image corresponding to the labeled handwritten date image.

[0011] Optionally, training the image style transfer model includes:

[0012] The content features of the labeled handwritten date image and the style-transferred handwritten date image are compared to obtain the content loss function value of the image style transfer model. The style features of the unlabeled handwritten date image and the style features of the style-transferred handwritten date image are compared to obtain the style loss function value of the image style transfer model. The handwriting features of the unlabeled handwritten date image and the handwriting features of the style-transferred handwritten date image are compared to obtain the handwriting loss function value of the image style transfer model. Based on the content loss function value, the style loss function value, and the handwriting loss function value, the network parameters of the image style transfer model are adjusted to obtain the image style transfer model.

[0013] Optionally, the image style transfer model includes a content encoder, a style encoder, a handwriting encoder, and a decoder; the step of inputting the labeled handwritten date image and the unlabeled handwritten date image into the pre-trained image style transfer model to obtain a style-transferred handwritten date image corresponding to the labeled handwritten date image includes:

[0014] The labeled handwritten date image is input into the content encoder to obtain the content features of the labeled handwritten date image; the unlabeled handwritten date image is input into the style encoder to obtain the style features of the unlabeled handwritten date image; the unlabeled handwritten date image is input into the handwriting encoder to obtain the handwriting features of the unlabeled handwritten date image; the content features of the labeled handwritten date image, the style features of the unlabeled handwritten date image, and the handwriting features of the unlabeled handwritten date image are subjected to feature concatenation processing to obtain concatenated features; the concatenated features are input into the decoder to generate a style-transferred handwritten date image.

[0015] Optionally, the handwriting encoder is a trained handwriting classification model, and the method further includes: training the handwriting classification model, including:

[0016] The labeled handwritten date image is input into a pre-built handwriting classification model to obtain the actual handwriting classification result of the labeled handwritten date image; the actual handwriting classification result is compared with the expected handwriting classification result of the labeled handwritten date image to obtain the classification loss function value of the pre-built handwriting classification model; based on the classification loss function value, the model parameters of the pre-built handwriting classification model are adjusted to obtain the trained handwritten date handwriting classification model.

[0017] According to another aspect of the present invention, an image recognition device is provided, the device comprising:

[0018] An image acquisition module is used to acquire an image of a handwritten date to be recognized, wherein the image of the handwritten date to be recognized contains image noise;

[0019] The date recognition module is used to input the handwritten date image to be recognized into a pre-trained handwritten date recognition model to obtain the date recognition result of the handwritten date image to be recognized.

[0020] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0021] At least one processor; and

[0022] A memory communicatively connected to the at least one processor; wherein,

[0023] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the image recognition method according to any embodiment of the present invention.

[0024] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the image recognition method according to any embodiment of the present invention.

[0025] The technical solution of this invention involves acquiring a handwritten date image to be recognized, wherein the handwritten date image contains image noise; inputting the handwritten date image to be recognized into a pre-trained handwritten date recognition model to obtain a date recognition result for the handwritten date image. This technical solution solves the technical problem of low accuracy in handwritten date recognition of images containing image noise in existing technologies, achieving more accurate recognition of handwritten dates in images containing image noise, thereby improving the accuracy of handwritten date recognition.

[0026] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0027] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0028] Figure 1 This is a flowchart illustrating an image recognition method provided in Embodiment 1 of the present invention;

[0029] Figure 2 This is a schematic diagram of the structure of an image recognition device provided in Embodiment 2 of the present invention;

[0030] Figure 3 This is a schematic diagram of the structure of an electronic device provided in Embodiment 3 of the present invention. Detailed Implementation

[0031] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0032] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0033] It is understood that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and related provisions.

[0034] Example 1

[0035] Figure 1 This is a flowchart illustrating an image recognition method provided in Embodiment 1 of the present invention. This embodiment is applicable to the situation of recognizing handwritten dates in images containing image noise. The method can be executed by an image recognition device, which can be implemented in hardware and / or software and can be configured in electronic devices such as computers or servers.

[0036] like Figure 1 As shown, the method in this embodiment includes:

[0037] S110. Obtain the handwritten date image to be recognized, wherein the handwritten date image to be recognized contains image noise.

[0038] The handwritten date image to be identified can be understood as an image for which handwritten date recognition is required. In this embodiment of the invention, the handwritten date image to be identified can be understood as a historical document image for which handwritten dates need to be identified. For example, the historical document image can be a power grid construction archive image. That is, the handwritten date image to be identified can be obtained based on the handwritten date to be identified in the power grid construction archive image. Image noise can be understood as unnecessary or redundant interference information present in the handwritten date image to be identified. Image noise can include at least one of blur noise, distortion noise, and illumination noise.

[0039] In this embodiment of the invention, the method for obtaining the power grid construction archive image can be as follows: First, the handwritten dates in the power grid construction archive image can be annotated, and the annotated image can be used as the handwritten date image to be identified. Second, the handwritten dates can be extracted from the power grid construction archive image, and the handwritten date image to be identified can be generated based on the extracted handwritten dates. Third, the power grid construction archive image can be analyzed to determine the target area of ​​the handwritten dates in the power grid construction archive image, and the power grid construction archive image can be further segmented to obtain a region image of the target area, i.e., the handwritten date image to be identified. Here, the target area can be understood as the region of the handwritten dates in the power grid construction archive image.

[0040] In this embodiment of the invention, there are various ways to acquire the handwritten date image to be recognized, and no limitation is set herein. For example, the handwritten date image to be recognized can be acquired from a database used to store the handwritten date image to be recognized; or, the handwritten date image to be recognized can be received from a device that stores the handwritten date image to be recognized.

[0041] S120. Input the handwritten date image to be recognized into a pre-trained handwritten date recognition model to obtain the date recognition result of the handwritten date image to be recognized.

[0042] The handwritten date recognition model can be understood as a model used to recognize the handwritten date in an image of a handwritten date. In this embodiment of the invention, the date recognition result can be the handwritten date data in the image of the handwritten date to be recognized. It should be noted that, in this embodiment of the invention, the specific font format of the date recognition result can be set according to actual needs and is not specifically limited here, such as Songti, Lishu, or Kaiti, etc.

[0043] Specifically, after acquiring a handwritten date image containing image noise, this image can be input into a pre-trained handwritten date recognition model. The output of the model will then be obtained, which is the date recognition result corresponding to the handwritten date image containing image noise.

[0044] In this embodiment of the invention, the handwritten date recognition model may include a content feature extraction network, an image feature extraction network, and a date handwriting classification network; wherein, the content feature extraction network can be understood as the network used to extract content features from the handwritten date image to be recognized in the handwritten date recognition model. The image feature extraction network can be understood as the network used to extract image features from the handwritten date image to be recognized. The date handwriting classification network can be understood as the network used to classify and recognize the handwritten date handwriting in the handwritten date image to be recognized.

[0045] Based on the above embodiments, the step of inputting the handwritten date image to be recognized into a pre-trained handwritten date recognition model to obtain the date recognition result of the handwritten date image may include: inputting the handwritten date image to be recognized into the content feature extraction network to obtain the content features of the handwritten date image; inputting the handwritten date image to be recognized into the image feature extraction network to obtain the image features of the handwritten date image; further, performing feature concatenation processing on the content features and image features of the handwritten date image to obtain the concatenated features; and inputting the concatenated features into the date handwriting classification network to obtain the date recognition result of the handwritten date image.

[0046] Based on the above embodiments, the method further includes: acquiring a sample dataset, wherein the sample dataset includes labeled handwritten date images, unlabeled handwritten date images, and style-transferred handwritten date images corresponding to the labeled handwritten date images. Then, based on the labeled handwritten date images, the unlabeled handwritten date images, and the style-transferred handwritten date images, an initial network model can be trained to obtain the handwritten date recognition model.

[0047] The labeled handwritten date image can be obtained by labeling handwritten dates in historical document images containing image noise. The unlabeled handwritten date image can be a historical document image containing handwritten dates and containing image noise. The style-transferred handwritten date image can be obtained by stylizing the handwritten dates in the labeled handwritten date image. The initial network model can be a pre-built model used for training based on the labeled handwritten date image, the unlabeled handwritten date image, and the style-transferred handwritten date image.

[0048] In this embodiment of the invention, the purpose of training the initial network model using labeled handwritten date images, unlabeled handwritten date images, and style-transferred handwritten date images is to obtain a handwriting recognition model through supervised training using both labeled and augmented data. Data augmentation aims to overcome image noise interference and improve date recognition accuracy. Therefore, the advantage of training the initial network model using labeled, unlabeled, and style-transferred handwritten date images is that it effectively locates and recognizes digits in the handwritten date images, thereby improving the accuracy of handwritten date recognition.

[0049] Based on the above embodiments, the method further includes: training the image style transfer model. In this embodiment of the invention, the image style transfer model can learn the style and handwriting of unlabeled data, and then transfer the labeled data to the new style and handwriting, thereby achieving data augmentation and enabling the stylization of labeled data and diversification of handwriting.

[0050] In this embodiment of the invention, training an image style transfer model includes: calculating the difference between the content features of the labeled handwritten date image and the content features of the style-transferred handwritten date image to obtain the content loss function value of the image style transfer model; calculating the difference between the style features of the unlabeled handwritten date image and the style features of the style-transferred handwritten date image to obtain the style loss function value of the image style transfer model; calculating the difference between the handwriting features of the unlabeled handwritten date image and the handwriting features of the style-transferred handwritten date image to obtain the handwriting loss function value of the image style transfer model; and adjusting the network parameters of the image style transfer model based on the content loss function value, the style loss function value, and the handwriting loss function value to obtain the image style transfer model.

[0051] The content loss function value can be obtained based on the difference between the content features of the labeled handwritten date image and the content features of the style-transferred handwritten date image. The style loss function value can be obtained based on the difference between the style features of the unlabeled handwritten date image and the style features of the style-transferred handwritten date image. The handwriting loss function value can be obtained based on the difference between the handwriting features of the unlabeled handwritten date image and the handwriting features of the style-transferred handwritten date image.

[0052] In this embodiment of the invention, the content features of the labeled handwritten date image and the style-transferred handwritten date image are compared to obtain the content loss function value of the image style transfer model. This can include: determining the content features of the labeled handwritten date image and the style-transferred handwritten date image. The difference between the content features of the labeled handwritten date image and the style-transferred handwritten date image can be calculated. The result of the difference calculation is then obtained, which is the content loss function value of the image style transfer model.

[0053] In this embodiment of the invention, the style loss function value of the image style transfer model is obtained by calculating the difference between the style features of the unlabeled handwritten date image and the style features of the style-transferred handwritten date image. This can include: determining the style features of the unlabeled handwritten date image and the style features of the style-transferred handwritten date image; then, calculating the difference between the style features of the unlabeled handwritten date image and the style features of the style-transferred handwritten date image; and finally, obtaining the difference calculation result, i.e., the style loss function value of the image style transfer model.

[0054] In this embodiment of the invention, the handwriting features of the unlabeled handwritten date image and the handwriting features of the style-transferred handwritten date image are compared to obtain the handwriting loss function value of the image style transfer model. This process may include: determining the handwriting features of the unlabeled handwritten date image and the handwriting features of the style-transferred handwritten date image. Then, the difference between the handwriting features of the unlabeled handwritten date image and the handwriting features of the style-transferred handwritten date image can be calculated. The result of this difference calculation is then obtained, which is the handwriting loss function value of the image style transfer model.

[0055] It should be noted that the image style transfer model includes a content loss function, a style loss function, and a handwriting loss function. The content loss function is used to determine the difference between the content features of the labeled handwritten date image and the content features of the style-transferred handwritten date image; that is, the content loss function value. The style loss function is used to determine the difference between the style features of the unlabeled handwritten date image and the style features of the style-transferred handwritten date image; that is, the style loss function value. The handwriting loss function is used to determine the difference between the handwriting features of the unlabeled handwritten date image and the handwriting features of the style-transferred handwritten date image; that is, the handwriting loss function value.

[0056] It should also be noted that during the adjustment of the network parameters of the image style transfer model, the adjustment of the network parameters can be stopped when the content loss function, style loss function, and handwriting loss function all converge, thus obtaining the trained image style transfer model. The advantage of this approach is that by using adversarial training with the content loss function, style loss function, and handwriting loss function, it is possible to obtain handwritten date image data with diverse handwriting conditions such as blurriness, distortion, and lighting.

[0057] Based on the above embodiments, the image style transfer model can be understood as a model used to learn the handwritten date characters in a handwritten date image and to stylize the handwritten date characters in the handwritten date image. In this embodiment of the invention, the specific method of obtaining the style-transferred handwritten date image may include: inputting the labeled handwritten date image and the unlabeled handwritten date image into a pre-trained image style transfer model, thereby obtaining a style-transferred handwritten date image corresponding to the labeled handwritten date image.

[0058] In this embodiment of the invention, the labeled handwritten date image and the unlabeled handwritten date image are input into a pre-constructed image style transfer model. The handwriting features of the handwritten date in the unlabeled handwritten date image can be learned, and the learned handwriting features can be applied to the handwritten date in the labeled handwritten date image, thereby achieving the technical effect of sample data enhancement.

[0059] Optionally, the image style transfer model includes a content encoder, a style encoder, a handwriting encoder, and a decoder; wherein, the content encoder can be understood as an encoder used to extract content features from an image with labeled handwritten dates. The style encoder can be understood as an encoder used to extract style features from an image with unlabeled handwritten dates. The handwriting encoder can be understood as an encoder used to extract handwriting features from an image with unlabeled handwritten dates. The decoder can be used to generate a style-transferred handwritten date image corresponding to the image with labeled handwritten dates.

[0060] Based on this, the step of inputting the labeled handwritten date image and the unlabeled handwritten date image into a pre-trained image style transfer model to obtain a style-transferred handwritten date image corresponding to the labeled handwritten date image can include: inputting the labeled handwritten date image into the content encoder to obtain the content features of the labeled handwritten date image; inputting the unlabeled handwritten date image into the style encoder to obtain the style features of the unlabeled handwritten date image; and inputting the unlabeled handwritten date image into the handwriting encoder to obtain the handwriting features of the unlabeled handwritten date image. Then, the content features of the labeled handwritten date image, the style features of the unlabeled handwritten date image, and the handwriting features of the unlabeled handwritten date image can be concatenated to obtain the concatenated features. After obtaining the concatenated features, the concatenated features can be input into the decoder to generate the style-transferred handwritten date image.

[0061] In this embodiment of the invention, the handwriting encoder is a trained handwriting classification model, and the network of the handwriting classification model can be a VGG classification network. Based on the above embodiments, the sample dataset includes the expected handwriting classification results corresponding to the labeled handwritten date images. In this embodiment of the invention, the specific training method of the handwritten date handwriting classification model may include: inputting the labeled handwritten date images into a pre-constructed handwriting classification model to obtain the actual handwriting classification results of the labeled handwritten date images; comparing the actual handwriting classification results with the expected handwriting classification results of the labeled handwritten date images to obtain the classification loss function value of the constructed handwriting classification model; and adjusting the model parameters of the pre-constructed handwriting classification model based on the classification loss function value to obtain the trained handwritten date handwriting classification model.

[0062] The actual handwriting classification result can be the output result of a model obtained after inputting the labeled handwritten date image into a pre-built handwriting classification model. In this embodiment of the invention, inputting the labeled handwritten date image into a pre-built handwriting classification model to obtain the actual handwriting classification result of the labeled handwritten date image can include: inputting the labeled handwritten date image into the pre-built handwriting classification model to obtain the handwriting features of the labeled handwritten date image, and determining the actual handwriting classification result of the labeled handwritten date image based on the handwriting features of the labeled handwritten date image. Optionally, the expected handwriting classification result can be the expected handwriting category of the handwritten date in the labeled handwritten date image.

[0063] In this embodiment of the invention, the handwriting encoder can be obtained through pre-training a handwritten date handwriting classification model. The handwritten date handwriting classification module uses a VGG classification network to extract features from handwritten date images. Through training with a handwriting classification loss function, the VGG classification network learns the handwriting features of the handwritten date images, achieving accurate classification of handwritten images with different handwriting styles. After pre-training, the ability of the handwriting encoder to extract handwriting features can be determined.

[0064] The technical solution of this invention involves acquiring a handwritten date image to be recognized, wherein the handwritten date image contains image noise; inputting the handwritten date image to be recognized into a pre-trained handwritten date recognition model to obtain a date recognition result for the handwritten date image. This technical solution solves the technical problem of low accuracy in handwritten date recognition of images containing image noise in existing technologies, achieving more accurate recognition of handwritten dates in images containing image noise, thereby improving the accuracy of handwritten date recognition.

[0065] Example 2

[0066] Figure 2 A schematic diagram of the structure of an image recognition device provided in Embodiment 2 of the present invention. (See attached diagram.) Figure 2 As shown, the device includes: an image acquisition module 210 and a date recognition module 220.

[0067] The image acquisition module 210 is used to acquire a handwritten date image to be recognized, wherein the handwritten date image to be recognized contains image noise; the date recognition module 220 is used to input the handwritten date image to be recognized into a pre-trained handwritten date recognition model to obtain a date recognition result for the handwritten date image to be recognized.

[0068] The technical solution of this invention involves acquiring a handwritten date image to be recognized through an image acquisition module, wherein the handwritten date image contains image noise. The handwritten date image is then input into a pre-trained handwritten date recognition model through a date recognition module to obtain a date recognition result for the handwritten date image. This technical solution solves the problem of low accuracy in handwritten date recognition of images containing image noise in existing technologies, achieving more accurate recognition of handwritten dates in images containing image noise, thereby improving the accuracy of handwritten date recognition.

[0069] Optionally, the handwritten date recognition model includes a content feature extraction network, an image feature extraction network, and a date handwriting classification network; the date recognition module 220 is specifically used for:

[0070] The handwritten date image to be identified is input into the content feature extraction network to obtain the content features of the handwritten date image to be identified.

[0071] The handwritten date image to be identified is input into the image feature extraction network to obtain the image features of the handwritten date image to be identified;

[0072] The content features and image features of the handwritten date image to be recognized are concatenated to obtain the concatenated features.

[0073] The spliced ​​features are input into the date handwriting classification network to obtain the date recognition result of the handwritten date image to be recognized.

[0074] Optionally, the device further includes a model training module, wherein the model training module is used for:

[0075] Obtain a sample dataset, wherein the sample dataset includes labeled handwritten date images, unlabeled handwritten date images, and style-transferred handwritten date images corresponding to the labeled handwritten date images;

[0076] Based on the labeled handwritten date image, the unlabeled handwritten date image, and the style-transferred handwritten date image, the initial network model is trained to obtain the handwritten date recognition model.

[0077] Optionally, the device further includes a style-transfer handwritten date image obtaining module, wherein the style-transfer handwritten date image obtaining module is used for:

[0078] The labeled handwritten date image and the unlabeled handwritten date image are input into a pre-trained image style transfer model to obtain a style-transferred handwritten date image corresponding to the labeled handwritten date image.

[0079] Optionally, the device further includes an image style transfer model training module; wherein, the image style transfer model training module is used for:

[0080] The difference between the content features of the labeled handwritten date image and the content features of the style-transferred handwritten date image is calculated to obtain the content loss function value of the image style transfer model.

[0081] The style loss function value of the image style transfer model is obtained by calculating the difference between the style features of the unlabeled handwritten date image and the style features of the style-transferred handwritten date image.

[0082] The handwriting features of the unlabeled handwritten date image and the handwriting features of the style-transferred handwritten date image are compared to obtain the handwriting loss function value of the image style transfer model.

[0083] Based on the content loss function value, the style loss function value, and the handwriting loss function value, the network parameters of the image style transfer model are adjusted to obtain the image style transfer model.

[0084] Optionally, the image style transfer model includes a content encoder, a style encoder, a handwriting encoder, and a decoder; the style transfer handwritten date image acquisition module is used for:

[0085] The labeled handwritten date image is input into the content encoder to obtain the content features of the labeled handwritten date image;

[0086] The unlabeled handwritten date image is input into the style encoder to obtain the style features of the unlabeled handwritten date image;

[0087] The unlabeled handwritten date image is input into the handwriting encoder to obtain the handwriting features of the unlabeled handwritten date image;

[0088] The content features of the labeled handwritten date image, the style features of the unlabeled handwritten date image, and the handwriting features of the unlabeled handwritten date image are concatenated to obtain concatenated features. The concatenated features are then input into the decoder to generate a style-transferred handwritten date image.

[0089] Optionally, the handwriting encoder is a trained handwritten date handwriting classification model. The device also includes a handwritten date handwriting classification model training module, used for:

[0090] The labeled handwritten date image is input into a pre-built handwriting classification model to obtain the actual handwriting classification result of the labeled handwritten date image;

[0091] The actual handwriting classification result is compared with the expected handwriting classification result of the labeled handwritten date image to obtain the classification loss function value of the constructed handwriting classification model;

[0092] Based on the classification loss function value, the model parameters of the pre-built handwriting classification model are adjusted to obtain the trained handwritten date handwriting classification model.

[0093] The image recognition device provided in the embodiments of the present invention can execute the image recognition method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of executing the method.

[0094] It is worth noting that the various units and modules included in the above-mentioned image recognition device are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be realized; in addition, the specific names of each functional unit are only for easy distinction between each other and are not used to limit the protection scope of the embodiments of the present invention.

[0095] Example 3

[0096] Figure 3 A schematic diagram of an electronic device 10 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0097] like Figure 3 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0098] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0099] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as image recognition methods.

[0100] In some embodiments, the image recognition method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the image recognition method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the image recognition method by any other suitable means (e.g., by means of firmware).

[0101] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0102] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0103] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0104] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0105] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0106] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0107] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0108] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. An image recognition method, characterized in that, include: Obtain an image of a handwritten date to be recognized, wherein the handwritten date image contains image noise; The handwritten date image to be recognized is input into a pre-trained handwritten date recognition model to obtain the date recognition result of the handwritten date image to be recognized; The process involves obtaining a sample dataset, which includes labeled handwritten date images, unlabeled handwritten date images, and style-transferred handwritten date images corresponding to the labeled handwritten date images. Based on the labeled handwritten date image, the unlabeled handwritten date image, and the style-transferred handwritten date image, the initial network model is trained to obtain the handwritten date recognition model. The labeled handwritten date image is obtained by labeling the handwritten dates in historical document images containing image noise. The unlabeled handwritten date image is a historical document image containing handwritten dates that contains image noise. The style-transferred handwritten date image is obtained by stylizing the handwritten dates in the labeled handwritten date image. Specifically, the labeled handwritten date image and the unlabeled handwritten date image are input into a pre-trained image style transfer model to obtain a style-transferred handwritten date image corresponding to the labeled handwritten date image; The image style transfer model includes a content encoder, a style encoder, a handwriting encoder, and a decoder; the step of inputting the labeled handwritten date image and the unlabeled handwritten date image into the pre-trained image style transfer model to obtain a style-transferred handwritten date image corresponding to the labeled handwritten date image includes: The labeled handwritten date image is input into the content encoder to obtain the content features of the labeled handwritten date image; The unlabeled handwritten date image is input into the style encoder to obtain the style features of the unlabeled handwritten date image; The unlabeled handwritten date image is input into the handwriting encoder to obtain the handwriting features of the unlabeled handwritten date image; The content features of the labeled handwritten date image, the style features of the unlabeled handwritten date image, and the handwriting features of the unlabeled handwritten date image are concatenated to obtain concatenated features. The concatenated features are then input into the decoder to generate a style-transferred handwritten date image.

2. The method according to claim 1, characterized in that, The handwritten date recognition model includes a content feature extraction network, an image feature extraction network, and a date handwriting classification network; the step of inputting the handwritten date image to be recognized into the pre-trained handwritten date recognition model to obtain the date recognition result of the handwritten date image to be recognized includes: The handwritten date image to be identified is input into the content feature extraction network to obtain the content features of the handwritten date image to be identified. The handwritten date image to be identified is input into the image feature extraction network to obtain the image features of the handwritten date image to be identified; The content features and image features of the handwritten date image to be recognized are concatenated to obtain the concatenated features. The spliced ​​features are input into the date handwriting classification network to obtain the date recognition result of the handwritten date image to be recognized.

3. The method according to claim 1, characterized in that, Training the image style transfer model includes: The difference between the content features of the labeled handwritten date image and the content features of the style-transferred handwritten date image is calculated to obtain the content loss function value of the image style transfer model. The style loss function value of the image style transfer model is obtained by calculating the difference between the style features of the unlabeled handwritten date image and the style features of the style-transferred handwritten date image. The handwriting features of the unlabeled handwritten date image and the handwriting features of the style-transferred handwritten date image are compared to obtain the handwriting loss function value of the image style transfer model. Based on the content loss function value, the style loss function value, and the handwriting loss function value, the network parameters of the image style transfer model are adjusted to obtain the image style transfer model.

4. The method according to claim 1, characterized in that, The handwriting encoder is a trained handwritten date handwriting classification model. The method further includes: training the handwritten date handwriting classification model, including: The labeled handwritten date image is input into a pre-built handwriting classification model to obtain the actual handwriting classification result of the labeled handwritten date image; The actual handwriting classification result is compared with the expected handwriting classification result of the labeled handwritten date image to obtain the classification loss function value of the constructed handwriting classification model; Based on the classification loss function value, the model parameters of the pre-built handwriting classification model are adjusted to obtain the trained handwritten date handwriting classification model.

5. An image recognition device, characterized in that, include: An image acquisition module is used to acquire an image of a handwritten date to be recognized, wherein the image of the handwritten date to be recognized contains image noise; The date recognition module is used to input the handwritten date image to be recognized into a pre-trained handwritten date recognition model to obtain the date recognition result of the handwritten date image to be recognized; The model training module is used to acquire a sample dataset, wherein the sample dataset includes labeled handwritten date images, unlabeled handwritten date images, and style-transferred handwritten date images corresponding to the labeled handwritten date images; Based on the labeled handwritten date image, the unlabeled handwritten date image, and the style-transferred handwritten date image, the initial network model is trained to obtain the handwritten date recognition model. The labeled handwritten date image is obtained by labeling the handwritten dates in historical document images containing image noise. The unlabeled handwritten date image is a historical document image containing handwritten dates that contains image noise. The style-transferred handwritten date image is obtained by stylizing the handwritten dates in the labeled handwritten date image. The style transfer handwritten date image acquisition module is used to input the labeled handwritten date image and the unlabeled handwritten date image into a pre-trained image style transfer model to obtain a style-transferred handwritten date image corresponding to the labeled handwritten date image; The image style transfer model includes a content encoder, a style encoder, a handwriting encoder, and a decoder; the style transfer handwritten date image acquisition module is used for: The labeled handwritten date image is input into the content encoder to obtain the content features of the labeled handwritten date image; The unlabeled handwritten date image is input into the style encoder to obtain the style features of the unlabeled handwritten date image; The unlabeled handwritten date image is input into the handwriting encoder to obtain the handwriting features of the unlabeled handwritten date image; The content features of the labeled handwritten date image, the style features of the unlabeled handwritten date image, and the handwriting features of the unlabeled handwritten date image are concatenated to obtain concatenated features. The concatenated features are then input into the decoder to generate a style-transferred handwritten date image.

6. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the image recognition method according to any one of claims 1-4.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the image recognition method according to any one of claims 1-4.