WO2023011155A1 - Barcode identification method and apparatus, computer device and storage medium - Google Patents

Barcode identification method and apparatus, computer device and storage medium Download PDF

Info

Publication number
WO2023011155A1
WO2023011155A1 PCT/CN2022/106288 CN2022106288W WO2023011155A1 WO 2023011155 A1 WO2023011155 A1 WO 2023011155A1 CN 2022106288 W CN2022106288 W CN 2022106288W WO 2023011155 A1 WO2023011155 A1 WO 2023011155A1
Authority
WO
WIPO (PCT)
Prior art keywords
neural network
network model
sequence
target
sample
Prior art date
Application number
PCT/CN2022/106288
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 深圳思谋信息科技有限公司
Publication of WO2023011155A1 publication Critical patent/WO2023011155A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • 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
    • G06N3/084Backpropagation, e.g. using gradient descent

Definitions

  • the present application relates to the technical field of image processing, in particular to a barcode recognition method, device, computer equipment and storage medium.
  • a barcode image restoration method, device, computer equipment and storage medium are provided.
  • the application provides a barcode recognition method, including:
  • the target prediction sequence is identified according to the encoding rule matched with the coding system identifier and the encoding information, and an identification result is obtained.
  • the present application also provides a barcode recognition device, including:
  • the sequence output module is used to input the barcode image into the pre-built target neural network model to obtain the predicted sequence output by the target neural network model; wherein the predicted sequence carries a code system identification;
  • a sequence decoding module configured to decode the predicted sequence to obtain a target predicted sequence containing coding information
  • a sequence identification module configured to identify the target predicted sequence according to the coding rule matched with the coding system identifier and the coding information, and obtain a recognition result.
  • the present application also provides a computer device, including a memory and a processor, the memory stores computer-readable instructions, and the processor implements the following steps when executing the computer-readable instructions:
  • the target prediction sequence is identified according to the encoding rule matched with the coding system identifier and the encoding information, and an identification result is obtained.
  • the present application also provides a computer-readable storage medium, on which computer-readable instructions are stored, and when the computer-readable instructions are executed by a processor, the following steps are implemented:
  • the target prediction sequence is identified according to the encoding rule matched with the coding system identifier and the encoding information, and an identification result is obtained.
  • the present application also provides a computer program product, including a computer program, and when the computer program is executed by a processor, the following steps are implemented:
  • the target prediction sequence is identified to obtain the identification result.
  • Fig. 1 is an application environment diagram of a barcode recognition method in an embodiment.
  • Fig. 2 is a schematic flowchart of a barcode recognition method in an embodiment.
  • Fig. 3 is a schematic flowchart of the steps of obtaining a target prediction sequence including encoding information in an embodiment.
  • Fig. 4 is a schematic flowchart of the step of identifying the target prediction sequence in an embodiment.
  • Fig. 5 is a schematic flowchart of the steps of training the initial neural network model in one embodiment.
  • Fig. 6 is a structural block diagram of a barcode recognition device in an embodiment.
  • Figure 7 is an internal block diagram of a computer device in one embodiment.
  • the barcode recognition method provided by this application can be independently applied to the terminal device deployed with the target neural network model; specifically, the terminal device captures a barcode image containing barcode information; the terminal device inputs the barcode image into the pre-deployed terminal device
  • the target neural network model obtains the prediction sequence output by the target neural network model; the prediction sequence carries a code system identification; the terminal device decodes the prediction sequence to obtain the target prediction sequence containing coding information; the terminal device matches the code system identification
  • the coding rules and coding information are used to identify the target prediction sequence and obtain the recognition result.
  • the barcode recognition method provided in this application can also be applied to the application environment shown in FIG. 1 .
  • the terminal 11 communicates with the server 12 through the network.
  • the terminal 11 sends the barcode image to the server 12, and the server 12 inputs the received barcode image into the pre-built target neural network model to obtain the predicted sequence output by the target neural network model;
  • the predicted sequence carries a code system identification;
  • the server 12 pairs the predicted sequence Perform decoding processing to obtain the target prediction sequence including coding information;
  • the server 12 identifies the target prediction sequence according to the coding rules and coding information matching the code system identifier, and obtains the recognition result;
  • the server 12 returns the recognition result to the terminal 11.
  • the terminal 11 can be, but not limited to, various code scanning devices, personal computers, notebook computers, smart phones, tablet computers and portable wearable devices
  • the server 12 can be realized by an independent server or a server cluster composed of multiple servers .
  • a barcode recognition method is provided, and the method is applied to the server 12 in FIG. 1 as an example for illustration, including the following steps:
  • Step 21 inputting the barcode image into the pre-built target neural network model to obtain a predicted sequence output by the target neural network model; wherein the predicted sequence carries a code system identifier.
  • the barcode image refers to the image containing the barcode information
  • the target neural network model refers to the pre-trained neural network model that can identify the barcode information in the barcode image and output the corresponding results
  • the prediction sequence refers to the target neural network model. The result of the sequence output after the model recognizes the barcode image
  • the code system identification refers to the code system corresponding to the barcode information in the barcode image recognized by the target neural network model, that is, the code system predicted by the neural network meets the coding requirements of the barcode image.
  • the server inputs the barcode image into the pre-built target neural network model; the target neural network model extracts image features corresponding to the barcode image according to information such as weight parameters determined in the pre-training process, performs convolution operations on the features, pools Output the final prediction result as the prediction sequence.
  • the code system identification can be determined by the number of activations of corresponding neurons in the target neural network model.
  • Step 22 decoding the prediction sequence to obtain a target prediction sequence including coding information.
  • the server performs an Argmax operation on the predicted sequence, and obtains the decoded sequence by extracting the Top-N maximum position at position i of each sequence;
  • the decoding process can be performed by various algorithms such as greedy search, beam search, and prefix beam search, which can be determined according to actual needs.
  • the placeholders in the sequence are further removed to obtain the target prediction sequence containing coding information; for example, CODO128 specifies No. 106 as a placeholder, then 106 needs to be removed from the above sequence, and the transformed sequence becomes into [1,2,2,7,5,3]; so far, the target prediction sequence including the start symbol, content, check digit, and terminator as coding information is obtained.
  • Step 23 according to the encoding rules and encoding information matched with the code system identifier, identify the target prediction sequence, and obtain the identification result.
  • the server determines the encoding rule corresponding to the target prediction sequence according to the coding system identifier; identifies the start symbol, check digit, terminator and content in the target prediction sequence according to the coding information, and analyzes the target prediction sequence; for example, the coding rule is CODE128
  • the target prediction sequence is [104, 35, 19, 99, 91, 24, 56, 78, 89, 106]
  • the server further determines that the target prediction sequence is the CODE128-B sub-coding rule through the start character 104, then according to the CODE128-B sub-coding rule
  • the coding rules further analyze the target prediction sequence to obtain the analysis result.
  • the analysis result can be output as the recognition result after passing the verification.
  • the above-mentioned barcode recognition method includes: inputting the barcode image into a pre-built target neural network model to obtain a predicted sequence output by the target neural network model; the predicted sequence carries a code system identification; decoding the predicted sequence to obtain a The target prediction sequence: according to the coding rules and coding information matched with the code system identifier, the target prediction sequence is identified, and the recognition result is obtained.
  • This application recognizes the barcode image through the pre-built target neural network model, and outputs the predicted sequence and the corresponding code system identification; after decoding the predicted sequence, the target predicted sequence with coding information is obtained; finally, the coded information and code system are used Identify the corresponding coding rules, identify the target prediction sequence to obtain the recognition result, and realize the recognition of barcode images of any code system; without manual switching and adjustment according to the code system of the barcode image, the barcode image can be directly recognized, improving Improve the efficiency of barcode recognition.
  • step 21, inputting the barcode image into the pre-built target neural network model to obtain the predicted sequence output by the target neural network model includes: if the size of the barcode image is not equal to the preset size, adjusting the barcode image to the preset size After setting the size, input the pre-built target neural network model to obtain the predicted sequence output by the target neural network model.
  • the preset size can be set according to the size of the sample barcode image when the target neural network model is trained.
  • the input barcode image is consistent with the sample barcode image, so that the target neural network model can predict and recognize the barcode image on a consistent basis, improving the efficiency and accuracy of the target neural network model in recognizing barcode images.
  • the above step 22 is to decode the predicted sequence to obtain the target predicted sequence containing coding information, including:
  • Step 31 obtaining position information corresponding to at least one maximum value in the prediction sequence, and generating a decoding sequence according to the position information;
  • Step 32 after removing duplicate items and preset placeholders in the decoding sequence, a target prediction sequence including coding information is obtained.
  • the preset placeholder is set according to the CTC algorithm used to construct the loss function in the target neural network model, so the preset placeholder needs to be deleted after decoding.
  • argmax is a function, which is a function for finding parameters (sets) of a function; that is, argmax(f(x)) is the variable point x (or set of x) corresponding to the maximum value of f(x).
  • the decoding sequence can be obtained through the beam search algorithm; beam search (Beam Search) is a heuristic graph search algorithm, which can affect the algorithm delay and final effect through the preset empirical parameter K (the empirical parameter K can be used according to the actual scene and experience to set).
  • Beam Search is a heuristic graph search algorithm, which can affect the algorithm delay and final effect through the preset empirical parameter K (the empirical parameter K can be used according to the actual scene and experience to set).
  • the decoded sequence can also be processed in a naive decoding manner, that is, the first line in the decoded sequence is directly obtained as the decoded decoded sequence, that is, the sequence corresponding to the position of the Top-1 maximum value.
  • the predicted sequence output by the model can be gradually adjusted to the target predicted sequence close to the barcode encoding format by generating the decoded sequence by position, obtaining the decoded decoded sequence, and removing duplicates in the decoded decoded sequence, improving the The efficiency of barcode recognition.
  • the above-mentioned step 23 identifies the target prediction sequence, and obtains the identification result, including:
  • Step 41 Analyze the target prediction sequence according to the encoding rules and encoding information matched with the code system identifier, and obtain the analysis result;
  • Step 42 constructing a subsequence of the target prediction sequence according to the parsing result
  • Step 43 verifying the subsequence of the target prediction sequence according to the encoding rule, and determining the recognition result according to the verification result.
  • the process of identifying the target prediction sequence mainly includes parsing and verification; if the result of the parsing is in the state of passing the verification, it can be confirmed that the target prediction sequence has been identified; otherwise, if the result of the parsing is in the state of failing the verification, it can be confirmed that The target prediction sequence has not been identified.
  • the process of parsing needs to determine the specific parsing method through coding rules, which are used to identify different components in the sequence.
  • the encoding rules can also verify the analysis results, and according to the verification results, it can be judged whether the analysis results can be used as credible identification results. For example, when a terminator appears when parsing to the end of the sequence, a new sequence is constructed according to the elements before the terminator as a subsequence of the target prediction sequence, and the subsequence is verified.
  • the verification of the target predicted sequence and the analysis result is realized by constructing a corresponding subsequence through the analysis result, which improves the efficiency and accuracy of barcode recognition.
  • the above step 21, before inputting the barcode image into the pre-built target neural network model to obtain the predicted sequence output by the target neural network model further includes:
  • Step 51 acquiring sample barcode images and corresponding sample coding information
  • Step 52 inputting the sample barcode image into the initial neural network model to obtain the prediction result of the sample barcode image at a preset height
  • Step 53 Train the initial neural network model according to the prediction result and sample encoding information to obtain the target neural network model.
  • the sample barcode image refers to an image that contains clear barcode information and is used for training the model;
  • the sample encoding information refers to encoding information corresponding to the sample barcode image one-to-one.
  • the corresponding sample code information can be obtained from the sample barcode image, and the corresponding sample barcode image can also be obtained according to the sample code information.
  • sample barcode images If you have obtained sample barcode images and need to obtain their corresponding sample code information, you can use the existing decoding software to directly identify the sample barcode images on the basis of knowing the code rules used by the sample barcode images to obtain the corresponding sample code information .
  • the height of the output can be fixed by the maximum pooling layer in the initial neural network model; for example, in the case of h-height sample barcode image input, the initial neural network model output height is recorded as h_model. If the value of h_model is not 1, the output can be max-pooled through the maximum pooling layer with height h_model, width 1, step size 1, and padding 0, so that the initial neural network model output is a height of 1
  • the two-dimensional matrix of is used as the prediction result of the sample barcode image.
  • the prediction result of the sample barcode image can also be controlled at a preset height by means of specific parameters such as pooling, convolution, resize (size adjustment function), interpolation, and the like.
  • the initial neural network model including the maximum pooling layer keeps the prediction result of the output sample barcode image uniform in size, which improves the training efficiency of the initial neural network model and the prediction accuracy of the target neural network model.
  • the above step 51, acquiring the sample barcode image and the corresponding sample coding information includes: randomly generating a plurality of original coding information according to different coding rules; generating the original coded image according to the corresponding coding rules from the original coding information; The original coded image is used as a sample barcode image, and the original coded information is used as corresponding sample coded information.
  • the initial neural network model needs to use the information pair composed of the sample code information and the sample barcode image in the training process, so one of the sample barcode image and the sample code information can be obtained, and the other can be generated through related technologies.
  • information to complete the accumulation of training data in addition to using the randomly generated original coding information to generate the corresponding sample barcode image, the sample barcode image can also be decoded according to the sample barcode image that has been obtained to obtain the corresponding original coding information as a sample Encoding information, that is, an information pair of sample barcode image-sample coding information is obtained.
  • corresponding sample barcode images are generated from a plurality of randomly generated original coding information, and the accumulation of sample barcode images and sample coding information is realized; the accumulation of samples can improve the effect of initial neural network model training.
  • the above step 53 is to train the initial neural network model according to the prediction result and sample encoding information to obtain the target neural network model, including: constructing a loss function based on the degree of difference between the prediction result and the sample encoding information; The initial neural network model is trained according to the loss function until the trained initial neural network model meets the preset training conditions, and the trained initial neural network model is used as the target neural network model.
  • the loss function can be constructed using the CTC (Connectionist temporal classification, a temporal classification algorithm) algorithm; the loss function value is obtained by calculating the difference between the prediction results and the sample encoding information through the CTC loss function, and the loss function value is reversed according to the loss function value. Propagate to the initial neural network model, and adjust each weight parameter; until the initial neural network model meets the preset training conditions, such as training for a certain number of times, or the loss function value is lower than a preset threshold, etc.
  • CTC Connectionist temporal classification, a temporal classification algorithm
  • the process of model training is continuously carried out towards reducing the degree of difference between prediction results and sample coding information, thereby improving the effect of initial neural network model training.
  • the sample barcode image before inputting the sample barcode image into the initial neural network model to obtain the prediction result of the sample barcode image at a preset height, it also includes: performing data enhancement processing on the sample barcode image, and adjusting the height of the sample barcode image to the preset height to obtain the processed sample barcode image;
  • Input the sample barcode image into the initial neural network model to obtain the prediction result of the sample barcode image at the preset height including: input the processed sample barcode image into the initial neural network model to obtain the prediction result of the sample barcode image at the preset height .
  • yet another barcode identification method including:
  • sample barcode image and sample coding information the coding rules that the sample barcode image and sample coding information can follow are EAN series, CODE code series, UPC code series, and ITF code series, and the sample coding information usually includes the start symbol, content, check digit and terminator.
  • the initial neural network model standardize all sample barcode images to a uniform height h. Perform data enhancement processing on all sample barcode images, including: blurring, adjusting image brightness, cropping images, adding noise, etc. The purpose is to reduce the quality of relatively regular images; obtain the changed sample barcode image. Select a neural network model, and calculate the output height value h_model of the model in the case of h-height image input; if the value of h_model is not 1, then pass the model output through a layer with a height of h_model and a width of 1 and a step size of 1, padding (fill Recharge) is the MaxPooling (maximum pooling) layer of 0.
  • the number of output channels C is the total number of codes that may appear in the barcode. For example, for Code128, the output dimension is 106+1, where +1 is required by the placeholder "Blank" designed in the CTC algorithm.
  • Decode the predicted sequence perform Argmax operation on the predicted sequence, extract the Top_N maximum value position at each position i, and obtain the sequence T.
  • Naive decoding method take out the first row of the sequence T, which is the position of the maximum value of Top 1 in the predicted sequence.
  • BeamSearch decoding method Select the empirical parameter K (K affects the algorithm delay and final effect; usually weighed according to the actual scene). Taking K as the optimal K sequence for alternative decoding, the sequence T is searched by BeamSearch.
  • the target prediction sequence includes original coding information such as start character, content, check digit, and terminator.
  • the encoding rules and encoding information identify the target prediction sequence and obtain the recognition result: use the encoding rule to decode the target prediction sequence; ,89,106] as an example, according to the start character 104, it is judged that the code is a CODE128-B sub-standard, and the subsequent value is analyzed through the CODE128-B sub-standard, and when the end character 106 appears at the end, it is backward 1 bit from the terminator, Construct a subsequence, and pass the subsequence through the CODE128 verification method, that is, verify [104, 35, 19, 99, 91, 24, 56, 78, 89]. If it passes the verification, the target prediction sequence is considered valid. Complete barcode recognition.
  • the above barcode recognition method recognizes the barcode image through the pre-built target neural network model, and outputs the predicted sequence and the corresponding code system identification; after decoding the predicted sequence, the target predicted sequence with coding information is obtained; finally, using the coding information And the coding rules corresponding to the code system logo, identify the target prediction sequence to get the recognition result, and realize the recognition of barcode images of any code system; without manual switching and adjustment according to the code system of the barcode image in advance, the barcode image can be directly processed Recognition, improve the efficiency of barcode recognition.
  • a barcode recognition device including:
  • the sequence output module 61 is used to input the barcode image into the pre-built target neural network model to obtain the predicted sequence output by the target neural network model; wherein the predicted sequence carries a code system identification;
  • a sequence decoding module 62 configured to decode the predicted sequence to obtain a target predicted sequence containing coding information
  • the sequence identification module 63 is configured to identify the target predicted sequence according to the coding rules and coding information matched with the coding system identifier, and obtain the recognition result.
  • the sequence output module 61 is also used to adjust the barcode image to the preset size and then input the pre-built target neural network model to obtain the target neural network model output if the size of the barcode image is not equal to the preset size. Prediction sequence.
  • the sequence decoding module 62 is further configured to obtain position information corresponding to at least one maximum value in the predicted sequence, and generate a decoding sequence according to the position information; after removing duplicates and preset placeholders in the decoding sequence, Obtain the target prediction sequence containing the coding information.
  • the sequence identification module 63 is further configured to analyze the target prediction sequence according to the coding rules and coding information matched with the code system identifier to obtain the analysis result; according to the analysis result, construct a subsequence of the target prediction sequence; The subsequence of the target prediction sequence is verified according to the coding rules, and the recognition result is determined according to the verification result.
  • the barcode recognition device also includes a model training module, which is used to obtain sample barcode images and corresponding sample coding information; input the sample barcode images into the initial neural network model to obtain the prediction results of the sample barcode images at a preset height ; Train the initial neural network model according to the prediction result and sample encoding information to obtain the target neural network model.
  • a model training module which is used to obtain sample barcode images and corresponding sample coding information; input the sample barcode images into the initial neural network model to obtain the prediction results of the sample barcode images at a preset height ; Train the initial neural network model according to the prediction result and sample encoding information to obtain the target neural network model.
  • the model training module is also used to randomly generate a plurality of original encoding information according to different encoding rules; generate the original encoding image according to the corresponding encoding rules; use the original encoding image as a sample barcode image, and convert the original The encoding information serves as the corresponding sample encoding information.
  • the model training module is also used to construct a loss function based on the difference between the prediction results and the sample encoding information; train the initial neural network model according to the loss function until the trained initial neural network model meets the preset When training conditions, the trained initial neural network model is used as the target neural network model.
  • the model training module is also used to perform data enhancement processing on the sample barcode image, and adjust the height of the sample barcode image to a preset height to obtain the processed sample barcode image; the processed sample barcode image Input the initial neural network model to obtain the prediction result of the sample barcode image at the preset height.
  • the symbolic identity is determined by the number of activations of corresponding neurons in the target neural network model.
  • Each module in the above-mentioned barcode recognition device can be fully or partially realized by software, hardware and a combination thereof.
  • the above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, and can also be stored in the memory of the computer device in the form of software, so that the processor can invoke and execute the corresponding operations of the above-mentioned modules.
  • a computer device is provided.
  • the computer device may be a server, and its internal structure may be as shown in FIG. 7 .
  • the computer device includes a processor, memory and a network interface connected by a system bus. Wherein, the processor of the computer device is used to provide calculation and control capabilities.
  • the memory of the computer device includes a non-volatile storage medium and an internal memory.
  • the non-volatile storage medium stores an operating system, computer readable instructions and a database.
  • the internal memory provides an environment for the execution of the operating system and computer readable instructions in the non-volatile storage medium.
  • the database of the computer device is used to store barcode identification data.
  • the network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer-readable instructions are executed by the processor, a barcode recognition method is realized.
  • FIG. 7 is only a block diagram of a part of the structure related to the solution of this application, and does not constitute a limitation to the computer equipment on which the solution of this application is applied.
  • the specific computer equipment can be More or fewer components than shown in the figures may be included, or some components may be combined, or have a different arrangement of components.
  • a computer device including a memory and a processor, where computer-readable instructions are stored in the memory, and the processor implements the following steps when executing the computer-readable instructions:
  • the target prediction sequence is identified to obtain the identification result.
  • the following steps are also implemented when the processor executes the computer-readable instructions: if the size of the barcode image is not equal to the preset size, then adjust the barcode image to the preset size and input the pre-built target neural network model to obtain the target The sequence of predictions output by the neural network model.
  • the processor when the processor executes the computer-readable instructions, the following steps are also implemented: obtaining the position information corresponding to at least one maximum value in the prediction sequence, generating a decoding sequence according to the position information; eliminating duplicates and presets in the decoding sequence After the placeholder, the target prediction sequence containing the coding information is obtained.
  • the processor when the processor executes the computer-readable instructions, the following steps are also implemented: according to the encoding rules and encoding information matched with the code system identifier, the target prediction sequence is analyzed to obtain the analysis result; according to the analysis result, the target prediction sequence is constructed The subsequence of the sequence; the subsequence of the target prediction sequence is verified according to the coding rules, and the recognition result is determined according to the verification result.
  • the processor when the processor executes the computer-readable instructions, the following steps are also implemented: acquiring the sample barcode image and corresponding sample coding information; inputting the sample barcode image into the initial neural network model to obtain the sample barcode image at a preset height Prediction results: train the initial neural network model according to the prediction results and sample encoding information to obtain the target neural network model.
  • the processor when the processor executes the computer-readable instructions, the following steps are also implemented: randomly generating a plurality of original encoding information according to different encoding rules; generating an original encoded image from the original encoding information according to corresponding encoding rules; using the original encoded image as The sample barcode image uses the original coded information as the corresponding sample coded information.
  • the processor when the processor executes the computer-readable instructions, the following steps are also implemented: constructing a loss function based on the prediction results and the degree of difference between the coded information of the samples; training the initial neural network model according to the loss function until the initial neural network model after training When the neural network model meets the preset training conditions, the trained initial neural network model is used as the target neural network model.
  • the processor when the processor executes the computer-readable instructions, the following steps are also implemented: performing data enhancement processing on the sample barcode image, and adjusting the height of the sample barcode image to a preset height to obtain the processed sample barcode image;
  • the processed sample barcode image is input to the initial neural network model to obtain the prediction result of the sample barcode image at a preset height.
  • the processor when the processor executes the computer-readable instructions, the following steps are further implemented: determining the code system identification by the number of times corresponding neurons in the target neural network model are activated.
  • a computer-readable storage medium on which computer-readable instructions are stored, and when the computer-readable instructions are executed by a processor, the following steps are implemented:
  • the target prediction sequence is identified to obtain the identification result.
  • the following steps are also implemented: if the size of the barcode image is not equal to the preset size, then adjust the barcode image to the preset size and input the pre-built target neural network model to obtain The sequence of predictions output by the target neural network model.
  • the following steps are further implemented: obtaining the position information corresponding to at least one maximum value in the prediction sequence, generating a decoding sequence according to the position information; eliminating duplicates and predictions in the decoding sequence After the placeholder is set, the target prediction sequence containing the coding information is obtained.
  • the following steps are further implemented: analyzing the target prediction sequence according to the encoding rules and encoding information matched with the code system identifier to obtain the analysis result; according to the analysis result, constructing the target The subsequence of the predicted sequence; the subsequence of the target predicted sequence is verified according to the coding rules, and the recognition result is determined according to the verification result.
  • the following steps are also implemented: obtaining the sample barcode image and corresponding sample coding information; inputting the sample barcode image into the initial neural network model to obtain the sample barcode image at a preset height The prediction results; according to the prediction results and sample coding information, the initial neural network model is trained to obtain the target neural network model.
  • the following steps are further implemented: randomly generating a plurality of original encoding information according to different encoding rules; generating the original encoding image from the original encoding information according to the corresponding encoding rule; converting the original encoding image As a sample barcode image, the original coding information is used as corresponding sample coding information.
  • the following steps are also implemented: constructing a loss function based on the prediction result and the degree of difference between the coded information of the samples; training the initial neural network model according to the loss function until the trained When the initial neural network model meets the preset training conditions, the trained initial neural network model is used as the target neural network model.
  • the following steps are further implemented: performing data enhancement processing on the sample barcode image, and adjusting the height of the sample barcode image to a preset height to obtain the processed sample barcode image;
  • the processed sample barcode image is input into the initial neural network model to obtain the prediction result of the sample barcode image at a preset height.
  • the following step is further implemented: determining the code system identification by the number of activation times of corresponding neurons in the target neural network model.
  • Non-volatile memory may include read-only memory (Read-Only Memory, ROM), magnetic tape, floppy disk, flash memory or optical memory, etc.
  • Volatile memory can include Random Access Memory (RAM) or external cache memory.
  • RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM).

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Data Mining & Analysis (AREA)
  • Toxicology (AREA)
  • Electromagnetism (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Computational Linguistics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Evolutionary Computation (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Image Analysis (AREA)
  • Image Processing (AREA)

Abstract

A barcode identification method and apparatus, a computer device and a storage medium, the method comprising: inputting a barcode image into a pre-built target neural network model to obtain a predicted sequence carrying a code system identifier (21); decoding the predicted sequence to obtain a target prediction sequence comprising coding information (22); and identifying the target prediction sequence according to coding rules and coding information matching the code system identifier so as to obtain an identification result (23).

Description

条码识别方法、装置、计算机设备和存储介质Barcode recognition method, device, computer equipment and storage medium
本申请要求于2021年08月02日提交中国专利局,申请号为202110881245.X,申请名称为“条码识别方法、装置、计算机设备和存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application with the application number 202110881245.X and the application name "barcode recognition method, device, computer equipment and storage medium" submitted to the China Patent Office on August 2, 2021, the entire content of which is passed References are incorporated in this application.
技术领域technical field
本申请涉及图像处理技术领域,特别是涉及一种条码识别方法、装置、计算机设备和存储介质。The present application relates to the technical field of image processing, in particular to a barcode recognition method, device, computer equipment and storage medium.
背景技术Background technique
在工业应用中,条码的使用越来越广泛,对条码的使用需求越来越大。条码技术发展迅速,已经衍生出了多种类型。In industrial applications, the use of barcodes is becoming more and more widespread, and the demand for the use of barcodes is increasing. The rapid development of bar code technology has derived a variety of types.
现有技术中,通常一种生产场景对应一套条码识别方案;若需要切换其他条码识别方案,需要人工手动进行设置;现有的条码识别方式还较为单一,无法适应于多变的工业生产场景,导致现有的条码识别效率还较低。In the existing technology, usually a production scene corresponds to a set of barcode recognition schemes; if you need to switch to other barcode recognition schemes, you need to manually set them up; the existing barcode recognition methods are still relatively simple and cannot adapt to changing industrial production scenarios , leading to the low efficiency of existing barcode recognition.
发明内容Contents of the invention
根据本申请公开的各种实施例,提供一种条码图像修复方法、装置、计算机设备和存储介质。According to various embodiments disclosed in this application, a barcode image restoration method, device, computer equipment and storage medium are provided.
第一方面,本申请提供了一种条码识别方法,包括:In a first aspect, the application provides a barcode recognition method, including:
将条码图像输入预先构建的目标神经网络模型,得到所述目标神经网络模型输出的预测序列;其中,所述预测序列携带有码制标识;Inputting the barcode image into the pre-built target neural network model to obtain a predicted sequence output by the target neural network model; wherein, the predicted sequence carries a code system identification;
对所述预测序列进行解码处理,得到包含有编码信息的目标预测序列;Decoding the predicted sequence to obtain a target predicted sequence including coding information;
根据与所述码制标识匹配的编码规则及所述编码信息,对所述目标预测序列进行识别,得到识别结果。The target prediction sequence is identified according to the encoding rule matched with the coding system identifier and the encoding information, and an identification result is obtained.
第二方面,本申请还提供了一种条码识别装置,包括:In a second aspect, the present application also provides a barcode recognition device, including:
序列输出模块,用于将条码图像输入预先构建的目标神经网络模型,得到所述目标神经网络模型输出的预测序列;其中,所述预测序列携带有码制标识;The sequence output module is used to input the barcode image into the pre-built target neural network model to obtain the predicted sequence output by the target neural network model; wherein the predicted sequence carries a code system identification;
序列解码模块,用于对所述预测序列进行解码处理,得到包含有编码信息的目标预测序列;A sequence decoding module, configured to decode the predicted sequence to obtain a target predicted sequence containing coding information;
序列识别模块,用于根据与所述码制标识匹配的编码规则及所述编码信息,对所述目标预测序列进行识别,得到识别结果。A sequence identification module, configured to identify the target predicted sequence according to the coding rule matched with the coding system identifier and the coding information, and obtain a recognition result.
第三方面,本申请还提供了一种计算机设备,包括存储器和处理器,所述存储器存储有计算机可读指令,所述处理器执行所述计算机可读指令时实现以下步骤:In a third aspect, the present application also provides a computer device, including a memory and a processor, the memory stores computer-readable instructions, and the processor implements the following steps when executing the computer-readable instructions:
将条码图像输入预先构建的目标神经网络模型,得到所述目标神经网络模型输出的预测序列;其中,所述预测序列携带有码制标识;Inputting the barcode image into the pre-built target neural network model to obtain a predicted sequence output by the target neural network model; wherein, the predicted sequence carries a code system identification;
对所述预测序列进行解码处理,得到包含有编码信息的目标预测序列;Decoding the predicted sequence to obtain a target predicted sequence including coding information;
根据与所述码制标识匹配的编码规则及所述编码信息,对所述目标预测序列进行识别,得到识别结果。The target prediction sequence is identified according to the encoding rule matched with the coding system identifier and the encoding information, and an identification result is obtained.
第四方面,本申请还提供了一种计算机可读存储介质,其上存储有计算机可读指令,所述计算机可读指令被处理器执行时实现以下步骤:In a fourth aspect, the present application also provides a computer-readable storage medium, on which computer-readable instructions are stored, and when the computer-readable instructions are executed by a processor, the following steps are implemented:
将条码图像输入预先构建的目标神经网络模型,得到所述目标神经网络模型输出的预测序列;其中,所述预测序列携带有码制标识;Inputting the barcode image into the pre-built target neural network model to obtain a predicted sequence output by the target neural network model; wherein, the predicted sequence carries a code system identification;
对所述预测序列进行解码处理,得到包含有编码信息的目标预测序列;Decoding the predicted sequence to obtain a target predicted sequence including coding information;
根据与所述码制标识匹配的编码规则及所述编码信息,对所述目标预测序列进行识别,得到识别结果。The target prediction sequence is identified according to the encoding rule matched with the coding system identifier and the encoding information, and an identification result is obtained.
第五方面,本申请还提供了一种计算机程序产品,包括计算机程序,该计算机程序被处理器执行时实现以下步骤:In the fifth aspect, the present application also provides a computer program product, including a computer program, and when the computer program is executed by a processor, the following steps are implemented:
将条码图像输入预先构建的目标神经网络模型,得到目标神经网络模型输出的预测序列;其中,预测序列携带有码制标识;Input the barcode image into the pre-built target neural network model to obtain the predicted sequence output by the target neural network model; wherein, the predicted sequence carries a code system identification;
对预测序列进行解码处理,得到包含有编码信息的目标预测序列;Decoding the predicted sequence to obtain a target predicted sequence containing encoded information;
根据与码制标识匹配的编码规则及编码信息,对目标预测序列进行识别,得到识别结果。According to the encoding rules and encoding information matched with the coding system identifier, the target prediction sequence is identified to obtain the identification result.
本申请的一个或多个实施例的细节在下面的附图和描述中提出。本申请的其它特征和优点将从说明书、附图以及权利要求书变得明显。The details of one or more embodiments of the application are set forth in the accompanying drawings and the description below. Other features and advantages of the application will be apparent from the description, drawings, and claims.
附图说明Description of drawings
为了更好地描述和说明这里公开的那些发明的实施例和示例,可以参考一幅或多幅附图。用于描述附图的附加细书或示例不应当被认为是对所公开的发明、目前描述的实施例和示例以及目前理解的这些发明的最佳模式中的任何一者的范围的限制。In order to better describe and illustrate embodiments and examples of the inventions disclosed herein, reference may be made to one or more of the accompanying drawings. The accompanying specification or examples used to describe the drawings should not be considered as limitations on the scope of any of the disclosed inventions, the presently described embodiments and examples, and the best mode of these inventions currently understood.
图1为一个实施例中条码识别方法的应用环境图。Fig. 1 is an application environment diagram of a barcode recognition method in an embodiment.
图2为一个实施例中条码识别方法的流程示意图。Fig. 2 is a schematic flowchart of a barcode recognition method in an embodiment.
图3为一个实施例中得到包含有编码信息的目标预测序列步骤的流程示意图。Fig. 3 is a schematic flowchart of the steps of obtaining a target prediction sequence including encoding information in an embodiment.
图4为一个实施例中对目标预测序列进行识别步骤的流程示意图。Fig. 4 is a schematic flowchart of the step of identifying the target prediction sequence in an embodiment.
图5为一个实施例中对初始神经网络模型进行训练步骤的流程示意图。Fig. 5 is a schematic flowchart of the steps of training the initial neural network model in one embodiment.
图6为一个实施例中条码识别装置的结构框图。Fig. 6 is a structural block diagram of a barcode recognition device in an embodiment.
图7为一个实施例中计算机设备的内部结构图。Figure 7 is an internal block diagram of a computer device in one embodiment.
具体实施方式Detailed ways
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solution and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present application, and are not intended to limit the present application.
本申请提供的条码识别方法,可以单独应用于部署有目标神经网络模型的终端设备;具体地,终端设备拍摄得到包含有条码信息的条码图像;终端设备将条码图像输入预先部署在终端设备内的目标神经网络模型,得到目标神经网络模型输出的预测序列;预测序列携带有码制标识;终端设备对预测序列进行解码处理,得到包含有编码信息的目标预测序列;终端设备根据与码制标识匹配的编码规则及编码信息,对目标预测序列进行识别,得到识别结果。The barcode recognition method provided by this application can be independently applied to the terminal device deployed with the target neural network model; specifically, the terminal device captures a barcode image containing barcode information; the terminal device inputs the barcode image into the pre-deployed terminal device The target neural network model obtains the prediction sequence output by the target neural network model; the prediction sequence carries a code system identification; the terminal device decodes the prediction sequence to obtain the target prediction sequence containing coding information; the terminal device matches the code system identification The coding rules and coding information are used to identify the target prediction sequence and obtain the recognition result.
本申请提供的条码识别方法,还可以应用于如图1所示的应用环境中。其 中,终端11通过网络与服务器12进行通信。终端11将条码图像发送至服务器12,服务器12将接受到的条码图像输入预先构建的目标神经网络模型,得到目标神经网络模型输出的预测序列;预测序列携带有码制标识;服务器12对预测序列进行解码处理,得到包含有编码信息的目标预测序列;服务器12根据与码制标识匹配的编码规则及编码信息,对目标预测序列进行识别,得到识别结果;服务器12将识别结果返回至终端11。The barcode recognition method provided in this application can also be applied to the application environment shown in FIG. 1 . Wherein, the terminal 11 communicates with the server 12 through the network. The terminal 11 sends the barcode image to the server 12, and the server 12 inputs the received barcode image into the pre-built target neural network model to obtain the predicted sequence output by the target neural network model; the predicted sequence carries a code system identification; the server 12 pairs the predicted sequence Perform decoding processing to obtain the target prediction sequence including coding information; the server 12 identifies the target prediction sequence according to the coding rules and coding information matching the code system identifier, and obtains the recognition result; the server 12 returns the recognition result to the terminal 11.
其中,终端11可以但不限于是各种扫码设备、个人计算机、笔记本电脑、智能手机、平板电脑和便携式可穿戴设备,服务器12可以用独立的服务器或者是多个服务器组成的服务器集群来实现。Among them, the terminal 11 can be, but not limited to, various code scanning devices, personal computers, notebook computers, smart phones, tablet computers and portable wearable devices, and the server 12 can be realized by an independent server or a server cluster composed of multiple servers .
在一些实施例中,如图2所示,提供了一种条码识别方法,以该方法应用于图1中的服务器12为例进行说明,包括以下步骤:In some embodiments, as shown in FIG. 2, a barcode recognition method is provided, and the method is applied to the server 12 in FIG. 1 as an example for illustration, including the following steps:
步骤21,将条码图像输入预先构建的目标神经网络模型,得到目标神经网络模型输出的预测序列;其中,预测序列携带有码制标识。 Step 21, inputting the barcode image into the pre-built target neural network model to obtain a predicted sequence output by the target neural network model; wherein the predicted sequence carries a code system identifier.
其中,条码图像是指包含有条码信息的图像;目标神经网络模型是指经过预先训练的,能够对条码图像中的条码信息进行识别并输出相应结果的神经网络模型;预测序列是指目标神经网络模型对条码图像进行识别后输出的序列形式的结果;码制标识是指目标神经网络模型识别出的条码图像中条码信息对应的码制,即神经网络预测出的符合条码图像的编码要求。Among them, the barcode image refers to the image containing the barcode information; the target neural network model refers to the pre-trained neural network model that can identify the barcode information in the barcode image and output the corresponding results; the prediction sequence refers to the target neural network model. The result of the sequence output after the model recognizes the barcode image; the code system identification refers to the code system corresponding to the barcode information in the barcode image recognized by the target neural network model, that is, the code system predicted by the neural network meets the coding requirements of the barcode image.
具体地,服务器将条码图像输入预先构建的目标神经网络模型;目标神经网络模型根据预先训练过程中确定好的权重参数等信息,提取出条码图像对应的图像特征,对特征进行卷积运算、池化运算等输出最终的预测结果作为预测序列。码制标识可以由目标神经网络模型中相应的神经元被激活的次数确定。Specifically, the server inputs the barcode image into the pre-built target neural network model; the target neural network model extracts image features corresponding to the barcode image according to information such as weight parameters determined in the pre-training process, performs convolution operations on the features, pools Output the final prediction result as the prediction sequence. The code system identification can be determined by the number of activations of corresponding neurons in the target neural network model.
步骤22,对预测序列进行解码处理,得到包含有编码信息的目标预测序列。 Step 22, decoding the prediction sequence to obtain a target prediction sequence including coding information.
具体地,服务器对预测序列进行Argmax操作,通过提取每个序列位置i上的Top-N最大值位置,获得解码序列;Specifically, the server performs an Argmax operation on the predicted sequence, and obtains the decoded sequence by extracting the Top-N maximum position at position i of each sequence;
解码处理可以通过贪心搜索(greedy search)、集束搜索(Beam Search)、前缀束搜索(Prefix Beam Search)等多种算法进行,具体可根据实际需要进行确定。The decoding process can be performed by various algorithms such as greedy search, beam search, and prefix beam search, which can be determined according to actual needs.
解码后对序列中重复的元素进行合并,解码后的解码序列中若包含有连续且重复的元素,则将其中连续且重复的元素进行剔除;例如根据解码序列中Top-1最大值位置得到的序列表示为[1,2,106,2,2,2,7,5,3],可见该序列中连续的三个2是需要合并的,合并处理后仅保留一个2,即合并后的序列为[1,2,106,2,7,5,3]。Merge the repeated elements in the sequence after decoding. If the decoded decoding sequence contains continuous and repeated elements, remove the continuous and repeated elements; for example, according to the position of the Top-1 maximum value in the decoding sequence The sequence is expressed as [1,2,106,2,2,2,7,5,3]. It can be seen that three consecutive 2s in the sequence need to be merged, and only one 2 is retained after the merge process, that is, the merged sequence is [ 1,2,106,2,7,5,3].
最后根据编码信息将序列中的占位符进一步剔除,即得到包含有编码信息的目标预测序列;例如CODO128中指定106号为占位符,则在上述序列中需要剔除106,变换后的序列变成[1,2,2,7,5,3];至此,得到包含有起始符、内容、校验位、终止符作为编码信息的目标预测序列。Finally, according to the coding information, the placeholders in the sequence are further removed to obtain the target prediction sequence containing coding information; for example, CODO128 specifies No. 106 as a placeholder, then 106 needs to be removed from the above sequence, and the transformed sequence becomes into [1,2,2,7,5,3]; so far, the target prediction sequence including the start symbol, content, check digit, and terminator as coding information is obtained.
步骤23,根据与码制标识匹配的编码规则及编码信息,对目标预测序列进行识别,得到识别结果。 Step 23, according to the encoding rules and encoding information matched with the code system identifier, identify the target prediction sequence, and obtain the identification result.
服务器根据码制标识确定该目标预测序列对应的编码规则;根据编码信息识别目标预测序列中的起始符、校验位、终止符以及内容,对目标预测序列进行解析;例如编码规则为CODE128的目标预测序列为[104,35,19,99,91,24,56,78,89,106],服务器通过起始符104进一步确定该目标预测序列为CODE128-B子编码规则,则根据CODE128-B子编码规则对目标预测序列进一步解析,得到解析结果。解析结果在通过校验后可作为识别结果进行输出。The server determines the encoding rule corresponding to the target prediction sequence according to the coding system identifier; identifies the start symbol, check digit, terminator and content in the target prediction sequence according to the coding information, and analyzes the target prediction sequence; for example, the coding rule is CODE128 The target prediction sequence is [104, 35, 19, 99, 91, 24, 56, 78, 89, 106], the server further determines that the target prediction sequence is the CODE128-B sub-coding rule through the start character 104, then according to the CODE128-B sub-coding rule The coding rules further analyze the target prediction sequence to obtain the analysis result. The analysis result can be output as the recognition result after passing the verification.
上述条码识别方法,包括:将条码图像输入预先构建的目标神经网络模型,得到目标神经网络模型输出的预测序列;预测序列携带有码制标识;对预测序列进行解码处理,得到包含有编码信息的目标预测序列;根据与码制标识匹配的编码规则及编码信息,对目标预测序列进行识别,得到识别结果。本申请通过预先构建的目标神经网络模型对条码图像进行识别,输出预测序列和相应的码制标识;在对预测序列进行解码处理后得到有编码信息的目标预测序列;最后利用编码信息及码制标识对应的编码规则,识别目标预测序列得到识别结果,实现了对任意码制的条码图像的识别;无需人工预先按照条码图像的码制进行切换与调整,即可直接对条码图像进行识别,提高了条码识别的效率。The above-mentioned barcode recognition method includes: inputting the barcode image into a pre-built target neural network model to obtain a predicted sequence output by the target neural network model; the predicted sequence carries a code system identification; decoding the predicted sequence to obtain a The target prediction sequence: according to the coding rules and coding information matched with the code system identifier, the target prediction sequence is identified, and the recognition result is obtained. This application recognizes the barcode image through the pre-built target neural network model, and outputs the predicted sequence and the corresponding code system identification; after decoding the predicted sequence, the target predicted sequence with coding information is obtained; finally, the coded information and code system are used Identify the corresponding coding rules, identify the target prediction sequence to obtain the recognition result, and realize the recognition of barcode images of any code system; without manual switching and adjustment according to the code system of the barcode image, the barcode image can be directly recognized, improving Improve the efficiency of barcode recognition.
在一些实施例中,步骤21,将条码图像输入预先构建的目标神经网络模型,得到目标神经网络模型输出的预测序列,包括:若条码图像的尺寸不等于预设尺寸,则调整条码图像至预设尺寸后输入预先构建的目标神经网络模型,得到目标神经网络模型输出的预测序列。In some embodiments, step 21, inputting the barcode image into the pre-built target neural network model to obtain the predicted sequence output by the target neural network model includes: if the size of the barcode image is not equal to the preset size, adjusting the barcode image to the preset size After setting the size, input the pre-built target neural network model to obtain the predicted sequence output by the target neural network model.
具体地,预设尺寸可以根据目标神经网络模型训练时的样本条码图像的尺寸进行设定。本实施例中,输入的条码图像与样本条码图像保持一致,使得目标神经网络模型能够在一致的基础下对条码图像进行预测识别,提高了目标神经网络模型识别条码图像的效率和准确性。Specifically, the preset size can be set according to the size of the sample barcode image when the target neural network model is trained. In this embodiment, the input barcode image is consistent with the sample barcode image, so that the target neural network model can predict and recognize the barcode image on a consistent basis, improving the efficiency and accuracy of the target neural network model in recognizing barcode images.
在一些实施例中,如图3所示,上述步骤22,对预测序列进行解码处理,得到包含有编码信息的目标预测序列,包括:In some embodiments, as shown in FIG. 3, the above step 22 is to decode the predicted sequence to obtain the target predicted sequence containing coding information, including:
步骤31,获取预测序列中至少一个最大值所对应的位置信息,根据位置信息生成解码序列; Step 31, obtaining position information corresponding to at least one maximum value in the prediction sequence, and generating a decoding sequence according to the position information;
步骤32,剔除解码序列中的重复项及预设占位符后,得到包含有编码信息的目标预测序列。 Step 32, after removing duplicate items and preset placeholders in the decoding sequence, a target prediction sequence including coding information is obtained.
具体地,预设占位符是根据目标神经网络模型中,构建损失函数所用的CTC算法而设置的,因此在解码后需要删除该预设占位符。Specifically, the preset placeholder is set according to the CTC algorithm used to construct the loss function in the target neural network model, so the preset placeholder needs to be deleted after decoding.
获取目标预测序列中各个最大值的位置,根据最大值的位置生成解码序列可以通过Argmax算法进行计算取得。argmax是一种函数,是对函数求参数(集合)的函数;即argmax(f(x))是使得f(x)取得最大值所对应的变量点x(或x的集合)。Obtaining the position of each maximum value in the target prediction sequence, and generating a decoding sequence according to the position of the maximum value can be obtained by calculating through the Argmax algorithm. argmax is a function, which is a function for finding parameters (sets) of a function; that is, argmax(f(x)) is the variable point x (or set of x) corresponding to the maximum value of f(x).
解码序列可以通过集束搜索算法得到;集束搜索(Beam Search)是一种启发式图搜索算法,能够通过预先设定的经验参数K(经验参数K影响算法时延以及最终效果;可根据实际场景以及经验进行设定)。还可以利用朴素解码方式对解码序列进行处理,即直接获取解码序列中的第一行作为解码后的解码序列,即Top-1最大值对应位置的序列。The decoding sequence can be obtained through the beam search algorithm; beam search (Beam Search) is a heuristic graph search algorithm, which can affect the algorithm delay and final effect through the preset empirical parameter K (the empirical parameter K can be used according to the actual scene and experience to set). The decoded sequence can also be processed in a naive decoding manner, that is, the first line in the decoded sequence is directly obtained as the decoded decoded sequence, that is, the sequence corresponding to the position of the Top-1 maximum value.
本实施例中,通过位置生成解码序列、得到解码后的解码序列以及剔除解码后的解码序列中的重复项,能够逐渐将模型输出的预测序列调整为接近条码编码格式的目标预测序列,提高了条码识别的效率。In this embodiment, the predicted sequence output by the model can be gradually adjusted to the target predicted sequence close to the barcode encoding format by generating the decoded sequence by position, obtaining the decoded decoded sequence, and removing duplicates in the decoded decoded sequence, improving the The efficiency of barcode recognition.
在一些实施例中,如图4所示,上述步骤23,根据与码制标识匹配的编码 规则及编码信息,对目标预测序列进行识别,得到识别结果,包括:In some embodiments, as shown in Figure 4, the above-mentioned step 23, according to the encoding rules and encoding information matched with the code system identification, identifies the target prediction sequence, and obtains the identification result, including:
步骤41,根据与码制标识匹配的编码规则及编码信息,对目标预测序列进行解析,得到解析结果;Step 41: Analyze the target prediction sequence according to the encoding rules and encoding information matched with the code system identifier, and obtain the analysis result;
步骤42,根据解析结果,构造目标预测序列的子序列; Step 42, constructing a subsequence of the target prediction sequence according to the parsing result;
步骤43,根据编码规则对目标预测序列的子序列进行校验,根据校验结果确定识别结果。 Step 43, verifying the subsequence of the target prediction sequence according to the encoding rule, and determining the recognition result according to the verification result.
具体地,对目标预测序列进行识别的过程主要包括解析以及校验;若解析结果为校验通过状态,则可确认目标预测序列完成识别;反之若解析结果为校验未通过状态,则可确认目标预测序列未完成识别。Specifically, the process of identifying the target prediction sequence mainly includes parsing and verification; if the result of the parsing is in the state of passing the verification, it can be confirmed that the target prediction sequence has been identified; otherwise, if the result of the parsing is in the state of failing the verification, it can be confirmed that The target prediction sequence has not been identified.
解析的过程需要通过编码规则确定具体的解析方式,编码规则用于识别序列中不同的组成部分。编码规则同样能对解析结果进行校验,根据校验结果能够判断解析结果是否能够作为可信的识别结果。例如在解析到序列末尾时出现终止符,则根据终止符之前的元素构造新的序列作为目标预测序列的子序列,并对该子序列进行校验。The process of parsing needs to determine the specific parsing method through coding rules, which are used to identify different components in the sequence. The encoding rules can also verify the analysis results, and according to the verification results, it can be judged whether the analysis results can be used as credible identification results. For example, when a terminator appears when parsing to the end of the sequence, a new sequence is constructed according to the elements before the terminator as a subsequence of the target prediction sequence, and the subsequence is verified.
本实施例中,通过解析结果构造相应的子序列实现对目标预测序列以及解析结果的校验,提高了条码识别的效率和准确率。In this embodiment, the verification of the target predicted sequence and the analysis result is realized by constructing a corresponding subsequence through the analysis result, which improves the efficiency and accuracy of barcode recognition.
在一些实施例中,如图5所示,上述步骤21,在将条码图像输入预先构建的目标神经网络模型,得到目标神经网络模型输出的预测序列之前,还包括:In some embodiments, as shown in FIG. 5, the above step 21, before inputting the barcode image into the pre-built target neural network model to obtain the predicted sequence output by the target neural network model, further includes:
步骤51,获取样本条码图像以及对应的样本编码信息; Step 51, acquiring sample barcode images and corresponding sample coding information;
步骤52,将样本条码图像输入初始神经网络模型,得到样本条码图像在预设高度下的预测结果; Step 52, inputting the sample barcode image into the initial neural network model to obtain the prediction result of the sample barcode image at a preset height;
步骤53,根据预测结果与样本编码信息对初始神经网络模型进行训练,得到目标神经网络模型。Step 53: Train the initial neural network model according to the prediction result and sample encoding information to obtain the target neural network model.
其中,样本条码图像是指包含有明确条码信息且用于对模型进行训练的图像;样本编码信息是指与样本条码图像一一对应的编码信息。样本条码图像可以获取出相应的样本编码信息,同理根据样本编码信息也能获取到相应的样本条码图像。Wherein, the sample barcode image refers to an image that contains clear barcode information and is used for training the model; the sample encoding information refers to encoding information corresponding to the sample barcode image one-to-one. The corresponding sample code information can be obtained from the sample barcode image, and the corresponding sample barcode image can also be obtained according to the sample code information.
具体地,例如希望构造CODE128制式的样本条码图像,且包含信息 “C391245678”,需要通过CODE128编码规则,对所包含的信息进行编码,得到编码后的序列[104,35,19,99,91,24,56,78,89,106];其中第1位为起始符,同时指示了该编码遵循CODE128-B子制式对后续信息进行编码;被编码内容包含“35,19,99,91,24,56,78”其中35编码了信息中的“C”,19编码了信息中的“3”,“99”表示后续信息遵循CODE128-C子制式进行编码;“91”编码了信息中的“91”,“24”编码了信息中的“24”,依次类推,直到倒数第2位“89”为校验位,末位“106”为终止位。将样本编码信息全部识别后,可以按照CODE128制式的编码规则,生成与样本编码信息对应的样本条码图像。Specifically, for example, if you want to construct a sample barcode image of the CODE128 standard and contain the information "C391245678", you need to encode the contained information through the CODE128 encoding rule to obtain the encoded sequence [104,35,19,99,91, 24,56,78,89,106]; the first bit is the start character, and it indicates that the code follows the CODE128-B substandard to encode the subsequent information; the encoded content includes "35,19,99,91,24, 56,78", 35 encodes the "C" in the information, 19 encodes the "3" in the information, "99" indicates that the subsequent information is encoded in accordance with the CODE128-C substandard; "91" encodes the "91" in the information ", "24" encodes the "24" in the information, and so on, until the penultimate digit "89" is the check digit, and the last digit "106" is the stop digit. After all the sample coding information is identified, a sample barcode image corresponding to the sample coding information can be generated according to the coding rules of the CODE128 standard.
若已获取有样本条码图像需要获取其对应的样本编码信息,可再知道样本条码图像所利用编码规则的基础上,直接利用现有的解码软件对样本条码图像进行识别,得到对应的样本编码信息。If you have obtained sample barcode images and need to obtain their corresponding sample code information, you can use the existing decoding software to directly identify the sample barcode images on the basis of knowing the code rules used by the sample barcode images to obtain the corresponding sample code information .
可以通过初始神经网络模型中的最大池化层将输出的高度进行固定;例如在h高度的样本条码图像输入的情况下,初始神经网络模型输出高度记为h_model。如果h_model值不为1时,可以再通过高度为h_model、宽度为1步长为1、填充为0的最大池化层对输出进行最大池化处理,使得初始神经网络模型输出为一个高度为1的二维矩阵作为样本条码图像的预测结果。类似地,还可以通过特定参数的池化、卷积、resize(尺寸调整函数)、插值等方式使得样本条码图像的预测结果控制在预设高度下。The height of the output can be fixed by the maximum pooling layer in the initial neural network model; for example, in the case of h-height sample barcode image input, the initial neural network model output height is recorded as h_model. If the value of h_model is not 1, the output can be max-pooled through the maximum pooling layer with height h_model, width 1, step size 1, and padding 0, so that the initial neural network model output is a height of 1 The two-dimensional matrix of is used as the prediction result of the sample barcode image. Similarly, the prediction result of the sample barcode image can also be controlled at a preset height by means of specific parameters such as pooling, convolution, resize (size adjustment function), interpolation, and the like.
本实施例通过包含有最大池化层的初始神经网络模型使得输出的样本条码图像的预测结果始终保持尺寸统一,提高了初始神经网络模型进行训练的效率以及目标神经网络模型预测的准确性。In this embodiment, the initial neural network model including the maximum pooling layer keeps the prediction result of the output sample barcode image uniform in size, which improves the training efficiency of the initial neural network model and the prediction accuracy of the target neural network model.
在一些实施例中,上述步骤51,获取样本条码图像以及对应的样本编码信息,包括:根据不同编码规则随机生成多个原始编码信息;将原始编码信息按照对应的编码规则生成原始编码图像;将原始编码图像作为样本条码图像,将原始编码信息作为对应的样本编码信息。In some embodiments, the above step 51, acquiring the sample barcode image and the corresponding sample coding information includes: randomly generating a plurality of original coding information according to different coding rules; generating the original coded image according to the corresponding coding rules from the original coding information; The original coded image is used as a sample barcode image, and the original coded information is used as corresponding sample coded information.
具体地,初始神经网络模型在训练过程中需要用到样本编码信息与样本条码图像组成的信息对进行,因此可以获取样本条码图像及样本编码信息中的一种,并通过相关技术等生成另一种信息,完成训练数据的积累;除了利用随机 生成的原始编码信息生成相应的样本条码图像外,还可以根据已获取的样本条码图像,对样本条码图像进行解码处理得到相应的原始编码信息作为样本编码信息,即得到了样本条码图像-样本编码信息的信息对。Specifically, the initial neural network model needs to use the information pair composed of the sample code information and the sample barcode image in the training process, so one of the sample barcode image and the sample code information can be obtained, and the other can be generated through related technologies. information to complete the accumulation of training data; in addition to using the randomly generated original coding information to generate the corresponding sample barcode image, the sample barcode image can also be decoded according to the sample barcode image that has been obtained to obtain the corresponding original coding information as a sample Encoding information, that is, an information pair of sample barcode image-sample coding information is obtained.
本实施例通过随机生成的多个原始编码信息生成相应的样本条码图像,实现了样本条码图像和样本编码信息的积累;样本的积累能够提高初始神经网络模型训练的效果。In this embodiment, corresponding sample barcode images are generated from a plurality of randomly generated original coding information, and the accumulation of sample barcode images and sample coding information is realized; the accumulation of samples can improve the effect of initial neural network model training.
在一些实施例中,上述步骤53,根据预测结果与样本编码信息对初始神经网络模型进行训练,得到目标神经网络模型,包括:基于预测结果以及样本编码信息之间的差异程度,构建损失函数;根据损失函数训练初始神经网络模型,直至训练后的初始神经网络模型满足预设训练条件时,将训练后的初始神经网络模型作为目标神经网络模型。In some embodiments, the above step 53 is to train the initial neural network model according to the prediction result and sample encoding information to obtain the target neural network model, including: constructing a loss function based on the degree of difference between the prediction result and the sample encoding information; The initial neural network model is trained according to the loss function until the trained initial neural network model meets the preset training conditions, and the trained initial neural network model is used as the target neural network model.
具体地,损失函数可以利用CTC(Connectionist temporal classification,一种时序分类算法)算法进行构建;通过CTC损失函数计算预测结果以及样本编码信息之间的差异程度得到损失函数值,根据损失函数值反向传播到初始神经网络模型,对各个权值参数进行调节;直到初始神经网络模型满足预设训练条件,例如训练达到一定次数,或者损失函数值低于某个预设阈值等。Specifically, the loss function can be constructed using the CTC (Connectionist temporal classification, a temporal classification algorithm) algorithm; the loss function value is obtained by calculating the difference between the prediction results and the sample encoding information through the CTC loss function, and the loss function value is reversed according to the loss function value. Propagate to the initial neural network model, and adjust each weight parameter; until the initial neural network model meets the preset training conditions, such as training for a certain number of times, or the loss function value is lower than a preset threshold, etc.
本实施例通过构建损失函数,使得模型训练过程中不断朝着降低预测结果以及样本编码信息之间的差异程度进行,提高了初始神经网络模型训练的效果。In this embodiment, by constructing a loss function, the process of model training is continuously carried out towards reducing the degree of difference between prediction results and sample coding information, thereby improving the effect of initial neural network model training.
在一些实施例中,将样本条码图像输入初始神经网络模型,得到样本条码图像在预设高度下的预测结果之前,还包括:对样本条码图像进行数据增强处理,以及将样本条码图像的高度调整至预设高度,得到处理后的样本条码图像;In some embodiments, before inputting the sample barcode image into the initial neural network model to obtain the prediction result of the sample barcode image at a preset height, it also includes: performing data enhancement processing on the sample barcode image, and adjusting the height of the sample barcode image to the preset height to obtain the processed sample barcode image;
将样本条码图像输入初始神经网络模型,得到样本条码图像在预设高度下的预测结果,包括:将处理后的样本条码图像输入初始神经网络模型,得到样本条码图像在预设高度下的预测结果。Input the sample barcode image into the initial neural network model to obtain the prediction result of the sample barcode image at the preset height, including: input the processed sample barcode image into the initial neural network model to obtain the prediction result of the sample barcode image at the preset height .
在一些实施例中,还提供了又一种条码识别方法,包括:In some embodiments, yet another barcode identification method is provided, including:
1、获取样本条码图像以及样本编码信息:样本条码图像以及样本编码信息可以遵循的编码规则为EAN系列、CODE码系列、UPC码系列、ITF码系列,且样本编码信息中通常包含起始符、内容、校验位及终止符。1. Obtain the sample barcode image and sample coding information: the coding rules that the sample barcode image and sample coding information can follow are EAN series, CODE code series, UPC code series, and ITF code series, and the sample coding information usually includes the start symbol, content, check digit and terminator.
2、训练初始神经网络模型:将所有样本条码图像标准化到统一高度h。将所有样本条码图像进行数据增强处理,包括:模糊、调整图像亮度、对图像进行裁剪、增加噪声等,目的在于将比较规整的图像降低质量;得到变化后的样本条码图像。选择一个神经网络模型,计算在h高度图像输入情况下,该模型输出高度值h_model;如果h_model值不为1,则将模型输出通过一层高度为h_model宽度为1步长为1,padding(填充值)为0的MaxPooling(最大池化)层。2. Train the initial neural network model: standardize all sample barcode images to a uniform height h. Perform data enhancement processing on all sample barcode images, including: blurring, adjusting image brightness, cropping images, adding noise, etc. The purpose is to reduce the quality of relatively regular images; obtain the changed sample barcode image. Select a neural network model, and calculate the output height value h_model of the model in the case of h-height image input; if the value of h_model is not 1, then pass the model output through a layer with a height of h_model and a width of 1 and a step size of 1, padding (fill Recharge) is the MaxPooling (maximum pooling) layer of 0.
对初始神经网络模型输出的预测结果进行1*1卷积运算,输出通道数量C为条码中可能出现的编码总数量。例如针对Code128则输出维度为106+1,其中+1是由于CTC算法中设计的占位符“Blank”所需。Perform a 1*1 convolution operation on the prediction results output by the initial neural network model, and the number of output channels C is the total number of codes that may appear in the barcode. For example, for Code128, the output dimension is 106+1, where +1 is required by the placeholder "Blank" designed in the CTC algorithm.
通过CTC算法计算样本编码信息和预测结果之间的误差L,通过反向传播更新初始神经网络模型的模型参数,多次迭代该过程,直到误差L收敛为止(L收敛典型值0-20)时,得到训练完成的初始神经网络模型并作为预先构建的目标神经网络模型。Calculate the error L between the sample encoding information and the prediction result through the CTC algorithm, update the model parameters of the initial neural network model through back propagation, and iterate the process multiple times until the error L converges (the typical value of L convergence is 0-20) , get the trained initial neural network model and use it as the pre-built target neural network model.
3、利用预先构建的目标神经网络模型对条码图像进行识别:将待识别的条码图像的高度标准化到h后送入目标神经网络模型M,得到目标神经网络模型输出的预测序列;该预测序列为一个通道数量为C,宽度跟随输入图像宽度变化的二维矩阵。3. Use the pre-built target neural network model to identify the barcode image: standardize the height of the barcode image to be recognized to h and send it to the target neural network model M to obtain the predicted sequence output by the target neural network model; the predicted sequence is A two-dimensional matrix with the number of channels C and whose width varies with the width of the input image.
对预测序列进行解码:对预测序列进行Argmax操作,提取每个位置i上的Top_N最大值位置,获得序列T。Decode the predicted sequence: perform Argmax operation on the predicted sequence, extract the Top_N maximum value position at each position i, and obtain the sequence T.
朴素解码方式:取出序列T的第一行,即预测序列中Top 1最大值的位置。BeamSearch解码方式:选取经验参数K(K影响算法时延、最终效果;通常根据实际场景权衡)。以K作为备选解码最优的K个序列,通过BeamSearch搜索到序列T。Naive decoding method: take out the first row of the sequence T, which is the position of the maximum value of Top 1 in the predicted sequence. BeamSearch decoding method: Select the empirical parameter K (K affects the algorithm delay and final effect; usually weighed according to the actual scene). Taking K as the optimal K sequence for alternative decoding, the sequence T is searched by BeamSearch.
合并T中连续且重复的信号;剔除合并后序列中的“Blank”占位符。以CODO128为例,若在训练阶段指定106号为占位符,则在上述例子中需要剔除106。变换后的序列变成[1,2,2,7,5,3]。此时序列中的重复字符不需要进行合并。将顺序通过解码、合并和剔除三个步骤后的序列称为目标预测序列。该目标预 测序列即包含起始符、内容、校验位、终止符等原始编码信息。Merge consecutive and repeated signals in T; remove the "Blank" placeholder in the merged sequence. Taking CODO128 as an example, if number 106 is specified as a placeholder during the training phase, 106 needs to be removed in the above example. The transformed sequence becomes [1,2,2,7,5,3]. Repeated characters in the sequence do not need to be merged at this time. The sequence after the three steps of decoding, merging and elimination is called the target prediction sequence. The target prediction sequence includes original coding information such as start character, content, check digit, and terminator.
4、根据编码规则及编码信息,对目标预测序列进行识别,得到识别结果:对目标预测序列运用编码规则进行解码;以CODE128的序列[104,35,19,99,91,24,56,78,89,106]为例,根据起始符104判断该码为CODE128-B子制式,对后续数值通过CODE128-B子制式进行解析,直到末尾106出现终止符时,从终止符向前倒退1位,构造子序列,将子序列通过CODE128校验方式,即对[104,35,19,99,91,24,56,78,89]进行校验,若通过校验,则认为目标预测序列有效,完成条码识别。4. According to the encoding rules and encoding information, identify the target prediction sequence and obtain the recognition result: use the encoding rule to decode the target prediction sequence; ,89,106] as an example, according to the start character 104, it is judged that the code is a CODE128-B sub-standard, and the subsequent value is analyzed through the CODE128-B sub-standard, and when the end character 106 appears at the end, it is backward 1 bit from the terminator, Construct a subsequence, and pass the subsequence through the CODE128 verification method, that is, verify [104, 35, 19, 99, 91, 24, 56, 78, 89]. If it passes the verification, the target prediction sequence is considered valid. Complete barcode recognition.
上述条码识别方法,通过预先构建的目标神经网络模型对条码图像进行识别,输出预测序列和相应的码制标识;在对预测序列进行解码处理后得到有编码信息的目标预测序列;最后利用编码信息及码制标识对应的编码规则,识别目标预测序列得到识别结果,实现了对任意码制的条码图像的识别;无需人工预先按照条码图像的码制进行切换与调整,即可直接对条码图像进行识别,提高了条码识别的效率。The above barcode recognition method recognizes the barcode image through the pre-built target neural network model, and outputs the predicted sequence and the corresponding code system identification; after decoding the predicted sequence, the target predicted sequence with coding information is obtained; finally, using the coding information And the coding rules corresponding to the code system logo, identify the target prediction sequence to get the recognition result, and realize the recognition of barcode images of any code system; without manual switching and adjustment according to the code system of the barcode image in advance, the barcode image can be directly processed Recognition, improve the efficiency of barcode recognition.
应该理解的是,虽然图2-5的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,图2-5中的至少一部分步骤可以包括多个步骤或者多个阶段,这些步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤中的步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that although the various steps in the flow charts of FIGS. 2-5 are shown sequentially as indicated by the arrows, these steps are not necessarily executed sequentially in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least some of the steps in Figures 2-5 may include multiple steps or stages, these steps or stages are not necessarily executed at the same moment, but may be executed at different moments, the execution of these steps or stages The sequence is not necessarily performed sequentially, but may be performed alternately or alternately with other steps or at least a part of steps or stages in other steps.
在一些实施例中,如图6所示,提供了一种条码识别装置,包括:In some embodiments, as shown in Figure 6, a barcode recognition device is provided, including:
序列输出模块61,用于将条码图像输入预先构建的目标神经网络模型,得到目标神经网络模型输出的预测序列;其中,预测序列携带有码制标识;The sequence output module 61 is used to input the barcode image into the pre-built target neural network model to obtain the predicted sequence output by the target neural network model; wherein the predicted sequence carries a code system identification;
序列解码模块62,用于对预测序列进行解码处理,得到包含有编码信息的目标预测序列;A sequence decoding module 62, configured to decode the predicted sequence to obtain a target predicted sequence containing coding information;
序列识别模块63,用于根据与码制标识匹配的编码规则及编码信息,对目标预测序列进行识别,得到识别结果。The sequence identification module 63 is configured to identify the target predicted sequence according to the coding rules and coding information matched with the coding system identifier, and obtain the recognition result.
在一些实施例中,序列输出模块61,还用于若条码图像的尺寸不等于预设尺寸,则调整条码图像至预设尺寸后输入预先构建的目标神经网络模型,得到目标神经网络模型输出的预测序列。In some embodiments, the sequence output module 61 is also used to adjust the barcode image to the preset size and then input the pre-built target neural network model to obtain the target neural network model output if the size of the barcode image is not equal to the preset size. Prediction sequence.
在一些实施例中,序列解码模块62,还用于获取预测序列中至少一个最大值所对应的位置信息,根据位置信息生成解码序列;剔除解码序列中的重复项及预设占位符后,得到包含有编码信息的目标预测序列。In some embodiments, the sequence decoding module 62 is further configured to obtain position information corresponding to at least one maximum value in the predicted sequence, and generate a decoding sequence according to the position information; after removing duplicates and preset placeholders in the decoding sequence, Obtain the target prediction sequence containing the coding information.
在一些实施例中,序列识别模块63,还用于根据与码制标识匹配的编码规则及编码信息,对目标预测序列进行解析,得到解析结果;根据解析结果,构造目标预测序列的子序列;根据编码规则对目标预测序列的子序列进行校验,根据校验结果确定识别结果。In some embodiments, the sequence identification module 63 is further configured to analyze the target prediction sequence according to the coding rules and coding information matched with the code system identifier to obtain the analysis result; according to the analysis result, construct a subsequence of the target prediction sequence; The subsequence of the target prediction sequence is verified according to the coding rules, and the recognition result is determined according to the verification result.
在一些实施例中,条码识别装置还包括模型训练模块,用于获取样本条码图像以及对应的样本编码信息;将样本条码图像输入初始神经网络模型,得到样本条码图像在预设高度下的预测结果;根据预测结果与样本编码信息对初始神经网络模型进行训练,得到目标神经网络模型。In some embodiments, the barcode recognition device also includes a model training module, which is used to obtain sample barcode images and corresponding sample coding information; input the sample barcode images into the initial neural network model to obtain the prediction results of the sample barcode images at a preset height ; Train the initial neural network model according to the prediction result and sample encoding information to obtain the target neural network model.
在一些实施例中,模型训练模块,还用于根据不同编码规则随机生成多个原始编码信息;将原始编码信息按照对应的编码规则生成原始编码图像;将原始编码图像作为样本条码图像,将原始编码信息作为对应的样本编码信息。In some embodiments, the model training module is also used to randomly generate a plurality of original encoding information according to different encoding rules; generate the original encoding image according to the corresponding encoding rules; use the original encoding image as a sample barcode image, and convert the original The encoding information serves as the corresponding sample encoding information.
在一些实施例中,模型训练模块,还用于基于预测结果以及样本编码信息之间的差异程度,构建损失函数;根据损失函数训练初始神经网络模型,直至训练后的初始神经网络模型满足预设训练条件时,将训练后的初始神经网络模型作为目标神经网络模型。In some embodiments, the model training module is also used to construct a loss function based on the difference between the prediction results and the sample encoding information; train the initial neural network model according to the loss function until the trained initial neural network model meets the preset When training conditions, the trained initial neural network model is used as the target neural network model.
在一些实施例中,模型训练模块,还用于对样本条码图像进行数据增强处理,以及将样本条码图像的高度调整至预设高度,得到处理后的样本条码图像;将处理后的样本条码图像输入初始神经网络模型,得到样本条码图像在预设高度下的预测结果。In some embodiments, the model training module is also used to perform data enhancement processing on the sample barcode image, and adjust the height of the sample barcode image to a preset height to obtain the processed sample barcode image; the processed sample barcode image Input the initial neural network model to obtain the prediction result of the sample barcode image at the preset height.
在一些实施例中,码制标识由目标神经网络模型中相应的神经元被激活的次数确定。In some embodiments, the symbolic identity is determined by the number of activations of corresponding neurons in the target neural network model.
关于条码识别装置的具体限定可以参见上文中对于条码识别方法的限定, 在此不再赘述。上述条码识别装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。For specific limitations on the barcode recognition device, please refer to the above-mentioned limitations on the barcode recognition method, which will not be repeated here. Each module in the above-mentioned barcode recognition device can be fully or partially realized by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, and can also be stored in the memory of the computer device in the form of software, so that the processor can invoke and execute the corresponding operations of the above-mentioned modules.
在一些实施例中,提供了一种计算机设备,该计算机设备可以是服务器,其内部结构图可以如图7所示。该计算机设备包括通过系统总线连接的处理器、存储器和网络接口。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统、计算机可读指令和数据库。该内存储器为非易失性存储介质中的操作系统和计算机可读指令的运行提供环境。该计算机设备的数据库用于存储条码识别数据。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机可读指令被处理器执行时以实现一种条码识别方法。In some embodiments, a computer device is provided. The computer device may be a server, and its internal structure may be as shown in FIG. 7 . The computer device includes a processor, memory and a network interface connected by a system bus. Wherein, the processor of the computer device is used to provide calculation and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer readable instructions and a database. The internal memory provides an environment for the execution of the operating system and computer readable instructions in the non-volatile storage medium. The database of the computer device is used to store barcode identification data. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer-readable instructions are executed by the processor, a barcode recognition method is realized.
本领域技术人员可以理解,图7中示出的结构,仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。Those skilled in the art can understand that the structure shown in Figure 7 is only a block diagram of a part of the structure related to the solution of this application, and does not constitute a limitation to the computer equipment on which the solution of this application is applied. The specific computer equipment can be More or fewer components than shown in the figures may be included, or some components may be combined, or have a different arrangement of components.
在一些实施例中,提供了一种计算机设备,包括存储器和处理器,存储器中存储有计算机可读指令,该处理器执行计算机可读指令时实现以下步骤:In some embodiments, a computer device is provided, including a memory and a processor, where computer-readable instructions are stored in the memory, and the processor implements the following steps when executing the computer-readable instructions:
将条码图像输入预先构建的目标神经网络模型,得到目标神经网络模型输出的预测序列;其中,预测序列携带有码制标识;Input the barcode image into the pre-built target neural network model to obtain the predicted sequence output by the target neural network model; wherein, the predicted sequence carries a code system identification;
对预测序列进行解码处理,得到包含有编码信息的目标预测序列;Decoding the predicted sequence to obtain a target predicted sequence containing encoded information;
根据与码制标识匹配的编码规则及编码信息,对目标预测序列进行识别,得到识别结果。According to the encoding rules and encoding information matched with the coding system identifier, the target prediction sequence is identified to obtain the identification result.
在一些实施例中,处理器执行计算机可读指令时还实现以下步骤:若条码图像的尺寸不等于预设尺寸,则调整条码图像至预设尺寸后输入预先构建的目标神经网络模型,得到目标神经网络模型输出的预测序列。In some embodiments, the following steps are also implemented when the processor executes the computer-readable instructions: if the size of the barcode image is not equal to the preset size, then adjust the barcode image to the preset size and input the pre-built target neural network model to obtain the target The sequence of predictions output by the neural network model.
在一些实施例中,处理器执行计算机可读指令时还实现以下步骤:获取预测序列中至少一个最大值所对应的位置信息,根据位置信息生成解码序列;剔 除解码序列中的重复项及预设占位符后,得到包含有编码信息的目标预测序列。In some embodiments, when the processor executes the computer-readable instructions, the following steps are also implemented: obtaining the position information corresponding to at least one maximum value in the prediction sequence, generating a decoding sequence according to the position information; eliminating duplicates and presets in the decoding sequence After the placeholder, the target prediction sequence containing the coding information is obtained.
在一些实施例中,处理器执行计算机可读指令时还实现以下步骤:根据与码制标识匹配的编码规则及编码信息,对目标预测序列进行解析,得到解析结果;根据解析结果,构造目标预测序列的子序列;根据编码规则对目标预测序列的子序列进行校验,根据校验结果确定识别结果。In some embodiments, when the processor executes the computer-readable instructions, the following steps are also implemented: according to the encoding rules and encoding information matched with the code system identifier, the target prediction sequence is analyzed to obtain the analysis result; according to the analysis result, the target prediction sequence is constructed The subsequence of the sequence; the subsequence of the target prediction sequence is verified according to the coding rules, and the recognition result is determined according to the verification result.
在一些实施例中,处理器执行计算机可读指令时还实现以下步骤:获取样本条码图像以及对应的样本编码信息;将样本条码图像输入初始神经网络模型,得到样本条码图像在预设高度下的预测结果;根据预测结果与样本编码信息对初始神经网络模型进行训练,得到目标神经网络模型。In some embodiments, when the processor executes the computer-readable instructions, the following steps are also implemented: acquiring the sample barcode image and corresponding sample coding information; inputting the sample barcode image into the initial neural network model to obtain the sample barcode image at a preset height Prediction results: train the initial neural network model according to the prediction results and sample encoding information to obtain the target neural network model.
在一些实施例中,处理器执行计算机可读指令时还实现以下步骤:根据不同编码规则随机生成多个原始编码信息;将原始编码信息按照对应的编码规则生成原始编码图像;将原始编码图像作为样本条码图像,将原始编码信息作为对应的样本编码信息。In some embodiments, when the processor executes the computer-readable instructions, the following steps are also implemented: randomly generating a plurality of original encoding information according to different encoding rules; generating an original encoded image from the original encoding information according to corresponding encoding rules; using the original encoded image as The sample barcode image uses the original coded information as the corresponding sample coded information.
在一些实施例中,处理器执行计算机可读指令时还实现以下步骤:基于预测结果以及样本编码信息之间的差异程度,构建损失函数;根据损失函数训练初始神经网络模型,直至训练后的初始神经网络模型满足预设训练条件时,将训练后的初始神经网络模型作为目标神经网络模型。In some embodiments, when the processor executes the computer-readable instructions, the following steps are also implemented: constructing a loss function based on the prediction results and the degree of difference between the coded information of the samples; training the initial neural network model according to the loss function until the initial neural network model after training When the neural network model meets the preset training conditions, the trained initial neural network model is used as the target neural network model.
在一些实施例中,处理器执行计算机可读指令时还实现以下步骤:对样本条码图像进行数据增强处理,以及将样本条码图像的高度调整至预设高度,得到处理后的样本条码图像;将处理后的样本条码图像输入初始神经网络模型,得到样本条码图像在预设高度下的预测结果。In some embodiments, when the processor executes the computer-readable instructions, the following steps are also implemented: performing data enhancement processing on the sample barcode image, and adjusting the height of the sample barcode image to a preset height to obtain the processed sample barcode image; The processed sample barcode image is input to the initial neural network model to obtain the prediction result of the sample barcode image at a preset height.
在一些实施例中,处理器执行计算机可读指令时还实现以下步骤:由目标神经网络模型中相应的神经元被激活的次数确定码制标识。In some embodiments, when the processor executes the computer-readable instructions, the following steps are further implemented: determining the code system identification by the number of times corresponding neurons in the target neural network model are activated.
在一些实施例中,提供了一种计算机可读存储介质,其上存储有计算机可读指令,计算机可读指令被处理器执行时实现以下步骤:In some embodiments, a computer-readable storage medium is provided, on which computer-readable instructions are stored, and when the computer-readable instructions are executed by a processor, the following steps are implemented:
将条码图像输入预先构建的目标神经网络模型,得到目标神经网络模型输出的预测序列;其中,预测序列携带有码制标识;Input the barcode image into the pre-built target neural network model to obtain the predicted sequence output by the target neural network model; wherein, the predicted sequence carries a code system identification;
对预测序列进行解码处理,得到包含有编码信息的目标预测序列;Decoding the predicted sequence to obtain a target predicted sequence containing encoded information;
根据与码制标识匹配的编码规则及编码信息,对目标预测序列进行识别,得到识别结果。According to the encoding rules and encoding information matched with the coding system identifier, the target prediction sequence is identified to obtain the identification result.
在一些实施例中,计算机可读指令被处理器执行时还实现以下步骤:若条码图像的尺寸不等于预设尺寸,则调整条码图像至预设尺寸后输入预先构建的目标神经网络模型,得到目标神经网络模型输出的预测序列。In some embodiments, when the computer readable instructions are executed by the processor, the following steps are also implemented: if the size of the barcode image is not equal to the preset size, then adjust the barcode image to the preset size and input the pre-built target neural network model to obtain The sequence of predictions output by the target neural network model.
在一些实施例中,计算机可读指令被处理器执行时还实现以下步骤:获取预测序列中至少一个最大值所对应的位置信息,根据位置信息生成解码序列;剔除解码序列中的重复项及预设占位符后,得到包含有编码信息的目标预测序列。In some embodiments, when the computer-readable instructions are executed by the processor, the following steps are further implemented: obtaining the position information corresponding to at least one maximum value in the prediction sequence, generating a decoding sequence according to the position information; eliminating duplicates and predictions in the decoding sequence After the placeholder is set, the target prediction sequence containing the coding information is obtained.
在一些实施例中,计算机可读指令被处理器执行时还实现以下步骤:根据与码制标识匹配的编码规则及编码信息,对目标预测序列进行解析,得到解析结果;根据解析结果,构造目标预测序列的子序列;根据编码规则对目标预测序列的子序列进行校验,根据校验结果确定识别结果。In some embodiments, when the computer-readable instructions are executed by the processor, the following steps are further implemented: analyzing the target prediction sequence according to the encoding rules and encoding information matched with the code system identifier to obtain the analysis result; according to the analysis result, constructing the target The subsequence of the predicted sequence; the subsequence of the target predicted sequence is verified according to the coding rules, and the recognition result is determined according to the verification result.
在一些实施例中,计算机可读指令被处理器执行时还实现以下步骤:获取样本条码图像以及对应的样本编码信息;将样本条码图像输入初始神经网络模型,得到样本条码图像在预设高度下的预测结果;根据预测结果与样本编码信息对初始神经网络模型进行训练,得到目标神经网络模型。In some embodiments, when the computer readable instructions are executed by the processor, the following steps are also implemented: obtaining the sample barcode image and corresponding sample coding information; inputting the sample barcode image into the initial neural network model to obtain the sample barcode image at a preset height The prediction results; according to the prediction results and sample coding information, the initial neural network model is trained to obtain the target neural network model.
在一些实施例中,计算机可读指令被处理器执行时还实现以下步骤:根据不同编码规则随机生成多个原始编码信息;将原始编码信息按照对应的编码规则生成原始编码图像;将原始编码图像作为样本条码图像,将原始编码信息作为对应的样本编码信息。In some embodiments, when the computer-readable instructions are executed by the processor, the following steps are further implemented: randomly generating a plurality of original encoding information according to different encoding rules; generating the original encoding image from the original encoding information according to the corresponding encoding rule; converting the original encoding image As a sample barcode image, the original coding information is used as corresponding sample coding information.
在一些实施例中,计算机可读指令被处理器执行时还实现以下步骤:基于预测结果以及样本编码信息之间的差异程度,构建损失函数;根据损失函数训练初始神经网络模型,直至训练后的初始神经网络模型满足预设训练条件时,将训练后的初始神经网络模型作为目标神经网络模型。In some embodiments, when the computer-readable instructions are executed by the processor, the following steps are also implemented: constructing a loss function based on the prediction result and the degree of difference between the coded information of the samples; training the initial neural network model according to the loss function until the trained When the initial neural network model meets the preset training conditions, the trained initial neural network model is used as the target neural network model.
在一些实施例中,计算机可读指令被处理器执行时还实现以下步骤:对样本条码图像进行数据增强处理,以及将样本条码图像的高度调整至预设高度,得到处理后的样本条码图像;将处理后的样本条码图像输入初始神经网络模型, 得到样本条码图像在预设高度下的预测结果。In some embodiments, when the computer readable instructions are executed by the processor, the following steps are further implemented: performing data enhancement processing on the sample barcode image, and adjusting the height of the sample barcode image to a preset height to obtain the processed sample barcode image; The processed sample barcode image is input into the initial neural network model to obtain the prediction result of the sample barcode image at a preset height.
在一些实施例中,计算机可读指令被处理器执行时还实现以下步骤:由目标神经网络模型中相应的神经元被激活的次数确定码制标识。In some embodiments, when the computer-readable instructions are executed by the processor, the following step is further implemented: determining the code system identification by the number of activation times of corresponding neurons in the target neural network model.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机可读指令来指令相关的硬件来完成,上述的计算机可读指令可存储于一非易失性计算机可读取存储介质中,该计算机可读指令在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和易失性存储器中的至少一种。非易失性存储器可包括只读存储器(Read-Only Memory,ROM)、磁带、软盘、闪存或光存储器等。易失性存储器可包括随机存取存储器(Random Access Memory,RAM)或外部高速缓冲存储器。作为说明而非局限,RAM可以是多种形式,比如静态随机存取存储器(Static Random Access Memory,SRAM)或动态随机存取存储器(Dynamic Random Access Memory,DRAM)等。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above-mentioned embodiments can be implemented by instructing related hardware through computer-readable instructions. The above-mentioned computer-readable instructions can be stored in a non-volatile computer-readable When being read from the storage medium, the computer-readable instructions may include the processes of the embodiments of the above-mentioned methods when executed. Wherein, any references to memory, storage, database or other media used in the various embodiments provided in the present application may include at least one of non-volatile memory and volatile memory. Non-volatile memory may include read-only memory (Read-Only Memory, ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM).
以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above embodiments can be combined arbitrarily. To make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be It is considered to be within the range described in this specification.
以上各个实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。The above embodiments only express several implementation modes of the present application, and the description thereof is relatively specific and detailed, but it should not be construed as limiting the scope of the patent for the invention. It should be noted that those skilled in the art can make several modifications and improvements without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the scope of protection of the patent application should be based on the appended claims.

Claims (20)

  1. 一种条码识别方法,其特征在于,包括:A barcode recognition method is characterized in that, comprising:
    将条码图像输入预先构建的目标神经网络模型,得到所述目标神经网络模型输出的预测序列;其中,所述预测序列携带有码制标识;Inputting the barcode image into the pre-built target neural network model to obtain a predicted sequence output by the target neural network model; wherein, the predicted sequence carries a code system identification;
    对所述预测序列进行解码处理,得到包含有编码信息的目标预测序列;Decoding the predicted sequence to obtain a target predicted sequence including coding information;
    根据与所述码制标识匹配的编码规则及所述编码信息,对所述目标预测序列进行识别,得到识别结果。The target prediction sequence is identified according to the encoding rule matched with the coding system identifier and the encoding information, and an identification result is obtained.
  2. 根据权利要求1所述的方法,其特征在于,所述将条码图像输入预先构建的目标神经网络模型,得到所述目标神经网络模型输出的预测序列,包括:The method according to claim 1, wherein the input of the barcode image into the pre-built target neural network model to obtain the predicted sequence output by the target neural network model comprises:
    若所述条码图像的尺寸不等于预设尺寸,则调整所述条码图像至所述预设尺寸后输入预先构建的目标神经网络模型,得到所述目标神经网络模型输出的预测序列。If the size of the barcode image is not equal to the preset size, the barcode image is adjusted to the preset size and then input into a pre-built target neural network model to obtain a prediction sequence output by the target neural network model.
  3. 根据权利要求1所述的方法,其特征在于,对所述预测序列进行解码处理,得到包含有编码信息的目标预测序列,包括:The method according to claim 1, wherein decoding the predicted sequence to obtain a target predicted sequence containing coding information includes:
    获取所述预测序列中至少一个最大值所对应的位置信息,根据所述位置信息生成解码序列;Obtaining position information corresponding to at least one maximum value in the predicted sequence, and generating a decoding sequence according to the position information;
    剔除所述解码序列中的重复项及预设占位符后,得到包含有编码信息的目标预测序列。After eliminating repeated items and preset placeholders in the decoding sequence, a target prediction sequence including coding information is obtained.
  4. 根据权利要求1所述的方法,其特征在于,所述根据与所述码制标识匹配的编码规则及所述编码信息,对所述目标预测序列进行识别,得到识别结果,包括:The method according to claim 1, wherein the identifying the target prediction sequence according to the encoding rule matched with the coding system identifier and the encoding information, and obtaining an identification result includes:
    根据与所述码制标识匹配的编码规则及所述编码信息,对所述目标预测序列进行解析,得到解析结果;Analyzing the target prediction sequence according to the encoding rule matched with the coding system identifier and the encoding information, to obtain an analysis result;
    根据所述解析结果,构造所述目标预测序列的子序列;Constructing a subsequence of the target prediction sequence according to the parsing result;
    根据所述编码规则对所述目标预测序列的子序列进行校验,根据校验结果确定识别结果。Checking the subsequence of the target prediction sequence according to the encoding rule, and determining the recognition result according to the checking result.
  5. 根据权利要求1所述的方法,其特征在于,所述将条码图像输入预先构建的目标神经网络模型,得到所述目标神经网络模型输出的预测序列之前,还 包括:The method according to claim 1, wherein the barcode image is input into the pre-built target neural network model, and before obtaining the predicted sequence output by the target neural network model, it also includes:
    获取样本条码图像以及对应的样本编码信息;Obtain the sample barcode image and the corresponding sample coding information;
    将所述样本条码图像输入初始神经网络模型,得到所述样本条码图像在预设高度下的预测结果;Inputting the sample barcode image into an initial neural network model to obtain a prediction result of the sample barcode image at a preset height;
    根据所述预测结果与所述样本编码信息对所述初始神经网络模型进行训练,得到所述目标神经网络模型。The initial neural network model is trained according to the prediction result and the sample encoding information to obtain the target neural network model.
  6. 根据权利要求5所述的方法,其特征在于,所述获取样本条码图像以及对应的样本编码信息,包括:The method according to claim 5, wherein said acquiring sample barcode images and corresponding sample coding information comprises:
    根据不同编码规则随机生成多个原始编码信息;Randomly generate multiple original coding information according to different coding rules;
    将所述原始编码信息按照对应的编码规则生成原始编码图像;Generating an original encoded image from the original encoded information according to a corresponding encoding rule;
    将所述原始编码图像作为样本条码图像,将所述原始编码信息作为对应的样本编码信息。The original coded image is used as a sample barcode image, and the original coded information is used as corresponding sample coded information.
  7. 根据权利要求5所述的方法,其特征在于,所述根据所述预测结果与所述样本编码信息对所述初始神经网络模型进行训练,得到所述目标神经网络模型,包括:The method according to claim 5, wherein the training of the initial neural network model according to the prediction result and the sample encoding information to obtain the target neural network model includes:
    基于所述预测结果以及所述样本编码信息之间的差异程度,构建损失函数;Constructing a loss function based on the prediction results and the degree of difference between the sample coding information;
    根据所述损失函数训练所述初始神经网络模型,直至训练后的初始神经网络模型满足预设训练条件时,将所述训练后的初始神经网络模型作为所述目标神经网络模型。The initial neural network model is trained according to the loss function until the trained initial neural network model satisfies a preset training condition, and the trained initial neural network model is used as the target neural network model.
  8. 根据权利要求5所述的方法,其特征在于,所述将所述样本条码图像输入初始神经网络模型,得到所述样本条码图像在预设高度下的预测结果之前,还包括:The method according to claim 5, wherein, before said inputting the sample barcode image into the initial neural network model to obtain the prediction result of the sample barcode image at a preset height, further comprising:
    对所述样本条码图像进行数据增强处理,以及将所述样本条码图像的高度调整至所述预设高度,得到处理后的样本条码图像;performing data enhancement processing on the sample barcode image, and adjusting the height of the sample barcode image to the preset height to obtain the processed sample barcode image;
    所述将所述样本条码图像输入初始神经网络模型,得到样本条码图像在预设高度下的预测结果,包括:Said inputting the sample barcode image into the initial neural network model to obtain the prediction result of the sample barcode image at a preset height, including:
    将所述处理后的样本条码图像输入初始神经网络模型,得到所述样本条码图像在预设高度下的预测结果。Inputting the processed sample barcode image into an initial neural network model to obtain a prediction result of the sample barcode image at a preset height.
  9. 根据权利要求1所述的方法,其特征在于,所述码制标识由所述目标神经网络模型中相应的神经元被激活的次数确定。The method according to claim 1, wherein the coding system identification is determined by the number of times corresponding neurons in the target neural network model are activated.
  10. 一种条码识别装置,其特征在于,包括:A barcode recognition device is characterized in that it comprises:
    序列输出模块,用于将条码图像输入预先构建的目标神经网络模型,得到所述目标神经网络模型输出的预测序列;其中,所述预测序列携带有码制标识;The sequence output module is used to input the barcode image into the pre-built target neural network model to obtain the predicted sequence output by the target neural network model; wherein the predicted sequence carries a code system identification;
    序列解码模块,用于对所述预测序列进行解码处理,得到包含有编码信息的目标预测序列;A sequence decoding module, configured to decode the predicted sequence to obtain a target predicted sequence containing coding information;
    序列识别模块,用于根据与所述码制标识匹配的编码规则及所述编码信息,对所述目标预测序列进行识别,得到识别结果。A sequence identification module, configured to identify the target predicted sequence according to the encoding rule matched with the coding system identifier and the encoding information, and obtain an identification result.
  11. 根据权利要求10所述的装置,其特征在于,所述序列输出模块,还用于若所述条码图像的尺寸不等于预设尺寸,则调整所述条码图像至所述预设尺寸后输入预先构建的目标神经网络模型,得到所述目标神经网络模型输出的预测序列。The device according to claim 10, wherein the sequence output module is further configured to adjust the barcode image to the preset size and then input the preset A target neural network model is constructed to obtain a predicted sequence output by the target neural network model.
  12. 根据权利要求10所述的装置,其特征在于,所述序列解码模块,还用于获取所述预测序列中至少一个最大值所对应的位置信息,根据所述位置信息生成解码序列;剔除所述解码序列中的重复项及预设占位符后,得到包含有编码信息的目标预测序列。The device according to claim 10, wherein the sequence decoding module is further configured to obtain position information corresponding to at least one maximum value in the predicted sequence, and generate a decoding sequence according to the position information; After decoding the repeated items and preset placeholders in the sequence, the target prediction sequence including the coding information is obtained.
  13. 根据权利要求10所述的装置,其特征在于,所述序列识别模块,还用于根据与所述码制标识匹配的编码规则及所述编码信息,对所述目标预测序列进行解析,得到解析结果;根据所述解析结果,构造所述目标预测序列的子序列;根据所述编码规则对所述目标预测序列的子序列进行校验,根据校验结果确定识别结果。The device according to claim 10, wherein the sequence identification module is further configured to analyze the target prediction sequence according to the encoding rule matched with the code system identifier and the encoding information, to obtain the analyzed Result; according to the parsing result, construct the subsequence of the target prediction sequence; verify the subsequence of the target prediction sequence according to the encoding rule, and determine the recognition result according to the verification result.
  14. 根据权利要求10所述的装置,其特征在于,所述装置还包括模型训练模块,用于获取样本条码图像以及对应的样本编码信息;将所述样本条码图像输入初始神经网络模型,得到所述样本条码图像在预设高度下的预测结果;根据所述预测结果与所述样本编码信息对所述初始神经网络模型进行训练,得到所述目标神经网络模型。The device according to claim 10, further comprising a model training module for obtaining sample barcode images and corresponding sample encoding information; inputting the sample barcode images into an initial neural network model to obtain the A prediction result of the sample barcode image at a preset height; training the initial neural network model according to the prediction result and the sample encoding information to obtain the target neural network model.
  15. 根据权利要求14所述的装置,其特征在于,所述模型训练模块,还用 于根据不同编码规则随机生成多个原始编码信息;将所述原始编码信息按照对应的编码规则生成原始编码图像;将所述原始编码图像作为样本条码图像,将所述原始编码信息作为对应的样本编码信息。The device according to claim 14, wherein the model training module is further configured to randomly generate a plurality of original encoding information according to different encoding rules; generate an original encoded image according to the corresponding encoding rules from the original encoding information; The original coded image is used as a sample barcode image, and the original coded information is used as corresponding sample coded information.
  16. 根据权利要求14所述的装置,其特征在于,所述模型训练模块,还用于基于所述预测结果以及所述样本编码信息之间的差异程度,构建损失函数;根据所述损失函数训练所述初始神经网络模型,直至训练后的初始神经网络模型满足预设训练条件时,将所述训练后的初始神经网络模型作为所述目标神经网络模型。The device according to claim 14, wherein the model training module is further configured to construct a loss function based on the prediction result and the degree of difference between the sample coding information; The initial neural network model, until the trained initial neural network model meets the preset training conditions, the trained initial neural network model is used as the target neural network model.
  17. 根据权利要求10所述的装置,其特征在于,所述码制标识由所述目标神经网络模型中相应的神经元被激活的次数确定。The device according to claim 10, wherein the code system identification is determined by the number of times corresponding neurons in the target neural network model are activated.
  18. 一种计算机设备,包括存储器和处理器,所述存储器存储有计算机可读指令,其特征在于,所述处理器执行所述计算机可读指令时实现权利要求1至9中任一项所述的方法的步骤。A computer device, comprising a memory and a processor, the memory stores computer-readable instructions, wherein the processor implements the method described in any one of claims 1 to 9 when executing the computer-readable instructions method steps.
  19. 一种计算机可读存储介质,其上存储有计算机可读指令,其特征在于,所述计算机可读指令被处理器执行时实现权利1至9中任一项所述的方法的步骤。A computer-readable storage medium, on which computer-readable instructions are stored, wherein, when the computer-readable instructions are executed by a processor, the steps of the method described in any one of claims 1 to 9 are implemented.
  20. 一种计算机程序产品,包括计算机可读指令,其特征在于,所述计算机可读指令被处理器执行时实现权利要求1至9中任一项所述的方法的步骤。A computer program product, comprising computer-readable instructions, wherein the steps of the method according to any one of claims 1 to 9 are implemented when the computer-readable instructions are executed by a processor.
PCT/CN2022/106288 2021-08-02 2022-07-18 Barcode identification method and apparatus, computer device and storage medium WO2023011155A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110881245.XA CN113627207B (en) 2021-08-02 2021-08-02 Bar code identification method, device, computer equipment and storage medium
CN202110881245.X 2021-08-02

Publications (1)

Publication Number Publication Date
WO2023011155A1 true WO2023011155A1 (en) 2023-02-09

Family

ID=78382272

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/106288 WO2023011155A1 (en) 2021-08-02 2022-07-18 Barcode identification method and apparatus, computer device and storage medium

Country Status (2)

Country Link
CN (1) CN113627207B (en)
WO (1) WO2023011155A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113627207B (en) * 2021-08-02 2024-03-22 深圳思谋信息科技有限公司 Bar code identification method, device, computer equipment and storage medium
CN114022558B (en) * 2022-01-05 2022-08-26 深圳思谋信息科技有限公司 Image positioning method, image positioning device, computer equipment and storage medium
CN115578464A (en) * 2022-12-07 2023-01-06 深圳思谋信息科技有限公司 Bar code identification method and device, computer equipment and readable storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105809094A (en) * 2014-12-31 2016-07-27 研祥智能科技股份有限公司 Bar code identification method based on machine vision
CN109241806A (en) * 2018-08-10 2019-01-18 北京龙贝世纪科技股份有限公司 A kind of multi-code recognition methods and identifying system simultaneously
CN110532825A (en) * 2019-08-21 2019-12-03 厦门壹普智慧科技有限公司 A kind of bar code identifying device and method based on artificial intelligence target detection
WO2020034850A1 (en) * 2018-08-16 2020-02-20 腾讯科技(深圳)有限公司 Identification method for identification code, device, computer apparatus, and storage medium
CN111144161A (en) * 2020-04-03 2020-05-12 支付宝(杭州)信息技术有限公司 Barcode identification method and device, commodity information determination method and payment method
CN113627207A (en) * 2021-08-02 2021-11-09 深圳思谋信息科技有限公司 Bar code identification method and device, computer equipment and storage medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
RU2665273C2 (en) * 2016-06-03 2018-08-28 Автономная некоммерческая образовательная организация высшего образования "Сколковский институт науки и технологий" Trained visual markers and the method of their production
CN108416412B (en) * 2018-01-23 2021-04-06 浙江瀚镪自动化设备股份有限公司 Logistics composite code identification method based on multitask deep learning
WO2019209756A1 (en) * 2018-04-24 2019-10-31 University Of Pittsburgh-Of The Commonwealth System Of Higher Education System and method of decoding a barcode using machine learning
CN110427793B (en) * 2019-08-01 2022-04-26 厦门商集网络科技有限责任公司 Bar code detection method and system based on deep learning
CN111783495B (en) * 2020-06-30 2023-07-14 创新奇智(南京)科技有限公司 Bar code identification method and device, electronic equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105809094A (en) * 2014-12-31 2016-07-27 研祥智能科技股份有限公司 Bar code identification method based on machine vision
CN109241806A (en) * 2018-08-10 2019-01-18 北京龙贝世纪科技股份有限公司 A kind of multi-code recognition methods and identifying system simultaneously
WO2020034850A1 (en) * 2018-08-16 2020-02-20 腾讯科技(深圳)有限公司 Identification method for identification code, device, computer apparatus, and storage medium
CN110532825A (en) * 2019-08-21 2019-12-03 厦门壹普智慧科技有限公司 A kind of bar code identifying device and method based on artificial intelligence target detection
CN111144161A (en) * 2020-04-03 2020-05-12 支付宝(杭州)信息技术有限公司 Barcode identification method and device, commodity information determination method and payment method
CN113627207A (en) * 2021-08-02 2021-11-09 深圳思谋信息科技有限公司 Bar code identification method and device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN113627207A (en) 2021-11-09
CN113627207B (en) 2024-03-22

Similar Documents

Publication Publication Date Title
WO2023011155A1 (en) Barcode identification method and apparatus, computer device and storage medium
CN110162669B (en) Video classification processing method and device, computer equipment and storage medium
Song et al. Unified binary generative adversarial network for image retrieval and compression
CN105718502B (en) Method and apparatus for efficient feature matching
US9400918B2 (en) Compact face representation
Duan et al. Compact descriptors for visual search
US9934452B2 (en) Pruning and label selection in hidden Markov model-based OCR
CN113254654B (en) Model training method, text recognition method, device, equipment and medium
CN112528637A (en) Text processing model training method and device, computer equipment and storage medium
CN112287672A (en) Text intention recognition method and device, electronic equipment and storage medium
WO2022028197A1 (en) Image processing method and device thereof
CN111767697B (en) Text processing method and device, computer equipment and storage medium
Baroffio et al. Coding local and global binary visual features extracted from video sequences
Baroffio et al. Coding binary local features extracted from video sequences
KR20230046946A (en) Electronic device for identifying a target speaker and an operating method thereof
CN116434741A (en) Speech recognition model training method, device, computer equipment and storage medium
CN114332500A (en) Image processing model training method and device, computer equipment and storage medium
CN114973229A (en) Text recognition model training method, text recognition device, text recognition equipment and medium
CN113220874B (en) Multi-label text classification method and system
CN114328898A (en) Text abstract generating method and device, equipment, medium and product thereof
US20230245483A1 (en) Handwriting recognition method and apparatus, and electronic device and storage medium
CN116364061A (en) Multi-scene voice recognition method, device, computer equipment and storage medium
CN112559750B (en) Text data classification method, device, nonvolatile storage medium and processor
CN111143619B (en) Video fingerprint generation method, search method, electronic device and medium
CN112749539A (en) Text matching method and device, computer readable storage medium and computer equipment

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22851869

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE