Image processing method, device, equipment, and medium

By using the mobilenetV3-small network as the backbone of the text detection model, and combining the feature pyramid network and the prediction network, the problem of low efficiency of the DBnet model on the mobile terminal is solved, and the efficiency of image text detection is improved.

CN114973285BActive Publication Date: 2024-10-22CHINA PING AN LIFE INSURANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210581958.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-26
Publication Date
2024-10-22
Estimated Expiration
2042-05-26

AI Technical Summary

Technical Problem

The existing DBnet model has low image processing efficiency on the mobile terminal and a large amount of calculation, resulting in lag in text detection applications.

Method used

By replacing the backbone network of the text detection model with the mobilenetV3-small network, and performing feature cascade processing through the feature pyramid network and prediction network, the amount of parameters and calculations of the model are reduced, and the efficiency of image text detection is improved.

Benefits of technology

It effectively reduces the calculation amount of the model and improves the efficiency of image text detection, allowing the method to be easily deployed on mobile devices and has good detection results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114973285B_ABST
    Figure CN114973285B_ABST
Patent Text Reader

Abstract

This application provides an image processing method, apparatus, device, and medium, belonging to the field of image processing technology. The method includes: acquiring an original image to be processed; performing feature extraction processing on the original image using the backbone network of a pre-trained text detection model to obtain several initial feature maps, wherein the backbone network is a MobileNetV3-Small network; performing feature concatenation processing on the several initial feature maps using the feature pyramid network of the text detection model to obtain a target feature map; performing prediction processing on the target feature map using the prediction network of the text detection model to obtain a target prediction probability map and a target threshold map; performing differentiable binarization processing on the target prediction probability map and the target threshold map to obtain a target binary image; and obtaining a text detection result based on the target binary image. This embodiment processes the image using a text detection model with a MobileNetV3-Small network as the backbone network, reducing the computational load of the model and improving the efficiency of image text detection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image processing technology, and in particular to an image processing method, apparatus, device, and medium. Background Art

[0002] In image processing, the DBnet model has the characteristics of fast speed and good effect. Therefore, the DBnet model is often used to detect text on images, and the text detection effect is good, but the model has too much calculation. Due to factors such as the computing power of the mobile terminal and the size of the model, the current DBnet model has low image processing efficiency on the mobile terminal, resulting in a relatively lagging application of image text detection on the mobile terminal. Therefore, how to provide an image processing method that can improve the efficiency of image text detection has become a technical problem that needs to be solved urgently. Summary of the invention

[0003] The main purpose of the embodiments of the present application is to propose an image processing method, device, equipment, and medium, which can improve the efficiency of image text detection by reducing the calculation amount of the model.

[0004] To achieve the above object, a first aspect of an embodiment of the present application provides an image processing method, the method comprising:

[0005] Obtain the original image to be processed;

[0006] Perform feature extraction processing on the original image through a pre-trained text detection model backbone network to obtain a number of initial feature maps, wherein the backbone network is a mobilenetV3-small network;

[0007] Performing feature cascade processing on the initial feature maps through the feature pyramid network of the text detection model to obtain a target feature map;

[0008] Performing prediction processing on the target feature map through the prediction network of the text detection model to obtain a target prediction probability map and a target threshold map;

[0009] The target prediction probability map and the target threshold map are subjected to differentiable binarization processing to obtain a target binary image, and a text detection result is obtained according to the target binary image.

[0010] According to the image processing method of the first aspect of the embodiment of the present application, there are at least the following beneficial effects: by replacing the backbone network of the text detection model with the mobilenetV3-small network, and processing the image through the replaced text detection model, the number of parameters of the model is reduced, thereby reducing the amount of calculation of the model and improving the efficiency of image text detection.

[0011] In some embodiments, the predicting process of the target feature map by the prediction network of the text detection model to obtain a target prediction probability map and a target threshold map includes:

[0012] Inputting the target feature map into a 1x1 convolution kernel, and performing convolution processing on the target feature map through the 1x1 convolution kernel to obtain an initial prediction probability map and an initial threshold map;

[0013] Downsampling the initial prediction probability map to obtain a target prediction probability map;

[0014] The initial threshold map is downsampled to obtain a target threshold map.

[0015] In some embodiments, the step of performing feature cascade processing on the plurality of initial feature maps through the feature pyramid network of the text detection model to obtain a target feature map includes:

[0016] Applying weight values ​​of different sizes to the plurality of initial feature maps respectively to obtain a plurality of weighted feature maps;

[0017] Perform feature cascade processing on several of the weight feature maps to obtain a target feature map.

[0018] In some embodiments, the original image is a multi-channel color image, and after obtaining the original image to be processed, the method further includes:

[0019] Preprocessing the multi-channel color image to obtain a single-channel color image;

[0020] Performing grayscale processing on the single-channel color image to obtain an initial grayscale image of the single channel;

[0021] The initial grayscale image is downsampled to obtain a target grayscale image, and the target grayscale image is input into a text detection model so that text detection is performed on the target grayscale image through the text detection model.

