WO2022095318A1 - Character detection method and apparatus, electronic device, storage medium, and program - Google Patents

Character detection method and apparatus, electronic device, storage medium, and program Download PDF

Info

Publication number
WO2022095318A1
WO2022095318A1 PCT/CN2021/080318 CN2021080318W WO2022095318A1 WO 2022095318 A1 WO2022095318 A1 WO 2022095318A1 CN 2021080318 W CN2021080318 W CN 2021080318W WO 2022095318 A1 WO2022095318 A1 WO 2022095318A1
Authority
WO
WIPO (PCT)
Prior art keywords
character sequence
character
boundary lines
feature point
parameters
Prior art date
Application number
PCT/CN2021/080318
Other languages
French (fr)
Chinese (zh)
Inventor
毕研广
胡志强
Original Assignee
上海商汤智能科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 上海商汤智能科技有限公司 filed Critical 上海商汤智能科技有限公司
Priority to KR1020227002100A priority Critical patent/KR20220015496A/en
Publication of WO2022095318A1 publication Critical patent/WO2022095318A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/14Image acquisition
    • G06V30/148Segmentation of character regions
    • G06V30/153Segmentation of character regions using recognition of characters or words
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • G06F18/2415Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches based on parametric or probabilistic models, e.g. based on likelihood ratio or false acceptance rate versus a false rejection rate
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/26Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion
    • G06V10/267Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion by performing operations on regions, e.g. growing, shrinking or watersheds