[0022] In some embodiments, the untrained text detection model is an initial text detection model, including an initial mobilenetV3-small network, an initial feature pyramid network, and an initial prediction network connected in sequence; the process of training the initial text detection model includes:

[0023] Acquire a first sample image;

[0024] Inputting the first sample image into an initial text detection model;

[0025] Perform feature extraction on the first sample image through the initial mobilenetV3-small network to obtain a number of initial sample feature maps;

[0026] The redundant channels of the initial feature pyramid network are pruned by a channel pruning operation to obtain a target feature pyramid network;

[0027] Performing feature cascade processing on a plurality of the initial sample feature maps through the target feature pyramid network to obtain a target sample feature map;

[0028] The target sample feature map is convolved by the initial prediction network of the text detection model, and the initial sample prediction probability map and the initial sample threshold map obtained after the convolution process are downsampled to obtain a target sample prediction probability map and a target sample threshold map;

[0029] Performing differentiable binarization processing on the target sample prediction probability map and the target sample threshold map to obtain a sample binary map;

[0030] A loss function is obtained according to the first sample image and the sample binary image, and the initial text detection model is trained according to the loss function to obtain a first text detection model.

[0031] In some embodiments, the pruning of redundant channels of the initial feature pyramid network by channel pruning to obtain a target feature pyramid network includes:

[0032] Performing feature cascade processing on a plurality of the initial sample feature maps through an intermediate network layer of the initial feature pyramid network to obtain a plurality of intermediate features;

[0033] Calculating the channel weights of the channels of the intermediate network layer according to the intermediate features, and determining the redundant channels of the initial feature pyramid network according to the channel weights;

[0034] The redundant channels are pruned through a channel pruning operation to obtain a target feature pyramid network.

[0035] In some embodiments, after training the initial text detection model according to the loss function to obtain the first text detection model, the method further includes:

[0036] Get the pre-trained teacher model and the second sample image;

[0037] Inputting the second sample image into the teacher model and the first text detection model respectively, to obtain a first output image of the teacher model and a second output image of the first text detection model;

[0038] Performing knowledge distillation using the first output image and the second output image to obtain a knowledge distillation result;

[0039] The first text detection model is updated according to the knowledge distillation result to obtain a second text detection model.

[0040] To achieve the above-mentioned purpose, a second aspect of an embodiment of the present application provides an image processing device, including:

[0041] An acquisition module, used for acquiring the original image to be processed;

[0042] A feature extraction module, used to perform feature extraction processing on the original image through a backbone network of a pre-trained text detection model to obtain a number of initial feature maps, wherein the backbone network is a mobilenetV3-small network;

[0043] A feature cascade module, used for performing feature cascade processing on the initial feature maps through the feature pyramid network of the text detection model to obtain a target feature map;

[0044] A prediction processing module, used for performing prediction processing on the target feature map through the prediction network of the text detection model to obtain a target prediction probability map and a target threshold map;

[0045] The target processing module is used to perform differentiable binarization processing on the target prediction probability map and the target threshold map to obtain a target binary image, and obtain a text detection result based on the target binary image.

[0046] To achieve the above-mentioned purpose, the third aspect of an embodiment of the present application proposes a computer device, which includes a memory, a processor, a program stored in the memory and executable on the processor, and a data bus for realizing connection and communication between the processor and the memory, and the program, when executed by the processor, implements the method described in the first aspect above.

[0047] To achieve the above-mentioned purpose, the fourth aspect of an embodiment of the present application proposes a storage medium, which is a computer-readable storage medium used for computer-readable storage, and the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the method described in the first aspect above.

[0048] The image processing method, device, equipment, and medium proposed in the present application can obtain the original image to be processed; perform feature extraction processing on the original image through the backbone network of a pre-trained text detection model to obtain several initial feature maps, and the backbone network is a mobilenetV3-small network; perform feature cascade processing on several initial feature maps through the feature pyramid network of the text detection model to obtain a target feature map; perform prediction processing on the target feature map through the prediction network of the text detection model to obtain a target prediction probability map and a target threshold map; perform differentiable binarization processing on the target prediction probability map and the target threshold map to obtain a target binary image, and obtain a text detection result based on the target binary image. This embodiment reduces the number of parameters of the model by replacing the backbone network of the text detection model with a mobilenetV3-small network, and processes the image through the replaced text detection model, thereby reducing the amount of calculation of the model and improving the efficiency of image text detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] Figure 1 is a flowchart of an image processing method provided in an embodiment of the present application;

[0050] Figure 2 yes Figure 1 Flow chart of step S130 in FIG.

[0051] Figure 3 yes Figure 1 Flow chart of step S140 in FIG.

[0052] Figure 4 is another flow chart of the image processing method provided by an embodiment of the present application;

[0053] Figure 5 is another flow chart of the image processing method provided by an embodiment of the present application;

[0054] Figure 6 yes Figure 5 Flow chart of step S540 in FIG.

[0055] Figure 7 is another flow chart of the image processing method provided by an embodiment of the present application;

[0056] Figure 8 is a block diagram of the module structure of the image processing device provided in an embodiment of the present application;