Definitions

  • the present disclosure relates to the technical field of computer vision, and in particular, to a character detection method, device, electronic device, storage medium and program.
  • Character detection in natural scenes is an important research field in computer vision, and has been applied to a variety of application scenarios, such as real-time text translation, document recognition, license plate recognition, etc.
  • characters are in a rigid plane in practical application scenarios. , however, during the imaging process, due to the distortion and distortion of the camera's angle of view, the characters on the rigid plane appear as irregular arbitrary quadrilateral shapes; for these characters, it is necessary to accurately return and locate their four boundaries before subsequent character recognition can be performed. The correct character shape is corrected in the link, so as to correctly identify the character content.
  • the present disclosure provides a technical solution for character detection.
  • An embodiment of the present disclosure provides a character detection method, including:
  • the position information of the bounding box of the first character sequence is determined.
  • the position information of the vertices of the bounding box of the first character sequence is determined, and according to the position of the vertices of the bounding box of the first character sequence information, determine the position information of the bounding box of the first character sequence, thereby disassembling the polygon (such as quadrilateral) bounding box of the character sequence into multiple (such as four) independent boundary lines, and carry out a separate process for each independent boundary line. Therefore, the detection of each boundary line will not be disturbed by two different vertices, thereby improving the accuracy of character detection.
  • the multiple boundary lines of the first character sequence in the image to be processed are predicted respectively, and the prediction parameters of the multiple boundary lines of the first character sequence are obtained, including:
  • the prediction parameters of the plurality of boundary lines of the first character sequence are determined according to the parameters of the plurality of boundary lines of the first character sequence corresponding to the first feature points.
  • the parameters of the multiple boundary lines of the first character sequence corresponding to the first feature points are respectively predicted, and according to the multiple boundaries of the first character sequence
  • the line corresponds to the parameters of the first feature point
  • the prediction parameters of the plurality of boundary lines of the first character sequence are determined, thereby predicting the parameters of the boundary line of the first character sequence based on the feature points related to the first character sequence, thereby It helps to improve the efficiency of obtaining the prediction parameters of the boundary line, and helps to improve the accuracy of the obtained prediction parameters.
  • the method further includes:
  • the first feature point is determined according to the probability that the position of the pixel in the image to be processed belongs to a character. In this way, by predicting the probability that the position of the pixel in the image to be processed belongs to the character, and determining the first feature point according to the probability that the position of the pixel in the image to be processed belongs to the character, it is possible to accurately determine the first feature point related to the first character sequence the first feature point of . Predicting the parameters of the boundary line of the first character sequence based on the first feature point thus determined helps to further improve the efficiency of obtaining the prediction parameters of the boundary line, and helps to further improve the accuracy of the obtained prediction parameters .
  • the parameters of the plurality of boundary lines of the first character sequence corresponding to the first feature point include:
  • the prediction parameters of the plurality of boundary lines of the first character sequence are determined according to parameters of the plurality of boundary lines of the first character sequence corresponding to the first feature points, include:
  • the prediction parameters of the plurality of boundary lines of the first character sequence are determined. In this way, by mapping the distance parameters and angle parameters of the multiple boundary lines of the first character sequence in the polar coordinate system corresponding to the first feature point to the Cartesian coordinate system, the multiple boundary lines of the first character sequence are obtained in the Cartesian coordinate system.
  • the parameters corresponding to the first feature point in the coordinate system, and according to the parameters corresponding to the first feature point of the multiple boundary lines of the first character sequence in the Cartesian coordinate system, the prediction of multiple boundary lines of the first character sequence is determined parameters, so that the predicted parameters of the boundary line can be obtained by regression based on the parameters in different polar coordinate systems.
  • the plurality of boundary lines of the first character sequence include an upper boundary line, a right boundary line, a lower boundary line and a left boundary line of the first character sequence.
  • the shape of the character sequence is a quadrilateral, according to this implementation, it is helpful to obtain more accurate position information of the bounding box of the character sequence in most cases.
  • the first feature points related to the first character sequence it is respectively predicted that a plurality of boundary lines of the first character sequence corresponds to the first character sequence.
  • Parameters of feature points including:
  • the pre-trained neural network respectively predicts the parameters corresponding to the first feature points of the multiple boundary lines of the first character sequence, thereby improving the speed of parameter prediction, And can improve the accuracy of the predicted parameters.
  • the method further includes:
  • the probability that the position of the pixel in the image to be processed belongs to a character is predicted through the neural network.
  • the pre-trained neural network predicts the probability that the pixel location in the image to be processed belongs to the character, thereby improving the speed of predicting the probability that the pixel location belongs to the character, and improving the accuracy of the predicted probability.
  • the method before inputting the to-be-processed image into a pre-trained neural network, the method further includes:
  • the multiple boundary lines of the second character sequence corresponding to the predicted value of the parameter of the second feature point and the multiple boundary lines of the second character sequence corresponding to the true value of the parameter of the second feature point value to train the neural network.
  • each independent boundary line is detected separately, so that the neural network will not be affected by regression vertices.
  • the training disturbance is brought about, thereby improving the learning efficiency and detection effect of the neural network, and the neural network trained according to this implementation can learn the ability to accurately predict the parameters of the boundary line of the character sequence.
  • the parameters of the plurality of boundary lines of the second character sequence corresponding to the second feature point include: the plurality of boundary lines of the second character sequence are at the second feature point The distance parameter and the angle parameter under the corresponding polar coordinate system, wherein, the polar coordinate system corresponding to the second feature point represents a polar coordinate system with the second feature point as a pole;
  • the multiple boundary lines according to the second character sequence correspond to the predicted value of the parameter of the second feature point, and the multiple boundary lines of the second character sequence correspond to the parameter of the second feature point
  • the true value of train the neural network, including:
  • the angle parameter of the second feature point corresponding to the plurality of boundary lines of the second character sequence and the angle parameter of the second feature point corresponding to the plurality of boundary lines of the second character sequence
  • the true value of to train the neural network.
  • the straight line equation in the Cartesian coordinate system to the polar coordinate system
  • the amount of parameters and correlation are reduced, and the actual physical meaning of the parameters is given, which is beneficial to network learning, and learning to detect the character sequence by training the neural network.
  • Each boundary line corresponds to the distance and angle of the feature points, so that the detection of the boundary lines does not interfere with each other, so that the learning efficiency and detection effect of the neural network can be improved.
  • the plurality of boundary lines according to the second character sequence corresponds to the predicted value of the distance parameter of the second feature point
  • the plurality of boundary lines of the second character sequence Corresponding to the true value of the distance parameter of the second feature point, training the neural network, including:
  • the distance parameters of different sizes in different application scenarios can be normalized, which can help to perform multi-scale character detection, that is, it helps to achieve higher accuracy in character detection of different scales.
  • the plurality of boundary lines according to the second character sequence corresponds to the predicted value of the angle parameter of the second feature point
  • the plurality of boundary lines of the second character sequence Corresponding to the true value of the angle parameter of the second feature point, training the neural network, including:
  • the neural network is trained according to the sine of the half angle of the absolute value. In this way, for any one of the multiple boundary lines of the second character sequence, the absolute value of the difference between the true value and the predicted value of the angle parameter of the boundary line corresponding to the second feature point is determined, and according to the absolute value of the difference
  • the sine value of half the angle is used to train the neural network, so that the learning of the neural network will not be disturbed due to the confusion of 0 and 2 ⁇ , thereby helping to improve the learning efficiency and detection effect of the neural network.
  • the second feature points include feature points in an effective area corresponding to the second character area. In this way, when calculating the loss function of the neural network, only the feature points in the valid region corresponding to the second character region are supervised, and the feature points outside the valid region corresponding to the second character region are not supervised, which helps to reduce the network burden.
  • the method further includes:
  • the neural network is trained according to the probability that the positions of the pixels in the training image belong to characters, and the labeled data that the positions of the pixels in the training images belong to the characters. In this way, the neural network can learn the ability to predict the probability that the position of the pixel belongs to the character.
  • the training of the neural network according to the probability that the position of the pixel in the training image belongs to a character, and the labeled data that the position of the pixel in the training image belongs to the character includes:
  • the neural network is trained according to the probability that the position of the pixel in the valid region corresponding to the second character sequence belongs to the character, and the labeled data that the position of the pixel in the valid region belongs to the character.
  • the neural network can learn the ability of character segmentation , and can improve the efficiency of neural network learning character segmentation.
  • the method further includes:
  • the real bounding box is reduced to obtain an effective area corresponding to the second character sequence.
  • the effective area corresponding to the second character sequence is obtained, and the neural network is trained based on the feature points in the effective area corresponding to the second character sequence, which helps to reduce the network burden.
  • reducing the real bounding box to obtain an effective area corresponding to the second character sequence including:
  • the real bounding box is reduced to obtain the effective area corresponding to the second character sequence, wherein the first The ratio of the distance to the second distance is equal to the preset ratio, the first distance represents the distance between the first vertex of the effective area and the anchor point, and the second distance represents the The distance between the vertex corresponding to the first vertex and the anchor point, where the first vertex represents any vertex of the effective area.
  • the effective area corresponding to the second character sequence is obtained, and the neural network is trained based on the feature points in the effective area corresponding to the second character sequence, which helps to improve the learning efficiency and prediction accuracy of the neural network.
  • the embodiment of the present disclosure also provides a character detection device, including:
  • the first prediction module is configured to respectively predict multiple boundary lines of the first character sequence in the image to be processed, and obtain prediction parameters of the multiple boundary lines of the first character sequence, wherein the boundary of the first character sequence
  • the line represents the dividing line between the area where the first character sequence is located and the area not where the first character sequence is located;
  • a first determining module configured to determine the position information of the vertices of the bounding box of the first character sequence according to the prediction parameters of a plurality of boundary lines of the first character sequence
  • the second determining module is configured to determine the position information of the bounding box of the first character sequence according to the position information of the vertices of the bounding box of the first character sequence.
  • the first prediction module is configured to, based on the to-be-processed image, respectively predict a plurality of boundary lines of the first character sequence for first feature points related to the first character sequence a parameter corresponding to the first feature point;
  • the prediction parameters of the plurality of boundary lines of the first character sequence are determined according to the parameters of the plurality of boundary lines of the first character sequence corresponding to the first feature points.
  • the apparatus further includes:
  • a second prediction module configured to predict the probability that the position of the pixel in the to-be-processed image belongs to a character
  • the third determining module is configured to determine the first feature point according to the probability that the position of the pixel in the image to be processed belongs to a character.
  • the parameters of the plurality of boundary lines of the first character sequence corresponding to the first feature point include:
  • the first prediction module is configured to map distance parameters and angle parameters of a plurality of boundary lines of the first character sequence in the polar coordinate system corresponding to the first feature point to A Cartesian coordinate system, to obtain the parameters corresponding to the first feature points of the plurality of boundary lines of the first character sequence under the Cartesian coordinate system;
  • the prediction parameters of the plurality of boundary lines of the first character sequence are determined.
  • the plurality of boundary lines of the first character sequence include an upper boundary line, a right boundary line, a lower boundary line and a left boundary line of the first character sequence.
  • the first prediction module is configured to input the to-be-processed image into a pre-trained neural network, and through the neural network, respectively predict the first feature points related to the first character sequence through the neural network.
  • a plurality of boundary lines of the first character sequence correspond to parameters of the first feature point.
  • the apparatus further includes:
  • the third prediction module is configured to predict the probability that the position of the pixel in the image to be processed belongs to the character through the neural network.
  • the apparatus further includes:
  • the fourth prediction module is configured to input the training image into the neural network, and through the neural network, for the second feature points related to the second character sequence in the training image, respectively predict the number of the second character sequence.
  • a boundary line corresponds to the predicted value of the parameter of the second feature point;
  • the first training module is configured to correspond to the predicted value of the parameter of the second feature point according to the plurality of boundary lines of the second character sequence, and the plurality of boundary lines of the second character sequence correspond to the first The true values of the parameters of the two feature points, train the neural network.
  • the parameters of the plurality of boundary lines of the second character sequence corresponding to the second feature point include: the plurality of boundary lines of the second character sequence are at the second feature point The distance parameter and the angle parameter under the corresponding polar coordinate system, wherein, the polar coordinate system corresponding to the second feature point represents a polar coordinate system with the second feature point as a pole;
  • the first training module is configured to correspond to the predicted value of the distance parameter of the second feature point according to the plurality of boundary lines of the second character sequence, and the plurality of boundary lines of the second character sequence correspond to the predicted value of the distance parameter of the second feature point.
  • the true value of the distance parameter of the second feature point is used to train the neural network;
  • the first training module is configured to, for any one of a plurality of boundary lines of the second character sequence, according to the boundary line corresponding to the second feature point
  • the ratio of the smaller to larger of the true and predicted values of the distance parameter trains the neural network.
  • the first training module is configured to, for any one of a plurality of boundary lines of the second character sequence, determine that the boundary line corresponds to the second feature point.
  • the neural network is trained according to the sine of the half angle of the absolute value.
  • the second feature points include feature points in an effective area corresponding to the second character area.
  • the apparatus further includes:
  • a fifth prediction module configured to predict the probability that the position of the pixel in the training image belongs to the character via the neural network
  • the second training module is configured to train the neural network according to the probability that the position of the pixel in the training image belongs to a character, and the labeled data that the position of the pixel in the training image belongs to the character.
  • the second training module is configured to, according to the probability that the position of the pixel in the effective area corresponding to the second character sequence belongs to the character, and the position of the pixel in the effective area belongs to the character the labeled data to train the neural network.
  • the apparatus further includes:
  • an acquisition module configured to acquire the position information of the real bounding box of the second character sequence
  • the shrinking module is configured to shrink the real bounding box according to the position information of the real bounding box and a preset ratio to obtain an effective area corresponding to the second character sequence.
  • the reduction module is configured to determine the anchor point of the real bounding box according to the position information of the real bounding box, wherein the anchor point of the real bounding box is the real boundary the intersection of the diagonals of the boxes;
  • the real bounding box is reduced to obtain the effective area corresponding to the second character sequence, wherein the first The ratio of the distance to the second distance is equal to the preset ratio, the first distance represents the distance between the first vertex of the effective area and the anchor point, and the second distance represents the The distance between the vertex corresponding to the first vertex and the anchor point, where the first vertex represents any vertex of the effective area.
  • Embodiments of the present disclosure also provide an electronic device, comprising: one or more processors; a memory for storing executable instructions; wherein the one or more processors are configured to call executable instructions stored in the memory The instruction is executed to execute the character detection method described in any of the above embodiments.
  • Embodiments of the present disclosure further provide a computer-readable storage medium, on which computer program instructions are stored, and when the computer program instructions are executed by a processor, implement the character detection method described in any of the foregoing embodiments.
  • An embodiment of the present disclosure further provides a computer program, where the computer program includes computer-readable codes, and when the computer-readable codes are executed in an electronic device, a processor of the electronic device executes any of the foregoing embodiments The described character detection method.
  • the prediction parameters of the multiple boundary lines of the first character sequence are obtained by respectively predicting multiple boundary lines of the first character sequence in the image to be processed.
  • the prediction parameter determines the position information of the vertices of the bounding box of the first character sequence, and determines the position information of the bounding box of the first character sequence according to the position information of the vertices of the bounding box of the first character sequence.
  • the polygon (such as quadrilateral) bounding box is disassembled into multiple (such as four) independent boundary lines, and each independent boundary line is detected separately, so that the detection of each boundary line will not be disturbed by two different vertices , which can improve the accuracy of character detection.
  • FIG. 1 shows a flowchart of a character detection method provided by an embodiment of the present disclosure
  • FIG. 2 shows a schematic diagram of a system architecture to which the character detection method according to an embodiment of the present disclosure is applied;
  • Fig. 3 shows the schematic diagram of the distance parameter and the angle parameter of 4 boundary lines of the first character sequence under the polar coordinate system corresponding to a certain first feature point;
  • FIG. 4 shows a schematic diagram of the real bounding box 31 and the effective area 32 of the second character area
  • FIG. 5 shows a schematic diagram of an application scenario of an embodiment of the present disclosure
  • FIG. 6 shows a block diagram of a character detection apparatus provided by an embodiment of the present disclosure
  • FIG. 7 shows a block diagram of an electronic device 800 provided by an embodiment of the present disclosure
  • FIG. 8 shows a block diagram of an electronic device 1900 provided by an embodiment of the present disclosure.
  • a rectangular frame or a rotated rectangular frame is mostly used to detect characters, but these rectangular frames or rotated rectangular frames cannot accurately locate the character boundary, which affects subsequent character recognition.
  • the related art also proposes a character detection method in which a bounding box of a character is formed by regressing four vertices of a quadrilateral. However, a vertex is actually formed by the intersection of two adjacent edges, and the regression of each vertex affects both edges, so each edge is disturbed by two different vertices, which affects the accuracy of character detection results.
  • embodiments of the present disclosure provide a character detection method, apparatus, electronic device, storage medium, and program, by decomposing a polygonal (eg, quadrilateral) bounding box of a character into multiple (eg, four) independent boundary lines , each independent boundary line is independently detected, so that the detection of each boundary line will not be disturbed by two different vertices, so that the accuracy of character detection can be improved.
  • a polygonal (eg, quadrilateral) bounding box of a character into multiple (eg, four) independent boundary lines , each independent boundary line is independently detected, so that the detection of each boundary line will not be disturbed by two different vertices, so that the accuracy of character detection can be improved.
  • FIG. 1 shows a flowchart of a character detection method provided by an embodiment of the present disclosure.
  • the execution body of the character detection method may be a character detection device.
  • the character detection method may be performed by a terminal device or a server or other processing device.
  • the terminal device may be a user equipment (User Equipment, UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (Personal Digital Assistant, PDA), a handheld device, a computing device, a vehicle-mounted device, or a wearable devices, etc.
  • the character detection method may be implemented by a processor invoking computer-readable instructions stored in a memory. As shown in FIG. 1 , the character detection method includes steps S11 to S13.
  • step S11 the multiple boundary lines of the first character sequence in the image to be processed are respectively predicted, and the prediction parameters of the multiple boundary lines of the first character sequence are obtained.
  • the boundary line of the first character sequence represents the dividing line between the area where the first character sequence is located and the area not where the first character sequence is located.
  • character detection may refer to detecting a position of a character and/or character sequence in an image, for example, may refer to detecting a position of a bounding box of a character and/or character sequence in an image.
  • the to-be-processed image may represent an image that needs character detection.
  • the first character sequence represents any character sequence in the image to be processed.
  • the image to be processed may include one or more character sequences.
  • the first sequence of characters may include one or more characters, and the characters may include at least one of words, letters, numbers, punctuation marks, operation symbols, and the like.
  • the distance between any two characters is less than or equal to a preset first distance threshold, it is determined that the two characters belong to the same character sequence.
  • the writing direction in the image to be processed is the horizontal direction, if any two characters belong to the same line of text, and the distance between the two characters is less than or equal to a preset With the second distance threshold, it is determined that the two characters belong to the same character sequence; when the writing direction in the image to be processed is the vertical direction, if any two characters belong to the same column of characters, and the difference between the two characters is If the distance is less than or equal to the preset third distance threshold, it is determined that the two characters belong to the same character sequence.
  • the writing direction may represent the positional relationship between two adjacent characters. For example, if the positional relationship between two adjacent characters is the left-right relationship, the writing direction is the horizontal direction; if the positional relationship between the two adjacent characters is the up-down relationship, the writing direction is the vertical direction.
  • the boundary line of the first character sequence represents the boundary line between the area where the first character sequence is located and the area where the non-first character sequence is located, wherein the area where the non-first character sequence is located may be a background area (ie non-character region) and/or other character sequences.
  • the boundary line of the first character sequence may be a straight line or a curved line, which is not limited herein.
  • the prediction parameter of any one boundary line of the first character sequence may represent the parameter of the predicted boundary line.
  • the prediction parameter of any boundary line of the first character sequence may represent the prediction parameter of the line equation corresponding to the boundary line. Based on the prediction parameters of the line equation corresponding to the boundary line, the position of the boundary line can be determined.
  • the boundary line of the first character sequence when the boundary line of the first character sequence is a straight line, the number of boundary lines of the first character sequence is at least three, and multiple boundary lines of the first character sequence may enclose the first character The bounding box of the sequence.
  • the bounding box of the first character sequence may be a polygon, and accordingly, the number of boundary lines of the first character sequence may correspond to the number of sides of the bounding box of the first character sequence. For example, if the bounding box of the first character sequence is a quadrilateral, the number of boundary lines of the first character sequence is 4.
  • the bounding box of the first character sequence may also be a pentagon, a triangle, etc., which is not limited herein.
  • the plurality of boundary lines of the first character sequence include an upper boundary line, a right boundary line, a lower boundary line, and a left boundary line of the first character sequence.
  • the bounding box of the first character sequence is a quadrilateral, and the number of boundary lines of the first character sequence is four.
  • the upper boundary line of the first character sequence may indicate that the direction of the characters in the first character sequence is used as a reference for dividing the area where the first character sequence is located and the area where the non-first character sequence above the first character sequence is located.
  • Demarcation line the right boundary line of the first character sequence, which can be used to demarcate the area where the first character sequence is located and the area where the non-first character sequence to the right of the first character sequence is located with reference to the direction of the characters in the first character sequence.
  • Demarcation line the left boundary line of the first character sequence, which can be used to divide the area where the first character sequence is located and the area where the non-first character sequence to the left of the first character sequence is located with reference to the direction of the characters in the first character sequence. dividing line. Since the shape of the character sequence is a quadrilateral in most cases, according to this embodiment, it is helpful to obtain more accurate position information of the bounding box of the character sequence in most cases.
  • the multiple boundary lines of the first character sequence in the image to be processed are predicted respectively, and the prediction parameters of the multiple boundary lines of the first character sequence are obtained, which may include: the upper part of the first character sequence in the image to be processed Predict the boundary line to obtain the prediction parameters of the straight line equation corresponding to the upper boundary line of the first character sequence; predict the right boundary line of the first character sequence in the image to be processed to obtain the prediction of the straight line equation corresponding to the right boundary line of the first character sequence parameter; predict the lower boundary line of the first character sequence in the image to be processed, and obtain the prediction parameters of the straight line equation corresponding to the lower boundary line of the first character sequence; predict the left boundary line of the first character sequence in the image to be processed, and obtain the first character The predicted parameters of the line equation corresponding to the left boundary line of the series.
  • step S12 the position information of the vertices of the bounding box of the first character sequence is determined according to the prediction parameters of the plurality of boundary lines of the first character sequence.
  • the intersection of the plurality of boundary lines of the first character sequence can be obtained, and the intersection of the plurality of boundary lines of the first character sequence can be calculated.
  • Position information which is the position information of the vertices of the bounding box of the first character sequence.
  • the multiple boundary lines of the first character sequence include an upper boundary line, a right boundary line, a lower boundary line and a left boundary line of the first character sequence; according to the prediction parameters of the line equation corresponding to the upper boundary line of the first character sequence and the first character
  • the prediction parameters of the straight line equation corresponding to the right boundary line of the sequence can obtain the intersection of the upper boundary line of the first character sequence and the right boundary line of the first character sequence, and the upper boundary line of the first character sequence and the first character sequence can be obtained.
  • the position information of the intersection of the right boundary line is used as the position information of the upper right corner vertex of the bounding box of the first character sequence; according to the prediction parameter of the line equation corresponding to the right boundary line of the first character sequence and the line equation corresponding to the lower boundary line of the first character sequence
  • the prediction parameters of The position information of the vertex at the lower right corner of the bounding box of the character sequence; according to the prediction parameter of the straight line equation corresponding to the lower boundary line of the first character sequence and the prediction parameter of the straight line equation corresponding to the left border line of the first character sequence, the first character sequence can be obtained
  • the intersection of the lower boundary line of the first character sequence and the left boundary line of the first character sequence, and the position information of the intersection of the lower boundary line of the first character sequence and the left boundary line of the first character sequence can be used as the lower left corner vertex of the bounding box of the first character sequence.
  • Position information according to the prediction parameter of the straight line equation corresponding to the left boundary line of the first character sequence and the prediction parameter of the straight line equation corresponding to the upper boundary line of the first character sequence, the left boundary line of the first character sequence and the first character sequence can be obtained.
  • the intersection point of the upper boundary line, and the position information of the intersection point of the left boundary line of the first character sequence and the upper boundary line of the first character sequence can be used as the position information of the upper left corner vertex of the bounding box of the first character sequence.
  • the position information of the vertices of the bounding box of the first character sequence may be represented by the coordinates of the vertices of the bounding box of the first character sequence.
  • the location information of the vertices of the bounding box of the first character sequence may include the coordinates of the upper left vertex, the upper right vertex, the lower right vertex and the lower left vertex of the bounding box of the first character sequence.
  • step S13 the position information of the bounding box of the first character sequence is determined according to the position information of the vertices of the bounding box of the first character sequence.
  • the position information of the vertices of the bounding box of the first character sequence may be used as the position information of the bounding box of the first character sequence.
  • the location information of the bounding box of the first character sequence may include coordinates of respective vertices of the bounding box of the first character sequence.
  • the bounding box of the first character sequence is a rectangle
  • the coordinates of any vertex of the bounding box of the first character sequence and the side lengths of two sides connected to the vertex can also be used to represent the first character sequence
  • the position information of the bounding box is not limited here.
  • FIG. 2 is a schematic diagram of a system architecture to which a character detection method according to an embodiment of the present disclosure can be applied; as shown in FIG. 2 , the system architecture includes: an image acquisition terminal 201 , a network 202 and a location determination terminal 203 .
  • the image acquisition terminal 201 and the position determination terminal 203 establish a communication connection through the network 202, the image acquisition terminal 201 reports the image to be processed to the position determination terminal 203 through the network 202, and the position determination terminal 203 responds to the received image.
  • the image to be processed, and the multiple boundary lines of the first character sequence in the image to be processed are respectively predicted to obtain the prediction parameters of the multiple boundary lines of the first character sequence, and the prediction parameters based on the multiple boundary lines of the first character sequence are obtained.
  • determine the position information of the vertices of the bounding box of the first character sequence determine the position information of the bounding box of the first character sequence according to the position information of the vertices of the bounding box of the first character sequence.
  • the location determination terminal 203 uploads the determined location information to the network 202 , and sends the determined location information to the image acquisition terminal 201 through the network 202 .
  • the image acquisition terminal 201 may include an image acquisition device, and the location determination terminal 203 may include a visual processing device or a remote server with visual information processing capability.
  • the network 202 can be wired or wireless.
  • the image acquisition terminal 201 can be connected to the visual processing device through a wired connection, such as data communication through a bus; when it is determined that the location terminal 203 is a remote server, the image acquisition terminal 201 can perform data interaction with a remote server through a wireless network.
  • the image acquisition terminal 201 may be a vision processing device with an image acquisition module, which is specifically implemented as a host with a camera.
  • the character detection method of the embodiment of the present disclosure may be executed by the image acquisition terminal 201 , and the above-mentioned system architecture may not include the network 202 and the location determination terminal 203 .
  • the prediction parameters of the multiple boundary lines of the first character sequence are obtained by respectively predicting multiple boundary lines of the first character sequence in the image to be processed.
  • the prediction parameter determines the position information of the vertices of the bounding box of the first character sequence, and determines the position information of the bounding box of the first character sequence according to the position information of the vertices of the bounding box of the first character sequence.
  • the polygon (such as quadrilateral) bounding box is disassembled into multiple (such as four) independent boundary lines, and each independent boundary line is detected separately, so that the detection of each boundary line will not be disturbed by two different vertices , which can improve the accuracy of character detection.
  • the multiple boundary lines of the first character sequence in the image to be processed are respectively predicted to obtain the prediction parameters of the multiple boundary lines of the first character sequence, including: based on the image to be processed, for A first feature point related to a character sequence, respectively predict the parameters of the multiple boundary lines of the first character sequence corresponding to the first feature point; according to the parameters of the multiple boundary lines of the first character sequence corresponding to the first feature point, determine Prediction parameters for multiple boundary lines of the first character sequence.
  • the first feature points represent feature points associated with the first character sequence.
  • the feature points may represent points where the gray value of the image changes drastically and/or points with large curvature on the edge of the image (ie, the intersection of two edges).
  • the number of the first feature points may be multiple, of course, may also be one, which is not limited here.
  • the prediction parameter of the boundary line is determined according to the parameters of the boundary line corresponding to each of the first feature points. For example, the parameters of the boundary line corresponding to each of the first feature points can be regressed to obtain the predicted parameters of the boundary line.
  • the multiple boundary lines of the first character sequence may also be determined based on all pixel points related to the first character sequence (not limited to the first feature points related to the first character sequence).
  • the prediction parameters are not limited here.
  • the method further includes: predicting the probability that the position of the pixel in the image to be processed belongs to the character; and determining the first feature point according to the probability that the position of the pixel in the image to be processed belongs to the character.
  • the probability that each pixel in the image to be processed belongs to a character can be predicted.
  • the area occupied by each character sequence in the image to be processed can be preliminarily determined.
  • the first feature point may be determined according to the preliminarily determined feature points in the area occupied by the first character sequence.
  • all or part of the feature points in the area occupied by the initially determined first character sequence may be determined as the first feature points.
  • the first feature point can be accurately determined.
  • the first feature point associated with the character sequence Predicting the parameters of the boundary line of the first character sequence based on a feature point thus determined helps to further improve the efficiency and accuracy of obtaining the prediction parameters of the boundary line.
  • the feature points in the image to be processed may also be used as the first feature points respectively, without the need to predict the character probability.
  • the feature points in the image to be processed can be respectively used as the first feature points.
  • the parameters of the plurality of boundary lines of the first character sequence corresponding to the first feature point include: distance parameters of the plurality of boundary lines of the first character sequence in the polar coordinate system corresponding to the first feature point and angle parameters, wherein the polar coordinate system corresponding to the first feature point represents a polar coordinate system with the first feature point as a pole.
  • the polar coordinate system corresponding to the first feature point may use the axis whose pole points to the positive direction of the x-axis as the polar axis.
  • those skilled in the art can flexibly set the polar axis according to actual application scenario requirements, which is not limited here.
  • the distance parameter of any boundary line of the first character sequence in the polar coordinate system corresponding to the first feature point can represent the distance between the first feature point and the boundary line in the polar coordinate system corresponding to the first feature point
  • the minimum distance between that is, it can represent the length of the vertical line segment from the first feature point to the boundary line in the polar coordinate system corresponding to the first feature point; any boundary line of the first character sequence corresponds to the first feature point.
  • the angle parameter in the polar coordinate system of the The included angle between wherein the vertical point on the boundary line represents the intersection point of the vertical line segment from the first feature point to the boundary line and the boundary line.
  • can represent the distance parameter of any boundary line of the first character sequence in the polar coordinate system corresponding to the first feature point, and ⁇ can represent the polar coordinate corresponding to the first feature point of any boundary line of the first character sequence The angle parameter under the system.
  • FIG. 3 is a schematic diagram showing the distance parameters and angle parameters of the four boundary lines of the first character sequence in a polar coordinate system corresponding to a certain first feature point.
  • the distance parameter of the upper boundary line of the first character sequence in the polar coordinate system corresponding to the first feature point is ⁇ 1
  • the angle parameter is ⁇ 1
  • the right boundary line of the first character sequence is in the first character sequence.
  • the distance parameter in the polar coordinate system corresponding to the feature point is ⁇ 2 , and the angle parameter is ⁇ 2 ; the distance parameter of the lower boundary line of the first character sequence in the polar coordinate system corresponding to the first feature point is ⁇ 3 , and the angle parameter is ⁇ 3 ; the distance parameter of the left boundary line of the first character sequence in the polar coordinate system corresponding to the first feature point is ⁇ 4 , and the angle parameter is ⁇ 4 .
  • determining the prediction parameters of the plurality of boundary lines of the first character sequence according to the parameters corresponding to the first feature points of the plurality of boundary lines of the first character sequence includes: placing the plurality of boundary lines of the first character sequence on the first The distance parameters and angle parameters in the polar coordinate system corresponding to the feature points are mapped to the Cartesian coordinate system, and the parameters of the multiple boundary lines of the first character sequence corresponding to the first feature point in the Cartesian coordinate system are obtained; according to the first character The multiple boundary lines of the sequence correspond to the parameters of the first feature point in the Cartesian coordinate system, and the prediction parameters of the multiple boundary lines of the first character sequence are determined.
  • the multiple first feature points correspond to different polar coordinate systems, wherein the polar coordinate system corresponding to any first feature point is based on the first feature point.
  • Feature points are poles. Therefore, for any boundary line of the first character sequence, when regressing the distance parameter and angle parameter of the boundary line in the polar coordinate system corresponding to the plurality of first feature points to obtain the prediction parameter of the boundary line, the prediction parameter of the boundary line can be obtained by first The distance parameters and angle parameters of the boundary line in the polar coordinate system corresponding to the plurality of first feature points are mapped to the same Cartesian coordinate system to obtain the boundary line corresponding to the plurality of feature points in the Cartesian coordinate system.
  • the multiple boundary lines of the first character sequence are obtained in Cartesian coordinates.
  • the parameters corresponding to the first feature point in the coordinate system, and according to the parameters corresponding to the first feature point of the multiple boundary lines of the first character sequence in the Cartesian coordinate system, the prediction of multiple boundary lines of the first character sequence is determined parameters, so that the predicted parameters of the boundary line can be obtained by regression based on the parameters in different polar coordinate systems.
  • 1 ⁇ k ⁇ 4, 1 ⁇ l ⁇ 4, k and l are integers.
  • (x 12 , y 12 ) may represent the coordinates of the upper right vertex of the bounding box of the first character sequence
  • (x 23 , y 23 ) may represent the coordinates of the lower right vertex of the bounding box of the first character sequence
  • (x 34 , y 34 ) may represent the coordinates of the lower left corner vertex of the bounding box of the first character sequence
  • (x 41 , y 41 ) may represent the coordinates of the upper left corner vertex of the bounding box of the first character sequence.
  • the parameters of any boundary line of the first character sequence corresponding to the first feature point may include parameters of the boundary line predicted based on the first feature point in a Cartesian coordinate system, which is not limited herein.
  • the pre-trained neural network respectively predicts parameters corresponding to the first feature points of the plurality of boundary lines of the first character sequence for the first feature points related to the first character sequence via the neural network.
  • the pre-trained neural network respectively predicts the parameters of the multiple boundary lines of the first character sequence corresponding to the first feature points, thereby improving the speed of predicting parameters and accuracy.
  • the parameters corresponding to the first feature points of the multiple boundary lines of the first character sequence can also be predicted by using a pre-established model, function, etc., which is not limited here.
  • the probability that the position of the pixel in the image to be processed belongs to the character can also be predicted through the neural network.
  • the pre-trained neural network is used to predict the probability that the position of the pixel in the image to be processed belongs to the character, thereby improving the speed of predicting the probability that the position of the pixel belongs to the character, and improving the accuracy of the predicted probability.
  • a pre-established model, function, etc. can also be used to predict the probability that the location of the pixel in the image to be processed belongs to a character, which is not limited here.
  • the training image before inputting the image to be processed into the pre-trained neural network, may also be input into the neural network, and through the neural network, for the second feature point related to the second character sequence in the training image, Predicting the predicted values of the parameters of the second feature point corresponding to the multiple boundary lines of the second character sequence respectively; according to the predicted values of the parameters of the second feature point corresponding to the multiple boundary lines of the second character sequence, and the second character sequence
  • the multiple boundary lines correspond to the true values of the parameters of the second feature point, training the neural network.
  • a bounding box of a character is constructed by regressing four vertices of a quadrilateral. Since the vertex is actually formed by the intersection of two adjacent edges, the regression of each vertex will affect the two edges, therefore, each edge will be disturbed by two different vertices, thus affecting the learning efficiency and detection effect of the network.
  • the polygon (such as quadrilateral) bounding box of the character sequence into multiple (such as four) independent boundary lines, each independent boundary line is independently detected, so that no The training disturbance is brought to the neural network due to the regression vertex, thereby improving the learning efficiency and detection effect of the neural network.
  • the neural network trained according to this embodiment can learn the ability to accurately predict the parameters of the boundary line of the character sequence.
  • the parameters of the plurality of boundary lines of the second character sequence corresponding to the second feature points include: distance parameters of the plurality of boundary lines of the second character sequence in the polar coordinate system corresponding to the second feature points and angle parameters, wherein, the polar coordinate system corresponding to the second feature point represents a polar coordinate system with the second feature point as a pole; according to the predicted values of the parameters of the second feature point corresponding to multiple boundary lines of the second character sequence, And multiple boundary lines of the second character sequence correspond to the true value of the parameter of the second feature point, training the neural network, comprising: according to the multiple boundary lines of the second character sequence corresponding to the predicted value of the distance parameter of the second feature point , and the multiple boundary lines of the second character sequence correspond to the true value of the distance parameter of the second feature point, train the neural network; and/or, according to the multiple boundary lines of the second character sequence correspond to the angle of the second feature point
  • the correlation between the learning parameters and the parameters is reduced, and the parameters are given the actual physical meaning in the image, which is beneficial to network learning.
  • the neural network by training the neural network to learn to detect the distance and angle of each boundary line of the character sequence corresponding to the feature point, the detection of the boundary lines can not interfere with each other, so that the learning efficiency and detection effect of the neural network can be improved.
  • the plurality of boundary lines according to the second character sequence correspond to the predicted value of the distance parameter of the second feature point
  • the plurality of boundary lines of the second character sequence correspond to the true value of the distance parameter of the second feature point
  • training the neural network including: for any boundary line in the plurality of boundary lines of the second character sequence, according to the boundary line corresponding to the distance parameter of the second feature point between the true value and the predicted value of the smaller value and the larger value The ratio of values to train the neural network.
  • the loss function L ⁇ corresponding to the distance parameter can be obtained by using formula (7):
  • N represents the number of second feature points
  • ⁇ i represents the predicted value of the distance parameter of the boundary line corresponding to the second feature point i
  • the loss function L ⁇ corresponding to the distance parameter can be called the Intersection Over Union (IOU) loss function.
  • the smaller value and the larger value trains the neural network, which can normalize the distance parameters of different sizes in different application scenarios, which can help to perform multi-scale character detection, that is, it is helpful for character detection at different scales. achieve higher accuracy.
  • the neural network can also be trained according to the search of the true value and the predicted value of the distance parameter corresponding to the boundary line to the second feature point, It is not limited here.
  • the plurality of boundary lines of the second character sequence correspond to the predicted value of the angle parameter of the second feature point
  • the plurality of boundary lines of the second character sequence correspond to the true value of the angle parameter of the second feature point
  • training the neural network including: for any one of the multiple boundary lines of the second character sequence, determining the absolute value of the difference between the true value and the predicted value of the angle parameter of the boundary line corresponding to the second feature point; according to The absolute value of the sine of half the angle, training the neural network.
  • the half angle of the absolute value is equal to 0.5 times the absolute value.
  • the difference between the predicted value and the true value of the angle parameter of the boundary line corresponding to any second feature point is 90° or -90°
  • the absolute value of the difference between the true value and the predicted value of the angle parameter of the boundary line corresponding to the second feature point is 90°
  • the half angle of the absolute value is 45°.
  • the loss function L ⁇ corresponding to the angle parameter can be obtained by using formula (8):
  • N represents the number of second feature points
  • ⁇ i represents the predicted value of the angle parameter of the boundary line corresponding to the second feature point i
  • ⁇ i represents the predicted value of the angle parameter of the boundary line corresponding to the second feature point i
  • ⁇ i represents the predicted value of the angle parameter of the boundary line corresponding to the second feature point i
  • ⁇ i represents the predicted value of the angle parameter of the boundary line corresponding to the second feature point i
  • the value range of the true value and the predicted value of the angle parameter of the boundary line corresponding to any second feature point may be [0, 2 ⁇ ], which is 0 ⁇ i ⁇ 2 ⁇ . In polar coordinates, however, 0 coincides with 2 ⁇ .
  • determine the absolute value of the difference between the true value and the predicted value of the angle parameter of the boundary line corresponding to the second feature point and determine the absolute value of the difference according to the half angle of the absolute value.
  • the sine value of trains the neural network, so that the learning of the neural network will not be disturbed due to the confusion of 0 and 2 ⁇ , thereby improving the learning efficiency and detection effect of the neural network.
  • the second feature points include feature points in an effective area corresponding to the second character area.
  • the second feature points may only include feature points in the valid region corresponding to the second character region, and do not include feature points outside the valid region corresponding to the second character region.
  • the predicted value of the distance parameter between the feature point and a certain boundary line of the real bounding box is 9, and the real value is 10, then the error is 10%;
  • Feature point the predicted value of the distance parameter between the feature point and a certain boundary line of the real bounding box is 1, and the real value is 2, then the error is 50%. Therefore, by ignoring feature points outside the effective region, it helps to reduce the network burden.
  • all the feature points in the real bounding box of the second character sequence are not limited here.
  • the character detection method provided by the embodiment of the present disclosure further includes: acquiring position information of the real bounding box of the second character sequence; reducing the real bounding box according to the position information of the real bounding box and a preset ratio to obtain the first The valid region corresponding to the two-character sequence.
  • the range of the valid region corresponding to the second character sequence is within the real bounding box of the second character sequence, and the size of the valid region corresponding to the second character sequence is smaller than the size of the real bounding box of the second character sequence.
  • FIG. 4 shows a schematic diagram of the real bounding box 31 and the effective area 32 of the second character area. Based on this example, the effective area corresponding to the second character sequence is obtained, and the neural network is trained based on the feature points in the effective area corresponding to the second character sequence, which helps to reduce the network burden.
  • reducing the real bounding box according to the position information of the real bounding box and the preset ratio to obtain an effective area corresponding to the second character sequence including: determining the anchor point of the real bounding box according to the position information of the real bounding box, wherein, The anchor point of the real bounding box is the intersection of the diagonal lines of the real bounding box; according to the position information of the real bounding box, the position information of the anchor point of the real bounding box, and the preset scale, reduce the real bounding box to obtain the second character sequence
  • the corresponding valid area where the ratio of the first distance to the second distance is equal to the preset ratio, the first distance represents the distance between the first vertex of the valid area and the anchor point, and the second distance represents the first vertex in the real bounding box
  • the distance between the corresponding vertex and the anchor point, the first vertex represents any vertex of the valid area.
  • the preset ratio may be 0.35, 0.4, 0.3, etc., which is not limited herein.
  • the vertex corresponding to the first vertex in the real bounding box is the upper left vertex of the real bounding box, and so on.
  • the effective area corresponding to the second character sequence is obtained, and the neural network is trained based on the feature points in the effective area corresponding to the second character sequence, which helps to improve the learning efficiency and prediction accuracy of the neural network.
  • the four vertices of the real bounding box of the second character sequence can be sorted clockwise, (x 1 , y 1 ) can represent the upper left corner vertex of the real bounding box of the second character sequence, (x 2 , y 2 ) can represent the upper right corner vertex of the real bounding box of the second character sequence, (x 3 , y 3 ) can represent the lower right corner vertex of the real bounding box of the second character sequence, (x 4 , y 4 ) can represent the second character sequence The bottom-left vertex of the ground-truth bounding box.
  • any boundary line of the true bounding box of the second character sequence corresponds to the true value of the distance parameter of the second feature point and the truth value of the angle parameter Equations (9) to (16) can be used to determine:
  • q represents the true value of the vertical vector from the second feature point to the boundary line
  • q is parallel to the vertical line from the second feature point to the boundary line
  • BC>0 means q below the polar axis.
  • the method further includes: predicting the probability that the position of the pixel in the training image belongs to the character via the neural network; according to the probability that the position of the pixel in the training image belongs to the character, and the position of the pixel in the training image Labeled data belonging to characters to train a neural network.
  • the neural network can be a multi-task learning model, learning character segmentation (ie, learning to detect the probability that a pixel in an image belongs to a character) and parameter prediction of boundary lines.
  • the neural network can be made to learn the ability to predict the probability that the position of the pixel belongs to the character.
  • training a neural network according to the probability that the position of the pixel in the training image belongs to the character, and the labeled data of the position of the pixel in the training image belonging to the character includes: according to the pixel in the effective area corresponding to the second character sequence The probability that the position belongs to the character, and the labeled data of the position of the pixel in the effective area belonging to the character, train the neural network.
  • the loss function corresponding to character segmentation can be obtained by using formula (17):
  • the neural network can be trained by training the neural network according to the probability that the position of the pixel in the effective area corresponding to the second character sequence belongs to the character, and the labeled data that the position of the pixel in the effective area belongs to the character. It can improve the ability of character segmentation and improve the efficiency of neural network learning character segmentation.
  • a neural network can be trained with a loss function L as shown in Equation (18):
  • L cls represents the loss function corresponding to character segmentation
  • L ⁇ represents the loss function corresponding to the distance parameter
  • L ⁇ represents the loss function corresponding to the angle parameter
  • ⁇ 1 represents the weight corresponding to L cls
  • ⁇ 2 represents the weight corresponding to L ⁇
  • ⁇ 3 represents the weight corresponding to L ⁇
  • the neural network may include at least one channel reduction module, so as to reduce the calculation amount of the neural network and improve the speed of the boundary line detection by the neural network.
  • the neural network may include at least one feature aggregation module, so as to make full use of multi-scale features and improve the accuracy of boundary line detection performed by the neural network.
  • FIG. 5 shows a schematic diagram of an application scenario of an embodiment of the present disclosure.
  • the neural network can be an encoder-decoder structure.
  • 506 denotes a channel reduction module.
  • the channel reduction module 506 may be implemented using 1x1 convolutions.
  • the channel reduction module 506 can also be implemented by using 3 ⁇ 3 convolution, etc., which is not limited here.
  • 507 represents a feature aggregation module.
  • the feature aggregation module 507 may be used to perform at least one operation of multiplying, adding, concat (merging) and the like on the input feature maps. For example, as shown in FIG.
  • the feature aggregation module 507 can double the size (width and height) of the input feature map, and then perform concat, 1 ⁇ 1 concat, 1 ⁇ 1 based on the enlarged feature map and the output of the channel reduction module 506 Non-linear convolution and 3 ⁇ 3 non-linear convolution.
  • the neural network can use the skeleton network to extract basic features, and continuously integrate the features of different scales through the feature aggregation module, and finally obtain the feature map of 9 channels, one of which is the text confidence level 504 (that is, the input image in the The probability of each pixel inputting a character), the other 8 channels are the distance parameters and angle parameters of the straight line equation of the four boundary lines, that is, the parameters 503 of the four boundary lines.
  • the straight line equation of each boundary line of the three character sequences in the Cartesian coordinate system can be obtained.
  • the straight line equation of the four boundary lines is visualized in the dashed box 505 on the right side of FIG. 5 , wherein the upper boundary line, the right boundary line, the lower boundary line and the left boundary line of the 3 character sequences are sequentially shown from top to bottom.
  • the bounding box 502 of the 3 character sequences can be obtained, as shown in the lower left of FIG. 5 .
  • the character detection method provided by the embodiments of the present disclosure can be applied to character detection in general natural scenarios, as well as real-time text translation, document recognition, certificate recognition (such as ID cards, bank cards), license plate recognition, and other application scenarios, which are not limited here. .
  • characters in the image will appear as irregular quadrilaterals due to camera perspective distortion.
  • the boundary of the character can be accurately detected, so that the shape of the character can be further corrected, which is beneficial to the subsequent character recognition.
  • some character carriers also exhibit the above phenomenon, such as rigid ID cards, bank cards, and license plates.
  • the present disclosure also provides a character detection device, an electronic device, a storage medium, and a program, all of which can be used to implement any character detection method provided by the present disclosure.
  • a character detection device an electronic device, a storage medium, and a program, all of which can be used to implement any character detection method provided by the present disclosure.
  • FIG. 6 shows a block diagram of a character detection apparatus provided by an embodiment of the present disclosure.
  • the character detection device 6 includes:
  • the first prediction module 61 is configured to respectively predict multiple boundary lines of the first character sequence in the image to be processed, and obtain prediction parameters of the multiple boundary lines of the first character sequence, wherein the The boundary line represents the dividing line between the area where the first character sequence is located and the area not where the first character sequence is located;
  • a first determination module 62 configured to determine the position information of the vertices of the bounding box of the first character sequence according to the prediction parameters of a plurality of boundary lines of the first character sequence;
  • the second determining module 63 is configured to determine the position information of the bounding box of the first character sequence according to the position information of the vertices of the bounding box of the first character sequence.
  • the first prediction module 61 is further configured to, based on the to-be-processed image, respectively predict a plurality of pieces of the first character sequence for the first feature points related to the first character sequence
  • the boundary line corresponds to the parameter of the first feature point
  • the prediction parameters of the plurality of boundary lines of the first character sequence are determined according to the parameters of the plurality of boundary lines of the first character sequence corresponding to the first feature points.
  • the character detection device 6 further includes:
  • a second prediction module configured to predict the probability that the position of the pixel in the to-be-processed image belongs to a character
  • the third determining module is configured to determine the first feature point according to the probability that the position of the pixel in the image to be processed belongs to a character.
  • the parameters of the plurality of boundary lines of the first character sequence corresponding to the first feature point include:
  • the first prediction module 61 is further configured to calculate distance parameters and angle parameters of multiple boundary lines of the first character sequence in the polar coordinate system corresponding to the first feature point Map to a Cartesian coordinate system, and obtain the parameters corresponding to the first feature point of a plurality of boundary lines of the first character sequence under the Cartesian coordinate system;
  • the prediction parameters of the plurality of boundary lines of the first character sequence are determined.
  • the plurality of boundary lines of the first character sequence include an upper boundary line, a right boundary line, a lower boundary line and a left boundary line of the first character sequence.
  • the first prediction module 61 is further configured to input the image to be processed into a pre-trained neural network, and for the first feature point related to the first character sequence via the neural network, A plurality of boundary lines of the first character sequence are respectively predicted to correspond to parameters of the first feature point.
  • the character detection device 6 further includes:
  • the third prediction module is configured to predict the probability that the position of the pixel in the image to be processed belongs to the character through the neural network.
  • the character detection device 6 further includes:
  • the fourth prediction module is configured to input the training image into the neural network, and through the neural network, for the second feature points related to the second character sequence in the training image, respectively predict the number of the second character sequence.
  • a boundary line corresponds to the predicted value of the parameter of the second feature point;
  • the first training module is configured to correspond to the predicted value of the parameter of the second feature point according to the plurality of boundary lines of the second character sequence, and the plurality of boundary lines of the second character sequence correspond to the first The true values of the parameters of the two feature points, train the neural network.
  • the parameters of the plurality of boundary lines of the second character sequence corresponding to the second feature point include: the plurality of boundary lines of the second character sequence are at the second feature point The distance parameter and the angle parameter under the corresponding polar coordinate system, wherein, the polar coordinate system corresponding to the second feature point represents a polar coordinate system with the second feature point as a pole;
  • the first training module is configured to correspond to the predicted value of the distance parameter of the second feature point according to the plurality of boundary lines of the second character sequence, and the plurality of boundary lines of the second character sequence correspond to the predicted value of the distance parameter of the second feature point.
  • the true value of the distance parameter of the second feature point is used to train the neural network;
  • the first training module is configured to, for any one of a plurality of boundary lines of the second character sequence, according to the boundary line corresponding to the second feature point
  • the ratio of the smaller to larger of the true and predicted values of the distance parameter trains the neural network.
  • the first training module is configured to, for any one of a plurality of boundary lines of the second character sequence, determine that the boundary line corresponds to the second feature point.
  • the neural network is trained according to the sine of the half angle of the absolute value.
  • the second feature points include feature points in an effective area corresponding to the second character area.
  • the apparatus further includes:
  • a fifth prediction module configured to predict the probability that the position of the pixel in the training image belongs to the character via the neural network
  • the second training module is configured to train the neural network according to the probability that the position of the pixel in the training image belongs to a character, and the labeled data that the position of the pixel in the training image belongs to the character.
  • the second training module is further configured to, according to the probability that the position of the pixel in the effective area corresponding to the second character sequence belongs to the character, and the position of the pixel in the effective area belongs to Annotated data of characters to train the neural network.
  • the character detection device 6 further includes:
  • an acquisition module configured to acquire the position information of the real bounding box of the second character sequence
  • the shrinking module is configured to shrink the real bounding box according to the position information of the real bounding box and a preset ratio to obtain an effective area corresponding to the second character sequence.
  • the reduction module is further configured to determine the anchor point of the real bounding box according to the position information of the real bounding box, wherein the anchor point of the real bounding box is the real bounding box the intersection of the diagonals of the bounding box;
  • the real bounding box is reduced to obtain the effective area corresponding to the second character sequence, wherein the first The ratio of the distance to the second distance is equal to the preset ratio, the first distance represents the distance between the first vertex of the effective area and the anchor point, and the second distance represents the The distance between the vertex corresponding to the first vertex and the anchor point, where the first vertex represents any vertex of the effective area.
  • the prediction parameters of the multiple boundary lines of the first character sequence are obtained by respectively predicting multiple boundary lines of the first character sequence in the image to be processed.
  • the prediction parameter determines the position information of the vertices of the bounding box of the first character sequence, and determines the position information of the bounding box of the first character sequence according to the position information of the vertices of the bounding box of the first character sequence.
  • the polygon (such as quadrilateral) bounding box is disassembled into multiple (such as four) independent boundary lines, and each independent boundary line is detected separately, so that the detection of each boundary line will not be disturbed by two different vertices , which can improve the accuracy of character detection.
  • the functions or modules included in the character detection apparatus 6 provided in the embodiments of the present disclosure may be configured to execute the methods described in the above method embodiments, and the specific implementation and technical effects thereof may refer to the above method embodiments. description, which will not be repeated here.
  • Embodiments of the present disclosure further provide a computer-readable storage medium, on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the foregoing method is implemented.
  • the computer-readable storage medium may be a non-volatile computer-readable storage medium, or may be a volatile computer-readable storage medium.
  • An embodiment of the present disclosure further provides a computer program, including computer-readable code, when the computer-readable code is executed in an electronic device, a processor in the electronic device executes the character detection method provided by any of the foregoing embodiments.
  • Embodiments of the present disclosure further provide another computer program product for storing computer-readable instructions, which, when executed, cause the computer to perform the operations of the character detection method provided by any of the foregoing embodiments.
  • Embodiments of the present disclosure further provide an electronic device, including: one or more processors; a memory for storing executable instructions; wherein the one or more processors are configured to call the executable instructions stored in the memory to execute The character detection method provided by any of the above embodiments.
  • the electronic device may be provided as a terminal, server or other form of device.
  • FIG. 7 shows a block diagram of an electronic device 800 provided by an embodiment of the present disclosure.
  • electronic device 800 may be a mobile phone, computer, digital broadcast terminal, messaging device, game console, tablet device, medical device, fitness device, personal digital assistant, etc. terminal.
  • an electronic device 800 may include one or more of the following components: a processing component 802, a memory 804, a power supply component 806, a multimedia component 808, an audio component 810, an Input/Output (I/O) interface 812, Sensor assembly 814 , and communication assembly 816 .
  • the processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations.
  • the processing component 802 can include one or more processors 820 to execute instructions to perform all or some of the steps of the methods described above.
  • processing component 802 may include one or more modules that facilitate interaction between processing component 802 and other components.
  • processing component 802 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802.
  • Memory 804 is configured to store various types of data to support operation at electronic device 800 . Examples of such data include instructions for any application or method operating on electronic device 800, contact data, phonebook data, messages, pictures, videos, and the like.
  • the memory 804 may be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random-Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (Electrically Erasable) Erasable Programmable read only memory, EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), Read Only Memory (Read-Only Memory) , ROM), magnetic memory, flash memory, magnetic disk or optical disk.
  • SRAM Static Random-Access Memory
  • EEPROM Electrically Erasable Programmable Read-Only Memory
  • EPROM Erasable Programmable Read Only Memory
  • PROM Programmable Read Only Memory
  • Read-Only Memory Read-Only Memory
  • Power supply assembly 806 provides power to various components of electronic device 800 .
  • Power supply components 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 800 .
  • Multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user.
  • the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user.
  • the touch panel includes one or more touch sensors to sense touch, swipe, and gestures on the touch panel. The touch sensor may not only sense the boundaries of a touch or swipe action, but also detect the duration and pressure associated with the touch or swipe action.
  • the multimedia component 808 includes a front-facing camera and/or a rear-facing camera. When the electronic device 800 is in an operation mode, such as a shooting mode or a video mode, the front camera and/or the rear camera may receive external multimedia data. Each of the front and rear cameras can be a fixed optical lens system or have focal length and optical zoom capability.
  • Audio component 810 is configured to output and/or input audio signals.
  • the audio component 810 includes a microphone (Microphone, MIC) configured to receive external audio signals when the electronic device 800 is in an operating mode, such as a calling mode, a recording mode, and a voice recognition mode.
  • the received audio signal may be further stored in memory 804 or transmitted via communication component 816 .
  • audio component 810 also includes a speaker for outputting audio signals.
  • the I/O interface 812 provides an interface between the processing component 802 and a peripheral interface module, which may be a keyboard, a click wheel, a button, or the like. These buttons may include, but are not limited to: home button, volume buttons, start button, and lock button.
  • Sensor assembly 814 includes one or more sensors for providing status assessment of various aspects of electronic device 800 .
  • the sensor assembly 814 can detect the on/off state of the electronic device 800, the relative positioning of the components, such as the display and the keypad of the electronic device 800, the sensor assembly 814 can also detect the electronic device 800 or one of the electronic device 800 Changes in the position of components, presence or absence of user contact with the electronic device 800 , orientation or acceleration/deceleration of the electronic device 800 and changes in the temperature of the electronic device 800 .
  • Sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects in the absence of any physical contact.
  • Sensor assembly 814 may also include a light sensor, such as a Complementary Metal Oxide Semiconductor (CMOS) or Charge-coupled Device (CCD) image sensor, for use in imaging applications.
  • CMOS Complementary Metal Oxide Semiconductor
  • CCD Charge-coupled Device
  • the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
  • Communication component 816 is configured to facilitate wired or wireless communication between electronic device 800 and other devices.
  • the electronic device 800 can access a wireless network based on a communication standard, such as a wireless network (Wi-Fi), a second-generation mobile communication technology (2-Generation, 2G), a third-generation mobile communication technology (3rd-Generation, 3G), The fourth generation mobile communication technology (4-Generation, 4G)/, the long term evolution (Long Term Evolution, LTE) of the universal mobile communication technology, the fifth generation mobile communication technology (5-Generation, 5G) or their combination.
  • the communication component 816 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel.
  • the communication component 816 also includes a Near Field Communication (NFC) module to facilitate short-range communication.
  • NFC Near Field Communication
  • the NFC module may be based on Radio Frequency Identification (RFID) technology, Infrared Data Association (IrDA) technology, Ultra Wide Band (UWB) technology, Bluetooth (BitTorrent, BT) technology and other technology to achieve.
  • RFID Radio Frequency Identification
  • IrDA Infrared Data Association
  • UWB Ultra Wide Band
  • Bluetooth BitTorrent, BT
  • the electronic device 800 may be implemented by one or more Application Specific Integrated Circuit (ASIC), Digital Signal Process (DSP), Digital Signal Processing Device (Digital Signal Process Device) , DSPD), Programmable Logic Device (PLD), Field Programmable Gate Array (FPGA), controller, microcontroller, microprocessor, or other electronic component implementation, used to perform the above method.
  • ASIC Application Specific Integrated Circuit
  • DSP Digital Signal Process
  • DSPD Digital Signal Processing Device
  • PLD Programmable Logic Device
  • FPGA Field Programmable Gate Array
  • controller microcontroller, microprocessor, or other electronic component implementation, used to perform the above method.
  • a non-volatile computer-readable storage medium such as a memory 804 comprising computer program instructions executable by the processor 820 of the electronic device 800 to perform the above method is also provided.
  • FIG. 8 shows a block diagram of an electronic device 1900 provided by an embodiment of the present disclosure.
  • the electronic device 1900 may be provided as a server.
  • electronic device 1900 includes processing component 1922, which further includes one or more processors, and a memory resource represented by memory 1932 for storing instructions executable by processing component 1922, such as applications.
  • An application program stored in memory 1932 may include one or more modules, each corresponding to a set of instructions.
  • the processing component 1922 is configured to execute instructions to perform the above-described methods.
  • the electronic device 1900 may also include a power supply assembly 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input-output interface 1958.
  • the electronic device 1900 can operate based on an operating system stored in the memory 1932, such as a Microsoft server operating system (Windows ServerTM), a graphical user interface based operating system (Mac OS XTM) introduced by Apple, a multi-user multi-process computer operating system (UnixTM). ), Free and Open Source Unix-like Operating System (LinuxTM), Open Source Unix-like Operating System (FreeBSDTM) or similar.
  • a non-volatile computer-readable storage medium such as memory 1932 comprising computer program instructions executable by processing component 1922 of electronic device 1900 to perform the above-described method.
  • the present disclosure may be a system, method and/or computer program product.
  • the computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for causing a processor to implement various aspects of the present disclosure.
  • a computer-readable storage medium may be a tangible device that can hold and store instructions for use by the instruction execution device.
  • the computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing.
  • Computer readable storage media include: portable computer disks, hard disks, random access memory (RAM), ROM, EPROM or flash memory, SRAM, portable compact disk read only Memory (Compact Disc Read-Only Memory, CD-ROM), Digital Video Disc (DVD), memory sticks, floppy disks, mechanical coding devices, such as punched cards or recessed protrusions on which instructions are stored structure, and any suitable combination of the above.
  • Computer-readable storage media, as used herein, are not to be construed as transient signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (eg, light pulses through fiber optic cables), or through electrical wires transmitted electrical signals.
  • the computer readable program instructions described herein may be downloaded to various computing/processing devices from a computer readable storage medium, or to an external computer or external storage device over a network such as the Internet, a local area network, a wide area network, and/or a wireless network.
  • the network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and/or edge servers.
  • a network adapter card or network interface in each computing/processing device receives computer-readable program instructions from a network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in each computing/processing device .
  • the computer program instructions for carrying out the operations of the present disclosure may be assembly instructions, Industry Standard Architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or in one or more source or object code written in any combination of programming languages, including object-oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as the "C" language or similar programming languages.
  • the computer readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or server implement.
  • the remote computer may be connected to the user's computer through any kind of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or, may be connected to an external computer (eg, use an internet service provider to connect via the internet).
  • LAN Local Area Network
  • WAN Wide Area Network
  • electronic circuits such as programmable logic circuits, FPGAs, or Programmable Logic Arrays (PLAs), that can execute computer-readable Program instructions are read to implement various aspects of the present disclosure.
  • PDAs Programmable Logic Arrays
  • These computer readable program instructions may be provided to a processor of a general purpose computer, special purpose computer or other programmable data processing apparatus to produce a machine that causes the instructions when executed by the processor of the computer or other programmable data processing apparatus , resulting in means for implementing the functions/acts specified in one or more blocks of the flowchart and/or block diagrams.
  • These computer readable program instructions can also be stored in a computer readable storage medium, these instructions cause a computer, programmable data processing apparatus and/or other equipment to operate in a specific manner, so that the computer readable medium on which the instructions are stored includes An article of manufacture comprising instructions for implementing various aspects of the functions/acts specified in one or more blocks of the flowchart and/or block diagrams.
  • Computer readable program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other equipment to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other equipment to produce a computer-implemented process , thereby causing instructions executing on a computer, other programmable data processing apparatus, or other device to implement the functions/acts specified in one or more blocks of the flowcharts and/or block diagrams.
  • each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more functions for implementing the specified logical function(s) executable instructions.
  • the functions noted in the blocks may occur out of the order noted in the figures. For example, two blocks in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved.
  • each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations can be implemented in dedicated hardware-based systems that perform the specified functions or actions , or can be implemented in a combination of dedicated hardware and computer instructions.
  • the computer program product can be specifically implemented by hardware, software or a combination thereof.
  • the computer program product is embodied as a computer storage medium, and in another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (Software Development Kit, SDK), etc. Wait.
  • a software development kit Software Development Kit, SDK
  • the present disclosure provides a character detection method, device, electronic device, storage medium and program; wherein, multiple boundary lines of a first character sequence in a to-be-processed image are respectively predicted to obtain multiple boundaries of the first character sequence line prediction parameters, wherein the boundary line of the first character sequence represents the dividing line between the area where the first character sequence is located and the area not where the first character sequence is located; according to the multiplicity of the first character sequence
  • the prediction parameters of the boundary lines determine the position information of the vertices of the bounding box of the first character sequence; according to the position information of the vertices of the bounding box of the first character sequence, determine the location information.