[0057] Fig. 9 It is a schematic diagram of the hardware structure of the computer device provided in the embodiment of the present application. DETAILED DESCRIPTION

[0058] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0059] It should be noted that, although the functional modules are divided in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first", "second", etc. in the specification, claims and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0060] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0061] First, some nouns involved in this application are analyzed:

[0062] Artificial intelligence (AI) is a new technical science that studies and develops theories, methods, technologies and application systems for simulating, extending and expanding human intelligence. AI is a branch of computer science that attempts to understand the essence of intelligence and produce a new type of intelligent machine that can respond in a similar way to human intelligence. Research in this field includes robotics, speech recognition, image recognition, natural language processing and expert systems. AI can simulate the information process of human consciousness and thinking. AI is also a theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0063] Natural language processing (NLP): NLP uses computers to process, understand and apply human languages ​​(such as Chinese, English, etc.). NLP is a branch of artificial intelligence and an interdisciplinary subject between computer science and linguistics. It is often referred to as computational linguistics. Natural language processing includes grammatical analysis, semantic analysis, and text comprehension. Natural language processing is commonly used in technical fields such as machine translation, handwritten and printed character recognition, speech recognition and text-to-speech conversion, information image processing, information extraction and filtering, text classification and clustering, public opinion analysis and opinion mining. It involves data mining related to language processing, machine learning, knowledge acquisition, knowledge engineering, artificial intelligence research, and linguistic research related to language computing.

[0064] Information Extraction (NER): A text processing technology that extracts specified types of entity, relationship, event and other factual information from natural language text and forms structured data output. Information extraction is a technology that extracts specific information from text data. Text data is composed of some specific units, such as sentences, paragraphs, and chapters. Text information is composed of some small specific units, such as characters, words, phrases, sentences, paragraphs, or a combination of these specific units. Extracting noun phrases, names, place names, etc. from text data are all text information extraction. Of course, the information extracted by text information extraction technology can be various types of information.

[0065] Computed Tomography (CT): It uses precisely collimated X-ray beams, gamma rays, ultrasound, etc., together with extremely sensitive detectors to perform cross-sectional scans around a certain part of the human body one by one. It has the characteristics of fast scanning time and clear images, and can be used to detect a variety of diseases. According to the different rays used, it can be divided into: X-ray CT (X-CT) and gamma-ray CT (γ-CT), etc.

[0066] Back propagation: The general principle of back propagation is: input the training set data into the input layer of the neural network, pass through the hidden layer of the neural network, and finally reach the output layer of the neural network and output the result; since there is an error between the output result of the neural network and the actual result, the error between the estimated value and the actual value is calculated, and the error is backpropagated from the output layer to the hidden layer until it propagates to the input layer; in the process of back propagation, the values ​​of various parameters are adjusted according to the error; the above process is continuously iterated until convergence.

[0067] Optical Character Recognition (OCR) refers to the process in which an electronic device (such as a scanner or digital camera) examines characters printed on paper, determines their shapes by detecting dark and light patterns, and then uses character recognition methods to translate the shapes into computer text; that is, for printed characters, an optical method is used to convert the text in a paper document into a black and white dot matrix image file, and recognition software is used to convert the text in the image into text format for further editing and processing by word processing software.

[0068] DBnet model (Real-time Scene Text Detection with Differentiable Binarization): The principle of the DBnet model is based on the segmentation algorithm. The general segmentation algorithm process is: first output the probability map of text segmentation through the network, then use the set threshold to convert the probability map into a binary map, and then get the detection result (text box coordinates) through post-processing.

[0069] At present, artificial intelligence technology continues to empower various scenarios in our lives, making our lives more convenient and intelligent. In the field of OCR (optical character recognition), the DBnet model is the most widely used model in the industry. In image processing, the DBnet model has the characteristics of fast speed and good effect. Therefore, the DBnet model is often used to detect text on images, and the text detection effect is good, but the calculation amount of the DBnet model is too large. Due to factors such as the computing power of edge devices and the size of the model, the current DBnet model has low image processing efficiency on the mobile terminal, resulting in a relatively lagging deployment of the text detection model on the mobile terminal. Therefore, how to provide an image processing method that can improve the efficiency of image text detection has become a technical problem that needs to be solved urgently.

[0070] Based on this, the main purpose of the embodiments of the present application is to propose an image processing method and apparatus, equipment, and medium, aiming to reduce the computational complexity of the model and improve the efficiency of image text detection, so that the image processing method can be applied to mobile terminals.

[0071] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.

[0072] AI basic technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics, etc. AI software technologies mainly include computer vision technology, robotics technology, biometrics technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0073] The image processing method provided in the embodiment of the present application relates to the field of artificial intelligence technology. The image processing method provided in the embodiment of the present application can be applied to a terminal, can be applied to a server side, or can be software running in a terminal or a server side. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc.; the server side can be configured as an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application that implements the image processing method, etc., but is not limited to the above forms.

[0074] The present application can be used in many general or special computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, etc. The present application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0075] The embodiments of the present application provide an image processing method, apparatus, device, and medium, which are specifically described through the following embodiments. First, the image processing method in the embodiments of the present application is described.

[0076] Figure 1 is an optional flowchart of the image processing method provided in the embodiment of the present application. Figure 1 The method may include but is not limited to steps S110 to S150.

[0077] Step S110, obtaining an original image to be processed;

[0078] Step S120, performing feature extraction processing on the original image through the backbone network of the pre-trained text detection model to obtain a number of initial feature maps, where the backbone network is a mobilenetV3-small network;

[0079] Step S130, performing feature cascade processing on a plurality of initial feature maps through a feature pyramid network of a text detection model to obtain a target feature map;

[0080] Step S140, performing prediction processing on the target feature map through the prediction network of the text detection model to obtain a target prediction probability map and a target threshold map;

[0081] Step S150, performing differentiable binarization processing on the target prediction probability map and the target threshold map to obtain a target binary image, and obtaining a text detection result based on the target binary image.

[0082] Specifically, through step S110 to step S150, the embodiment of the present application replaces the backbone network of the text detection model with the mobilenetV3-small network, and processes the image through the replaced text detection model, thereby effectively reducing the number of model parameters, thereby reducing the amount of model calculations and improving the efficiency of image text detection. It should be noted that the text detection model of this embodiment can be as small as 0.9Mb, can be easily deployed to various mobile phone models, and has good detection effects. The text detection model of this embodiment can be used in mobile AI projects such as life insurance AI cameras.

[0083] In step S110, the original image to be processed may be a three-dimensional image; in some embodiments, the three-dimensional image may be obtained through computed tomography (CT); in another embodiment, the three-dimensional image may be obtained through magnetic resonance imaging (MRI).

[0084] In some medical application scenarios, the above-mentioned original image to be processed may be a medical image, and the type of object contained in the original image is a lesion, that is, a part of the body where a disease occurs. Medical images refer to internal tissues obtained in a non-invasive manner for medical treatment or medical research, such as CT (Computed Tomography), MRI (Magnetic Resonance Imaging), US (ultrasonic), X-ray images, and images generated by medical instruments using optical photographic lights.

[0085] In step S120, the original image is subjected to feature extraction processing through the backbone network of the pre-trained text detection model to obtain several initial feature maps, and the backbone network is a mobilenetV3-small network. The resolutions of the several initial feature maps are different. In one embodiment, the original image is output with four initial feature maps after passing through the backbone network, and the resolutions are 1 / 4, 1 / 8, 1 / 16, and 1 / 32 of the original image, respectively. The original backbone network of the text detection model is a CNN network structure. In this embodiment, the CNN network structure is replaced by a mobilenetV3-small network with small parameters and high speed, so that the calculation amount of the model is greatly reduced, and the speed of image processing is improved.

[0086] In step S130, feature cascade processing is performed on several initial feature maps through the feature pyramid network of the text detection model to obtain a target feature map. In one embodiment, the four initial feature maps are upsampled to 1 / 4 of the original image resolution, and then feature cascade processing is performed to obtain the target feature map. It should be noted that under the structure of the feature pyramid network, increasing the number of feature extraction layers can learn or characterize richer information on the image. Therefore, this embodiment can extract the potential feature information of the image by performing feature cascade processing on multiple initial feature maps, which is beneficial to improving the accuracy of image synthesis and improving the quality of image processing.

[0087] In a specific example, taking 640x640x1 (grayscale image) as input, the feature dimension of the output after the backbone network is 1x160x160x512, and the output after processing by the feature pyramid network is a tensor of 1x80x80x128. After passing through the prediction network, the target prediction probability map and target threshold map output are both 1x320x320 prediction maps. Finally, the prediction map is subjected to differentiable binarization processing to obtain the final text detection result.

[0088] See also Figure 2 In some embodiments, step S130 may include but is not limited to steps S210 to S220:

[0089] Step S210, applying weight values ​​of different sizes to a plurality of initial feature maps to obtain a plurality of weighted feature maps;

[0090] Step S220, performing feature cascade processing on several weighted feature maps to obtain a target feature map.

[0091] Specifically, in step S210 to step S220, weight values ​​of different sizes are applied to the initial feature maps through the attention mechanism to obtain several weighted feature maps, and feature cascade processing is performed on the several weighted feature maps to obtain the target feature map. In this embodiment, the initial feature maps not only have different resolutions, but also weights are applied to the initial feature maps through the attention mechanism, which can improve the generation quality of the target feature map.

[0092] See also Figure 3 In some embodiments, step S140 may include but is not limited to steps S310 to S330:

[0093] Step S310, inputting the target feature map into a 1x1 convolution kernel, and performing convolution processing on the target feature map through the 1x1 convolution kernel to obtain an initial prediction probability map and an initial threshold map;

[0094] Step S320, downsampling the initial prediction probability map to obtain a target prediction probability map;

[0095] Step S330, downsampling the initial threshold map to obtain a target threshold map.