Abstract

The present disclosure relates to a character detection method and apparatus, an electronic device, a storage medium, and a program, the method comprising: respectively performing prediction on multiple boundary lines of a first character sequence in an image to be processed to obtain prediction parameters of the multiple boundary lines of the first character sequence, the boundary lines of the first character sequence representing the boundary lines between an area in which the first character sequence is located and an area in which the first character sequence is not located; on the basis of the prediction parameters of the multiple boundary lines of the first character sequence, determining position information of the vertices of a boundary box of the first character sequence; and, on the basis of the position information of the vertices of the boundary box of the first character sequence, determining position information of the boundary box of the first character sequence. The embodiments of the present disclosure can increase the accuracy of character detection.

Description

字符检测方法、装置、电子设备、存储介质及程序Character detection method, device, electronic device, storage medium and program
相关申请的交叉引用CROSS-REFERENCE TO RELATED APPLICATIONS
本公开基于申请号为202011229418.1、申请日为2020年11月06日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本公开作为参考。The present disclosure is based on a Chinese patent application with application number 202011229418.1 and an application date of November 06, 2020, and claims the priority of the Chinese patent application, the entire contents of which are incorporated herein by reference.
技术领域technical field
本公开涉及计算机视觉技术领域,尤其涉及一种字符检测方法、装置、电子设备、存储介质及程序。The present disclosure relates to the technical field of computer vision, and in particular, to a character detection method, device, electronic device, storage medium and program.
背景技术Background technique
自然场景下的字符检测是计算机视觉中的重要研究领域,且已被应用于多种应用场景,例如实时文本翻译、单据识别、车牌识别等;相关技术中,字符在实际应用场景中处于刚性平面,然而在成像过程中,由于相机的视角扭曲和畸变,导致处于刚性平面的字符呈现为不规则的任意四边形形状;对于这些字符,需要对其四条边界精确地回归定位,才能在后续的字符识别环节中矫正出正确的字符形状,从而正确识别出字符内容。Character detection in natural scenes is an important research field in computer vision, and has been applied to a variety of application scenarios, such as real-time text translation, document recognition, license plate recognition, etc. In related technologies, characters are in a rigid plane in practical application scenarios. , however, during the imaging process, due to the distortion and distortion of the camera's angle of view, the characters on the rigid plane appear as irregular arbitrary quadrilateral shapes; for these characters, it is necessary to accurately return and locate their four boundaries before subsequent character recognition can be performed. The correct character shape is corrected in the link, so as to correctly identify the character content.
发明内容SUMMARY OF THE INVENTION
本公开提供了一种字符检测的技术方案。The present disclosure provides a technical solution for character detection.
本公开实施例提供了一种字符检测方法,包括:An embodiment of the present disclosure provides a character detection method, including:
对待处理图像中第一字符序列的多条边界线分别进行预测,得到所述第一字符序列的多条边界线的预测参数,其中,所述第一字符序列的边界线表示所述第一字符序列所在区域与非所述第一字符序列所在区域之间的分界线;Predicting multiple boundary lines of the first character sequence in the image to be processed respectively, to obtain prediction parameters of multiple boundary lines of the first character sequence, wherein the boundary line of the first character sequence represents the first character The dividing line between the region where the sequence is located and the region not where the first character sequence is located;
根据所述第一字符序列的多条边界线的预测参数,确定所述第一字符序列的边界框的顶点的位置信息;According to the prediction parameters of a plurality of boundary lines of the first character sequence, determine the position information of the vertices of the bounding box of the first character sequence;
根据所述第一字符序列的边界框的顶点的位置信息,确定所述第一字符序列的边界框的位置信息。如此,通过预测出的待处理图像中第一字符序列的多条边界线的预测参数,确定第一字符序列的边界框的顶点的位置信息,并根据第一字符序列的边界框的顶点的位置信息,确定第一字符序列的边界框的位置信息,由此将字符序列的多边形(例如四边形)边界框拆解为多条(例如四条)独立的边界线,对每一条独立的边界线进行单独检测,从而每一条边界线的检测均不会被两个不同的顶点所干扰,进而能够提高字符检测的准确性。According to the position information of the vertices of the bounding box of the first character sequence, the position information of the bounding box of the first character sequence is determined. In this way, by predicting the prediction parameters of multiple boundary lines of the first character sequence in the image to be processed, the position information of the vertices of the bounding box of the first character sequence is determined, and according to the position of the vertices of the bounding box of the first character sequence information, determine the position information of the bounding box of the first character sequence, thereby disassembling the polygon (such as quadrilateral) bounding box of the character sequence into multiple (such as four) independent boundary lines, and carry out a separate process for each independent boundary line. Therefore, the detection of each boundary line will not be disturbed by two different vertices, thereby improving the accuracy of character detection.
在本公开的一些实施例中,所述对待处理图像中第一字符序列的多条边界线分别进行预测,得到所述第一字符序列的多条边界线的预测参数,包括:In some embodiments of the present disclosure, the multiple boundary lines of the first character sequence in the image to be processed are predicted respectively, and the prediction parameters of the multiple boundary lines of the first character sequence are obtained, including:
基于所述待处理图像,针对与第一字符序列相关的第一特征点,分别预测所述第一字符序列的多条边界线对应于所述第一特征点的参数;Based on the to-be-processed image, with respect to the first feature point related to the first character sequence, respectively predict the parameters corresponding to the first feature point of the plurality of boundary lines of the first character sequence;
根据所述第一字符序列的多条边界线对应于所述第一特征点的参数,确定所述第一字符序列的多条边界线的预测参数。如此,基于待处理图像,针对与第一字符序列相关的第一特征点,分别预测第一字符序列的多条边界线对应于第一特征点的参数,并根据第一字符序列的多条边界线对应于第一特征点的参数,确定第一字符序列的多条边界线的预测参数,由此基于与第一字符序列相关的特征点对第一字符序列的边界线的参数进行预测,从而有助于提高得到边界线的预测参数的效率,并有助于提高所得到的预测参数的准确性。The prediction parameters of the plurality of boundary lines of the first character sequence are determined according to the parameters of the plurality of boundary lines of the first character sequence corresponding to the first feature points. In this way, based on the image to be processed, for the first feature points related to the first character sequence, the parameters of the multiple boundary lines of the first character sequence corresponding to the first feature points are respectively predicted, and according to the multiple boundaries of the first character sequence The line corresponds to the parameters of the first feature point, and the prediction parameters of the plurality of boundary lines of the first character sequence are determined, thereby predicting the parameters of the boundary line of the first character sequence based on the feature points related to the first character sequence, thereby It helps to improve the efficiency of obtaining the prediction parameters of the boundary line, and helps to improve the accuracy of the obtained prediction parameters.
在本公开的一些实施例中,所述方法还包括:In some embodiments of the present disclosure, the method further includes:
预测所述待处理图像中的像素所在位置属于字符的概率;Predict the probability that the position of the pixel in the to-be-processed image belongs to the character;
根据所述待处理图像中的像素所在位置属于字符的概率,确定所述第一特征点。如此,通过预测待处理图像中的像素所在位置属于字符的概率,并根据待处理图像中的像素所在位置属于字符的概率,确定第一特征点,由此能够准确地确定与第一字符序列相关的第一特征点。基于由此确定的第一 特征点对第一字符序列的边界线的参数进行预测,有助于进一步提高得到边界线的预测参数的效率,并有助于进一步提高所得到的预测参数的准确性。The first feature point is determined according to the probability that the position of the pixel in the image to be processed belongs to a character. In this way, by predicting the probability that the position of the pixel in the image to be processed belongs to the character, and determining the first feature point according to the probability that the position of the pixel in the image to be processed belongs to the character, it is possible to accurately determine the first feature point related to the first character sequence the first feature point of . Predicting the parameters of the boundary line of the first character sequence based on the first feature point thus determined helps to further improve the efficiency of obtaining the prediction parameters of the boundary line, and helps to further improve the accuracy of the obtained prediction parameters .
在本公开的一些实施例中,所述第一字符序列的多条边界线对应于所述第一特征点的参数包括:In some embodiments of the present disclosure, the parameters of the plurality of boundary lines of the first character sequence corresponding to the first feature point include:
所述第一字符序列的多条边界线在所述第一特征点对应的极坐标系下的距离参数和角度参数,其中,所述第一特征点对应的极坐标系表示以所述第一特征点为极点的极坐标系。如此,通过将边界线在笛卡尔坐标系下的直线方程映射到极坐标系中,得到在图像中具有明确的物理意义且相互独立的距离参数和角度参数,减少了参数量及相关性,且有利于网络学习。Distance parameters and angle parameters of multiple boundary lines of the first character sequence in the polar coordinate system corresponding to the first feature point, wherein the polar coordinate system corresponding to the first feature point is represented by the first feature point. A polar coordinate system in which the feature points are poles. In this way, by mapping the straight line equation of the boundary line in the Cartesian coordinate system to the polar coordinate system, the distance parameter and angle parameter with clear physical meaning and independent of each other in the image are obtained, which reduces the parameter amount and correlation, and Conducive to online learning.
在本公开的一些实施例中,所述根据所述第一字符序列的多条边界线对应于所述第一特征点的参数,确定所述第一字符序列的多条边界线的预测参数,包括:In some embodiments of the present disclosure, the prediction parameters of the plurality of boundary lines of the first character sequence are determined according to parameters of the plurality of boundary lines of the first character sequence corresponding to the first feature points, include:
将所述第一字符序列的多条边界线在所述第一特征点对应的极坐标系下的距离参数和角度参数映射至笛卡尔坐标系,得到所述第一字符序列的多条边界线在所述笛卡尔坐标系下对应于所述第一特征点的参数;Mapping the distance parameters and angle parameters of the plurality of boundary lines of the first character sequence in the polar coordinate system corresponding to the first feature point to the Cartesian coordinate system to obtain the plurality of boundary lines of the first character sequence A parameter corresponding to the first feature point in the Cartesian coordinate system;
根据所述第一字符序列的多条边界线在所述笛卡尔坐标系下对应于所述第一特征点的参数,确定所述第一字符序列的多条边界线的预测参数。如此,通过将第一字符序列的多条边界线在第一特征点对应的极坐标系下的距离参数和角度参数映射至笛卡尔坐标系,得到第一字符序列的多条边界线在笛卡尔坐标系下对应于第一特征点的参数,并根据第一字符序列的多条边界线在笛卡尔坐标系下对应于第一特征点的参数,确定第一字符序列的多条边界线的预测参数,由此能够基于不同极坐标系下的参数回归得到边界线的预测参数。According to the parameters of the plurality of boundary lines of the first character sequence corresponding to the first feature point in the Cartesian coordinate system, the prediction parameters of the plurality of boundary lines of the first character sequence are determined. In this way, by mapping the distance parameters and angle parameters of the multiple boundary lines of the first character sequence in the polar coordinate system corresponding to the first feature point to the Cartesian coordinate system, the multiple boundary lines of the first character sequence are obtained in the Cartesian coordinate system. The parameters corresponding to the first feature point in the coordinate system, and according to the parameters corresponding to the first feature point of the multiple boundary lines of the first character sequence in the Cartesian coordinate system, the prediction of multiple boundary lines of the first character sequence is determined parameters, so that the predicted parameters of the boundary line can be obtained by regression based on the parameters in different polar coordinate systems.
在本公开的一些实施例中,所述第一字符序列的多条边界线包括所述第一字符序列的上边界线、右边界线、下边界线和左边界线。如此,由于在大多数情况下,字符序列的形状为四边形,进而根据该实现方式,有助于在大多数情况下获得较准确的字符序列的边界框的位置信息。In some embodiments of the present disclosure, the plurality of boundary lines of the first character sequence include an upper boundary line, a right boundary line, a lower boundary line and a left boundary line of the first character sequence. In this way, since in most cases, the shape of the character sequence is a quadrilateral, according to this implementation, it is helpful to obtain more accurate position information of the bounding box of the character sequence in most cases.
在本公开的一些实施例中,所述基于所述待处理图像,针对与第一字符序列相关的第一特征点,分别预测所述第一字符序列的多条边界线对应于所述第一特征点的参数,包括:In some embodiments of the present disclosure, based on the to-be-processed image, for the first feature points related to the first character sequence, it is respectively predicted that a plurality of boundary lines of the first character sequence corresponds to the first character sequence. Parameters of feature points, including:
将所述待处理图像输入预先训练的神经网络,经由所述神经网络针对与第一字符序列相关的第一特征点,分别预测所述第一字符序列的多条边界线对应于所述第一特征点的参数。如此,通过预先训练的神经网络针对与第一字符序列相关的第一特征点,分别预测第一字符序列的多条边界线对应于第一特征点的参数,由此能够提高预测参数的速度,并能提高所预测的参数的准确性。Input the image to be processed into a pre-trained neural network, and through the neural network, for the first feature points related to the first character sequence, respectively predict that multiple boundary lines of the first character sequence correspond to the first character sequence. Parameters of feature points. In this way, for the first feature points related to the first character sequence, the pre-trained neural network respectively predicts the parameters corresponding to the first feature points of the multiple boundary lines of the first character sequence, thereby improving the speed of parameter prediction, And can improve the accuracy of the predicted parameters.
在本公开的一些实施例中,所述方法还包括:In some embodiments of the present disclosure, the method further includes:
经由所述神经网络预测所述待处理图像中的像素所在位置属于字符的概率。如此,通过预先训练的神经网络预测待处理图像中的像素所在位置属于字符的概率,由此能够提高预测像素所在位置属于字符的概的速度,并能够提高所预测的概率的准确性。The probability that the position of the pixel in the image to be processed belongs to a character is predicted through the neural network. In this way, the pre-trained neural network predicts the probability that the pixel location in the image to be processed belongs to the character, thereby improving the speed of predicting the probability that the pixel location belongs to the character, and improving the accuracy of the predicted probability.
在本公开的一些实施例中,所述将所述待处理图像输入预先训练的神经网络之前,所述方法还包括:In some embodiments of the present disclosure, before inputting the to-be-processed image into a pre-trained neural network, the method further includes:
将训练图像输入所述神经网络,经由所述神经网络针对与所述训练图像中的第二字符序列相关的第二特征点,分别预测所述第二字符序列的多条边界线对应于所述第二特征点的参数的预测值;Input the training image into the neural network, and through the neural network, for the second feature points related to the second character sequence in the training image, respectively predict that a plurality of boundary lines of the second character sequence correspond to the The predicted value of the parameter of the second feature point;
根据所述第二字符序列的多条边界线对应于所述第二特征点的参数的预测值,以及所述第二字符序列的多条边界线对应于所述第二特征点的参数的真值,训练所述神经网络。如此,通过将字符序列的多边形(例如四边形)边界框拆解为多条(例如四条)独立的边界线,对每一条独立的边界线进行单独检测,由此不会因回归顶点而给神经网络带来训练扰动,从而提高神经网络的学习效率和检测效果,且根据该实现方式训练得到的神经网络能够学习到准确地预测字符序列的边界线的参数的能力。According to the multiple boundary lines of the second character sequence corresponding to the predicted value of the parameter of the second feature point, and the multiple boundary lines of the second character sequence corresponding to the true value of the parameter of the second feature point value to train the neural network. In this way, by decomposing the polygon (such as quadrilateral) bounding box of the character sequence into multiple (such as four) independent boundary lines, each independent boundary line is detected separately, so that the neural network will not be affected by regression vertices. The training disturbance is brought about, thereby improving the learning efficiency and detection effect of the neural network, and the neural network trained according to this implementation can learn the ability to accurately predict the parameters of the boundary line of the character sequence.
在本公开的一些实施例中,所述第二字符序列的多条边界线对应于所述第二特征点的参数包括:所述第二字符序列的多条边界线在所述第二特征点对应的极坐标系下的距离参数和角度参数,其中,所述第二特征点对应的极坐标系表示以所述第二特征点为极点的极坐标系;In some embodiments of the present disclosure, the parameters of the plurality of boundary lines of the second character sequence corresponding to the second feature point include: the plurality of boundary lines of the second character sequence are at the second feature point The distance parameter and the angle parameter under the corresponding polar coordinate system, wherein, the polar coordinate system corresponding to the second feature point represents a polar coordinate system with the second feature point as a pole;
所述根据所述第二字符序列的多条边界线对应于所述第二特征点的参数的预测值,以及所述第二字符序列的多条边界线对应于所述第二特征点的参数的真值,训练所述神经网络,包括:The multiple boundary lines according to the second character sequence correspond to the predicted value of the parameter of the second feature point, and the multiple boundary lines of the second character sequence correspond to the parameter of the second feature point The true value of , train the neural network, including:
根据所述第二字符序列的多条边界线对应于所述第二特征点的距离参数的预测值,以及所述第二字符序列的多条边界线对应于所述第二特征点的距离参数的真值,训练所述神经网络;According to the predicted value of the distance parameter of the second feature point corresponding to the plurality of boundary lines of the second character sequence, and the distance parameter of the second feature point corresponding to the plurality of boundary lines of the second character sequence The true value of , train the neural network;
和/或,and / or,
根据所述第二字符序列的多条边界线对应于所述第二特征点的角度参数的预测值,以及所述第二字符序列的多条边界线对应于所述第二特征点的角度参数的真值,训练所述神经网络。如此,通过将笛卡尔坐标系下的直线方程映射到极坐标系中,减少了参数量及相关性,并且赋予了参数实际物理意义,有利于网络学习,且通过训练神经网络学习检测字符序列的各条边界线对应于特征点的距离与角度,能够使边界线的检测不互相干扰,从而能够提高神经网络的学习效率和检测效果。According to the predicted value of the angle parameter of the second feature point corresponding to the plurality of boundary lines of the second character sequence, and the angle parameter of the second feature point corresponding to the plurality of boundary lines of the second character sequence The true value of , to train the neural network. In this way, by mapping the straight line equation in the Cartesian coordinate system to the polar coordinate system, the amount of parameters and correlation are reduced, and the actual physical meaning of the parameters is given, which is beneficial to network learning, and learning to detect the character sequence by training the neural network. Each boundary line corresponds to the distance and angle of the feature points, so that the detection of the boundary lines does not interfere with each other, so that the learning efficiency and detection effect of the neural network can be improved.
在本公开的一些实施例中,所述根据所述第二字符序列的多条边界线对应于所述第二特征点的距离参数的预测值,以及所述第二字符序列的多条边界线对应于所述第二特征点的距离参数的真值,训练所述神经网络,包括:In some embodiments of the present disclosure, the plurality of boundary lines according to the second character sequence corresponds to the predicted value of the distance parameter of the second feature point, and the plurality of boundary lines of the second character sequence Corresponding to the true value of the distance parameter of the second feature point, training the neural network, including:
对于所述第二字符序列的多条边界线中的任意一条边界线,根据所述边界线对应于所述第二特征点的距离参数的真值和预测值中的较小值与较大值的比值,训练所述神经网络。如此,通过对于第二字符序列的多条边界线中的任意一条边界线,根据边界线对应于第二特征点的距离参数的真值和预测值中的较小值与较大值的比值,训练神经网络,由此能够对不同应用场景下不同大小的距离参数进行归一化,从而能够有助于进行多尺度的字符检测,即有助于在不同尺度的字符检测中达到更高准确性。For any boundary line among the plurality of boundary lines of the second character sequence, according to the boundary line corresponding to the smaller value and the larger value of the distance parameter of the second feature point and the predicted value The ratio of , to train the neural network. In this way, for any one of the multiple boundary lines of the second character sequence, according to the ratio of the smaller value to the larger value among the true value and predicted value of the distance parameter corresponding to the boundary line to the second feature point, By training the neural network, the distance parameters of different sizes in different application scenarios can be normalized, which can help to perform multi-scale character detection, that is, it helps to achieve higher accuracy in character detection of different scales. .
在本公开的一些实施例中,所述根据所述第二字符序列的多条边界线对应于所述第二特征点的角度参数的预测值,以及所述第二字符序列的多条边界线对应于所述第二特征点的角度参数的真值,训练所述神经网络,包括:In some embodiments of the present disclosure, the plurality of boundary lines according to the second character sequence corresponds to the predicted value of the angle parameter of the second feature point, and the plurality of boundary lines of the second character sequence Corresponding to the true value of the angle parameter of the second feature point, training the neural network, including:
对于所述第二字符序列的多条边界线中的任意一条边界线,确定所述边界线对应于所述第二特征点的角度参数的真值与预测值的差值的绝对值;For any one of the multiple boundary lines of the second character sequence, determine the absolute value of the difference between the true value and the predicted value of the angle parameter of the boundary line corresponding to the second feature point;
根据所述绝对值的半倍角的正弦值,训练所述神经网络。如此,通过对于第二字符序列的多条边界线中的任意一条边界线,确定边界线对应于第二特征点的角度参数的真值与预测值的差值的绝对值,并根据绝对值的半倍角的正弦值,训练神经网络,由此不会因为0与2π混淆而对神经网络的学习带来干扰,从而有助于提高神经网络的学习效率和检测效果。The neural network is trained according to the sine of the half angle of the absolute value. In this way, for any one of the multiple boundary lines of the second character sequence, the absolute value of the difference between the true value and the predicted value of the angle parameter of the boundary line corresponding to the second feature point is determined, and according to the absolute value of the difference The sine value of half the angle is used to train the neural network, so that the learning of the neural network will not be disturbed due to the confusion of 0 and 2π, thereby helping to improve the learning efficiency and detection effect of the neural network.
在本公开的一些实施例中,所述第二特征点包括所述第二字符区域对应的有效区域中的特征点。如此,在计算神经网络的损失函数时,通过仅监督第二字符区域对应的有效区域中的特征点,不监督第二字符区域对应的有效区域外的特征点,有助于减少网络负担。In some embodiments of the present disclosure, the second feature points include feature points in an effective area corresponding to the second character area. In this way, when calculating the loss function of the neural network, only the feature points in the valid region corresponding to the second character region are supervised, and the feature points outside the valid region corresponding to the second character region are not supervised, which helps to reduce the network burden.
在本公开的一些实施例中,所述方法还包括:In some embodiments of the present disclosure, the method further includes:
经由所述神经网络预测所述训练图像中的像素所在位置属于字符的概率;Predicting the probability that the position of the pixel in the training image belongs to a character via the neural network;
根据所述训练图像中的像素所在位置属于字符的概率,以及所述训练图像中的像素所在位置属于字符的标注数据,训练所述神经网络。如此,能够使神经网络学习到预测像素所在位置属于字符的概率的能力。The neural network is trained according to the probability that the positions of the pixels in the training image belong to characters, and the labeled data that the positions of the pixels in the training images belong to the characters. In this way, the neural network can learn the ability to predict the probability that the position of the pixel belongs to the character.
在本公开的一些实施例中,所述根据所述训练图像中的像素所在位置属于字符的概率,以及所述训练图像中的像素所在位置属于字符的标注数据,训练所述神经网络,包括:In some embodiments of the present disclosure, the training of the neural network according to the probability that the position of the pixel in the training image belongs to a character, and the labeled data that the position of the pixel in the training image belongs to the character, includes:
根据所述第二字符序列对应的有效区域中的像素所在位置属于字符的概率,以及所述有效区域中的像素所在位置属于字符的标注数据,训练所述神经网络。如此,通过根据第二字符序列对应的有效区域中的像素所在位置属于字符的概率,以及有效区域中的像素所在位置属于字符的标注数据,训练神经网络,能够使神经网络学习到字符分割的能力,且能提高神经网络学习字符分割的效率。The neural network is trained according to the probability that the position of the pixel in the valid region corresponding to the second character sequence belongs to the character, and the labeled data that the position of the pixel in the valid region belongs to the character. In this way, by training the neural network according to the probability that the position of the pixel in the effective area corresponding to the second character sequence belongs to the character, and the labeled data that the position of the pixel in the effective area belongs to the character, the neural network can learn the ability of character segmentation , and can improve the efficiency of neural network learning character segmentation.
在本公开的一些实施例中,所述方法还包括:In some embodiments of the present disclosure, the method further includes:
获取所述第二字符序列的真实边界框的位置信息;obtaining the position information of the real bounding box of the second character sequence;
根据所述真实边界框的位置信息,以及预设比例,缩小所述真实边界框,得到所述第二字符序列对应的有效区域。如此,得到第二字符序列对应的有效区域,并基于第二字符序列对应的有效区域中的特征点进行神经网络的训练,有助于减少网络负担。According to the position information of the real bounding box and the preset ratio, the real bounding box is reduced to obtain an effective area corresponding to the second character sequence. In this way, the effective area corresponding to the second character sequence is obtained, and the neural network is trained based on the feature points in the effective area corresponding to the second character sequence, which helps to reduce the network burden.
在本公开的一些实施例中,所述根据所述真实边界框的位置信息,以及预设比例,缩小所述真实边界框,得到所述第二字符序列对应的有效区域,包括:In some embodiments of the present disclosure, according to the position information of the real bounding box and a preset ratio, reducing the real bounding box to obtain an effective area corresponding to the second character sequence, including:
根据所述真实边界框的位置信息,确定所述真实边界框的锚点,其中,所述真实边界框的锚点为所述真实边界框的对角线的交点;Determine the anchor point of the real bounding box according to the position information of the real bounding box, wherein the anchor point of the real bounding box is the intersection of the diagonal lines of the real bounding box;
根据所述真实边界框的位置信息,所述真实边界框的锚点的位置信息,以及预设比例,缩小所述真实边界框,得到所述第二字符序列对应的有效区域,其中,第一距离与第二距离的比值等于所述预设比例,所述第一距离表示所述有效区域的第一顶点与所述锚点之间的距离,所述第二距离表示真实边界框中所述第一顶点对应的顶点与所述锚点之间的距离,所述第一顶点表示所述有效区域的任一顶点。如此,得到第二字符序列对应的有效区域,并基于第二字符序列对应的有效区域中的特征点进行神经网络的训练,有助于提高神经网络的学习效率和预测准确性。According to the position information of the real bounding box, the position information of the anchor point of the real bounding box, and the preset ratio, the real bounding box is reduced to obtain the effective area corresponding to the second character sequence, wherein the first The ratio of the distance to the second distance is equal to the preset ratio, the first distance represents the distance between the first vertex of the effective area and the anchor point, and the second distance represents the The distance between the vertex corresponding to the first vertex and the anchor point, where the first vertex represents any vertex of the effective area. In this way, the effective area corresponding to the second character sequence is obtained, and the neural network is trained based on the feature points in the effective area corresponding to the second character sequence, which helps to improve the learning efficiency and prediction accuracy of the neural network.
以下装置、电子设备等的效果描述参见上述方法的说明,这里不再赘述。For descriptions of the effects of the following apparatuses, electronic devices, etc., reference may be made to the descriptions of the above-mentioned methods, which will not be repeated here.
本公开实施例还提供了一种字符检测装置,包括:The embodiment of the present disclosure also provides a character detection device, including:
第一预测模块,配置为对待处理图像中第一字符序列的多条边界线分别进行预测,得到所述第一字符序列的多条边界线的预测参数,其中,所述第一字符序列的边界线表示所述第一字符序列所在区域与非所述第一字符序列所在区域之间的分界线;The first prediction module is configured to respectively predict multiple boundary lines of the first character sequence in the image to be processed, and obtain prediction parameters of the multiple boundary lines of the first character sequence, wherein the boundary of the first character sequence The line represents the dividing line between the area where the first character sequence is located and the area not where the first character sequence is located;
第一确定模块,配置为根据所述第一字符序列的多条边界线的预测参数,确定所述第一字符序列的边界框的顶点的位置信息;a first determining module, configured to determine the position information of the vertices of the bounding box of the first character sequence according to the prediction parameters of a plurality of boundary lines of the first character sequence;
第二确定模块,配置为根据所述第一字符序列的边界框的顶点的位置信息,确定所述第一字符序列的边界框的位置信息。The second determining module is configured to determine the position information of the bounding box of the first character sequence according to the position information of the vertices of the bounding box of the first character sequence.
在本公开的一些实施例中,所述第一预测模块配置为基于所述待处理图像,针对与第一字符序列相关的第一特征点,分别预测所述第一字符序列的多条边界线对应于所述第一特征点的参数;In some embodiments of the present disclosure, the first prediction module is configured to, based on the to-be-processed image, respectively predict a plurality of boundary lines of the first character sequence for first feature points related to the first character sequence a parameter corresponding to the first feature point;
根据所述第一字符序列的多条边界线对应于所述第一特征点的参数,确定所述第一字符序列的多条边界线的预测参数。The prediction parameters of the plurality of boundary lines of the first character sequence are determined according to the parameters of the plurality of boundary lines of the first character sequence corresponding to the first feature points.
在本公开的一些实施例中,所述装置还包括:In some embodiments of the present disclosure, the apparatus further includes:
第二预测模块,配置为预测所述待处理图像中的像素所在位置属于字符的概率;a second prediction module, configured to predict the probability that the position of the pixel in the to-be-processed image belongs to a character;
第三确定模块,配置为根据所述待处理图像中的像素所在位置属于字符的概率,确定所述第一特征点。The third determining module is configured to determine the first feature point according to the probability that the position of the pixel in the image to be processed belongs to a character.
在本公开的一些实施例中,所述第一字符序列的多条边界线对应于所述第一特征点的参数包括:In some embodiments of the present disclosure, the parameters of the plurality of boundary lines of the first character sequence corresponding to the first feature point include:
所述第一字符序列的多条边界线在所述第一特征点对应的极坐标系下的距离参数和角度参数,其中,所述第一特征点对应的极坐标系表示以所述第一特征点为极点的极坐标系。Distance parameters and angle parameters of multiple boundary lines of the first character sequence in the polar coordinate system corresponding to the first feature point, wherein the polar coordinate system corresponding to the first feature point is represented by the first feature point. A polar coordinate system in which the feature points are poles.
在本公开的一些实施例中,所述第一预测模块配置为将所述第一字符序列的多条边界线在所述第一特征点对应的极坐标系下的距离参数和角度参数映射至笛卡尔坐标系,得到所述第一字符序列的多条边界线在所述笛卡尔坐标系下对应于所述第一特征点的参数;In some embodiments of the present disclosure, the first prediction module is configured to map distance parameters and angle parameters of a plurality of boundary lines of the first character sequence in the polar coordinate system corresponding to the first feature point to A Cartesian coordinate system, to obtain the parameters corresponding to the first feature points of the plurality of boundary lines of the first character sequence under the Cartesian coordinate system;
根据所述第一字符序列的多条边界线在所述笛卡尔坐标系下对应于所述第一特征点的参数,确定所述第一字符序列的多条边界线的预测参数。According to the parameters of the plurality of boundary lines of the first character sequence corresponding to the first feature point in the Cartesian coordinate system, the prediction parameters of the plurality of boundary lines of the first character sequence are determined.
在本公开的一些实施例中,所述第一字符序列的多条边界线包括所述第一字符序列的上边界线、右边界线、下边界线和左边界线。In some embodiments of the present disclosure, the plurality of boundary lines of the first character sequence include an upper boundary line, a right boundary line, a lower boundary line and a left boundary line of the first character sequence.
在本公开的一些实施例中,所述第一预测模块配置为将所述待处理图像输入预先训练的神经网络,经由所述神经网络针对与第一字符序列相关的第一特征点,分别预测所述第一字符序列的多条边界线对应于所述第一特征点的参数。In some embodiments of the present disclosure, the first prediction module is configured to input the to-be-processed image into a pre-trained neural network, and through the neural network, respectively predict the first feature points related to the first character sequence through the neural network. A plurality of boundary lines of the first character sequence correspond to parameters of the first feature point.
在本公开的一些实施例中,所述装置还包括:In some embodiments of the present disclosure, the apparatus further includes:
第三预测模块,配置为经由所述神经网络预测所述待处理图像中的像素所在位置属于字符的概率。The third prediction module is configured to predict the probability that the position of the pixel in the image to be processed belongs to the character through the neural network.
在本公开的一些实施例中,所述装置还包括:In some embodiments of the present disclosure, the apparatus further includes:
第四预测模块,配置为将训练图像输入所述神经网络,经由所述神经网络针对与所述训练图像中的第二字符序列相关的第二特征点,分别预测所述第二字符序列的多条边界线对应于所述第二特征点的参数的预测值;The fourth prediction module is configured to input the training image into the neural network, and through the neural network, for the second feature points related to the second character sequence in the training image, respectively predict the number of the second character sequence. A boundary line corresponds to the predicted value of the parameter of the second feature point;
第一训练模块,配置为根据所述第二字符序列的多条边界线对应于所述第二特征点的参数的预测值,以及所述第二字符序列的多条边界线对应于所述第二特征点的参数的真值,训练所述神经网络。The first training module is configured to correspond to the predicted value of the parameter of the second feature point according to the plurality of boundary lines of the second character sequence, and the plurality of boundary lines of the second character sequence correspond to the first The true values of the parameters of the two feature points, train the neural network.
在本公开的一些实施例中,所述第二字符序列的多条边界线对应于所述第二特征点的参数包括:所述第二字符序列的多条边界线在所述第二特征点对应的极坐标系下的距离参数和角度参数,其中,所述第二特征点对应的极坐标系表示以所述第二特征点为极点的极坐标系;In some embodiments of the present disclosure, the parameters of the plurality of boundary lines of the second character sequence corresponding to the second feature point include: the plurality of boundary lines of the second character sequence are at the second feature point The distance parameter and the angle parameter under the corresponding polar coordinate system, wherein, the polar coordinate system corresponding to the second feature point represents a polar coordinate system with the second feature point as a pole;
所述第一训练模块配置为根据所述第二字符序列的多条边界线对应于所述第二特征点的距离参数的预测值,以及所述第二字符序列的多条边界线对应于所述第二特征点的距离参数的真值,训练所述神经网络;The first training module is configured to correspond to the predicted value of the distance parameter of the second feature point according to the plurality of boundary lines of the second character sequence, and the plurality of boundary lines of the second character sequence correspond to the predicted value of the distance parameter of the second feature point. The true value of the distance parameter of the second feature point is used to train the neural network;
和/或,and / or,
根据所述第二字符序列的多条边界线对应于所述第二特征点的角度参数的预测值,以及所述第二字符序列的多条边界线对应于所述第二特征点的角度参数的真值,训练所述神经网络。According to the predicted value of the angle parameter of the second feature point corresponding to the plurality of boundary lines of the second character sequence, and the angle parameter of the second feature point corresponding to the plurality of boundary lines of the second character sequence The true value of , to train the neural network.
在本公开的一些实施例中,所述第一训练模块配置为对于所述第二字符序列的多条边界线中的任意一条边界线,根据所述边界线对应于所述第二特征点的距离参数的真值和预测值中的较小值与较大值的比值,训练所述神经网络。In some embodiments of the present disclosure, the first training module is configured to, for any one of a plurality of boundary lines of the second character sequence, according to the boundary line corresponding to the second feature point The ratio of the smaller to larger of the true and predicted values of the distance parameter, trains the neural network.
在本公开的一些实施例中,所述第一训练模块配置为对于所述第二字符序列的多条边界线中的任意一条边界线,确定所述边界线对应于所述第二特征点的角度参数的真值与预测值的差值的绝对值;In some embodiments of the present disclosure, the first training module is configured to, for any one of a plurality of boundary lines of the second character sequence, determine that the boundary line corresponds to the second feature point. The absolute value of the difference between the true value of the angle parameter and the predicted value;
根据所述绝对值的半倍角的正弦值,训练所述神经网络。The neural network is trained according to the sine of the half angle of the absolute value.
在本公开的一些实施例中,所述第二特征点包括所述第二字符区域对应的有效区域中的特征点。In some embodiments of the present disclosure, the second feature points include feature points in an effective area corresponding to the second character area.
在本公开的一些实施例中,所述装置还包括:In some embodiments of the present disclosure, the apparatus further includes:
第五预测模块,配置为经由所述神经网络预测所述训练图像中的像素所在位置属于字符的概率;a fifth prediction module, configured to predict the probability that the position of the pixel in the training image belongs to the character via the neural network;
第二训练模块,配置为根据所述训练图像中的像素所在位置属于字符的概率,以及所述训练图像中的像素所在位置属于字符的标注数据,训练所述神经网络。The second training module is configured to train the neural network according to the probability that the position of the pixel in the training image belongs to a character, and the labeled data that the position of the pixel in the training image belongs to the character.
在本公开的一些实施例中,所述第二训练模块配置为根据所述第二字符序列对应的有效区域中的像素所在位置属于字符的概率,以及所述有效区域中的像素所在位置属于字符的标注数据,训练所述神经网络。In some embodiments of the present disclosure, the second training module is configured to, according to the probability that the position of the pixel in the effective area corresponding to the second character sequence belongs to the character, and the position of the pixel in the effective area belongs to the character the labeled data to train the neural network.
在本公开的一些实施例中,所述装置还包括:In some embodiments of the present disclosure, the apparatus further includes:
获取模块,配置为获取所述第二字符序列的真实边界框的位置信息;an acquisition module, configured to acquire the position information of the real bounding box of the second character sequence;
缩小模块,配置为根据所述真实边界框的位置信息,以及预设比例,缩小所述真实边界框,得到所述第二字符序列对应的有效区域。The shrinking module is configured to shrink the real bounding box according to the position information of the real bounding box and a preset ratio to obtain an effective area corresponding to the second character sequence.
在本公开的一些实施例中,所述缩小模块配置为根据所述真实边界框的位置信息,确定所述真实边界框的锚点,其中,所述真实边界框的锚点为所述真实边界框的对角线的交点;In some embodiments of the present disclosure, the reduction module is configured to determine the anchor point of the real bounding box according to the position information of the real bounding box, wherein the anchor point of the real bounding box is the real boundary the intersection of the diagonals of the boxes;
根据所述真实边界框的位置信息,所述真实边界框的锚点的位置信息,以及预设比例,缩小所述真实边界框,得到所述第二字符序列对应的有效区域,其中,第一距离与第二距离的比值等于所述预设比例,所述第一距离表示所述有效区域的第一顶点与所述锚点之间的距离,所述第二距离表示真实边界框中所述第一顶点对应的顶点与所述锚点之间的距离,所述第一顶点表示所述有效区域的任一顶点。According to the position information of the real bounding box, the position information of the anchor point of the real bounding box, and the preset ratio, the real bounding box is reduced to obtain the effective area corresponding to the second character sequence, wherein the first The ratio of the distance to the second distance is equal to the preset ratio, the first distance represents the distance between the first vertex of the effective area and the anchor point, and the second distance represents the The distance between the vertex corresponding to the first vertex and the anchor point, where the first vertex represents any vertex of the effective area.
本公开实施例还提供了一种电子设备,包括:一个或多个处理器;用于存储可执行指令的存储器;其中,所述一个或多个处理器被配置为调用所述存储器存储的可执行指令,以执行上述任一实施例所述的字符检测方法。Embodiments of the present disclosure also provide an electronic device, comprising: one or more processors; a memory for storing executable instructions; wherein the one or more processors are configured to call executable instructions stored in the memory The instruction is executed to execute the character detection method described in any of the above embodiments.
本公开实施例还提供了一种计算机可读存储介质,其上存储有计算机程序指令,所述计算机程序指令被处理器执行时实现上述任一实施例所述的字符检测方法。Embodiments of the present disclosure further provide a computer-readable storage medium, on which computer program instructions are stored, and when the computer program instructions are executed by a processor, implement the character detection method described in any of the foregoing embodiments.
本公开实施例还提供一种计算机程序,所述计算机程序包括计算机可读代码,在所述计算机可读代码在电子设备中运行的情况下,所述电子设备的处理器执行上述任一实施例所述的字符检测方法。An embodiment of the present disclosure further provides a computer program, where the computer program includes computer-readable codes, and when the computer-readable codes are executed in an electronic device, a processor of the electronic device executes any of the foregoing embodiments The described character detection method.
在本公开实施例中,通过对待处理图像中第一字符序列的多条边界线分别进行预测,得到第一字符序列的多条边界线的预测参数,根据第一字符序列的多条边界线的预测参数,确定第一字符序列的边界框的顶点的位置信息,并根据第一字符序列的边界框的顶点的位置信息,确定第一字符序列的边界框的位置信息,由此将字符序列的多边形(例如四边形)边界框拆解为多条(例如四条)独立的边界线,对每一条独立的边界线进行单独检测,从而每一条边界线的检测均不会被两个不同的顶点所干扰,进而能够提高字符检测的准确性。In the embodiment of the present disclosure, the prediction parameters of the multiple boundary lines of the first character sequence are obtained by respectively predicting multiple boundary lines of the first character sequence in the image to be processed. The prediction parameter determines the position information of the vertices of the bounding box of the first character sequence, and determines the position information of the bounding box of the first character sequence according to the position information of the vertices of the bounding box of the first character sequence. The polygon (such as quadrilateral) bounding box is disassembled into multiple (such as four) independent boundary lines, and each independent boundary line is detected separately, so that the detection of each boundary line will not be disturbed by two different vertices , which can improve the accuracy of character detection.
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,而非限制本公开。It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure.
根据下面参考附图对示例性实施例的详细说明,本公开的其它特征及方面将变得清楚。Other features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments with reference to the accompanying drawings.
附图说明Description of drawings
此处的附图被并入说明书中并构成本说明书的一部分,这些附图示出了符合本公开的实施例,并与说明书一起用于说明本公开的技术方案。The accompanying drawings, which are incorporated into and constitute a part of this specification, illustrate embodiments consistent with the present disclosure, and together with the description, serve to explain the technical solutions of the present disclosure.
图1示出本公开实施例提供的一种字符检测方法的流程图;FIG. 1 shows a flowchart of a character detection method provided by an embodiment of the present disclosure;
图2示出了应用本公开实施例的字符检测方法的一种系统架构示意图;FIG. 2 shows a schematic diagram of a system architecture to which the character detection method according to an embodiment of the present disclosure is applied;
图3示出第一字符序列的4条边界线在某一第一特征点对应的极坐标系下的距离参数和角度参数的示意图;Fig. 3 shows the schematic diagram of the distance parameter and the angle parameter of 4 boundary lines of the first character sequence under the polar coordinate system corresponding to a certain first feature point;
图4示出第二字符区域的真实边界框31和有效区域32的示意图;FIG. 4 shows a schematic diagram of the real bounding box 31 and the effective area 32 of the second character area;
图5示出本公开实施例的一个应用场景的示意图;FIG. 5 shows a schematic diagram of an application scenario of an embodiment of the present disclosure;
图6示出本公开实施例提供的字符检测装置的框图;6 shows a block diagram of a character detection apparatus provided by an embodiment of the present disclosure;
图7示出本公开实施例提供的一种电子设备800的框图;FIG. 7 shows a block diagram of an electronic device 800 provided by an embodiment of the present disclosure;
图8示出本公开实施例提供的一种电子设备1900的框图。FIG. 8 shows a block diagram of an electronic device 1900 provided by an embodiment of the present disclosure.
具体实施方式Detailed ways
以下将参考附图详细说明本公开的各种示例性实施例、特征和方面。附图中相同的附图标记表示功能相同或相似的元件。尽管在附图中示出了实施例的各种方面,但是除非特别指出,不必按比例绘制附图。Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. The same reference numbers in the figures denote elements that have the same or similar functions. While various aspects of the embodiments are shown in the drawings, the drawings are not necessarily drawn to scale unless otherwise indicated.
在这里专用的词“示例性”意为“用作例子、实施例或说明性”。这里作为“示例性”所说明的任何实施例不必解释为优于或好于其它实施例。The word "exemplary" is used exclusively herein to mean "serving as an example, embodiment, or illustration." Any embodiment described herein as "exemplary" is not necessarily to be construed as preferred or advantageous over other embodiments.
本文中术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中术语“至少一种”表示多种中的任意一种或多种中的至少两种的任意组合,例如,包括A、B、C中的至少一种,可以表示包括从A、B和C构成的集合中选择的任意一个或多个元素。The term "and/or" in this article is only an association relationship to describe the associated objects, indicating that there can be three kinds of relationships, for example, A and/or B, it can mean that A exists alone, A and B exist at the same time, and A and B exist independently B these three cases. In addition, the term "at least one" herein refers to any combination of any one of the plurality or at least two of the plurality, for example, including at least one of A, B, and C, and may mean including from A, B, and C. Any one or more elements selected from the set of B and C.
另外,为了更好地说明本公开,在下文的具体实施方式中给出了众多的具体细节。本领域技术人员应当理解,没有某些具体细节,本公开同样可以实施。在一些实例中,对于本领域技术人员熟知的方法、手段、元件和电路未作详细描述,以便于凸显本公开的主旨。In addition, in order to better illustrate the present disclosure, numerous specific details are set forth in the following detailed description. It will be understood by those skilled in the art that the present disclosure may be practiced without certain specific details. In some instances, methods, means, components and circuits well known to those skilled in the art have not been described in detail so as not to obscure the subject matter of the present disclosure.
相关技术中,大多采用矩形框或者旋转矩形框来检测字符,但这些矩形框或者旋转矩形框均无法准确定位字符边界,导致影响后续的字符识别。另外,相关技术中还提出了通过回归四边形的四个顶点来构成字符的边界框的字符检测方法。然而,顶点实际上是两条相邻边相交形成的,每个顶点的回归会影响两条边,因此,每条边都会被两个不同的顶点所干扰,从而影响字符检测结果的准确性。In the related art, a rectangular frame or a rotated rectangular frame is mostly used to detect characters, but these rectangular frames or rotated rectangular frames cannot accurately locate the character boundary, which affects subsequent character recognition. In addition, the related art also proposes a character detection method in which a bounding box of a character is formed by regressing four vertices of a quadrilateral. However, a vertex is actually formed by the intersection of two adjacent edges, and the regression of each vertex affects both edges, so each edge is disturbed by two different vertices, which affects the accuracy of character detection results.
基于以上问题,本公开实施例提供了一种字符检测方法、装置、电子设备、存储介质及程序,通过将字符的多边形(例如四边形)边界框拆解为多条(例如四条)独立的边界线,对每一条独立的边界线进行单独检测,由此每一条边界线的检测均不会被两个不同的顶点所干扰,从而能够提高字符检测的准确性。Based on the above problems, embodiments of the present disclosure provide a character detection method, apparatus, electronic device, storage medium, and program, by decomposing a polygonal (eg, quadrilateral) bounding box of a character into multiple (eg, four) independent boundary lines , each independent boundary line is independently detected, so that the detection of each boundary line will not be disturbed by two different vertices, so that the accuracy of character detection can be improved.
下面结合附图对本公开实施例提供的字符检测方法进行详细的说明。The character detection method provided by the embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings.
图1示出本公开实施例提供的字符检测方法的流程图。其中,字符检测方法的执行主体可以是字符检测装置。在本公开的一些实施例中,字符检测方法可以由终端设备或服务器或其它处理设备执行。其中,终端设备可以是用户设备(User Equipment,UE)、移动设备、用户终端、终端、蜂窝电话、无绳电话、个人数字助理(Personal Digital Assistant,PDA)、手持设备、计算设备、车载设备或者可穿戴设备等。在本公开的一些实施例中,字符检测方法可以通过处理器调用存储器中存储的计算机可读指令的方式来实现。如图1所示,字符检测方法包括步骤S11至步骤S13。FIG. 1 shows a flowchart of a character detection method provided by an embodiment of the present disclosure. Wherein, the execution body of the character detection method may be a character detection device. In some embodiments of the present disclosure, the character detection method may be performed by a terminal device or a server or other processing device. The terminal device may be a user equipment (User Equipment, UE), a mobile device, a user terminal, a terminal, a cellular phone, a cordless phone, a personal digital assistant (Personal Digital Assistant, PDA), a handheld device, a computing device, a vehicle-mounted device, or a wearable devices, etc. In some embodiments of the present disclosure, the character detection method may be implemented by a processor invoking computer-readable instructions stored in a memory. As shown in FIG. 1 , the character detection method includes steps S11 to S13.
在步骤S11中,对待处理图像中第一字符序列的多条边界线分别进行预测,得到第一字符序列的多条边界线的预测参数。In step S11, the multiple boundary lines of the first character sequence in the image to be processed are respectively predicted, and the prediction parameters of the multiple boundary lines of the first character sequence are obtained.
其中,第一字符序列的边界线表示第一字符序列所在区域与非第一字符序列所在区域之间的分界线。Wherein, the boundary line of the first character sequence represents the dividing line between the area where the first character sequence is located and the area not where the first character sequence is located.
在本公开实施例中,字符检测可以表示检测图像中的字符和/或字符序列的位置,例如,可以表示检测图像中的字符和/或字符序列的边界框的位置。在本公开实施例中,待处理图像可以表示需要进行字符检测的图像。第一字符序列表示待处理图像中的任一字符序列。待处理图像可以包括一个或多个字符序列。第一字符序列可以包括一个或多个字符,字符可以包括文字、字母、数字、标点符号、运算符号等中的至少之一。在本公开的一些实施例中,在待处理图像中,若任意两个字符之间的距离小于或等于预设的第一距离阈值,则确定该两个字符属于同一字符序列。在本公开的另一些实施例中,在待处理图像中的书写方向为水平方向的情况下,若任意两个字符属于同一行文字,且该两个字符之间的距离小于或等于预设的第二距离阈值,则确定该两个字符属于同一字符序列;在待处理图像中的书写方向为竖直方向的情况下,若任意两个字符属于同一列文字,且该两个字符之间的距离小于或等于预设的第三距离阈值,则确定该两个字符属于同一字符序列。其中,书写方向可以表示相邻的两个字符之间的位置关系。例如,若相邻的两个字符之间的位置关系为左右关系,则书写方向为水平方向;若相邻的两个字符之间的位置关系为上下关系,则书写方向为竖直方向。In an embodiment of the present disclosure, character detection may refer to detecting a position of a character and/or character sequence in an image, for example, may refer to detecting a position of a bounding box of a character and/or character sequence in an image. In the embodiment of the present disclosure, the to-be-processed image may represent an image that needs character detection. The first character sequence represents any character sequence in the image to be processed. The image to be processed may include one or more character sequences. The first sequence of characters may include one or more characters, and the characters may include at least one of words, letters, numbers, punctuation marks, operation symbols, and the like. In some embodiments of the present disclosure, in the image to be processed, if the distance between any two characters is less than or equal to a preset first distance threshold, it is determined that the two characters belong to the same character sequence. In other embodiments of the present disclosure, when the writing direction in the image to be processed is the horizontal direction, if any two characters belong to the same line of text, and the distance between the two characters is less than or equal to a preset With the second distance threshold, it is determined that the two characters belong to the same character sequence; when the writing direction in the image to be processed is the vertical direction, if any two characters belong to the same column of characters, and the difference between the two characters is If the distance is less than or equal to the preset third distance threshold, it is determined that the two characters belong to the same character sequence. The writing direction may represent the positional relationship between two adjacent characters. For example, if the positional relationship between two adjacent characters is the left-right relationship, the writing direction is the horizontal direction; if the positional relationship between the two adjacent characters is the up-down relationship, the writing direction is the vertical direction.
在本公开实施例中,第一字符序列的边界线表示第一字符序列所在区域与非第一字符序列所在区域之间的分界线,其中,非第一字符序列所在区域可以是背景区域(即非字符所在区域)和/或其他字符序列所在区域。第一字符序列的边界线可以是直线,也可以是曲线,在此不作限定。第一字符序列的任意一条边界线的预测参数可以表示所预测的边界线的参数。在第一字符序列的边界线为直线的情况下,第一字符序列的任意一条边界线的预测参数可以表示边界线对应的直线方程的预测参数。基于边界线对应的直线方程的预测参数,能够确定边界线的位置。In the embodiment of the present disclosure, the boundary line of the first character sequence represents the boundary line between the area where the first character sequence is located and the area where the non-first character sequence is located, wherein the area where the non-first character sequence is located may be a background area (ie non-character region) and/or other character sequences. The boundary line of the first character sequence may be a straight line or a curved line, which is not limited herein. The prediction parameter of any one boundary line of the first character sequence may represent the parameter of the predicted boundary line. When the boundary line of the first character sequence is a straight line, the prediction parameter of any boundary line of the first character sequence may represent the prediction parameter of the line equation corresponding to the boundary line. Based on the prediction parameters of the line equation corresponding to the boundary line, the position of the boundary line can be determined.
在本公开实施例中,在第一字符序列的边界线为直线的情况下,第一字符序列的边界线的数量为至少3条,第一字符序列的多条边界线可以围成第一字符序列的边界框。第一字符序列的边界框可以是多边形,相应地,第一字符序列的边界线的数量可以与第一字符序列的边界框的边数相对应。例如,第一字符序列的边界框为四边形,则第一字符序列的边界线的数量为4。当然,第一字符序列的边界框也可以为五边形、三角形等,在此不作限定。In the embodiment of the present disclosure, when the boundary line of the first character sequence is a straight line, the number of boundary lines of the first character sequence is at least three, and multiple boundary lines of the first character sequence may enclose the first character The bounding box of the sequence. The bounding box of the first character sequence may be a polygon, and accordingly, the number of boundary lines of the first character sequence may correspond to the number of sides of the bounding box of the first character sequence. For example, if the bounding box of the first character sequence is a quadrilateral, the number of boundary lines of the first character sequence is 4. Of course, the bounding box of the first character sequence may also be a pentagon, a triangle, etc., which is not limited herein.
在本公开的一些实施例中,第一字符序列的多条边界线包括第一字符序列的上边界线、右边界线、下边界线和左边界线。在该实施例中,第一字符序列的边界框为四边形,第一字符序列的边界线的数量为4。其中,第一字符序列的上边界线,可以表示以第一字符序列中的字符的方向为参照,用于划分第一字符序列所在区域与第一字符序列上方的非第一字符序列所在区域的分界线;第一字符序列的右边界线,可以表示以第一字符序列中的字符的方向为参照,用于划分第一字符序列所在区域与第一字符序列右边的非第一字符序列所在区域的分界线;第一字符序列的下边界线,可以表示以第一字符序列中的字符的方向为参照,用于划分第一字符序列所在区域与第一字符序列下方的非第一字符序列所在区域的分界线;第一字符序列的左边界线,可以表示以第一字符序列中的字符的方向为参照,用于划分第一字符序列所在区域与第一字符序列左边的非第一字符序列所在区域的分界线。由于在大多数情况下,字符序列的形状为四边形,因此,根据该实施例,有助于在大多数情况下获得较准确的字符序列的边界框的位置信息。In some embodiments of the present disclosure, the plurality of boundary lines of the first character sequence include an upper boundary line, a right boundary line, a lower boundary line, and a left boundary line of the first character sequence. In this embodiment, the bounding box of the first character sequence is a quadrilateral, and the number of boundary lines of the first character sequence is four. Wherein, the upper boundary line of the first character sequence may indicate that the direction of the characters in the first character sequence is used as a reference for dividing the area where the first character sequence is located and the area where the non-first character sequence above the first character sequence is located. Demarcation line; the right boundary line of the first character sequence, which can be used to demarcate the area where the first character sequence is located and the area where the non-first character sequence to the right of the first character sequence is located with reference to the direction of the characters in the first character sequence. Demarcation line; the lower boundary line of the first character sequence, which can be used to demarcate the area where the first character sequence is located and the area where the non-first character sequence below the first character sequence is located with reference to the direction of the characters in the first character sequence. Demarcation line; the left boundary line of the first character sequence, which can be used to divide the area where the first character sequence is located and the area where the non-first character sequence to the left of the first character sequence is located with reference to the direction of the characters in the first character sequence. dividing line. Since the shape of the character sequence is a quadrilateral in most cases, according to this embodiment, it is helpful to obtain more accurate position information of the bounding box of the character sequence in most cases.
在该实施例中,对待处理图像中第一字符序列的多条边界线分别进行预测,得到第一字符序列的多条边界线的预测参数,可以包括:对待处理图像中第一字符序列的上边界线进行预测,得到第一字符序列的上边界线对应的直线方程的预测参数;对待处理图像中第一字符序列的右边界线进行预测,得到第一字符序列的右边界线对应的直线方程的预测参数;对待处理图像中第一字符序列的下边界线进行预测,得到第一字符序列的下边界线对应的直线方程的预测参数;对待处理图像中第一字符序列的左边界线进行预测,得到第一字符序列的左边界线对应的直线方程的预测参数。In this embodiment, the multiple boundary lines of the first character sequence in the image to be processed are predicted respectively, and the prediction parameters of the multiple boundary lines of the first character sequence are obtained, which may include: the upper part of the first character sequence in the image to be processed Predict the boundary line to obtain the prediction parameters of the straight line equation corresponding to the upper boundary line of the first character sequence; predict the right boundary line of the first character sequence in the image to be processed to obtain the prediction of the straight line equation corresponding to the right boundary line of the first character sequence parameter; predict the lower boundary line of the first character sequence in the image to be processed, and obtain the prediction parameters of the straight line equation corresponding to the lower boundary line of the first character sequence; predict the left boundary line of the first character sequence in the image to be processed, and obtain the first character The predicted parameters of the line equation corresponding to the left boundary line of the series.
在步骤S12中,根据第一字符序列的多条边界线的预测参数,确定第一字符序列的边界框的顶点的位置信息。In step S12, the position information of the vertices of the bounding box of the first character sequence is determined according to the prediction parameters of the plurality of boundary lines of the first character sequence.
在本公开实施例中,根据第一字符序列的多条边界线的预测参数,可以得到第一字符序列的多条边界线的交点,并可以将第一字符序列的多条边界线的交点的位置信息,作为第一字符序列的边界框的顶点的位置信息。例如,第一字符序列的多条边界线包括第一字符序列的上边界线、右边界线、下边界线和左边界线;根据第一字符序列的上边界线对应的直线方程的预测参数和第一字符序列的右边界线对应的直线方程的预测参数,可以得到第一字符序列的上边界线与第一字符序列的右边界线的交点,并可以将第一字符序列的上边界线与第一字符序列的右边界线的交点的位置信息作为第一字符序列的边界框的右上角顶点的位置信息;根据第一字符序列的右边界线对应的直线方程的预测参数和第一字符序列的下边界线对应的直线方程的预测参数,可以得到第一字符序列的右边界线与第一字符序列的下边界线的交点,并可以将第一字符序列的右边界线与第一字符序列的下边界线的交点的位置信息作为第一字符序列的边界框的右下角顶点的位置信息;根据第一字符序列的下边界线对应的直线方程的预测参数和第一字符序列的左边界线对应的直线方程的预测参数,可以得到第一字符序列的下边界线与第一字符序列的左边界线的交点,并可以将第一字符序列的下边界线与第一字符序列的左边界线的交点的位置信息作为第一字符序列的边界框的左下角顶点的位置信息;根据第一字符序列的左边界线对应的直线方程的预测参数和第一字符序列的上边界线对应的直线方程的预测参数,可以得到第一字符序列的左边界线与第一字符序列的上边界线的交点,并可以将第一字符序列的左边界线与第一字符序列的上边界线的交点的位置信息作为第一字符序列的边界框的左上角顶点的位置信息。在本公开实施例中,第一字符序列的边界框的顶点的位置信息可以采用第一字符序列的边界框的顶点的坐标来表示。例如,第一字符序列的边界框的顶点的位置信息可以包括第一字符序列的边界框的左上角顶点的坐标、右上角顶点的坐标、右下角顶点的坐标和左下角顶点的坐标。In the embodiment of the present disclosure, according to the prediction parameters of the plurality of boundary lines of the first character sequence, the intersection of the plurality of boundary lines of the first character sequence can be obtained, and the intersection of the plurality of boundary lines of the first character sequence can be calculated. Position information, which is the position information of the vertices of the bounding box of the first character sequence. For example, the multiple boundary lines of the first character sequence include an upper boundary line, a right boundary line, a lower boundary line and a left boundary line of the first character sequence; according to the prediction parameters of the line equation corresponding to the upper boundary line of the first character sequence and the first character The prediction parameters of the straight line equation corresponding to the right boundary line of the sequence can obtain the intersection of the upper boundary line of the first character sequence and the right boundary line of the first character sequence, and the upper boundary line of the first character sequence and the first character sequence can be obtained. The position information of the intersection of the right boundary line is used as the position information of the upper right corner vertex of the bounding box of the first character sequence; according to the prediction parameter of the line equation corresponding to the right boundary line of the first character sequence and the line equation corresponding to the lower boundary line of the first character sequence The prediction parameters of The position information of the vertex at the lower right corner of the bounding box of the character sequence; according to the prediction parameter of the straight line equation corresponding to the lower boundary line of the first character sequence and the prediction parameter of the straight line equation corresponding to the left border line of the first character sequence, the first character sequence can be obtained The intersection of the lower boundary line of the first character sequence and the left boundary line of the first character sequence, and the position information of the intersection of the lower boundary line of the first character sequence and the left boundary line of the first character sequence can be used as the lower left corner vertex of the bounding box of the first character sequence. Position information; according to the prediction parameter of the straight line equation corresponding to the left boundary line of the first character sequence and the prediction parameter of the straight line equation corresponding to the upper boundary line of the first character sequence, the left boundary line of the first character sequence and the first character sequence can be obtained. The intersection point of the upper boundary line, and the position information of the intersection point of the left boundary line of the first character sequence and the upper boundary line of the first character sequence can be used as the position information of the upper left corner vertex of the bounding box of the first character sequence. In this embodiment of the present disclosure, the position information of the vertices of the bounding box of the first character sequence may be represented by the coordinates of the vertices of the bounding box of the first character sequence. For example, the location information of the vertices of the bounding box of the first character sequence may include the coordinates of the upper left vertex, the upper right vertex, the lower right vertex and the lower left vertex of the bounding box of the first character sequence.
在步骤S13中,根据第一字符序列的边界框的顶点的位置信息,确定第一字符序列的边界框的位置信息。In step S13, the position information of the bounding box of the first character sequence is determined according to the position information of the vertices of the bounding box of the first character sequence.
在本公开实施例中,可以将第一字符序列的边界框的顶点的位置信息,作为第一字符序列的边界框的位置信息。例如,第一字符序列的边界框的位置信息可以包括第一字符序列的边界框的各个顶点的坐标。当然,在第一字符序列的边界框为矩形的情况下,还可以采用第一字符序列的边界框的任意一个顶点的坐标和与该顶点相连的两条边的边长来表示第一字符序列的边界框的位置信息,在此不作限定。In this embodiment of the present disclosure, the position information of the vertices of the bounding box of the first character sequence may be used as the position information of the bounding box of the first character sequence. For example, the location information of the bounding box of the first character sequence may include coordinates of respective vertices of the bounding box of the first character sequence. Of course, in the case where the bounding box of the first character sequence is a rectangle, the coordinates of any vertex of the bounding box of the first character sequence and the side lengths of two sides connected to the vertex can also be used to represent the first character sequence The position information of the bounding box is not limited here.
图2为可以应用本公开实施例的字符检测方法的一种系统架构示意图;如图2所示,该系统架构中包括:图像获取终端201、网络202和确定位置终端203。为实现支撑一个示例性应用,图像获取终端201和确定位置终端203通过网络202建立通信连接,图像获取终端201通过网络202向确定位置终端203上报待处理图像,确定位置终端203响应于接收到的待处理图像,并对待处理图像中第一字符序列的多条边界线分别进行预测,得到第一字符序列的多条边界线的预测参数,并基于第一字符序列的多条边界线的预测参数,确定第一字符序列的边界框的顶点的位置信息;根据第一字符序列的边界框的顶点的位置信息,确定第一字符序列的边界框的位置信息。最后,确定位置终端203将该确定的位置信息上传至网络202,并通过网络202发送给图像获取终端201。FIG. 2 is a schematic diagram of a system architecture to which a character detection method according to an embodiment of the present disclosure can be applied; as shown in FIG. 2 , the system architecture includes: an image acquisition terminal 201 , a network 202 and a location determination terminal 203 . In order to support an exemplary application, the image acquisition terminal 201 and the position determination terminal 203 establish a communication connection through the network 202, the image acquisition terminal 201 reports the image to be processed to the position determination terminal 203 through the network 202, and the position determination terminal 203 responds to the received image. The image to be processed, and the multiple boundary lines of the first character sequence in the image to be processed are respectively predicted to obtain the prediction parameters of the multiple boundary lines of the first character sequence, and the prediction parameters based on the multiple boundary lines of the first character sequence are obtained. , determine the position information of the vertices of the bounding box of the first character sequence; determine the position information of the bounding box of the first character sequence according to the position information of the vertices of the bounding box of the first character sequence. Finally, the location determination terminal 203 uploads the determined location information to the network 202 , and sends the determined location information to the image acquisition terminal 201 through the network 202 .
作为示例,图像获取终端201可以包括图像采集设备,确定位置终端203可以包括具有视觉信息处理能力的视觉处理设备或远程服务器。网络202可以采用有线连接或无线连接方式。其中,当确定位置终端203为视觉处理设备时,图像获取终端201可以通过有线连接的方式与视觉处理设备通信连 接,例如通过总线进行数据通信;当确定位置终端203为远程服务器时,图像获取终端201可以通过无线网络与远程服务器进行数据交互。As an example, the image acquisition terminal 201 may include an image acquisition device, and the location determination terminal 203 may include a visual processing device or a remote server with visual information processing capability. The network 202 can be wired or wireless. Wherein, when it is determined that the location terminal 203 is a visual processing device, the image acquisition terminal 201 can be connected to the visual processing device through a wired connection, such as data communication through a bus; when it is determined that the location terminal 203 is a remote server, the image acquisition terminal 201 can perform data interaction with a remote server through a wireless network.
或者,在一些场景中,图像获取终端201可以是带有图像采集模组的视觉处理设备,具体实现为带有摄像头的主机。这时,本公开实施例的字符检测方法可以由图像获取终端201执行,上述系统架构可以不包含网络202和确定位置终端203。Alternatively, in some scenarios, the image acquisition terminal 201 may be a vision processing device with an image acquisition module, which is specifically implemented as a host with a camera. At this time, the character detection method of the embodiment of the present disclosure may be executed by the image acquisition terminal 201 , and the above-mentioned system architecture may not include the network 202 and the location determination terminal 203 .
在本公开实施例中,通过对待处理图像中第一字符序列的多条边界线分别进行预测,得到第一字符序列的多条边界线的预测参数,根据第一字符序列的多条边界线的预测参数,确定第一字符序列的边界框的顶点的位置信息,并根据第一字符序列的边界框的顶点的位置信息,确定第一字符序列的边界框的位置信息,由此将字符序列的多边形(例如四边形)边界框拆解为多条(例如四条)独立的边界线,对每一条独立的边界线进行单独检测,从而每一条边界线的检测均不会被两个不同的顶点所干扰,进而能够提高字符检测的准确性。In the embodiment of the present disclosure, the prediction parameters of the multiple boundary lines of the first character sequence are obtained by respectively predicting multiple boundary lines of the first character sequence in the image to be processed. The prediction parameter determines the position information of the vertices of the bounding box of the first character sequence, and determines the position information of the bounding box of the first character sequence according to the position information of the vertices of the bounding box of the first character sequence. The polygon (such as quadrilateral) bounding box is disassembled into multiple (such as four) independent boundary lines, and each independent boundary line is detected separately, so that the detection of each boundary line will not be disturbed by two different vertices , which can improve the accuracy of character detection.
在本公开的一些实施例中,对待处理图像中第一字符序列的多条边界线分别进行预测,得到第一字符序列的多条边界线的预测参数,包括:基于待处理图像,针对与第一字符序列相关的第一特征点,分别预测第一字符序列的多条边界线对应于第一特征点的参数;根据第一字符序列的多条边界线对应于第一特征点的参数,确定第一字符序列的多条边界线的预测参数。在该实施例中,第一特征点表示与第一字符序列相关的特征点。其中,特征点可以表示图像灰度值发生剧烈变化的点和/或在图像边缘上曲率较大的点(即两个边缘的交点)。第一特征点的数量可以为多个,当然,也可以为1个,在此不作限定。例如,在第一特征点的数量为多个且第一字符序列的边界线的数量为4条的情况下,对于任意一个第一特征点,分别预测第一字符序列的每条边界线对应于第一特征点的参数,并对于任意一条边界线,根据该边界线对应于各个第一特征点的参数,确定该边界线的预测参数。例如,可以对该边界线对应于各个第一特征点的参数进行回归,得到该边界线的预测参数。在该实施例中,基于待处理图像,针对与第一字符序列相关的第一特征点,分别预测第一字符序列的多条边界线对应于第一特征点的参数,并根据第一字符序列的多条边界线对应于第一特征点的参数,确定第一字符序列的多条边界线的预测参数,由此基于与第一字符序列相关的特征点对第一字符序列的边界线的参数进行预测,从而有助于提高得到边界线的预测参数的效率,并有助于提高所得到的预测参数的准确性。当然,在本公开的其他实施例中,还可以基于与第一字符序列相关的所有像素点(不限于与第一字符序列相关的第一特征点)确定第一字符序列的多条边界线的预测参数,在此不作限定。In some embodiments of the present disclosure, the multiple boundary lines of the first character sequence in the image to be processed are respectively predicted to obtain the prediction parameters of the multiple boundary lines of the first character sequence, including: based on the image to be processed, for A first feature point related to a character sequence, respectively predict the parameters of the multiple boundary lines of the first character sequence corresponding to the first feature point; according to the parameters of the multiple boundary lines of the first character sequence corresponding to the first feature point, determine Prediction parameters for multiple boundary lines of the first character sequence. In this embodiment, the first feature points represent feature points associated with the first character sequence. The feature points may represent points where the gray value of the image changes drastically and/or points with large curvature on the edge of the image (ie, the intersection of two edges). The number of the first feature points may be multiple, of course, may also be one, which is not limited here. For example, when the number of first feature points is multiple and the number of boundary lines of the first character sequence is 4, for any first feature point, it is predicted that each boundary line of the first character sequence corresponds to parameters of the first feature point, and for any boundary line, the prediction parameter of the boundary line is determined according to the parameters of the boundary line corresponding to each of the first feature points. For example, the parameters of the boundary line corresponding to each of the first feature points can be regressed to obtain the predicted parameters of the boundary line. In this embodiment, based on the image to be processed, for the first feature points related to the first character sequence, parameters corresponding to the first feature points of multiple boundary lines of the first character sequence are respectively predicted, and according to the first character sequence The plurality of boundary lines correspond to the parameters of the first feature point, and the prediction parameters of the plurality of boundary lines of the first character sequence are determined, whereby the parameters of the boundary line of the first character sequence are based on the feature points related to the first character sequence. The prediction is performed, thereby helping to improve the efficiency of obtaining the prediction parameters of the boundary line, and helping to improve the accuracy of the obtained prediction parameters. Of course, in other embodiments of the present disclosure, the multiple boundary lines of the first character sequence may also be determined based on all pixel points related to the first character sequence (not limited to the first feature points related to the first character sequence). The prediction parameters are not limited here.
作为该实施例的一个示例,该方法还包括:预测待处理图像中的像素所在位置属于字符的概率;根据待处理图像中的像素所在位置属于字符的概率,确定第一特征点。在该示例中,可以预测待处理图像中的各个像素所在位置属于字符的概率。根据待处理图像中的各个像素所在位置属于字符的概率,可以初步确定待处理图像中的各个字符序列所占的区域。对于任一第一字符序列,可以根据初步确定的第一字符序列所占区域中的特征点,确定第一特征点。例如,可以将初步确定的第一字符序列所占区域中的全部或部分特征点,确定为第一特征点。在该示例中,通过预测待处理图像中的像素所在位置属于字符的概率,并根据待处理图像中的像素所在位置属于字符的概率,确定第一特征点,由此能够准确地确定与第一字符序列相关的第一特征点。基于由此确定的一特征点对第一字符序列的边界线的参数进行预测,有助于进一步提高得到边界线的预测参数的效率和准确性。As an example of this embodiment, the method further includes: predicting the probability that the position of the pixel in the image to be processed belongs to the character; and determining the first feature point according to the probability that the position of the pixel in the image to be processed belongs to the character. In this example, the probability that each pixel in the image to be processed belongs to a character can be predicted. According to the probability that the position of each pixel in the image to be processed belongs to a character, the area occupied by each character sequence in the image to be processed can be preliminarily determined. For any first character sequence, the first feature point may be determined according to the preliminarily determined feature points in the area occupied by the first character sequence. For example, all or part of the feature points in the area occupied by the initially determined first character sequence may be determined as the first feature points. In this example, by predicting the probability that the position of the pixel in the image to be processed belongs to the character, and determining the first feature point according to the probability that the position of the pixel in the image to be processed belongs to the character, the first feature point can be accurately determined. The first feature point associated with the character sequence. Predicting the parameters of the boundary line of the first character sequence based on a feature point thus determined helps to further improve the efficiency and accuracy of obtaining the prediction parameters of the boundary line.
在本公开的其他实施例提供的示例中,还可以将待处理图像中的特征点分别作为第一特征点,而无需进行字符概率的预测。例如,在待处理图像中只存在一个第一字符序列,且第一字符序列占满或几乎占满待处理图像的情况下,可以将待处理图像中的特征点分别作为第一特征点。In the examples provided by other embodiments of the present disclosure, the feature points in the image to be processed may also be used as the first feature points respectively, without the need to predict the character probability. For example, when there is only one first character sequence in the image to be processed, and the first character sequence occupies or almost occupies the image to be processed, the feature points in the image to be processed can be respectively used as the first feature points.
作为该实施例的一个示例,第一字符序列的多条边界线对应于第一特征点的参数包括:第一字符序列的多条边界线在第一特征点对应的极坐标系下的距离参数和角度参数,其中,第一特征点对应的极坐标系表示以第一特征点为极点的极坐标系。在该示例中,第一特征点对应的极坐标系可以以极点指向x轴正方向的轴作为极轴。当然,本领域技术人员可以根据实际应用场景需求灵活设置极轴,在此不作限定。在该示例中,第一字符序列的任意一条边界线在第一特征点对应的极坐标系下的距离参数,可以表示在第一特征点对应的极坐标系下、第一特征点与边界线之间的最小距离,即,可以表示 在第一特征点对应的极坐标系下、第一特征点到边界线的垂线段的长度;第一字符序列的任意一条边界线在第一特征点对应的极坐标系下的角度参数,可以表示在第一特征点对应的极坐标系下、由第一特征点指向边界线上的垂点的向量与第一特征点对应的极坐标系的极轴之间的夹角,其中,边界线上的垂点表示第一特征点到边界线的垂线段与边界线的交点。As an example of this embodiment, the parameters of the plurality of boundary lines of the first character sequence corresponding to the first feature point include: distance parameters of the plurality of boundary lines of the first character sequence in the polar coordinate system corresponding to the first feature point and angle parameters, wherein the polar coordinate system corresponding to the first feature point represents a polar coordinate system with the first feature point as a pole. In this example, the polar coordinate system corresponding to the first feature point may use the axis whose pole points to the positive direction of the x-axis as the polar axis. Of course, those skilled in the art can flexibly set the polar axis according to actual application scenario requirements, which is not limited here. In this example, the distance parameter of any boundary line of the first character sequence in the polar coordinate system corresponding to the first feature point can represent the distance between the first feature point and the boundary line in the polar coordinate system corresponding to the first feature point The minimum distance between , that is, it can represent the length of the vertical line segment from the first feature point to the boundary line in the polar coordinate system corresponding to the first feature point; any boundary line of the first character sequence corresponds to the first feature point. The angle parameter in the polar coordinate system of the The included angle between , wherein the vertical point on the boundary line represents the intersection point of the vertical line segment from the first feature point to the boundary line and the boundary line.
在一个例子中,笛卡尔坐标系(直角坐标系或者斜坐标系)下的直线方程可以采用公式(1)来表示:In an example, the equation of a straight line in a Cartesian coordinate system (a Cartesian coordinate system or an oblique coordinate system) can be expressed by formula (1):
Ax+By+C=0   公式(1);Ax+By+C=0 Formula (1);
其中,A、B和C表示直线方程的参数。where A, B and C represent the parameters of the equation of the line.
然而,当C≠0时,公式1所示的直线方程中的参数及参数之间的相关性存在冗余。另外,笛卡尔坐标系下的直线方程的参数在图像中没有明确的物理意义,导致不利于网络学习。However, when C≠0, there is redundancy in the parameters and the correlations between the parameters in the equation of the straight line shown in Equation 1. In addition, the parameters of the straight line equation in the Cartesian coordinate system have no clear physical meaning in the image, which is not conducive to network learning.
在该示例中,可以将笛卡尔坐标系下的直线方程转换至极坐标系,得到公式(2):In this example, the equation of the line in the Cartesian coordinate system can be converted to the polar coordinate system, resulting in formula (2):
ρ=x cosθ+y sinθ   公式(2);ρ=x cosθ+y sinθ Formula (2);
其中,ρ可以表示第一字符序列的任意一条边界线在第一特征点对应的极坐标系下的距离参数,θ可以表示第一字符序列的任意一条边界线在第一特征点对应的极坐标系下的角度参数。Among them, ρ can represent the distance parameter of any boundary line of the first character sequence in the polar coordinate system corresponding to the first feature point, and θ can represent the polar coordinate corresponding to the first feature point of any boundary line of the first character sequence The angle parameter under the system.
相应地,直线方程的参数可以采用公式(3)来表示:Correspondingly, the parameters of the straight line equation can be expressed by formula (3):
A=cosθ,B=sinθ,C=-ρ  公式(3);A=cosθ, B=sinθ, C=-ρ Formula (3);
图3示出第一字符序列的4条边界线在某一第一特征点对应的极坐标系下的距离参数和角度参数的示意图。如图3所示,第一字符序列的上边界线在该第一特征点对应的极坐标系下的距离参数为ρ 1,角度参数为θ 1;第一字符序列的右边界线在该第一特征点对应的极坐标系下的距离参数为ρ 2,角度参数为θ 2;第一字符序列的下边界线在该第一特征点对应的极坐标系下的距离参数为ρ 3,角度参数为θ 3;第一字符序列的左边界线在该第一特征点对应的极坐标系下的距离参数为ρ 4,角度参数为θ 4FIG. 3 is a schematic diagram showing the distance parameters and angle parameters of the four boundary lines of the first character sequence in a polar coordinate system corresponding to a certain first feature point. As shown in FIG. 3 , the distance parameter of the upper boundary line of the first character sequence in the polar coordinate system corresponding to the first feature point is ρ 1 , and the angle parameter is θ 1 ; the right boundary line of the first character sequence is in the first character sequence. The distance parameter in the polar coordinate system corresponding to the feature point is ρ 2 , and the angle parameter is θ 2 ; the distance parameter of the lower boundary line of the first character sequence in the polar coordinate system corresponding to the first feature point is ρ 3 , and the angle parameter is θ 3 ; the distance parameter of the left boundary line of the first character sequence in the polar coordinate system corresponding to the first feature point is ρ 4 , and the angle parameter is θ 4 .
在该示例中,通过将边界线在笛卡尔坐标系下的直线方程映射到极坐标系中,得到在图像中具有明确的物理意义且相互独立的距离参数和角度参数,减少了参数量及相关性,且有利于网络学习。In this example, by mapping the straight line equation of the boundary line in the Cartesian coordinate system to the polar coordinate system, the distance parameters and angle parameters that have clear physical meaning and are independent of each other in the image are obtained, reducing the amount of parameters and related sex, and is conducive to online learning.
其中,根据第一字符序列的多条边界线对应于第一特征点的参数,确定第一字符序列的多条边界线的预测参数,包括:将第一字符序列的多条边界线在第一特征点对应的极坐标系下的距离参数和角度参数映射至笛卡尔坐标系,得到第一字符序列的多条边界线在笛卡尔坐标系下对应于第一特征点的参数;根据第一字符序列的多条边界线在笛卡尔坐标系下对应于第一特征点的参数,确定第一字符序列的多条边界线的预测参数。在这个例子中,在第一特征点的数量为多个的情况下,多个第一特征点对应于不同的极坐标系,其中,任一第一特征点对应的极坐标系以该第一特征点为极点。因此,对于第一字符序列的任意一条边界线,在根据该边界线在多个第一特征点对应的极坐标系下的距离参数和角度参数回归得到该边界线的预测参数时,可先将该边界线在多个第一特征点对应的极坐标系下的距离参数和角度参数映射至同一个笛卡尔坐标系下,得到该边界线在该笛卡尔坐标系下对应于多个特征点的参数,再根据该边界线在该笛卡尔坐标系下对应于多个特征点的参数进行回归,得到该边界线的预测参数。其中,通过将第一字符序列的多条边界线在第一特征点对应的极坐标系下的距离参数和角度参数映射至笛卡尔坐标系,得到第一字符序列的多条边界线在笛卡尔坐标系下对应于第一特征点的参数,并根据第一字符序列的多条边界线在笛卡尔坐标系下对应于第一特征点的参数,确定第一字符序列的多条边界线的预测参数,由此能够基于不同极坐标系下的参数回归得到边界线的预测参数。Wherein, determining the prediction parameters of the plurality of boundary lines of the first character sequence according to the parameters corresponding to the first feature points of the plurality of boundary lines of the first character sequence includes: placing the plurality of boundary lines of the first character sequence on the first The distance parameters and angle parameters in the polar coordinate system corresponding to the feature points are mapped to the Cartesian coordinate system, and the parameters of the multiple boundary lines of the first character sequence corresponding to the first feature point in the Cartesian coordinate system are obtained; according to the first character The multiple boundary lines of the sequence correspond to the parameters of the first feature point in the Cartesian coordinate system, and the prediction parameters of the multiple boundary lines of the first character sequence are determined. In this example, when the number of the first feature points is multiple, the multiple first feature points correspond to different polar coordinate systems, wherein the polar coordinate system corresponding to any first feature point is based on the first feature point. Feature points are poles. Therefore, for any boundary line of the first character sequence, when regressing the distance parameter and angle parameter of the boundary line in the polar coordinate system corresponding to the plurality of first feature points to obtain the prediction parameter of the boundary line, the prediction parameter of the boundary line can be obtained by first The distance parameters and angle parameters of the boundary line in the polar coordinate system corresponding to the plurality of first feature points are mapped to the same Cartesian coordinate system to obtain the boundary line corresponding to the plurality of feature points in the Cartesian coordinate system. parameters, and then perform regression according to the parameters of the boundary line corresponding to multiple feature points in the Cartesian coordinate system to obtain the predicted parameters of the boundary line. Wherein, by mapping the distance parameters and angle parameters of the multiple boundary lines of the first character sequence in the polar coordinate system corresponding to the first feature point to the Cartesian coordinate system, the multiple boundary lines of the first character sequence are obtained in Cartesian coordinates. The parameters corresponding to the first feature point in the coordinate system, and according to the parameters corresponding to the first feature point of the multiple boundary lines of the first character sequence in the Cartesian coordinate system, the prediction of multiple boundary lines of the first character sequence is determined parameters, so that the predicted parameters of the boundary line can be obtained by regression based on the parameters in different polar coordinate systems.
如图3所示,第一字符序列的上边界线的预测参数为A 1、B 1和C 1,即预测的第一字符序列的上边界线的直线方程可以表示为A 1x+B 1y+C 1=0;第一字符序列的右边界线的预测参数为A 2、B 2和C 2,即预测的第一字符序列的右边界线的直线方程可以表示为A 2x+B 2y+C 2=0;第一字符序列的下边界线的预测参数为A 3、B 3和C 3,即预测的第一字符序列的下边界线的直线方程可以表示为A 3x+B 3y+C 3=0;第一字符序列的左边界线的预测参数为A 4、B 4和C 4,即,所预测的第一字符序列的左边界线的直线方程可以表示为A 4x+B 4y+C 4=0。即可根据公式(4)至(6),得到第一字符序列的边界框的各个顶点的坐标: As shown in FIG. 3 , the prediction parameters of the upper boundary line of the first character sequence are A 1 , B 1 and C 1 , that is, the predicted straight line equation of the upper boundary line of the first character sequence can be expressed as A 1 x+B 1 y+C 1 =0; the prediction parameters of the right boundary line of the first character sequence are A 2 , B 2 and C 2 , that is, the predicted straight line equation of the right boundary line of the first character sequence can be expressed as A 2 x+B 2 y +C 2 =0; the prediction parameters of the lower boundary line of the first character sequence are A 3 , B 3 and C 3 , that is, the linear equation of the predicted lower boundary line of the first character sequence can be expressed as A 3 x+B 3 y+ C 3 =0; the prediction parameters of the left boundary line of the first character sequence are A 4 , B 4 and C 4 , that is, the predicted straight line equation of the left boundary line of the first character sequence can be expressed as A 4 x+B 4 y +C 4 =0. That is, according to formulas (4) to (6), the coordinates of each vertex of the bounding box of the first character sequence can be obtained:
D kl=A kB l-A lB k  公式(4); D kl =A k B l -A l B k formula (4);
Figure PCTCN2021080318-appb-000001
Figure PCTCN2021080318-appb-000001
Figure PCTCN2021080318-appb-000002
Figure PCTCN2021080318-appb-000002
其中,1≤k≤4,1≤l≤4,k和l均为整数。例如,(x 12,y 12)可以表示第一字符序列的边界框的右上角顶点的坐标,(x 23,y 23)可以表示第一字符序列的边界框的右下角顶点的坐标,(x 34,y 34)可以表示第一字符序列的边界框的左下角顶点的坐标,(x 41,y 41)可以表示第一字符序列的边界框的左上角顶点的坐标。 Among them, 1≤k≤4, 1≤l≤4, k and l are integers. For example, (x 12 , y 12 ) may represent the coordinates of the upper right vertex of the bounding box of the first character sequence, (x 23 , y 23 ) may represent the coordinates of the lower right vertex of the bounding box of the first character sequence, (x 34 , y 34 ) may represent the coordinates of the lower left corner vertex of the bounding box of the first character sequence, and (x 41 , y 41 ) may represent the coordinates of the upper left corner vertex of the bounding box of the first character sequence.
在其他示例中,第一字符序列的任意一条边界线对应于第一特征点的参数可以包括基于第一特征点预测的边界线在笛卡尔坐标系下的参数,在此不作限定。In other examples, the parameters of any boundary line of the first character sequence corresponding to the first feature point may include parameters of the boundary line predicted based on the first feature point in a Cartesian coordinate system, which is not limited herein.
在一个例子中,基于待处理图像,针对与第一字符序列相关的第一特征点,分别预测第一字符序列的多条边界线对应于第一特征点的参数,包括:将待处理图像输入预先训练的神经网络,经由神经网络针对与第一字符序列相关的第一特征点,分别预测第一字符序列的多条边界线对应于第一特征点的参数。其中,通过预先训练的神经网络针对与第一字符序列相关的第一特征点,分别预测第一字符序列的多条边界线对应于第一特征点的参数,由此能够提高预测参数的速度以及准确性。同时还可通过预先建立的模型、函数等预测第一字符序列的多条边界线对应于第一特征点的参数,在此不作限定。In an example, based on the image to be processed, for the first feature point related to the first character sequence, respectively predicting the parameters corresponding to the first feature point of multiple boundary lines of the first character sequence, including: inputting the image to be processed into The pre-trained neural network respectively predicts parameters corresponding to the first feature points of the plurality of boundary lines of the first character sequence for the first feature points related to the first character sequence via the neural network. Wherein, for the first feature points related to the first character sequence, the pre-trained neural network respectively predicts the parameters of the multiple boundary lines of the first character sequence corresponding to the first feature points, thereby improving the speed of predicting parameters and accuracy. At the same time, the parameters corresponding to the first feature points of the multiple boundary lines of the first character sequence can also be predicted by using a pre-established model, function, etc., which is not limited here.
本公开提供的实施例中,还可经由神经网络预测待处理图像中的像素所在位置属于字符的概率。其中,通过预先训练的神经网络预测待处理图像中的像素所在位置属于字符的概率,由此能够提高预测像素所在位置属于字符的概的速度,并能够提高所预测的概率的准确性。当然,在其他例子中,还可以通过预先建立的模型、函数等预测待处理图像中的像素所在位置属于字符的概率,在此不作限定。In the embodiments provided by the present disclosure, the probability that the position of the pixel in the image to be processed belongs to the character can also be predicted through the neural network. The pre-trained neural network is used to predict the probability that the position of the pixel in the image to be processed belongs to the character, thereby improving the speed of predicting the probability that the position of the pixel belongs to the character, and improving the accuracy of the predicted probability. Of course, in other examples, a pre-established model, function, etc. can also be used to predict the probability that the location of the pixel in the image to be processed belongs to a character, which is not limited here.
在本公开一些的实施例中,将待处理图像输入预先训练的神经网络之前,还可以将训练图像输入神经网络,经由神经网络针对与训练图像中的第二字符序列相关的第二特征点,分别预测第二字符序列的多条边界线对应于第二特征点的参数的预测值;根据第二字符序列的多条边界线对应于第二特征点的参数的预测值,以及第二字符序列的多条边界线对应于第二特征点的参数的真值,训练神经网络。In some embodiments of the present disclosure, before inputting the image to be processed into the pre-trained neural network, the training image may also be input into the neural network, and through the neural network, for the second feature point related to the second character sequence in the training image, Predicting the predicted values of the parameters of the second feature point corresponding to the multiple boundary lines of the second character sequence respectively; according to the predicted values of the parameters of the second feature point corresponding to the multiple boundary lines of the second character sequence, and the second character sequence The multiple boundary lines correspond to the true values of the parameters of the second feature point, training the neural network.
在相关技术中,通过回归四边形的四个顶点来构成字符的边界框。由于顶点实际上是两条相邻边 相交形成的,每个顶点的回归会影响两条边,因此,每条边都会被两个不同的顶点所干扰,从而影响网络的学习效率和检测效果。在本公开提供的实施例中,通过将字符序列的多边形(例如四边形)边界框拆解为多条(例如四条)独立的边界线,对每一条独立的边界线进行单独检测,由此不会由于回归顶点而给神经网络带来训练扰动,从而提高神经网络的学习效率和检测效果。根据该实施例训练得到的神经网络能够学习到准确地预测字符序列的边界线的参数的能力。In the related art, a bounding box of a character is constructed by regressing four vertices of a quadrilateral. Since the vertex is actually formed by the intersection of two adjacent edges, the regression of each vertex will affect the two edges, therefore, each edge will be disturbed by two different vertices, thus affecting the learning efficiency and detection effect of the network. In the embodiments provided by the present disclosure, by decomposing the polygon (such as quadrilateral) bounding box of the character sequence into multiple (such as four) independent boundary lines, each independent boundary line is independently detected, so that no The training disturbance is brought to the neural network due to the regression vertex, thereby improving the learning efficiency and detection effect of the neural network. The neural network trained according to this embodiment can learn the ability to accurately predict the parameters of the boundary line of the character sequence.
作为该实施例的一个示例,第二字符序列的多条边界线对应于第二特征点的参数包括:第二字符序列的多条边界线在第二特征点对应的极坐标系下的距离参数和角度参数,其中,第二特征点对应的极坐标系表示以第二特征点为极点的极坐标系;根据第二字符序列的多条边界线对应于第二特征点的参数的预测值,以及第二字符序列的多条边界线对应于第二特征点的参数的真值,训练神经网络,包括:根据第二字符序列的多条边界线对应于第二特征点的距离参数的预测值,以及第二字符序列的多条边界线对应于第二特征点的距离参数的真值,训练神经网络;和/或,根据第二字符序列的多条边界线对应于第二特征点的角度参数的预测值,以及第二字符序列的多条边界线对应于第二特征点的角度参数的真值,训练神经网络。在该示例中,通过将笛卡尔坐标系下的直线方程映射到极坐标系中,减少了学习参数和参数间的相关性,并且赋予了参数以图像中的实际物理意义,有利于网络学习。另外,在该示例中,通过训练神经网络学习检测字符序列的各条边界线对应于特征点的距离与角度,能够使边界线的检测不互相干扰,从而能够提高神经网络的学习效率和检测效果。As an example of this embodiment, the parameters of the plurality of boundary lines of the second character sequence corresponding to the second feature points include: distance parameters of the plurality of boundary lines of the second character sequence in the polar coordinate system corresponding to the second feature points and angle parameters, wherein, the polar coordinate system corresponding to the second feature point represents a polar coordinate system with the second feature point as a pole; according to the predicted values of the parameters of the second feature point corresponding to multiple boundary lines of the second character sequence, And multiple boundary lines of the second character sequence correspond to the true value of the parameter of the second feature point, training the neural network, comprising: according to the multiple boundary lines of the second character sequence corresponding to the predicted value of the distance parameter of the second feature point , and the multiple boundary lines of the second character sequence correspond to the true value of the distance parameter of the second feature point, train the neural network; and/or, according to the multiple boundary lines of the second character sequence correspond to the angle of the second feature point The predicted value of the parameter, and the true value of the angle parameter of the plurality of boundary lines of the second character sequence corresponding to the second feature point, train the neural network. In this example, by mapping the straight line equation in the Cartesian coordinate system to the polar coordinate system, the correlation between the learning parameters and the parameters is reduced, and the parameters are given the actual physical meaning in the image, which is beneficial to network learning. In addition, in this example, by training the neural network to learn to detect the distance and angle of each boundary line of the character sequence corresponding to the feature point, the detection of the boundary lines can not interfere with each other, so that the learning efficiency and detection effect of the neural network can be improved. .
在一个例子中,根据第二字符序列的多条边界线对应于第二特征点的距离参数的预测值,以及第二字符序列的多条边界线对应于第二特征点的距离参数的真值,训练神经网络,包括:对于第二字符序列的多条边界线中的任意一条边界线,根据边界线对应于第二特征点的距离参数的真值和预测值中的较小值与较大值的比值,训练神经网络。In one example, the plurality of boundary lines according to the second character sequence correspond to the predicted value of the distance parameter of the second feature point, and the plurality of boundary lines of the second character sequence correspond to the true value of the distance parameter of the second feature point , training the neural network, including: for any boundary line in the plurality of boundary lines of the second character sequence, according to the boundary line corresponding to the distance parameter of the second feature point between the true value and the predicted value of the smaller value and the larger value The ratio of values to train the neural network.
例如,针对第二字符序列的多条边界线中的任意一条边界线,距离参数对应的损失函数L ρ可以采用公式(7)得到: For example, for any one of the multiple boundary lines of the second character sequence, the loss function L ρ corresponding to the distance parameter can be obtained by using formula (7):
Figure PCTCN2021080318-appb-000003
Figure PCTCN2021080318-appb-000003
其中,N表示第二特征点的数量,
Figure PCTCN2021080318-appb-000004
表示该边界线对应于第二特征点i的距离参数的真值,ρ i表示该边界线对应于第二特征点i的距离参数的预测值,
Figure PCTCN2021080318-appb-000005
表示该边界线对应于第二特征点i的距离参数的真值和预测值中的较小值,
Figure PCTCN2021080318-appb-000006
表示该边界线对应于第二特征点i的距离参数的真值和预测值中的较大值。例如,若
Figure PCTCN2021080318-appb-000007
Figure PCTCN2021080318-appb-000008
Figure PCTCN2021080318-appb-000009
Figure PCTCN2021080318-appb-000010
由于
Figure PCTCN2021080318-appb-000011
和ρ i对应的极点相同(均为第二特征点i),即
Figure PCTCN2021080318-appb-000012
和ρ i的一端处于相同点,因此,该距离参数对应的损失函数L ρ可以称为射线重叠度(Intersection Over Union,IOU)损失函数。
Among them, N represents the number of second feature points,
Figure PCTCN2021080318-appb-000004
represents the true value of the distance parameter of the boundary line corresponding to the second feature point i, ρ i represents the predicted value of the distance parameter of the boundary line corresponding to the second feature point i,
Figure PCTCN2021080318-appb-000005
indicates that the boundary line corresponds to the smaller of the true value and the predicted value of the distance parameter of the second feature point i,
Figure PCTCN2021080318-appb-000006
Indicates that the boundary line corresponds to the larger of the true value and the predicted value of the distance parameter of the second feature point i. For example, if
Figure PCTCN2021080318-appb-000007
but
Figure PCTCN2021080318-appb-000008
like
Figure PCTCN2021080318-appb-000009
but
Figure PCTCN2021080318-appb-000010
because
Figure PCTCN2021080318-appb-000011
The poles corresponding to ρ i are the same (both are the second feature point i), that is,
Figure PCTCN2021080318-appb-000012
is at the same point as one end of ρ i , therefore, the loss function L ρ corresponding to the distance parameter can be called the Intersection Over Union (IOU) loss function.
在这个例子中,通过对于第二字符序列的多条边界线中的任意一条边界线,根据边界线对应于第二特征点的距离参数的真值和预测值中的较小值与较大值的比值,训练神经网络,由此能够对不同应用场景下、不同大小的距离参数进行归一化,从而能够有助于进行多尺度的字符检测,即,有助于在不同尺度的字符检测中达到更高的准确性。In this example, for any one of the plurality of boundary lines of the second character sequence, according to the boundary line corresponding to the actual value and the predicted value of the distance parameter of the second feature point, the smaller value and the larger value The ratio of , trains the neural network, which can normalize the distance parameters of different sizes in different application scenarios, which can help to perform multi-scale character detection, that is, it is helpful for character detection at different scales. achieve higher accuracy.
当然,在其他例子中,对于第二字符序列的多条边界线中的任意一条边界线,还可以根据边界线对应于第二特征点的距离参数的真值与预测值的查找训练神经网络,在此不作限定。Of course, in other examples, for any boundary line among the multiple boundary lines of the second character sequence, the neural network can also be trained according to the search of the true value and the predicted value of the distance parameter corresponding to the boundary line to the second feature point, It is not limited here.
在一个例子中,根据第二字符序列的多条边界线对应于第二特征点的角度参数的预测值,以及第二字符序列的多条边界线对应于第二特征点的角度参数的真值,训练神经网络,包括:对于第二字符序列的多条边界线中的任意一条边界线,确定边界线对应于第二特征点的角度参数的真值与预测值的差值的绝对值;根据绝对值的半倍角的正弦值,训练神经网络。In one example, the plurality of boundary lines of the second character sequence correspond to the predicted value of the angle parameter of the second feature point, and the plurality of boundary lines of the second character sequence correspond to the true value of the angle parameter of the second feature point , training the neural network, including: for any one of the multiple boundary lines of the second character sequence, determining the absolute value of the difference between the true value and the predicted value of the angle parameter of the boundary line corresponding to the second feature point; according to The absolute value of the sine of half the angle, training the neural network.
其中,绝对值的半倍角等于绝对值的0.5倍。例如,对于第二字符序列的多条边界线中的任意一条边界线,边界线对应于任一第二特征点的角度参数的预测值与真值的差值为90°或﹣90°,则边界线对应于该第二特征点的角度参数的真值与预测值的差值的绝对值为90°,则绝对值的半倍角为45°。Among them, the half angle of the absolute value is equal to 0.5 times the absolute value. For example, for any one of the multiple boundary lines of the second character sequence, the difference between the predicted value and the true value of the angle parameter of the boundary line corresponding to any second feature point is 90° or -90°, then The absolute value of the difference between the true value and the predicted value of the angle parameter of the boundary line corresponding to the second feature point is 90°, and the half angle of the absolute value is 45°.
例如,针对第二字符序列的多条边界线中的任意一条边界线,角度参数对应的损失函数L θ可以采用公式(8)得到: For example, for any one of the multiple boundary lines of the second character sequence, the loss function L θ corresponding to the angle parameter can be obtained by using formula (8):
Figure PCTCN2021080318-appb-000013
Figure PCTCN2021080318-appb-000013
其中,N表示第二特征点的数量,
Figure PCTCN2021080318-appb-000014
表示该边界线对应于第二特征点i的角度参数的真值,θ i表示该边界线对应于第二特征点i的角度参数的预测值,
Figure PCTCN2021080318-appb-000015
表示该边界线对应于第二特征点i的角度参数的真值与预测值的差值的绝对值,
Figure PCTCN2021080318-appb-000016
表示该边界线对应于第二特征点i的角度参数的真值与预测值的差值的绝对值的半倍角。
Among them, N represents the number of second feature points,
Figure PCTCN2021080318-appb-000014
represents the true value of the angle parameter of the boundary line corresponding to the second feature point i, θ i represents the predicted value of the angle parameter of the boundary line corresponding to the second feature point i,
Figure PCTCN2021080318-appb-000015
represents the absolute value of the difference between the true value and the predicted value of the angle parameter of the boundary line corresponding to the second feature point i,
Figure PCTCN2021080318-appb-000016
Indicates that the boundary line corresponds to the half angle of the absolute value of the difference between the true value and the predicted value of the angle parameter of the second feature point i.
其中,对于第二字符序列的多条边界线中的任意一条边界线,边界线对应于任一第二特征点的角度参数的真值和预测值的取值范围可以是[0,2π],即
Figure PCTCN2021080318-appb-000017
0≤θ i≤2π。然而在极坐标系中,0与2π重合。通过对于第二字符序列的多条边界线中的任意一条边界线,确定边界线对应于第二特征点的角度参数的真值与预测值的差值的绝对值,并根据绝对值的半倍角的正弦值,训练神经网络,由此不会因为0与2π混淆而对神经网络的学习带来干扰,从而提高神经网络的学习效率和检测效果。
Wherein, for any one of the multiple boundary lines of the second character sequence, the value range of the true value and the predicted value of the angle parameter of the boundary line corresponding to any second feature point may be [0, 2π], which is
Figure PCTCN2021080318-appb-000017
0≤θi≤2π . In polar coordinates, however, 0 coincides with 2π. For any one of the multiple boundary lines of the second character sequence, determine the absolute value of the difference between the true value and the predicted value of the angle parameter of the boundary line corresponding to the second feature point, and determine the absolute value of the difference according to the half angle of the absolute value. The sine value of , trains the neural network, so that the learning of the neural network will not be disturbed due to the confusion of 0 and 2π, thereby improving the learning efficiency and detection effect of the neural network.
当然,本领域技术人员还可以对公式8进行变形后采用余弦损失函数等,在此不作限定。Of course, those skilled in the art can also use a cosine loss function or the like after transforming Equation 8, which is not limited here.
作为该实施例的一个示例,第二特征点包括第二字符区域对应的有效区域中的特征点。其中,第二特征点可以仅包括第二字符区域对应的有效区域中的特征点,不包括第二字符区域对应的有效区域外的特征点。在计算神经网络的损失函数时,通过仅监督第二字符区域对应的有效区域中的特征点,不监督第二字符区域对应的有效区域外的特征点,有助于减少网络负担。对于第二字符区域的真实边界框中、靠近真实边界框的边缘区域的任一特征点而言,该特征点与真实边界框的边界线之间的距离较小,难以准确检测,容易造成较大的误差。例如,对于有效区域中的某一特征点,该特征点与真实边界框的某一边界线的距离参数的预测值为9,真实值为10,则误差为10%;对于有效区域外的某一特征点,该特征点与真实边界框的某一边界线的距离参数的预测值为1,真实值为2,则误差为50%。因此,通过忽略有效区域之外的特征点,有助于减少网络负担。当然,在其他示例中,第二字符序列的真实边界框中的所有特征点,在此不作限定。As an example of this embodiment, the second feature points include feature points in an effective area corresponding to the second character area. Wherein, the second feature points may only include feature points in the valid region corresponding to the second character region, and do not include feature points outside the valid region corresponding to the second character region. When calculating the loss function of the neural network, by only supervising the feature points in the valid region corresponding to the second character region, and not supervising the feature points outside the valid region corresponding to the second character region, it helps to reduce the network burden. For any feature point in the real bounding box of the second character region or in the edge region close to the real bounding box, the distance between the feature point and the boundary line of the real bounding box is small, so it is difficult to detect accurately, and it is easy to cause relatively big error. For example, for a feature point in the effective area, the predicted value of the distance parameter between the feature point and a certain boundary line of the real bounding box is 9, and the real value is 10, then the error is 10%; Feature point, the predicted value of the distance parameter between the feature point and a certain boundary line of the real bounding box is 1, and the real value is 2, then the error is 50%. Therefore, by ignoring feature points outside the effective region, it helps to reduce the network burden. Of course, in other examples, all the feature points in the real bounding box of the second character sequence are not limited here.
在一个例子中,本公开实施例提供的字符检测方法还包括:获取第二字符序列的真实边界框的位置信息;根据真实边界框的位置信息,以及预设比例,缩小真实边界框,得到第二字符序列对应的有效区域。在这个例子中,第二字符序列对应的有效区域的范围在第二字符序列的真实边界框内,且第二字符序列对应的有效区域的尺寸小于第二字符序列的真实边界框的尺寸。图4示出第二字符区域的真实边界框31和有效区域32的示意图。基于这个例子得到第二字符序列对应的有效区域,并基于第二字符序列对应的有效区域中的特征点进行神经网络的训练,有助于减少网络负担。In an example, the character detection method provided by the embodiment of the present disclosure further includes: acquiring position information of the real bounding box of the second character sequence; reducing the real bounding box according to the position information of the real bounding box and a preset ratio to obtain the first The valid region corresponding to the two-character sequence. In this example, the range of the valid region corresponding to the second character sequence is within the real bounding box of the second character sequence, and the size of the valid region corresponding to the second character sequence is smaller than the size of the real bounding box of the second character sequence. FIG. 4 shows a schematic diagram of the real bounding box 31 and the effective area 32 of the second character area. Based on this example, the effective area corresponding to the second character sequence is obtained, and the neural network is trained based on the feature points in the effective area corresponding to the second character sequence, which helps to reduce the network burden.
例如,根据真实边界框的位置信息,以及预设比例,缩小真实边界框,得到第二字符序列对应的 有效区域,包括:根据真实边界框的位置信息,确定真实边界框的锚点,其中,真实边界框的锚点为真实边界框的对角线的交点;根据真实边界框的位置信息,真实边界框的锚点的位置信息,以及预设比例,缩小真实边界框,得到第二字符序列对应的有效区域,其中,第一距离与第二距离的比值等于预设比例,第一距离表示有效区域的第一顶点与锚点之间的距离,第二距离表示真实边界框中第一顶点对应的顶点与锚点之间的距离,第一顶点表示有效区域的任一顶点。例如,预设比例可以是0.35、0.4、0.3等,在此不作限定。例如,第一顶点为有效区域的左上角顶点,则真实边界框中第一顶点对应的顶点为真实边界框的左上角顶点,以此类推。根据这个例子得到第二字符序列对应的有效区域,并基于第二字符序列对应的有效区域中的特征点进行神经网络的训练,有助于提高神经网络的学习效率和预测准确性。For example, reducing the real bounding box according to the position information of the real bounding box and the preset ratio to obtain an effective area corresponding to the second character sequence, including: determining the anchor point of the real bounding box according to the position information of the real bounding box, wherein, The anchor point of the real bounding box is the intersection of the diagonal lines of the real bounding box; according to the position information of the real bounding box, the position information of the anchor point of the real bounding box, and the preset scale, reduce the real bounding box to obtain the second character sequence The corresponding valid area, where the ratio of the first distance to the second distance is equal to the preset ratio, the first distance represents the distance between the first vertex of the valid area and the anchor point, and the second distance represents the first vertex in the real bounding box The distance between the corresponding vertex and the anchor point, the first vertex represents any vertex of the valid area. For example, the preset ratio may be 0.35, 0.4, 0.3, etc., which is not limited herein. For example, if the first vertex is the upper left vertex of the valid area, the vertex corresponding to the first vertex in the real bounding box is the upper left vertex of the real bounding box, and so on. According to this example, the effective area corresponding to the second character sequence is obtained, and the neural network is trained based on the feature points in the effective area corresponding to the second character sequence, which helps to improve the learning efficiency and prediction accuracy of the neural network.
在一个例子中,第二字符序列的真实边界框的4个顶点的坐标可以表示为(x i,y i),i=1,2,3,4。其中,第二字符序列的真实边界框的4个顶点可以按顺时针方向排序,(x 1,y 1)可以表示第二字符序列的真实边界框的左上角顶点,(x 2,y 2)可以表示第二字符序列的真实边界框的右上角顶点,(x 3,y 3)可以表示第二字符序列的真实边界框的右下角顶点,(x 4,y 4)可以表示第二字符序列的真实边界框的左下角顶点。对于任一第二特征点(x 0,y 0),第二字符序列的真实边界框的任意一条边界线对应于该第二特征点的距离参数的真值
Figure PCTCN2021080318-appb-000018
和角度参数的真值
Figure PCTCN2021080318-appb-000019
可以采用公式(9)至(16)确定:
In one example, the coordinates of the 4 vertices of the true bounding box of the second character sequence may be represented as ( xi , yi ), i=1, 2, 3, 4. Among them, the four vertices of the real bounding box of the second character sequence can be sorted clockwise, (x 1 , y 1 ) can represent the upper left corner vertex of the real bounding box of the second character sequence, (x 2 , y 2 ) can represent the upper right corner vertex of the real bounding box of the second character sequence, (x 3 , y 3 ) can represent the lower right corner vertex of the real bounding box of the second character sequence, (x 4 , y 4 ) can represent the second character sequence The bottom-left vertex of the ground-truth bounding box. For any second feature point (x 0 , y 0 ), any boundary line of the true bounding box of the second character sequence corresponds to the true value of the distance parameter of the second feature point
Figure PCTCN2021080318-appb-000018
and the truth value of the angle parameter
Figure PCTCN2021080318-appb-000019
Equations (9) to (16) can be used to determine:
j=mod(i,4)+1  公式(9);j=mod(i,4)+1 Formula (9);
A=y j-y i  公式(10); A = y j -y i formula (10);
B=x i-x j  公式(11); B=x i -x j formula (11);
C=x jy i-x iy j  公式(12); C=x j y i -x i y j formula (12);
Figure PCTCN2021080318-appb-000020
Figure PCTCN2021080318-appb-000020
Figure PCTCN2021080318-appb-000021
Figure PCTCN2021080318-appb-000021
e=(1,0)   公式(15);e=(1,0) Formula (15);
Figure PCTCN2021080318-appb-000022
Figure PCTCN2021080318-appb-000022
其中,q表示第二特征点到该边界线的垂线向量的真值,q与第二特征点到该边界线的垂线平行,且由第二特征点指向垂点,BC>0表示q在极轴下方。Among them, q represents the true value of the vertical vector from the second feature point to the boundary line, q is parallel to the vertical line from the second feature point to the boundary line, and points from the second feature point to the vertical point, BC>0 means q below the polar axis.
作为该实施例的一个示例,该方法还包括:经由神经网络预测训练图像中的像素所在位置属于字符的概率;根据训练图像中的像素所在位置属于字符的概率,以及训练图像中的像素所在位置属于字符的标注数据,训练神经网络。在该示例中,神经网络可以为多任务学习模型,分别学习字符分割(即学习检测图像中的像素所在位置属于字符的概率)以及边界线的参数预测两个任务。根据该示例,能够使神经网络学习到预测像素所在位置属于字符的概率的能力。As an example of this embodiment, the method further includes: predicting the probability that the position of the pixel in the training image belongs to the character via the neural network; according to the probability that the position of the pixel in the training image belongs to the character, and the position of the pixel in the training image Labeled data belonging to characters to train a neural network. In this example, the neural network can be a multi-task learning model, learning character segmentation (ie, learning to detect the probability that a pixel in an image belongs to a character) and parameter prediction of boundary lines. According to this example, the neural network can be made to learn the ability to predict the probability that the position of the pixel belongs to the character.
在一个例子中,根据训练图像中的像素所在位置属于字符的概率,以及训练图像中的像素所在位置属于字符的标注数据,训练神经网络,包括:根据第二字符序列对应的有效区域中的像素所在位置属于字符的概率,以及有效区域中的像素所在位置属于字符的标注数据,训练神经网络。In one example, training a neural network according to the probability that the position of the pixel in the training image belongs to the character, and the labeled data of the position of the pixel in the training image belonging to the character, includes: according to the pixel in the effective area corresponding to the second character sequence The probability that the position belongs to the character, and the labeled data of the position of the pixel in the effective area belonging to the character, train the neural network.
例如,字符分割对应的损失函数可以采用公式(17)得到:For example, the loss function corresponding to character segmentation can be obtained by using formula (17):
Figure PCTCN2021080318-appb-000023
Figure PCTCN2021080318-appb-000023
其中,
Figure PCTCN2021080318-appb-000024
表示第二字符序列对应的有效区域,
Figure PCTCN2021080318-appb-000025
表示第二字符序列对应的有效区域中的像素数;
Figure PCTCN2021080318-appb-000026
表示第二字符序列对应的有效区域中的像素j所在位置属于字符的标注数据,例如,若像素j所在位置属于字符,则
Figure PCTCN2021080318-appb-000027
若像素j所在位置不属于字符,则
Figure PCTCN2021080318-appb-000028
y j表示第二字符序列对应的有效区域中的像素j所在位置属于字符的概率,0≤y j≤1。
in,
Figure PCTCN2021080318-appb-000024
Indicates the valid area corresponding to the second character sequence,
Figure PCTCN2021080318-appb-000025
Indicates the number of pixels in the valid area corresponding to the second character sequence;
Figure PCTCN2021080318-appb-000026
Indicates that the position of the pixel j in the valid area corresponding to the second character sequence belongs to the label data of the character. For example, if the position of the pixel j belongs to the character, then
Figure PCTCN2021080318-appb-000027
If the position of pixel j does not belong to a character, then
Figure PCTCN2021080318-appb-000028
y j represents the probability that the position of the pixel j in the effective area corresponding to the second character sequence belongs to the character, 0≤yj≤1.
在这个例子中,通过根据第二字符序列对应的有效区域中的像素所在位置属于字符的概率,以及有效区域中的像素所在位置属于字符的标注数据,训练神经网络,由此能够使神经网络学习到字符分割的能力,且能提高神经网络学习字符分割的效率。In this example, the neural network can be trained by training the neural network according to the probability that the position of the pixel in the effective area corresponding to the second character sequence belongs to the character, and the labeled data that the position of the pixel in the effective area belongs to the character. It can improve the ability of character segmentation and improve the efficiency of neural network learning character segmentation.
在一个例子中,可以采用如公式(18)所示的损失函数L训练神经网络:In one example, a neural network can be trained with a loss function L as shown in Equation (18):
L=λ 1L cls2L ρ3L θ   公式(18); L=λ 1 L cls2 L ρ3 L θ Formula (18);
其中,L cls表示字符分割对应的损失函数,L ρ表示距离参数对应的损失函数,L θ表示角度参数对应的损失函数,λ 1表示L cls对应的权重,λ 2表示L ρ对应的权重,λ 3表示L θ对应的权重,λ 1、λ 2和λ 3可以根据经验或者训练策略等灵活设置,例如,λ 1=λ 2=λ 3=1,在此不作限定。 Among them, L cls represents the loss function corresponding to character segmentation, L ρ represents the loss function corresponding to the distance parameter, L θ represents the loss function corresponding to the angle parameter, λ 1 represents the weight corresponding to L cls , λ 2 represents the weight corresponding to L ρ , λ 3 represents the weight corresponding to L θ , and λ 1 , λ 2 and λ 3 can be flexibly set according to experience or training strategies, for example, λ 123 =1, which is not limited here.
作为该实施例的一个示例,神经网络可以包括至少一个通道削减模块,以降低神经网络的计算量,提高神经网络进行边界线检测的速度。As an example of this embodiment, the neural network may include at least one channel reduction module, so as to reduce the calculation amount of the neural network and improve the speed of the boundary line detection by the neural network.
作为该实施例的一个示例,神经网络可以包括至少一个特征聚合模块,以充分地利用多尺度的特征,提高神经网络进行边界线检测的准确性。As an example of this embodiment, the neural network may include at least one feature aggregation module, so as to make full use of multi-scale features and improve the accuracy of boundary line detection performed by the neural network.
下面对本公开实施例的一个应用场景进行说明。图5示出本公开实施例的一个应用场景的示意图。如图5所示,神经网络可以是编码器-解码器的结构。在图5中,506表示通道削减模块。例如,通道削减模块506可以采用1×1卷积来实现。当然,通道削减模块506还可以采用3×3卷积等来实现,在此不作限定。507表示特征聚合模块。特征聚合模块507可以用于对输入的特征图进行相乘、相加、concat(合并)等中的至少一种操作。例如,如图5所示,特征聚合模块507可以将输入的特征图的尺寸(宽和高)扩大为两倍后,基于扩大后的特征图与通道削减模块506的输出进行concat、1×1非线性卷积和3×3非线性卷积。如图5所示,神经网络可以使用骨架网络提取基础特征,经过特征聚合模块不断融合不同尺度的特征,最终得到9个通道的特征图,其中一个通道为文字置信度504(即输入图像中的各个像素输入字符的概率),其他8个通道为4条边界线的直线方程的距离参数和角度参 数,即四条边界线的参数503。根据输入图像501中3个字符序列的各条边界线在极坐标系下的距离参数和角度参数,可以得到3个字符序列的各条边界线在笛卡尔坐标系下的直线方程。图5的右侧的虚线框505中对4条边界线的直线方程进行了可视化,其中,从上到下依次示出了3个字符序列的上边界线、右边界线、下边界线和左边界线。根据输入图像中3个字符序列的各条边界线的直线方程,可以得到3个字符序列的边界框502,如图5的左下方所示。An application scenario of the embodiment of the present disclosure will be described below. FIG. 5 shows a schematic diagram of an application scenario of an embodiment of the present disclosure. As shown in Figure 5, the neural network can be an encoder-decoder structure. In Figure 5, 506 denotes a channel reduction module. For example, the channel reduction module 506 may be implemented using 1x1 convolutions. Of course, the channel reduction module 506 can also be implemented by using 3×3 convolution, etc., which is not limited here. 507 represents a feature aggregation module. The feature aggregation module 507 may be used to perform at least one operation of multiplying, adding, concat (merging) and the like on the input feature maps. For example, as shown in FIG. 5 , the feature aggregation module 507 can double the size (width and height) of the input feature map, and then perform concat, 1×1 concat, 1×1 based on the enlarged feature map and the output of the channel reduction module 506 Non-linear convolution and 3×3 non-linear convolution. As shown in Figure 5, the neural network can use the skeleton network to extract basic features, and continuously integrate the features of different scales through the feature aggregation module, and finally obtain the feature map of 9 channels, one of which is the text confidence level 504 (that is, the input image in the The probability of each pixel inputting a character), the other 8 channels are the distance parameters and angle parameters of the straight line equation of the four boundary lines, that is, the parameters 503 of the four boundary lines. According to the distance parameters and angle parameters of each boundary line of the three character sequences in the input image 501 in the polar coordinate system, the straight line equation of each boundary line of the three character sequences in the Cartesian coordinate system can be obtained. The straight line equation of the four boundary lines is visualized in the dashed box 505 on the right side of FIG. 5 , wherein the upper boundary line, the right boundary line, the lower boundary line and the left boundary line of the 3 character sequences are sequentially shown from top to bottom. According to the straight line equation of each boundary line of the 3 character sequences in the input image, the bounding box 502 of the 3 character sequences can be obtained, as shown in the lower left of FIG. 5 .
本公开实施例提供的字符检测方法可以应用于通用自然场景下的字符检测,以及实时文本翻译、单据识别、证件识别(例如身份证、银行卡)、车牌识别等应用场景中,在此不作限定。在一些自然场景中,由于相机视角畸变,图像中的字符将呈现为不规则的四边形。通过采用本公开实施例,能够精确地检测字符的边界,从而进一步校正字符的形状,有利于后续的字符识别。另外,除了字符之外,有一些字符的载体也会呈现出上述现象,例如刚性的身份证、银行卡以及车牌等。通过采用本公开实施例检测这些包含字符的四边形载体的边界,同样有利于后续的字符识别环节。The character detection method provided by the embodiments of the present disclosure can be applied to character detection in general natural scenarios, as well as real-time text translation, document recognition, certificate recognition (such as ID cards, bank cards), license plate recognition, and other application scenarios, which are not limited here. . In some natural scenes, characters in the image will appear as irregular quadrilaterals due to camera perspective distortion. By adopting the embodiments of the present disclosure, the boundary of the character can be accurately detected, so that the shape of the character can be further corrected, which is beneficial to the subsequent character recognition. In addition, in addition to characters, some character carriers also exhibit the above phenomenon, such as rigid ID cards, bank cards, and license plates. By using the embodiments of the present disclosure to detect the boundaries of these quadrilateral carriers containing characters, it is also beneficial to the subsequent character recognition process.
可以理解,本公开提及的上述各个方法实施例,在不违背原理逻辑的情况下,均可以彼此相互结合形成结合后的实施例,限于篇幅,本公开不再赘述。本领域技术人员可以理解,在具体实施方式的上述方法中,各步骤的具体执行顺序应当以其功能和可能的内在逻辑确定。It can be understood that the above-mentioned method embodiments mentioned in the present disclosure can be combined with each other to form a combined embodiment without violating the principle and logic. Those skilled in the art can understand that, in the above method of the specific embodiment, the specific execution order of each step should be determined by its function and possible internal logic.
此外,本公开还提供了字符检测装置、电子设备、存储介质以及程序,上述均可用来实现本公开提供的任一种字符检测方法,相应技术方案和技术效果可参见方法部分的相应记载,不再赘述。In addition, the present disclosure also provides a character detection device, an electronic device, a storage medium, and a program, all of which can be used to implement any character detection method provided by the present disclosure. For the corresponding technical solutions and technical effects, please refer to the corresponding records in the method section. Repeat.
图6示出本公开实施例提供的字符检测装置的框图。如图6所示,字符检测装置6包括:FIG. 6 shows a block diagram of a character detection apparatus provided by an embodiment of the present disclosure. As shown in Figure 6, the character detection device 6 includes:
第一预测模块61,配置为对待处理图像中第一字符序列的多条边界线分别进行预测,得到所述第一字符序列的多条边界线的预测参数,其中,所述第一字符序列的边界线表示所述第一字符序列所在区域与非所述第一字符序列所在区域之间的分界线;The first prediction module 61 is configured to respectively predict multiple boundary lines of the first character sequence in the image to be processed, and obtain prediction parameters of the multiple boundary lines of the first character sequence, wherein the The boundary line represents the dividing line between the area where the first character sequence is located and the area not where the first character sequence is located;
第一确定模块62,配置为根据所述第一字符序列的多条边界线的预测参数,确定所述第一字符序列的边界框的顶点的位置信息;a first determination module 62, configured to determine the position information of the vertices of the bounding box of the first character sequence according to the prediction parameters of a plurality of boundary lines of the first character sequence;
第二确定模块63,配置为根据所述第一字符序列的边界框的顶点的位置信息,确定所述第一字符序列的边界框的位置信息。The second determining module 63 is configured to determine the position information of the bounding box of the first character sequence according to the position information of the vertices of the bounding box of the first character sequence.
在本公开的一些实施例中,所述第一预测模块61还配置为基于所述待处理图像,针对与第一字符序列相关的第一特征点,分别预测所述第一字符序列的多条边界线对应于所述第一特征点的参数;In some embodiments of the present disclosure, the first prediction module 61 is further configured to, based on the to-be-processed image, respectively predict a plurality of pieces of the first character sequence for the first feature points related to the first character sequence The boundary line corresponds to the parameter of the first feature point;
根据所述第一字符序列的多条边界线对应于所述第一特征点的参数,确定所述第一字符序列的多条边界线的预测参数。The prediction parameters of the plurality of boundary lines of the first character sequence are determined according to the parameters of the plurality of boundary lines of the first character sequence corresponding to the first feature points.
在本公开的一些实施例中,所述字符检测装置6还包括:In some embodiments of the present disclosure, the character detection device 6 further includes:
第二预测模块,配置为预测所述待处理图像中的像素所在位置属于字符的概率;a second prediction module, configured to predict the probability that the position of the pixel in the to-be-processed image belongs to a character;
第三确定模块,配置为根据所述待处理图像中的像素所在位置属于字符的概率,确定所述第一特征点。The third determining module is configured to determine the first feature point according to the probability that the position of the pixel in the image to be processed belongs to a character.
在本公开的一些实施例中,所述第一字符序列的多条边界线对应于所述第一特征点的参数包括:In some embodiments of the present disclosure, the parameters of the plurality of boundary lines of the first character sequence corresponding to the first feature point include:
所述第一字符序列的多条边界线在所述第一特征点对应的极坐标系下的距离参数和角度参数,其中,所述第一特征点对应的极坐标系表示以所述第一特征点为极点的极坐标系。Distance parameters and angle parameters of multiple boundary lines of the first character sequence in the polar coordinate system corresponding to the first feature point, wherein the polar coordinate system corresponding to the first feature point is represented by the first feature point. A polar coordinate system in which the feature points are poles.
在本公开的一些实施例中,所述第一预测模块61还配置为将所述第一字符序列的多条边界线在所述第一特征点对应的极坐标系下的距离参数和角度参数映射至笛卡尔坐标系,得到所述第一字符序列的多条边界线在所述笛卡尔坐标系下对应于所述第一特征点的参数;In some embodiments of the present disclosure, the first prediction module 61 is further configured to calculate distance parameters and angle parameters of multiple boundary lines of the first character sequence in the polar coordinate system corresponding to the first feature point Map to a Cartesian coordinate system, and obtain the parameters corresponding to the first feature point of a plurality of boundary lines of the first character sequence under the Cartesian coordinate system;
根据所述第一字符序列的多条边界线在所述笛卡尔坐标系下对应于所述第一特征点的参数,确定所述第一字符序列的多条边界线的预测参数。According to the parameters of the plurality of boundary lines of the first character sequence corresponding to the first feature point in the Cartesian coordinate system, the prediction parameters of the plurality of boundary lines of the first character sequence are determined.
在本公开的一些实施例中,所述第一字符序列的多条边界线包括所述第一字符序列的上边界线、右边界线、下边界线和左边界线。In some embodiments of the present disclosure, the plurality of boundary lines of the first character sequence include an upper boundary line, a right boundary line, a lower boundary line and a left boundary line of the first character sequence.
在本公开的一些实施例中,所述第一预测模块61还配置为将所述待处理图像输入预先训练的神经网络,经由所述神经网络针对与第一字符序列相关的第一特征点,分别预测所述第一字符序列的多条边界线对应于所述第一特征点的参数。In some embodiments of the present disclosure, the first prediction module 61 is further configured to input the image to be processed into a pre-trained neural network, and for the first feature point related to the first character sequence via the neural network, A plurality of boundary lines of the first character sequence are respectively predicted to correspond to parameters of the first feature point.
在本公开的一些实施例中,所述字符检测装置6还包括:In some embodiments of the present disclosure, the character detection device 6 further includes:
第三预测模块,配置为经由所述神经网络预测所述待处理图像中的像素所在位置属于字符的概率。The third prediction module is configured to predict the probability that the position of the pixel in the image to be processed belongs to the character through the neural network.
在本公开的一些实施例中,所述字符检测装置6还包括:In some embodiments of the present disclosure, the character detection device 6 further includes:
第四预测模块,配置为将训练图像输入所述神经网络,经由所述神经网络针对与所述训练图像中的第二字符序列相关的第二特征点,分别预测所述第二字符序列的多条边界线对应于所述第二特征点的参数的预测值;The fourth prediction module is configured to input the training image into the neural network, and through the neural network, for the second feature points related to the second character sequence in the training image, respectively predict the number of the second character sequence. A boundary line corresponds to the predicted value of the parameter of the second feature point;
第一训练模块,配置为根据所述第二字符序列的多条边界线对应于所述第二特征点的参数的预测值,以及所述第二字符序列的多条边界线对应于所述第二特征点的参数的真值,训练所述神经网络。The first training module is configured to correspond to the predicted value of the parameter of the second feature point according to the plurality of boundary lines of the second character sequence, and the plurality of boundary lines of the second character sequence correspond to the first The true values of the parameters of the two feature points, train the neural network.
在本公开的一些实施例中,所述第二字符序列的多条边界线对应于所述第二特征点的参数包括:所述第二字符序列的多条边界线在所述第二特征点对应的极坐标系下的距离参数和角度参数,其中,所述第二特征点对应的极坐标系表示以所述第二特征点为极点的极坐标系;In some embodiments of the present disclosure, the parameters of the plurality of boundary lines of the second character sequence corresponding to the second feature point include: the plurality of boundary lines of the second character sequence are at the second feature point The distance parameter and the angle parameter under the corresponding polar coordinate system, wherein, the polar coordinate system corresponding to the second feature point represents a polar coordinate system with the second feature point as a pole;
所述第一训练模块配置为根据所述第二字符序列的多条边界线对应于所述第二特征点的距离参数的预测值,以及所述第二字符序列的多条边界线对应于所述第二特征点的距离参数的真值,训练所述神经网络;The first training module is configured to correspond to the predicted value of the distance parameter of the second feature point according to the plurality of boundary lines of the second character sequence, and the plurality of boundary lines of the second character sequence correspond to the predicted value of the distance parameter of the second feature point. The true value of the distance parameter of the second feature point is used to train the neural network;
和/或,and / or,
根据所述第二字符序列的多条边界线对应于所述第二特征点的角度参数的预测值,以及所述第二字符序列的多条边界线对应于所述第二特征点的角度参数的真值,训练所述神经网络。According to the predicted value of the angle parameter of the second feature point corresponding to the plurality of boundary lines of the second character sequence, and the angle parameter of the second feature point corresponding to the plurality of boundary lines of the second character sequence The true value of , to train the neural network.
在本公开的一些实施例中,所述第一训练模块配置为对于所述第二字符序列的多条边界线中的任意一条边界线,根据所述边界线对应于所述第二特征点的距离参数的真值和预测值中的较小值与较大值的比值,训练所述神经网络。In some embodiments of the present disclosure, the first training module is configured to, for any one of a plurality of boundary lines of the second character sequence, according to the boundary line corresponding to the second feature point The ratio of the smaller to larger of the true and predicted values of the distance parameter, trains the neural network.
在本公开的一些实施例中,所述第一训练模块配置为对于所述第二字符序列的多条边界线中的任意一条边界线,确定所述边界线对应于所述第二特征点的角度参数的真值与预测值的差值的绝对值;In some embodiments of the present disclosure, the first training module is configured to, for any one of a plurality of boundary lines of the second character sequence, determine that the boundary line corresponds to the second feature point. The absolute value of the difference between the true value of the angle parameter and the predicted value;
根据所述绝对值的半倍角的正弦值,训练所述神经网络。The neural network is trained according to the sine of the half angle of the absolute value.
在本公开的一些实施例中,所述第二特征点包括所述第二字符区域对应的有效区域中的特征点。In some embodiments of the present disclosure, the second feature points include feature points in an effective area corresponding to the second character area.
在本公开的一些实施例中,所述装置还包括:In some embodiments of the present disclosure, the apparatus further includes:
第五预测模块,配置为经由所述神经网络预测所述训练图像中的像素所在位置属于字符的概率;a fifth prediction module, configured to predict the probability that the position of the pixel in the training image belongs to the character via the neural network;
第二训练模块,配置为根据所述训练图像中的像素所在位置属于字符的概率,以及所述训练图像中的像素所在位置属于字符的标注数据,训练所述神经网络。The second training module is configured to train the neural network according to the probability that the position of the pixel in the training image belongs to a character, and the labeled data that the position of the pixel in the training image belongs to the character.
在本公开的一些实施例中,所述第二训练模块还配置为根据所述第二字符序列对应的有效区域中的像素所在位置属于字符的概率,以及所述有效区域中的像素所在位置属于字符的标注数据,训练所述神经网络。In some embodiments of the present disclosure, the second training module is further configured to, according to the probability that the position of the pixel in the effective area corresponding to the second character sequence belongs to the character, and the position of the pixel in the effective area belongs to Annotated data of characters to train the neural network.
在本公开的一些实施例中,所述字符检测装置6还包括:In some embodiments of the present disclosure, the character detection device 6 further includes:
获取模块,配置为获取所述第二字符序列的真实边界框的位置信息;an acquisition module, configured to acquire the position information of the real bounding box of the second character sequence;
缩小模块,配置为根据所述真实边界框的位置信息,以及预设比例,缩小所述真实边界框,得到所述第二字符序列对应的有效区域。The shrinking module is configured to shrink the real bounding box according to the position information of the real bounding box and a preset ratio to obtain an effective area corresponding to the second character sequence.
在本公开的一些实施例中,所述缩小模块还配置为根据所述真实边界框的位置信息,确定所述真实边界框的锚点,其中,所述真实边界框的锚点为所述真实边界框的对角线的交点;In some embodiments of the present disclosure, the reduction module is further configured to determine the anchor point of the real bounding box according to the position information of the real bounding box, wherein the anchor point of the real bounding box is the real bounding box the intersection of the diagonals of the bounding box;
根据所述真实边界框的位置信息,所述真实边界框的锚点的位置信息,以及预设比例,缩小所述真实边界框,得到所述第二字符序列对应的有效区域,其中,第一距离与第二距离的比值等于所述预设比例,所述第一距离表示所述有效区域的第一顶点与所述锚点之间的距离,所述第二距离表示真实边界框中所述第一顶点对应的顶点与所述锚点之间的距离,所述第一顶点表示所述有效区域的任一顶点。According to the position information of the real bounding box, the position information of the anchor point of the real bounding box, and the preset ratio, the real bounding box is reduced to obtain the effective area corresponding to the second character sequence, wherein the first The ratio of the distance to the second distance is equal to the preset ratio, the first distance represents the distance between the first vertex of the effective area and the anchor point, and the second distance represents the The distance between the vertex corresponding to the first vertex and the anchor point, where the first vertex represents any vertex of the effective area.
在本公开实施例中,通过对待处理图像中第一字符序列的多条边界线分别进行预测,得到第一字符序列的多条边界线的预测参数,根据第一字符序列的多条边界线的预测参数,确定第一字符序列的 边界框的顶点的位置信息,并根据第一字符序列的边界框的顶点的位置信息,确定第一字符序列的边界框的位置信息,由此将字符序列的多边形(例如四边形)边界框拆解为多条(例如四条)独立的边界线,对每一条独立的边界线进行单独检测,从而每一条边界线的检测均不会被两个不同的顶点所干扰,进而能够提高字符检测的准确性。In the embodiment of the present disclosure, the prediction parameters of the multiple boundary lines of the first character sequence are obtained by respectively predicting multiple boundary lines of the first character sequence in the image to be processed. The prediction parameter determines the position information of the vertices of the bounding box of the first character sequence, and determines the position information of the bounding box of the first character sequence according to the position information of the vertices of the bounding box of the first character sequence. The polygon (such as quadrilateral) bounding box is disassembled into multiple (such as four) independent boundary lines, and each independent boundary line is detected separately, so that the detection of each boundary line will not be disturbed by two different vertices , which can improve the accuracy of character detection.
在一些实施例中,本公开实施例提供的字符检测装置6具有的功能或包含的模块可以配置为执行上文方法实施例描述的方法,其具体实现和技术效果可以参照上文方法实施例的描述,这里不再赘述。In some embodiments, the functions or modules included in the character detection apparatus 6 provided in the embodiments of the present disclosure may be configured to execute the methods described in the above method embodiments, and the specific implementation and technical effects thereof may refer to the above method embodiments. description, which will not be repeated here.
本公开实施例还提供一种计算机可读存储介质,其上存储有计算机程序指令,该计算机程序指令被处理器执行时实现上述方法。其中,该计算机可读存储介质可以是非易失性计算机可读存储介质,或者可以是易失性计算机可读存储介质。Embodiments of the present disclosure further provide a computer-readable storage medium, on which computer program instructions are stored, and when the computer program instructions are executed by a processor, the foregoing method is implemented. Wherein, the computer-readable storage medium may be a non-volatile computer-readable storage medium, or may be a volatile computer-readable storage medium.
本公开实施例还提出一种计算机程序,包括计算机可读代码,当计算机可读代码在电子设备中运行时,电子设备中的处理器执行用于实现上述任一实施例提供的字符检测方法。An embodiment of the present disclosure further provides a computer program, including computer-readable code, when the computer-readable code is executed in an electronic device, a processor in the electronic device executes the character detection method provided by any of the foregoing embodiments.
本公开实施例还提供了另一种计算机程序产品,用于存储计算机可读指令,指令被执行时使得计算机执行上述任一实施例提供的字符检测方法的操作。Embodiments of the present disclosure further provide another computer program product for storing computer-readable instructions, which, when executed, cause the computer to perform the operations of the character detection method provided by any of the foregoing embodiments.
本公开实施例还提供一种电子设备,包括:一个或多个处理器;用于存储可执行指令的存储器;其中,一个或多个处理器被配置为调用存储器存储的可执行指令,以执行上述任一实施例提供的字符检测方法。Embodiments of the present disclosure further provide an electronic device, including: one or more processors; a memory for storing executable instructions; wherein the one or more processors are configured to call the executable instructions stored in the memory to execute The character detection method provided by any of the above embodiments.
电子设备可以被提供为终端、服务器或其它形态的设备。The electronic device may be provided as a terminal, server or other form of device.
图7示出本公开实施例提供的一种电子设备800的框图。例如,电子设备800可以是移动电话,计算机,数字广播终端,消息收发设备,游戏控制台,平板设备,医疗设备,健身设备,个人数字助理等终端。FIG. 7 shows a block diagram of an electronic device 800 provided by an embodiment of the present disclosure. For example, electronic device 800 may be a mobile phone, computer, digital broadcast terminal, messaging device, game console, tablet device, medical device, fitness device, personal digital assistant, etc. terminal.
参照图7,电子设备800可以包括以下一个或多个组件:处理组件802,存储器804,电源组件806,多媒体组件808,音频组件810,输入/输出(Input/Output,I/O)接口812,传感器组件814,以及通信组件816。7, an electronic device 800 may include one or more of the following components: a processing component 802, a memory 804, a power supply component 806, a multimedia component 808, an audio component 810, an Input/Output (I/O) interface 812, Sensor assembly 814 , and communication assembly 816 .
处理组件802通常控制电子设备800的整体操作,诸如与显示,电话呼叫,数据通信,相机操作和记录操作相关联的操作。处理组件802可以包括一个或多个处理器820来执行指令,以完成上述的方法的全部或部分步骤。此外,处理组件802可以包括一个或多个模块,便于处理组件802和其他组件之间的交互。例如,处理组件802可以包括多媒体模块,以方便多媒体组件808和处理组件802之间的交互。The processing component 802 generally controls the overall operation of the electronic device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 can include one or more processors 820 to execute instructions to perform all or some of the steps of the methods described above. Additionally, processing component 802 may include one or more modules that facilitate interaction between processing component 802 and other components. For example, processing component 802 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802.
存储器804被配置为存储各种类型的数据以支持在电子设备800的操作。这些数据的示例包括用于在电子设备800上操作的任何应用程序或方法的指令,联系人数据,电话簿数据,消息,图片,视频等。存储器804可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(Static Random-Access Memory,SRAM),电可擦除可编程只读存储器(Electrically Erasable Programmable read only memory,EEPROM),可擦除可编程只读存储器(Electrical Programmable Read Only Memory,EPROM),可编程只读存储器(Programmable Read-Only Memory,PROM),只读存储器(Read-Only Memory,ROM),磁存储器,快闪存储器,磁盘或光盘。Memory 804 is configured to store various types of data to support operation at electronic device 800 . Examples of such data include instructions for any application or method operating on electronic device 800, contact data, phonebook data, messages, pictures, videos, and the like. The memory 804 may be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as Static Random-Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (Electrically Erasable) Erasable Programmable read only memory, EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), Read Only Memory (Read-Only Memory) , ROM), magnetic memory, flash memory, magnetic disk or optical disk.
电源组件806为电子设备800的各种组件提供电力。电源组件806可以包括电源管理系统,一个或多个电源,及其他与为电子设备800生成、管理和分配电力相关联的组件。Power supply assembly 806 provides power to various components of electronic device 800 . Power supply components 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 800 .
多媒体组件808包括在所述电子设备800和用户之间的提供一个输出接口的屏幕。在一些实施例中,屏幕可以包括液晶显示器(Liquid Crystal Display,LCD)和触摸面板(Touch Panel,TP)。如果屏幕包括触摸面板,屏幕可以被实现为触摸屏,以接收来自用户的输入信号。触摸面板包括一个或多个触摸传感器以感测触摸、滑动和触摸面板上的手势。所述触摸传感器可以不仅感测触摸或滑动动作的边界,而且还检测与所述触摸或滑动操作相关的持续时间和压力。在一些实施例中,多媒体组件808包括一个前置摄像头和/或后置摄像头。当电子设备800处于操作模式,如拍摄模式或视频模式时,前置摄像头和/或后置摄像头可以接收外部的多媒体数据。每个前置摄像头和后置摄像头可以是一个固定的光学透镜系统或具有焦距和光学变焦能力。Multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and the user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touch, swipe, and gestures on the touch panel. The touch sensor may not only sense the boundaries of a touch or swipe action, but also detect the duration and pressure associated with the touch or swipe action. In some embodiments, the multimedia component 808 includes a front-facing camera and/or a rear-facing camera. When the electronic device 800 is in an operation mode, such as a shooting mode or a video mode, the front camera and/or the rear camera may receive external multimedia data. Each of the front and rear cameras can be a fixed optical lens system or have focal length and optical zoom capability.
音频组件810被配置为输出和/或输入音频信号。例如,音频组件810包括一个麦克风(Microphone,MIC),当电子设备800处于操作模式,如呼叫模式、记录模式和语音识别模式时,麦克风被配置为接收外部音频信号。所接收的音频信号可以被进一步存储在存储器804或经由通信组件816发送。在一些实施例中,音频组件810还包括一个扬声器,用于输出音频信号。Audio component 810 is configured to output and/or input audio signals. For example, the audio component 810 includes a microphone (Microphone, MIC) configured to receive external audio signals when the electronic device 800 is in an operating mode, such as a calling mode, a recording mode, and a voice recognition mode. The received audio signal may be further stored in memory 804 or transmitted via communication component 816 . In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
I/O接口812为处理组件802和外围接口模块之间提供接口,上述外围接口模块可以是键盘,点击轮,按钮等。这些按钮可包括但不限于:主页按钮、音量按钮、启动按钮和锁定按钮。The I/O interface 812 provides an interface between the processing component 802 and a peripheral interface module, which may be a keyboard, a click wheel, a button, or the like. These buttons may include, but are not limited to: home button, volume buttons, start button, and lock button.
传感器组件814包括一个或多个传感器,用于为电子设备800提供各个方面的状态评估。例如,传感器组件814可以检测到电子设备800的打开/关闭状态,组件的相对定位,例如所述组件为电子设备800的显示器和小键盘,传感器组件814还可以检测电子设备800或电子设备800一个组件的位置改变,用户与电子设备800接触的存在或不存在,电子设备800方位或加速/减速和电子设备800的温度变化。传感器组件814可以包括接近传感器,被配置用来在没有任何的物理接触时检测附近物体的存在。传感器组件814还可以包括光传感器,如互补金属氧化物半导体(Complementary Metal Oxide Semiconductor,CMOS)或电荷耦合装置(Charge-coupled Device,CCD)图像传感器,用于在成像应用中使用。在一些实施例中,该传感器组件814还可以包括加速度传感器,陀螺仪传感器,磁传感器,压力传感器或温度传感器。Sensor assembly 814 includes one or more sensors for providing status assessment of various aspects of electronic device 800 . For example, the sensor assembly 814 can detect the on/off state of the electronic device 800, the relative positioning of the components, such as the display and the keypad of the electronic device 800, the sensor assembly 814 can also detect the electronic device 800 or one of the electronic device 800 Changes in the position of components, presence or absence of user contact with the electronic device 800 , orientation or acceleration/deceleration of the electronic device 800 and changes in the temperature of the electronic device 800 . Sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects in the absence of any physical contact. Sensor assembly 814 may also include a light sensor, such as a Complementary Metal Oxide Semiconductor (CMOS) or Charge-coupled Device (CCD) image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
通信组件816被配置为便于电子设备800和其他设备之间有线或无线方式的通信。电子设备800可以接入基于通信标准的无线网络,如无线网络(Wi-Fi)、第二代移动通信技术(2-Generation,2G)、第三代移动通信技术(3rd-Generation,3G)、第四代移动通信技术(4-Generation,4G)/,通用移动通信技术的长期演进(Long Term Evolution,LTE)、第五代移动通信技术(5-Generation,5G)或它们的组合。在一个示例性实施例中,通信组件816经由广播信道接收来自外部广播管理系统的广播信号或广播相关信息。在一个示例性实施例中,所述通信组件816还包括近场通信(Near Field Communication,NFC)模块,以促进短程通信。例如,在NFC模块可基于射频识别(Radio Frequency Identification,RFID)技术,红外数据协会(Infrared Data Association,IrDA)技术,超宽带(Ultra Wide Band,UWB)技术,蓝牙(BitTorrent,BT)技术和其他技术来实现。Communication component 816 is configured to facilitate wired or wireless communication between electronic device 800 and other devices. The electronic device 800 can access a wireless network based on a communication standard, such as a wireless network (Wi-Fi), a second-generation mobile communication technology (2-Generation, 2G), a third-generation mobile communication technology (3rd-Generation, 3G), The fourth generation mobile communication technology (4-Generation, 4G)/, the long term evolution (Long Term Evolution, LTE) of the universal mobile communication technology, the fifth generation mobile communication technology (5-Generation, 5G) or their combination. In one exemplary embodiment, the communication component 816 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a Near Field Communication (NFC) module to facilitate short-range communication. For example, the NFC module may be based on Radio Frequency Identification (RFID) technology, Infrared Data Association (IrDA) technology, Ultra Wide Band (UWB) technology, Bluetooth (BitTorrent, BT) technology and other technology to achieve.
在示例性实施例中,电子设备800可以被一个或多个应用专用集成电路(Application Specific Integrated Circuit,ASIC)、数字信号处理器(Digital Signal Process,DSP)、数字信号处理设备(Digital Signal Process Device,DSPD)、可编程逻辑器件(Programmable Logic Device,PLD)、现场可编程门阵列(Field Programmable Gate Array,FPGA)、控制器、微控制器、微处理器或其他电子元件实现,用于执行上述方法。In an exemplary embodiment, the electronic device 800 may be implemented by one or more Application Specific Integrated Circuit (ASIC), Digital Signal Process (DSP), Digital Signal Processing Device (Digital Signal Process Device) , DSPD), Programmable Logic Device (PLD), Field Programmable Gate Array (FPGA), controller, microcontroller, microprocessor, or other electronic component implementation, used to perform the above method.
在示例性实施例中,还提供了一种非易失性计算机可读存储介质,例如包括计算机程序指令的存储器804,上述计算机程序指令可由电子设备800的处理器820执行以完成上述方法。In an exemplary embodiment, a non-volatile computer-readable storage medium, such as a memory 804 comprising computer program instructions executable by the processor 820 of the electronic device 800 to perform the above method is also provided.
图8示出本公开实施例提供的一种电子设备1900的框图。例如,电子设备1900可以被提供为一服务器。参照图8,电子设备1900包括处理组件1922,其进一步包括一个或多个处理器,以及由存储器1932所代表的存储器资源,用于存储可由处理组件1922的执行的指令,例如应用程序。存储器1932中存储的应用程序可以包括一个或一个以上的每一个对应于一组指令的模块。此外,处理组件1922被配置为执行指令,以执行上述方法。FIG. 8 shows a block diagram of an electronic device 1900 provided by an embodiment of the present disclosure. For example, the electronic device 1900 may be provided as a server. 8, electronic device 1900 includes processing component 1922, which further includes one or more processors, and a memory resource represented by memory 1932 for storing instructions executable by processing component 1922, such as applications. An application program stored in memory 1932 may include one or more modules, each corresponding to a set of instructions. Additionally, the processing component 1922 is configured to execute instructions to perform the above-described methods.
电子设备1900还可以包括一个电源组件1926被配置为执行电子设备1900的电源管理,一个有线或无线网络接口1950被配置为将电子设备1900连接到网络,和一个输入输出接口1958。电子设备1900可以操作基于存储在存储器1932的操作系统,例如微软服务器操作系统(Windows ServerTM),苹果公司推出的基于图形用户界面操作系统(Mac OS XTM),多用户多进程的计算机操作系统(UnixTM),自由和开放原代码的类Unix操作系统(LinuxTM),开放原代码的类Unix操作系统(FreeBSDTM)或类似。The electronic device 1900 may also include a power supply assembly 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input-output interface 1958. The electronic device 1900 can operate based on an operating system stored in the memory 1932, such as a Microsoft server operating system (Windows ServerTM), a graphical user interface based operating system (Mac OS XTM) introduced by Apple, a multi-user multi-process computer operating system (UnixTM). ), Free and Open Source Unix-like Operating System (LinuxTM), Open Source Unix-like Operating System (FreeBSDTM) or similar.
在示例性实施例中,还提供了一种非易失性计算机可读存储介质,例如包括计算机程序指令的存储器1932,上述计算机程序指令可由电子设备1900的处理组件1922执行以完成上述方法。In an exemplary embodiment, a non-volatile computer-readable storage medium is also provided, such as memory 1932 comprising computer program instructions executable by processing component 1922 of electronic device 1900 to perform the above-described method.
本公开可以是系统、方法和/或计算机程序产品。计算机程序产品可以包括计算机可读存储介质, 其上载有用于使处理器实现本公开的各个方面的计算机可读程序指令。The present disclosure may be a system, method and/or computer program product. The computer program product may include a computer-readable storage medium having computer-readable program instructions loaded thereon for causing a processor to implement various aspects of the present disclosure.
计算机可读存储介质可以是可以保持和存储由指令执行设备使用的指令的有形设备。计算机可读存储介质例如可以是但不限于电存储设备、磁存储设备、光存储设备、电磁存储设备、半导体存储设备或者上述的任意合适的组合。计算机可读存储介质的更具体的例子(非穷举的列表)包括:便携式计算机盘、硬盘、随机存取存储器(Random Access Memory,RAM)、ROM、EPROM或闪存、SRAM、便携式压缩盘只读存储器(Compact Disc Read-Only Memory,CD-ROM)、数字多功能盘(Digital Video Disc,DVD)、记忆棒、软盘、机械编码设备、例如其上存储有指令的打孔卡或凹槽内凸起结构、以及上述的任意合适的组合。这里所使用的计算机可读存储介质不被解释为瞬时信号本身,诸如无线电波或者其他自由传播的电磁波、通过波导或其他传输媒介传播的电磁波(例如,通过光纤电缆的光脉冲)、或者通过电线传输的电信号。A computer-readable storage medium may be a tangible device that can hold and store instructions for use by the instruction execution device. The computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples (non-exhaustive list) of computer readable storage media include: portable computer disks, hard disks, random access memory (RAM), ROM, EPROM or flash memory, SRAM, portable compact disk read only Memory (Compact Disc Read-Only Memory, CD-ROM), Digital Video Disc (DVD), memory sticks, floppy disks, mechanical coding devices, such as punched cards or recessed protrusions on which instructions are stored structure, and any suitable combination of the above. Computer-readable storage media, as used herein, are not to be construed as transient signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through waveguides or other transmission media (eg, light pulses through fiber optic cables), or through electrical wires transmitted electrical signals.
这里所描述的计算机可读程序指令可以从计算机可读存储介质下载到各个计算/处理设备,或者通过网络、例如因特网、局域网、广域网和/或无线网下载到外部计算机或外部存储设备。网络可以包括铜传输电缆、光纤传输、无线传输、路由器、防火墙、交换机、网关计算机和/或边缘服务器。每个计算/处理设备中的网络适配卡或者网络接口从网络接收计算机可读程序指令,并转发该计算机可读程序指令,以供存储在各个计算/处理设备中的计算机可读存储介质中。The computer readable program instructions described herein may be downloaded to various computing/processing devices from a computer readable storage medium, or to an external computer or external storage device over a network such as the Internet, a local area network, a wide area network, and/or a wireless network. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers, and/or edge servers. A network adapter card or network interface in each computing/processing device receives computer-readable program instructions from a network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in each computing/processing device .
用于执行本公开操作的计算机程序指令可以是汇编指令、指令集架构(Industry Standard Architecture,ISA)指令、机器指令、机器相关指令、微代码、固件指令、状态设置数据、或者以一种或多种编程语言的任意组合编写的源代码或目标代码,所述编程语言包括面向对象的编程语言—诸如Smalltalk、C++等,以及常规的过程式编程语言—诸如“C”语言或类似的编程语言。计算机可读程序指令可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络—包括局域网(Local Area Network,LAN)或广域网(Wide Area Network,WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。在一些实施例中,通过利用计算机可读程序指令的状态信息来个性化定制电子电路,例如可编程逻辑电路、FPGA或可编程逻辑阵列(Programmable Logic Arrays,PLA),该电子电路可以执行计算机可读程序指令,从而实现本公开的各个方面。The computer program instructions for carrying out the operations of the present disclosure may be assembly instructions, Industry Standard Architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or in one or more source or object code written in any combination of programming languages, including object-oriented programming languages such as Smalltalk, C++, etc., and conventional procedural programming languages such as the "C" language or similar programming languages. The computer readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer, or entirely on the remote computer or server implement. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or, may be connected to an external computer (eg, use an internet service provider to connect via the internet). In some embodiments, electronic circuits, such as programmable logic circuits, FPGAs, or Programmable Logic Arrays (PLAs), that can execute computer-readable Program instructions are read to implement various aspects of the present disclosure.
这里参照根据本公开实施例的方法、装置(系统)和计算机程序产品的流程图和/或框图描述了本公开的各个方面。应当理解,流程图和/或框图的每个方框以及流程图和/或框图中各方框的组合,都可以由计算机可读程序指令实现。Aspects of the present disclosure are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the disclosure. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer readable program instructions.
这些计算机可读程序指令可以提供给通用计算机、专用计算机或其它可编程数据处理装置的处理器,从而生产出一种机器,使得这些指令在通过计算机或其它可编程数据处理装置的处理器执行时,产生了实现流程图和/或框图中的一个或多个方框中规定的功能/动作的装置。也可以把这些计算机可读程序指令存储在计算机可读存储介质中,这些指令使得计算机、可编程数据处理装置和/或其他设备以特定方式工作,从而,存储有指令的计算机可读介质则包括一个制造品,其包括实现流程图和/或框图中的一个或多个方框中规定的功能/动作的各个方面的指令。These computer readable program instructions may be provided to a processor of a general purpose computer, special purpose computer or other programmable data processing apparatus to produce a machine that causes the instructions when executed by the processor of the computer or other programmable data processing apparatus , resulting in means for implementing the functions/acts specified in one or more blocks of the flowchart and/or block diagrams. These computer readable program instructions can also be stored in a computer readable storage medium, these instructions cause a computer, programmable data processing apparatus and/or other equipment to operate in a specific manner, so that the computer readable medium on which the instructions are stored includes An article of manufacture comprising instructions for implementing various aspects of the functions/acts specified in one or more blocks of the flowchart and/or block diagrams.
也可以把计算机可读程序指令加载到计算机、其它可编程数据处理装置、或其它设备上,使得在计算机、其它可编程数据处理装置或其它设备上执行一系列操作步骤,以产生计算机实现的过程,从而使得在计算机、其它可编程数据处理装置、或其它设备上执行的指令实现流程图和/或框图中的一个或多个方框中规定的功能/动作。Computer readable program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other equipment to cause a series of operational steps to be performed on the computer, other programmable data processing apparatus, or other equipment to produce a computer-implemented process , thereby causing instructions executing on a computer, other programmable data processing apparatus, or other device to implement the functions/acts specified in one or more blocks of the flowcharts and/or block diagrams.
附图中的流程图和框图显示了根据本公开的多个实施例的方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段或指令的一部分,所述模块、程序段或指令的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个连续的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用 执行规定的功能或动作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。The flowchart and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more functions for implementing the specified logical function(s) executable instructions. In some alternative implementations, the functions noted in the blocks may occur out of the order noted in the figures. For example, two blocks in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It is also noted that each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations, can be implemented in dedicated hardware-based systems that perform the specified functions or actions , or can be implemented in a combination of dedicated hardware and computer instructions.
该计算机程序产品可以具体通过硬件、软件或其结合的方式实现。在一个可选实施例中,所述计算机程序产品具体体现为计算机存储介质,在另一个可选实施例中,计算机程序产品具体体现为软件产品,例如软件开发包(Software Development Kit,SDK)等等。The computer program product can be specifically implemented by hardware, software or a combination thereof. In an optional embodiment, the computer program product is embodied as a computer storage medium, and in another optional embodiment, the computer program product is embodied as a software product, such as a software development kit (Software Development Kit, SDK), etc. Wait.
以上已经描述了本公开的各实施例,上述说明是示例性的,并非穷尽性的,并且也不限于所披露的各实施例。在不偏离所说明的各实施例的范围和精神的情况下,对于本技术领域的普通技术人员来说许多修改和变更都是显而易见的。本文中所用术语的选择,旨在最好地解释各实施例的原理、实际应用或对市场中的技术的改进,或者使本技术领域的其它普通技术人员能理解本文披露的各实施例。Various embodiments of the present disclosure have been described above, and the foregoing descriptions are exemplary, not exhaustive, and not limiting of the disclosed embodiments. Numerous modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terminology used herein was chosen to best explain the principles of the various embodiments, the practical application or improvement over the technology in the marketplace, or to enable others of ordinary skill in the art to understand the various embodiments disclosed herein.
工业实用性Industrial Applicability
本公开提供了一种字符检测方法、装置、电子设备、存储介质及程序;其中,对待处理图像中第一字符序列的多条边界线分别进行预测,得到所述第一字符序列的多条边界线的预测参数,其中,所述第一字符序列的边界线表示所述第一字符序列所在区域与非所述第一字符序列所在区域之间的分界线;根据所述第一字符序列的多条边界线的预测参数,确定所述第一字符序列的边界框的顶点的位置信息;根据所述第一字符序列的边界框的顶点的位置信息,确定所述第一字符序列的边界框的位置信息。The present disclosure provides a character detection method, device, electronic device, storage medium and program; wherein, multiple boundary lines of a first character sequence in a to-be-processed image are respectively predicted to obtain multiple boundaries of the first character sequence line prediction parameters, wherein the boundary line of the first character sequence represents the dividing line between the area where the first character sequence is located and the area not where the first character sequence is located; according to the multiplicity of the first character sequence The prediction parameters of the boundary lines determine the position information of the vertices of the bounding box of the first character sequence; according to the position information of the vertices of the bounding box of the first character sequence, determine the location information.

Claims (21)

  1. 一种字符检测方法,包括:A character detection method comprising:
    对待处理图像中第一字符序列的多条边界线分别进行预测,得到所述第一字符序列的多条边界线的预测参数,其中,所述第一字符序列的边界线表示所述第一字符序列所在区域与非所述第一字符序列所在区域之间的分界线;Predicting multiple boundary lines of the first character sequence in the image to be processed respectively, to obtain prediction parameters of multiple boundary lines of the first character sequence, wherein the boundary line of the first character sequence represents the first character The dividing line between the region where the sequence is located and the region not where the first character sequence is located;
    根据所述第一字符序列的多条边界线的预测参数,确定所述第一字符序列的边界框的顶点的位置信息;According to the prediction parameters of a plurality of boundary lines of the first character sequence, determine the position information of the vertices of the bounding box of the first character sequence;
    根据所述第一字符序列的边界框的顶点的位置信息,确定所述第一字符序列的边界框的位置信息。According to the position information of the vertices of the bounding box of the first character sequence, the position information of the bounding box of the first character sequence is determined.
  2. 根据权利要求1所述的方法,所述对待处理图像中第一字符序列的多条边界线分别进行预测,得到所述第一字符序列的多条边界线的预测参数,包括:The method according to claim 1, wherein the multiple boundary lines of the first character sequence in the image to be processed are respectively predicted, and the prediction parameters of the multiple boundary lines of the first character sequence are obtained, comprising:
    基于所述待处理图像,针对与第一字符序列相关的第一特征点,分别预测所述第一字符序列的多条边界线对应于所述第一特征点的参数;Based on the to-be-processed image, with respect to the first feature point related to the first character sequence, respectively predict the parameters corresponding to the first feature point of the plurality of boundary lines of the first character sequence;
    根据所述第一字符序列的多条边界线对应于所述第一特征点的参数,确定所述第一字符序列的多条边界线的预测参数。The prediction parameters of the plurality of boundary lines of the first character sequence are determined according to the parameters of the plurality of boundary lines of the first character sequence corresponding to the first feature points.
  3. 根据权利要求2所述的方法,所述方法还包括:The method of claim 2, further comprising:
    预测所述待处理图像中的像素所在位置属于字符的概率;Predict the probability that the position of the pixel in the to-be-processed image belongs to the character;
    根据所述待处理图像中的像素所在位置属于字符的概率,确定所述第一特征点。The first feature point is determined according to the probability that the position of the pixel in the image to be processed belongs to a character.
  4. 根据权利要求2或3所述的方法,所述第一字符序列的多条边界线对应于所述第一特征点的参数包括:According to the method according to claim 2 or 3, the parameters of the plurality of boundary lines of the first character sequence corresponding to the first feature points include:
    所述第一字符序列的多条边界线在所述第一特征点对应的极坐标系下的距离参数和角度参数,其中,所述第一特征点对应的极坐标系表示以所述第一特征点为极点的极坐标系。Distance parameters and angle parameters of multiple boundary lines of the first character sequence in the polar coordinate system corresponding to the first feature point, wherein the polar coordinate system corresponding to the first feature point is represented by the first feature point. A polar coordinate system in which the feature points are poles.
  5. 根据权利要求4所述的方法,所述根据所述第一字符序列的多条边界线对应于所述第一特征点的参数,确定所述第一字符序列的多条边界线的预测参数,包括:The method according to claim 4, wherein the prediction parameters of the plurality of boundary lines of the first character sequence are determined according to the parameters of the plurality of boundary lines of the first character sequence corresponding to the first feature points, include:
    将所述第一字符序列的多条边界线在所述第一特征点对应的极坐标系下的距离参数和角度参数映射至笛卡尔坐标系,得到所述第一字符序列的多条边界线在所述笛卡尔坐标系下对应于所述第一特征点的参数;Mapping the distance parameters and angle parameters of the plurality of boundary lines of the first character sequence in the polar coordinate system corresponding to the first feature point to the Cartesian coordinate system to obtain the plurality of boundary lines of the first character sequence A parameter corresponding to the first feature point in the Cartesian coordinate system;
    根据所述第一字符序列的多条边界线在所述笛卡尔坐标系下对应于所述第一特征点的参数,确定所述第一字符序列的多条边界线的预测参数。According to the parameters of the plurality of boundary lines of the first character sequence corresponding to the first feature point in the Cartesian coordinate system, the prediction parameters of the plurality of boundary lines of the first character sequence are determined.
  6. 根据权利要求1至5中任意一项所述的方法,所述第一字符序列的多条边界线包括所述第一字符序列的上边界线、右边界线、下边界线和左边界线。According to the method according to any one of claims 1 to 5, the plurality of boundary lines of the first character sequence includes an upper boundary line, a right boundary line, a lower boundary line and a left boundary line of the first character sequence.
  7. 根据权利要求2所述的方法,所述基于所述待处理图像,针对与第一字符序列相关的第一特征点,分别预测所述第一字符序列的多条边界线对应于所述第一特征点的参数,包括:The method according to claim 2, wherein, based on the to-be-processed image, for the first feature points related to the first character sequence, it is respectively predicted that a plurality of boundary lines of the first character sequence corresponds to the first character sequence. Parameters of feature points, including:
    将所述待处理图像输入预先训练的神经网络,经由所述神经网络针对与第一字符序列相关的第一特征点,分别预测所述第一字符序列的多条边界线对应于所述第一特征点的参数。Input the image to be processed into a pre-trained neural network, and through the neural network, for the first feature points related to the first character sequence, respectively predict that multiple boundary lines of the first character sequence correspond to the first character sequence. Parameters of feature points.
  8. 根据权利要求7所述的方法,所述方法还包括:The method of claim 7, further comprising:
    经由所述神经网络预测所述待处理图像中的像素所在位置属于字符的概率。The probability that the position of the pixel in the image to be processed belongs to a character is predicted through the neural network.
  9. 根据权利要求7或8所述的方法,所述将所述待处理图像输入预先训练的神经网络之前,所述方法还包括:The method according to claim 7 or 8, before inputting the image to be processed into a pre-trained neural network, the method further comprises:
    将训练图像输入所述神经网络,经由所述神经网络针对与所述训练图像中的第二字符序列相关的第二特征点,分别预测所述第二字符序列的多条边界线对应于所述第二特征点的参数的预测值;Input the training image into the neural network, and through the neural network, for the second feature points related to the second character sequence in the training image, respectively predict that a plurality of boundary lines of the second character sequence correspond to the The predicted value of the parameter of the second feature point;
    根据所述第二字符序列的多条边界线对应于所述第二特征点的参数的预测值,以及所述第二字符 序列的多条边界线对应于所述第二特征点的参数的真值,训练所述神经网络。According to the multiple boundary lines of the second character sequence corresponding to the predicted value of the parameter of the second feature point, and the multiple boundary lines of the second character sequence corresponding to the true value of the parameter of the second feature point value to train the neural network.
  10. 根据权利要求9所述的方法,所述第二字符序列的多条边界线对应于所述第二特征点的参数包括:所述第二字符序列的多条边界线在所述第二特征点对应的极坐标系下的距离参数和角度参数,其中,所述第二特征点对应的极坐标系表示以所述第二特征点为极点的极坐标系;The method according to claim 9, wherein the parameters of the plurality of boundary lines of the second character sequence corresponding to the second feature point comprise: the plurality of boundary lines of the second character sequence are at the second feature point The distance parameter and the angle parameter under the corresponding polar coordinate system, wherein, the polar coordinate system corresponding to the second feature point represents a polar coordinate system with the second feature point as a pole;
    所述根据所述第二字符序列的多条边界线对应于所述第二特征点的参数的预测值,以及所述第二字符序列的多条边界线对应于所述第二特征点的参数的真值,训练所述神经网络,包括:The multiple boundary lines according to the second character sequence correspond to the predicted value of the parameter of the second feature point, and the multiple boundary lines of the second character sequence correspond to the parameter of the second feature point The true value of , train the neural network, including:
    根据所述第二字符序列的多条边界线对应于所述第二特征点的距离参数的预测值,以及所述第二字符序列的多条边界线对应于所述第二特征点的距离参数的真值,训练所述神经网络;According to the predicted value of the distance parameter of the second feature point corresponding to the plurality of boundary lines of the second character sequence, and the distance parameter of the second feature point corresponding to the plurality of boundary lines of the second character sequence The true value of , train the neural network;
    和/或,and / or,
    根据所述第二字符序列的多条边界线对应于所述第二特征点的角度参数的预测值,以及所述第二字符序列的多条边界线对应于所述第二特征点的角度参数的真值,训练所述神经网络。According to the predicted value of the angle parameter of the second feature point corresponding to the plurality of boundary lines of the second character sequence, and the angle parameter of the second feature point corresponding to the plurality of boundary lines of the second character sequence The true value of , to train the neural network.
  11. 根据权利要求10所述的方法,所述根据所述第二字符序列的多条边界线对应于所述第二特征点的距离参数的预测值,以及所述第二字符序列的多条边界线对应于所述第二特征点的距离参数的真值,训练所述神经网络,包括:The method according to claim 10, wherein the plurality of boundary lines according to the second character sequence corresponds to the predicted value of the distance parameter of the second feature point, and the plurality of boundary lines of the second character sequence Corresponding to the true value of the distance parameter of the second feature point, training the neural network, including:
    对于所述第二字符序列的多条边界线中的任意一条边界线,根据所述边界线对应于所述第二特征点的距离参数的真值和预测值中的较小值与较大值的比值,训练所述神经网络。For any boundary line among the plurality of boundary lines of the second character sequence, according to the boundary line corresponding to the smaller value and the larger value of the distance parameter of the second feature point and the predicted value The ratio of , to train the neural network.
  12. 根据权利要求10所述的方法,所述根据所述第二字符序列的多条边界线对应于所述第二特征点的角度参数的预测值,以及所述第二字符序列的多条边界线对应于所述第二特征点的角度参数的真值,训练所述神经网络,包括:The method according to claim 10, wherein the plurality of boundary lines according to the second character sequence corresponds to the predicted value of the angle parameter of the second feature point, and the plurality of boundary lines of the second character sequence Corresponding to the true value of the angle parameter of the second feature point, training the neural network, including:
    对于所述第二字符序列的多条边界线中的任意一条边界线,确定所述边界线对应于所述第二特征点的角度参数的真值与预测值的差值的绝对值;For any one of the multiple boundary lines of the second character sequence, determine the absolute value of the difference between the true value and the predicted value of the angle parameter of the boundary line corresponding to the second feature point;
    根据所述绝对值的半倍角的正弦值,训练所述神经网络。The neural network is trained according to the sine of the half angle of the absolute value.
  13. 根据权利要求9至12中任意一项所述的方法,所述第二特征点包括所述第二字符区域对应的有效区域中的特征点。The method according to any one of claims 9 to 12, wherein the second feature points include feature points in an effective area corresponding to the second character area.
  14. 根据权利要求9至13中任意一项所述的方法,所述方法还包括:The method of any one of claims 9 to 13, further comprising:
    经由所述神经网络预测所述训练图像中的像素所在位置属于字符的概率;Predicting the probability that the position of the pixel in the training image belongs to a character via the neural network;
    根据所述训练图像中的像素所在位置属于字符的概率,以及所述训练图像中的像素所在位置属于字符的标注数据,训练所述神经网络。The neural network is trained according to the probability that the positions of the pixels in the training image belong to characters, and the labeled data that the positions of the pixels in the training image belong to the characters.
  15. 根据权利要求14所述的方法,所述根据所述训练图像中的像素所在位置属于字符的概率,以及所述训练图像中的像素所在位置属于字符的标注数据,训练所述神经网络,包括:The method according to claim 14, wherein the training of the neural network according to the probability that the position of the pixel in the training image belongs to the character, and the labeled data that the position of the pixel in the training image belongs to the character, comprises:
    根据所述第二字符序列对应的有效区域中的像素所在位置属于字符的概率,以及所述有效区域中的像素所在位置属于字符的标注数据,训练所述神经网络。The neural network is trained according to the probability that the position of the pixel in the valid region corresponding to the second character sequence belongs to the character, and the labeled data that the position of the pixel in the valid region belongs to the character.
  16. 根据权利要求13或15所述的方法,所述方法还包括:The method of claim 13 or 15, further comprising:
    获取所述第二字符序列的真实边界框的位置信息;obtaining the position information of the real bounding box of the second character sequence;
    根据所述真实边界框的位置信息,以及预设比例,缩小所述真实边界框,得到所述第二字符序列对应的有效区域。According to the position information of the real bounding box and the preset ratio, the real bounding box is reduced to obtain an effective area corresponding to the second character sequence.
  17. 根据权利要求16所述的方法,所述根据所述真实边界框的位置信息,以及预设比例,缩小所述真实边界框,得到所述第二字符序列对应的有效区域,包括:The method according to claim 16, wherein reducing the real bounding box according to the position information of the real bounding box and a preset ratio to obtain an effective area corresponding to the second character sequence, comprising:
    根据所述真实边界框的位置信息,确定所述真实边界框的锚点,其中,所述真实边界框的锚点为所述真实边界框的对角线的交点;Determine the anchor point of the real bounding box according to the position information of the real bounding box, wherein the anchor point of the real bounding box is the intersection of the diagonal lines of the real bounding box;
    根据所述真实边界框的位置信息,所述真实边界框的锚点的位置信息,以及预设比例,缩小所述真实边界框,得到所述第二字符序列对应的有效区域,其中,第一距离与第二距离的比值等于所述预设比例,所述第一距离表示所述有效区域的第一顶点与所述锚点之间的距离,所述第二距离表示真实边界框中所述第一顶点对应的顶点与所述锚点之间的距离,所述第一顶点表示所述有效区域的任一顶点。According to the position information of the real bounding box, the position information of the anchor points of the real bounding box, and the preset ratio, the real bounding box is reduced to obtain the effective area corresponding to the second character sequence, wherein the first The ratio of the distance to the second distance is equal to the preset ratio, the first distance represents the distance between the first vertex of the effective area and the anchor point, and the second distance represents the The distance between the vertex corresponding to the first vertex and the anchor point, where the first vertex represents any vertex of the effective area.
  18. 一种字符检测装置,包括:A character detection device, comprising:
    第一预测模块,配置为对待处理图像中第一字符序列的多条边界线分别进行预测,得到所述第一字符序列的多条边界线的预测参数,其中,所述第一字符序列的边界线表示所述第一字符序列所在区域与非所述第一字符序列所在区域之间的分界线;The first prediction module is configured to respectively predict multiple boundary lines of the first character sequence in the image to be processed, and obtain prediction parameters of the multiple boundary lines of the first character sequence, wherein the boundary of the first character sequence The line represents the dividing line between the area where the first character sequence is located and the area not where the first character sequence is located;
    第一确定模块,配置为根据所述第一字符序列的多条边界线的预测参数,确定所述第一字符序列的边界框的顶点的位置信息;a first determining module, configured to determine the position information of the vertices of the bounding box of the first character sequence according to the prediction parameters of a plurality of boundary lines of the first character sequence;
    第二确定模块,配置为根据所述第一字符序列的边界框的顶点的位置信息,确定所述第一字符序列的边界框的位置信息。The second determining module is configured to determine the position information of the bounding box of the first character sequence according to the position information of the vertices of the bounding box of the first character sequence.
  19. 一种电子设备,包括:An electronic device comprising:
    一个或多个处理器;one or more processors;
    用于存储可执行指令的存储器;memory for storing executable instructions;
    其中,所述一个或多个处理器被配置为调用所述存储器存储的可执行指令,以执行权利要求1至17中任意一项所述的字符检测方法。Wherein, the one or more processors are configured to invoke executable instructions stored in the memory to perform the character detection method of any one of claims 1 to 17.
  20. 一种计算机可读存储介质,其上存储有计算机程序指令,所述计算机程序指令被处理器执行时实现权利要求1至17中任意一项所述的字符检测方法。A computer-readable storage medium on which computer program instructions are stored, and when the computer program instructions are executed by a processor, implement the character detection method according to any one of claims 1 to 17.
  21. 一种计算机程序,所述计算机程序包括计算机可读代码,在所述计算机可读代码在电子设备中运行的情况下,所述电子设备的处理器执行用于实现如权利要求1至17中任意一项所述的字符检测方法。A computer program comprising computer-readable code, in the case of the computer-readable code being executed in an electronic device, executed by a processor of the electronic device for implementing any one of claims 1 to 17 A method of character detection as described.
PCT/CN2021/080318 2020-11-06 2021-03-11 Character detection method and apparatus, electronic device, storage medium, and program WO2022095318A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020227002100A KR20220015496A (en) 2020-11-06 2021-03-11 Character detection method, apparatus, electronic device, storage medium and program

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011229418.1 2020-11-06
CN202011229418.1A CN112348025B (en) 2020-11-06 2020-11-06 Character detection method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
WO2022095318A1 true WO2022095318A1 (en) 2022-05-12

Family

ID=74428376

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/080318 WO2022095318A1 (en) 2020-11-06 2021-03-11 Character detection method and apparatus, electronic device, storage medium, and program

Country Status (3)

Country Link
CN (1) CN112348025B (en)
TW (1) TW202219822A (en)
WO (1) WO2022095318A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112348025B (en) * 2020-11-06 2023-04-07 上海商汤智能科技有限公司 Character detection method and device, electronic equipment and storage medium
CN113139625B (en) * 2021-05-18 2023-12-15 北京世纪好未来教育科技有限公司 Model training method, electronic equipment and storage medium thereof

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030026482A1 (en) * 2001-07-09 2003-02-06 Xerox Corporation Method and apparatus for resolving perspective distortion in a document image and for calculating line sums in images
CN110472597A (en) * 2019-07-31 2019-11-19 中铁二院工程集团有限责任公司 Rock image rate of decay detection method and system based on deep learning
CN110751151A (en) * 2019-10-12 2020-02-04 上海眼控科技股份有限公司 Text character detection method and equipment for vehicle body image
CN111191611A (en) * 2019-12-31 2020-05-22 同济大学 Deep learning-based traffic sign label identification method
CN112101346A (en) * 2020-08-27 2020-12-18 南方医科大学南方医院 Verification code identification method and device based on target detection
CN112348025A (en) * 2020-11-06 2021-02-09 上海商汤智能科技有限公司 Character detection method and device, electronic equipment and storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10579897B2 (en) * 2017-10-02 2020-03-03 Xnor.ai Inc. Image based object detection
CN108960245B (en) * 2018-07-13 2022-04-19 广东工业大学 Tire mold character detection and recognition method, device, equipment and storage medium
KR20190096872A (en) * 2019-07-31 2019-08-20 엘지전자 주식회사 Method and apparatus for recognizing handwritten characters using federated learning

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030026482A1 (en) * 2001-07-09 2003-02-06 Xerox Corporation Method and apparatus for resolving perspective distortion in a document image and for calculating line sums in images
CN110472597A (en) * 2019-07-31 2019-11-19 中铁二院工程集团有限责任公司 Rock image rate of decay detection method and system based on deep learning
CN110751151A (en) * 2019-10-12 2020-02-04 上海眼控科技股份有限公司 Text character detection method and equipment for vehicle body image
CN111191611A (en) * 2019-12-31 2020-05-22 同济大学 Deep learning-based traffic sign label identification method
CN112101346A (en) * 2020-08-27 2020-12-18 南方医科大学南方医院 Verification code identification method and device based on target detection
CN112348025A (en) * 2020-11-06 2021-02-09 上海商汤智能科技有限公司 Character detection method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
TW202219822A (en) 2022-05-16
CN112348025B (en) 2023-04-07
CN112348025A (en) 2021-02-09

Similar Documents

Publication Publication Date Title
CN110674719B (en) Target object matching method and device, electronic equipment and storage medium
US11436863B2 (en) Method and apparatus for outputting data
US11288531B2 (en) Image processing method and apparatus, electronic device, and storage medium
US20170124718A1 (en) Method, device, and computer-readable storage medium for area extraction
US11443438B2 (en) Network module and distribution method and apparatus, electronic device, and storage medium
WO2022036972A1 (en) Image segmentation method and apparatus, and electronic device and storage medium
KR20170061631A (en) Method and device for region identification
JP7181375B2 (en) Target object motion recognition method, device and electronic device
CN110796664B (en) Image processing method, device, electronic equipment and computer readable storage medium
WO2022012179A1 (en) Method and apparatus for generating feature extraction network, and device and computer-readable medium
WO2022095318A1 (en) Character detection method and apparatus, electronic device, storage medium, and program
WO2023103377A1 (en) Calibration method and apparatus, electronic device, storage medium, and computer program product
CN113076814B (en) Text area determination method, device, equipment and readable storage medium
CN110619656B (en) Face detection tracking method and device based on binocular camera and electronic equipment
CN110781823B (en) Screen recording detection method and device, readable medium and electronic equipment
WO2019080702A1 (en) Image processing method and apparatus
CN112306235A (en) Gesture operation method, device, equipment and storage medium
CN111754414B (en) Image processing method and device for image processing
CN111783777B (en) Image processing method, apparatus, electronic device, and computer readable medium
CN112990197A (en) License plate recognition method and device, electronic equipment and storage medium
CN110989880B (en) Interface element processing method and device and readable storage medium
WO2023155393A1 (en) Feature point matching method and apparatus, electronic device, storage medium and computer program product
CN114155545A (en) Form identification method and device, readable medium and electronic equipment
CN111209050A (en) Method and device for switching working mode of electronic equipment
KR20220015496A (en) Character detection method, apparatus, electronic device, storage medium and program

Legal Events

Date Code Title Description
ENP Entry into the national phase

Ref document number: 2022503493

Country of ref document: JP

Kind code of ref document: A

ENP Entry into the national phase

Ref document number: 20227002100

Country of ref document: KR

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 04/10/2023)