[0096] Specifically, in step S310 to step S330, the target feature map is convolved with a 1x1 convolution kernel to obtain an initial prediction probability map and an initial threshold map. It should be noted that the role of the 1x1 convolution is to perform dimensionality increase or dimensionality reduction operations without changing the width and height of the target feature map. In this embodiment, the target feature map is convolved with a 1x1 kernel to increase the dimension of the target feature map, and the initial prediction probability map and the initial threshold map are obtained from the target feature map with increased dimension. The initial prediction probability map and the initial threshold map are then downsampled respectively, in order to reduce the amount of image calculation and further improve the speed of image processing.

[0097] See also Figure 4 In some embodiments, the original image is a multi-channel color image. After step S110, the image processing method specifically includes but is not limited to steps S410 to S430:

[0098] Step S410, preprocessing the multi-channel color image to obtain a single-channel color image;

[0099] Step S420, grayscale processing is performed on the single-channel color image to obtain an initial grayscale image of the single channel;

[0100] Step S430, down-sampling the initial grayscale image to obtain a target grayscale image, and inputting the target grayscale image into a text detection model so that text detection is performed on the target grayscale image through the text detection model.

[0101] Specifically, in step S410 to step S430, the original image initially acquired is a multi-channel color image. In this embodiment, the multi-channel color image is converted into a single-channel initial grayscale image, and the initial grayscale image is downsampled to obtain a target grayscale image, and then the target grayscale image is input into the text detection model. The purpose of processing the multi-channel color image in this embodiment is to further reduce the amount of image processing calculations and improve the speed of image processing.

[0102] See also Figure 5 In some embodiments, the untrained text detection model is an initial text detection model, including an initial mobilenetV3-small network, an initial feature pyramid network, and an initial prediction network connected in sequence; the process of training the initial text detection model specifically includes but is not limited to steps S510 to S580:

[0103] Step S510, obtaining a first sample image;

[0104] Step S520, inputting the first sample image into an initial text detection model;

[0105] Step S530, extracting features from the first sample image through the initial mobileneV3-small network to obtain a number of initial sample feature maps;

[0106] Step S540, pruning redundant channels of the initial feature pyramid network through a channel pruning operation to obtain a target feature pyramid network;

[0107] Step S550, performing feature cascade processing on a plurality of sample initial feature maps through a target feature pyramid network to obtain a target sample feature map;

[0108] Step S560, performing convolution processing on the target sample feature map through the initial prediction network of the text detection model, and performing downsampling processing on the initial sample prediction probability map and the initial sample threshold map obtained after the convolution processing, so as to obtain a target sample prediction probability map and a target sample threshold map;

[0109] Step S570, performing differentiable binarization processing on the target sample prediction probability map and the target sample threshold map to obtain a sample binary map;

[0110] Step S580, obtaining a loss function according to the first sample image and the sample binary image, and training the initial text detection model according to the loss function to obtain a first text detection model.

[0111] Through step S510 to step S580, the initial text detection model is trained to obtain a first text detection model with fast image processing speed and high image quality. It can be understood that the first text detection model has a small amount of calculation and high precision compared with the existing text detection model. Therefore, the first text detection model can be applied to devices with low computing performance such as mobile terminals, and good image detection results are guaranteed. It should be noted that the first text detection model of this embodiment can be as large as 0.9Mb, can be easily deployed to various mobile phone models, and has good detection effects. The first text detection model of this embodiment can be used in mobile AI projects such as life insurance AI cameras.

[0112] Specifically, in step S510, the first sample image may be obtained by computed tomography (CT) or magnetic resonance imaging (MRI).

[0113] Further, step S520 is executed to input the first sample image into the initial text detection model.

[0114] It should be noted that the initial text detection model is mainly composed of three parts, namely the initial backbone network, the initial feature pyramid network and the initial prediction network, which are connected in sequence. Among them, the initial backbone network is the initial mobilenetV3-small network. It should be noted that the mobilenetV3-small network, the feature pyramid network and the prediction network are all open source network structures.

[0115] Further, step S530 is executed to perform feature extraction processing on the original image through the mobilenetV3-small network to obtain several initial sample feature maps. Among them, the resolutions of the several initial feature maps are different. In one embodiment, the sample image is outputted with four initial sample feature maps after passing through the mobilenetV3-small network, and the resolutions are 1 / 4, 1 / 8, 1 / 16, and 1 / 32 of the sample image, respectively. The original backbone network of the text detection model is a CNN network structure. In this embodiment, the CNN network structure is replaced by a mobilenetV3-small network with small parameters and high speed, so that the calculation amount of the model is greatly reduced, and the speed of image processing is improved.

[0116] Further, when executing step S540 to step S550, it can be understood that there are multiple channels in the initial feature pyramid network, but not every channel plays a role in image processing, but it will increase the redundancy of the network, thereby affecting the calculation amount of the model. This step will cut the redundant channels of the initial feature pyramid network through the operation of channel pruning to obtain the target feature pyramid network, and perform feature cascade processing on several sample initial feature maps through the target feature pyramid network to obtain the target sample feature map. This embodiment reduces the model calculation amount.

[0117] Further, step S560 to step S570 are performed, and the target sample feature map is convolved by the initial prediction network of the text detection model, and the initial sample prediction probability map and the initial sample threshold map obtained after the convolution process are downsampled to obtain the target sample prediction probability map and the target sample threshold map; the target sample prediction probability map and the target sample threshold map are subjected to differentiable binarization to obtain a sample binary map. It can be understood that the target sample prediction probability map and the target sample threshold map obtained after the downsampling process can reduce the amount of image calculation and improve the speed of image processing. In one embodiment, the target feature map is convolved by a 1x1 core to increase the dimension of the target feature map, and the initial sample prediction probability map and the initial sample threshold map are obtained from the target sample feature map with increased dimension. Then, the initial sample prediction probability map and the initial sample threshold map are downsampled four times respectively, which can reduce the amount of image calculation and further improve the speed of image processing.

[0118] Finally, step S580 is performed to compare the first sample image and the sample binary image, and the model loss of the initial text detection model is calculated. For example, the similarity of the first sample image and the sample binary image is calculated, and a loss function is obtained according to the similarity, and the model loss is determined according to the loss function. The model loss is back-propagated, for example, back-propagated according to the loss function, so as to update the text detection model by optimizing the loss function, mainly to update the internal parameters (i.e., loss parameters) of the text detection model. It is understandable that the back-propagation principle can apply the conventional back-propagation principle, and the embodiment of the present application is not limited. By constantly repeating the above process, until the similarity of the first sample image and the sample binary image meets the preset condition, or the number of iterations meets the preset number of times, the loss function of the text detection model is optimized, and the updating of the text detection model is stopped to obtain the first text detection model.

[0119] See also Figure 6 In some embodiments, step S540 specifically includes but is not limited to steps S610 to S630:

[0120] Step S610, performing feature cascade processing on a plurality of sample initial feature maps through an intermediate network layer of an initial feature pyramid network to obtain a plurality of intermediate features;

[0121] Step S620, calculating the channel weights of each channel of the intermediate network layer according to the plurality of intermediate features, and determining the redundant channels of the initial feature pyramid network according to the channel weights;

[0122] Step S630, pruning redundant channels through channel pruning operations to obtain a target feature pyramid network.

[0123] Specifically, in step S610 to step S630, the intermediate features can be obtained by the intermediate network layer of the initial feature pyramid network after various operator operations. For example, the intermediate network layer performs feature cascade processing on several sample initial feature maps to obtain several intermediate features. According to several intermediate features, the channel weights of each channel of the intermediate network layer are calculated, so that the redundant channels in the initial feature pyramid can be determined according to the channel weights, and the redundant channels are pruned by the channel pruning operation to obtain the target feature pyramid network. In one embodiment, a channel weight is set for each channel of the intermediate network layer that needs to be pruned, and this channel weight is learnable during training. After the model is trained, the channel weight corresponding to the channel that does not play a big role in the final result is relatively small, and the channel weight corresponding to the channel that contributes a lot to the final result is relatively large. The redundant channels are determined by the size of the channel weights, and the redundant channels are pruned by the channel pruning operation, so that the calculation amount of the target feature pyramid network is reduced, which is beneficial to improving the speed of image processing.

[0124] See also Figure 7 In some embodiments, after step S580, the image processing method provided in this embodiment specifically includes but is not limited to steps S710 to S740:

[0125] Step S710, obtaining a pre-trained teacher model and a second sample image;

[0126] Step S720, inputting the second sample image into the teacher model and the first text detection model respectively, obtaining a first output image of the teacher model and a second output image of the first text detection model;

[0127] Step S730, performing knowledge distillation using the first output image and the second output image to obtain a knowledge distillation result;

[0128] Step S740: Update the first text detection model according to the knowledge distillation result to obtain a second text detection model.

[0129] Specifically, in step S710 to step S740, the pre-trained teacher model uses the open source Resnet18 network model. Through the high-precision but computationally intensive teacher model of image processing, the low-precision but less computationally intensive first text detection model is subjected to knowledge distillation, thereby obtaining the second text detection model after knowledge distillation. This embodiment can improve the generation quality of image processing of the second text detection model, but retains the advantage of small model computational complexity. It should be noted that the second text detection model of this embodiment can be as large as 0.9Mb, can be easily deployed to various mobile phone models, and has good detection effects. For example, the second text detection model of this embodiment can be used in mobile AI projects such as life insurance AI cameras.

[0130] The image processing method proposed in the embodiment of the present application reduces the number of parameters of the model by replacing the backbone network of the text detection model with the mobilenetV3-small network, and processes the image through the replaced text detection model, thereby reducing the amount of calculation of the model and improving the efficiency of image text detection. In addition, by reducing the number of parameters of the image through downsampling processing, the amount of calculation of the image can be further reduced and the speed of image processing can be increased. By trimming the redundant channels of the model through channel pruning operations, the number of parameters of the model can be further reduced, and the amount of calculation of the model can be further optimized.

[0131] See also Figure 8 The present application also provides an image processing device that can implement the above-mentioned image processing method. Figure 8 The module structure block diagram of the image processing device provided in the embodiment of the present application includes: an acquisition module 810, a feature extraction module 820, a feature cascade module 830, a prediction processing module 840, and a target processing module 850. Among them, the acquisition module 810 is used to acquire the original image to be processed; the feature extraction module 820 is used to perform feature extraction processing on the original image through the backbone network of the pre-trained text detection model to obtain a number of initial feature maps, and the backbone network is a mobilenetV3-small network; the feature cascade module 830 is used to perform feature cascade processing on a number of initial feature maps through the feature pyramid network of the text detection model to obtain a target feature map; the prediction processing module 840 is used to perform prediction processing on the target feature map through the prediction network of the text detection model to obtain a target prediction probability map and a target threshold map; the target processing module 850 is used to perform differentiable binarization processing on the target prediction probability map and the target threshold map to obtain a target binary image, and obtain a text detection result based on the target binary image.

[0132] The image processing device of the embodiment of the present application can obtain the original image to be processed; perform feature extraction processing on the original image through the backbone network of the pre-trained text detection model to obtain several initial feature maps, and the backbone network is a mobilenetV3-small network; perform feature cascade processing on several initial feature maps through the feature pyramid network of the text detection model to obtain a target feature map; perform prediction processing on the target feature map through the prediction network of the text detection model to obtain a target prediction probability map and a target threshold map; perform differentiable binarization processing on the target prediction probability map and the target threshold map to obtain a target binary image, and obtain a text detection result based on the target binary image. This embodiment reduces the number of parameters of the model by replacing the backbone network of the text detection model with a mobilenetV3-small network, and processes the image through the replaced text detection model, thereby reducing the amount of calculation of the model and improving the efficiency of image text detection.

[0133] In one embodiment, the image processing device also includes a training module, which can be used to execute the methods in steps S510 to S580 in the above method embodiment. The training module can also be used to execute the methods in steps S610 to S630 in the above method embodiment. The training module can also be used to execute the methods in steps S710 to S740 in the above method embodiment.

[0134] It should be noted that the specific implementation of the image processing device is basically the same as the specific embodiment of the above-mentioned image processing method, and will not be repeated here.

[0135] The embodiment of the present application also provides a computer device, which includes: a memory, a processor, a program stored in the memory and executable on the processor, and a data bus for realizing connection and communication between the processor and the memory, and the program is executed by the processor to realize the above-mentioned image processing method. The computer device can be any intelligent terminal including a tablet computer, a car computer, etc.

[0136] See also Fig. 9 , Fig. 9 The hardware structure of a computer device according to another embodiment is shown, and the computer device includes:

[0137] The processor 901 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;

[0138] The memory 902 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 902 can store an operating system and other application programs. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 902, and the processor 901 calls and executes the image processing method of the embodiment of this application;

[0139] Input / output interface 903, used to implement information input and output;

[0140] Communication interface 904, used to realize communication interaction between the device and other devices, which can be realized by wired mode (such as USB, network cable, etc.) or wireless mode (such as mobile network, WIFI, Bluetooth, etc.);

[0141] A bus 905 that transmits information between various components of the device (e.g., the processor 901, the memory 902, the input / output interface 903, and the communication interface 904);

[0142] The processor 901 , the memory 902 , the input / output interface 903 and the communication interface 904 are connected to each other in communication within the device via a bus 905 .

[0143] An embodiment of the present application also provides a storage medium, which is a computer-readable storage medium used for computer-readable storage. The storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the above-mentioned image processing method.

[0144] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0145] The image processing method, image processing device, computer equipment and storage medium provided in the embodiment of the present application obtain the original image to be processed; perform feature extraction processing on the original image through the backbone network of the pre-trained text detection model to obtain several initial feature maps, and the backbone network is a mobilenetV3-small network; perform feature cascade processing on several initial feature maps through the feature pyramid network of the text detection model to obtain a target feature map; perform prediction processing on the target feature map through the prediction network of the text detection model to obtain a target prediction probability map and a target threshold map; perform differentiable binarization processing on the target prediction probability map and the target threshold map to obtain a target binary image, and obtain a text detection result according to the target binary image. In this embodiment, the number of parameters of the model is reduced by replacing the backbone network of the text detection model with a mobilenetV3-small network, and the image is processed by the replaced text detection model, thereby reducing the amount of calculation of the model and improving the efficiency of image text detection. It should be noted that the size of the text detection model of this embodiment can reach 0.9Mb, which can be easily deployed to various mobile phone models and has a good detection effect. For example, the text detection model of this embodiment can be used in mobile AI projects such as life insurance AI cameras.

[0146] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.

[0147] It can be understood by those skilled in the art that Figure 1-7 The technical solutions shown in the figure do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than those shown in the figure, or a combination of certain steps, or different steps.

[0148] The device embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0149] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.

[0150] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0151] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0152] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0153] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0154] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0155] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.

[0156] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.

Claims

1. An image processing method, characterized in that: include: Obtain the original image to be processed; Perform feature extraction processing on the original image through a pre-trained text detection model backbone network to obtain a number of initial feature maps, wherein the backbone network is a mobilenetV3-small network; Performing feature cascade processing on the initial feature maps through the feature pyramid network of the text detection model to obtain a target feature map; The target feature map is predicted by the prediction network of the text detection model to obtain a target prediction probability map and a target threshold map; including: inputting the target feature map into a 1x1 convolution kernel, convolving the target feature map by the 1x1 convolution kernel to obtain a target feature map with increased dimension, and obtaining an initial prediction probability map and an initial threshold map from the target feature map with increased dimension, downsampling the initial prediction probability map to obtain the target prediction probability map, and downsampling the initial threshold map to obtain the target threshold map; The target prediction probability map and the target threshold map are subjected to differentiable binarization processing to obtain a target binary image, and a text detection result is obtained according to the target binary image.

2. The method according to claim 1, characterized in that The step of performing feature cascade processing on the initial feature maps through the feature pyramid network of the text detection model to obtain a target feature map includes: Applying weight values ​​of different sizes to the plurality of initial feature maps respectively to obtain a plurality of weighted feature maps; Perform feature cascade processing on several of the weight feature maps to obtain a target feature map.

3. The method according to any one of claims 1 to 2, characterized in that: The original image is a multi-channel color image. After obtaining the original image to be processed, the method further includes: Preprocessing the multi-channel color image to obtain a single-channel color image; Performing grayscale processing on the single-channel color image to obtain an initial grayscale image of the single channel; The initial grayscale image is downsampled to obtain a target grayscale image, and the target grayscale image is input into a text detection model so that text detection is performed on the target grayscale image through the text detection model.

4. The method according to any one of claims 1 to 2, characterized in that: The untrained text detection model is an initial text detection model, including an initial mobilenet_v3-small network, an initial feature pyramid network and an initial prediction network connected in sequence; The process of training the initial text detection model includes: Acquire a first sample image; Inputting the first sample image into an initial text detection model; Performing feature extraction on the first sample image through the initial mobilenet_v3-small network to obtain a number of initial sample feature maps; The redundant channels of the initial feature pyramid network are pruned by a channel pruning operation to obtain a target feature pyramid network; Performing feature cascade processing on a plurality of the initial sample feature maps through the target feature pyramid network to obtain a target sample feature map; The target sample feature map is convolved by the initial prediction network of the text detection model, and the initial sample prediction probability map and the initial sample threshold map obtained after the convolution process are downsampled to obtain a target sample prediction probability map and a target sample threshold map; Performing differentiable binarization processing on the target sample prediction probability map and the target sample threshold map to obtain a sample binary map; A loss function is obtained according to the first sample image and the sample binary image, and the initial text detection model is trained according to the loss function to obtain a first text detection model.

5. The method according to claim 4, characterized in that The redundant channels of the initial feature pyramid network are pruned by channel pruning to obtain a target feature pyramid network, including: Performing feature cascade processing on a plurality of the initial sample feature maps through an intermediate network layer of the initial feature pyramid network to obtain a plurality of intermediate features; Calculating the channel weights of the channels of the intermediate network layer according to the intermediate features, and determining the redundant channels of the initial feature pyramid network according to the channel weights; The redundant channels are pruned through a channel pruning operation to obtain a target feature pyramid network.

6. The method according to claim 4, characterized in that After training the initial text detection model according to the loss function to obtain the first text detection model, the method further includes: Get the pre-trained teacher model and the second sample image; Inputting the second sample image into the teacher model and the first text detection model respectively, to obtain a first output image of the teacher model and a second output image of the first text detection model; Performing knowledge distillation using the first output image and the second output image to obtain a knowledge distillation result; The first text detection model is updated according to the knowledge distillation result to obtain a second text detection model.

7. An image processing device, characterized in that: include: An acquisition module, used for acquiring the original image to be processed; A feature extraction module, used to perform feature extraction processing on the original image through a pre-trained text detection model backbone network to obtain a number of initial feature maps, wherein the backbone network is a mobilenetV3-small network; A feature cascade module, used for performing feature cascade processing on the initial feature maps through the feature pyramid network of the text detection model to obtain a target feature map; A prediction processing module, used for performing prediction processing on the target feature map through the prediction network of the text detection model to obtain a target prediction probability map and a target threshold map; comprising: inputting the target feature map into a 1x1 convolution kernel, performing convolution processing on the target feature map through the 1x1 convolution kernel to obtain a target feature map with increased dimension, and obtaining an initial prediction probability map and an initial threshold map from the target feature map with increased dimension, performing downsampling processing on the initial prediction probability map to obtain a target prediction probability map, and performing downsampling processing on the initial threshold map to obtain a target threshold map; The target processing module is used to perform differentiable binarization processing on the target prediction probability map and the target threshold map to obtain a target binary image, and obtain a text detection result based on the target binary image.

8. A computer device, characterized in that: The computer device includes a memory, a processor, a program stored in the memory and executable on the processor, and a data bus for realizing connection and communication between the processor and the memory. When the program is executed by the processor, the steps of the method according to any one of claims 1 to 6 are realized.

9. A storage medium, the storage medium being a computer-readable storage medium, used for computer-readable storage, characterized in that: The storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of any one of claims 1 to 6.