Commodity batch number detection method, electronic equipment and computer program product

By taking product images under ultraviolet lights and using AI recognition models to identify abnormalities in product batch numbers, the problem of the inability to detect batch numbers in the prior art is solved, and high-accurate batch number detection is achieved.

CN120164086APending Publication Date: 2025-06-17JUYU (SHANGHAI) INFORMATION SERVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510256439.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-05
Publication Date
2025-06-17

AI Technical Summary

Technical Problem

Existing AI identification technology cannot detect abnormal situations such as the dissolving and tampering of beauty products, and it is difficult to effectively identify the authenticity of the products.

Method used

By taking product images under ultraviolet lights, and using pre-trained base mark identification model and batch number identification model, the base mark area and batch number are identified and analyzed to determine whether the product batch number is abnormal.

Benefits of technology

It realizes accurate detection of whether the product batch number has been tampered with, improves the accuracy and reliability of the product batch number inspection, and can effectively identify abnormal batch number writing process and content, and crack down on counterfeit and shoddy products.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120164086A_ABST
    Figure CN120164086A_ABST
Patent Text Reader

Abstract

The invention provides a batch number detection method of a commodity, electronic equipment and a computer program product, which are used for shooting the commodity under the irradiation of an ultraviolet lamp so as to obtain an ultraviolet irradiation image of the commodity. The step utilizes the fluorescent agent possibly remained in batch number printing ink or other chemical substance characteristics capable of emitting light under ultraviolet light. And inputting the shot image into a pre-trained bottom mark recognition model, and performing recognition and extraction of a bottom mark region so as to obtain a bottom mark region image containing batch number information. And inputting the bottom mark area image into a batch number identification model, carrying out accurate identification on the batch number, extracting batch number images, and if two or more batch number images are identified, judging that the batch number of the commodity is in an abnormal state and indicating that the batch number may be tampered. According to the embodiment of the invention, the special light-emitting characteristic of the batch number ink under ultraviolet irradiation can be effectively utilized, and the advanced AI identification technology is combined, so that whether the batch number of the commodity is tampered or not can be accurately detected.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of image detection technology. Specifically, it relates to a method for detecting batch numbers of commodities, an electronic device, and a computer program product. Background Art

[0002] The production date of beauty products is usually presented in the form of batch numbers, which is crucial for consumers to experience the product effects. However, there are unscrupulous merchants in the market who, in pursuit of profits, take improper means to dissolve and erase the original batch numbers of products and then print new batch numbers in an attempt to cover up the true production date of the products. Such tampering is difficult to detect with the naked eye.

[0003] It should be noted that the batch number ink of beauty products often contains fluorescent agents or other chemical substances that can emit light under ultraviolet light. Although most of the ink can be dissolved and removed, these fluorescent components may not be completely eliminated. Under normal light, these substances are difficult to detect, but under ultraviolet light irradiation, they will emit visible light, thus becoming clues to identify such products with abnormal batch numbers.

[0004] AI authentication technology uses the principle of computer vision, can identify the authenticity of products, and can accurately distinguish the subtle differences between genuine and counterfeit products through algorithm models, with high reliability and fast computing power. However, the current AI authentication technology on the market, based on the product images taken under normal lighting conditions, cannot detect abnormal situations such as batch numbers being dissolved and tampered with. Summary of the Invention

[0005] The purpose of the embodiments of this application is to provide a method for detecting batch numbers of commodities, an electronic device, and a computer program product, so as to solve the problem that the existing AI authentication technology, based on the product images taken under normal lighting conditions, cannot detect abnormal situations such as batch numbers being dissolved and tampered with.

[0006] A method for detecting batch numbers of commodities provided by the embodiments of this application includes:

[0007] Taking a picture of the commodity under ultraviolet lamp irradiation to obtain a captured image of the commodity;

[0008] Inputting the captured image into a bottom label recognition model for bottom label recognition to obtain a bottom label area image;

[0009] Inputting the bottom label area image into a batch number recognition model for batch number recognition to obtain a batch number image;

[0010] If two or more batch numbers are recognized, it is determined that the batch number of the commodity is abnormal.

[0011] In the above technical solution, the commodity is photographed under the irradiation of an ultraviolet lamp to obtain an ultraviolet irradiation image of the commodity. This step utilizes the characteristics of fluorescent agents or other chemical substances that may remain in the batch number ink and emit light under ultraviolet light. The captured image is input into a pre-trained bottom label recognition model to identify and extract the bottom label area, thereby obtaining a bottom label area image containing batch number information. The bottom label area image is input into a batch number recognition model to accurately recognize the batch number and extract the batch number image. If two or more batch number images are recognized, it is determined that the batch number of the commodity is in an abnormal state, indicating that the batch number may have been tampered with. The embodiments of the present application can effectively utilize the special light-emitting characteristics of the batch number ink under ultraviolet irradiation and combine advanced AI recognition technology to achieve accurate detection of whether the batch number of the commodity has been tampered with.

[0012] In some alternative embodiments, after inputting the bottom label area image into the batch number recognition model to perform batch number recognition and obtain the batch number image, it further includes:

[0013] If one batch number is recognized in the bottom label area image, the batch number image is input into a batch number writing process recognition model to obtain the writing process of the batch number;

[0014] If the writing process of the batch number does not conform to the writing process of the genuine commodity, it is determined that the batch number of the commodity is batch number abnormal.

[0015] In the above technical solution, the recognized batch number image is further input into a batch number writing process recognition model. This model is trained to recognize and analyze the writing process characteristics of the batch number, such as stroke thickness, font style, spacing, etc., so as to obtain the writing process information of the batch number. The recognized writing process of the batch number is compared with the known writing process of the genuine commodity. If the recognized writing process of the batch number does not conform to the writing process of the genuine commodity, that is, there are obvious differences, it is determined that the batch number of the commodity is in an abnormal state. This may mean that the batch number has been tampered with or printed with a non-genuine process. This embodiment can further improve the accuracy and reliability of commodity batch number detection, not only paying attention to whether there are multiple batch numbers, but also being able to identify abnormalities in the batch number writing process, thereby more effectively combating counterfeit and shoddy commodities.

[0016] In some alternative embodiments, after inputting the batch number image into the batch number writing process recognition model to obtain the writing process of the batch number, it further includes:

[0017] If the writing process of the batch number conforms to the writing process of the genuine commodity, the batch number image is input into a batch number content recognition model to obtain the text content of the batch number;

[0018] According to the text content of the batch number, determine whether the batch number of the commodity is batch number abnormal.

[0019] In the above technical solution, the batch number image that has been verified as a genuine writing process is input into the batch number content recognition model. This model has undergone deep learning and training and can accurately identify and extract the text content in the batch number image, that is, the production batch number information. Based on the text content recognized from the batch number image, further judgment of batch number anomalies is carried out, including comparing with the genuine batch number database provided by the brand or manufacturer to verify the authenticity of the batch number; or judging whether it conforms to the batch number standard of genuine products according to the format, rules, etc. of the batch number. If it is found that the batch number content does not meet the genuine product standard, such as date logic errors, duplicate batch numbers, etc., then the batch number of the product is determined to be in an abnormal state.

[0020] In some alternative embodiments, judging whether the batch number of a product is a batch number anomaly according to the text content of the batch number includes:

[0021] Judging whether the text content of the batch number follows the mapping rule between the batch number and the production date;

[0022] If the text content of the batch number does not follow the mapping rule between the batch number and the production date, then it is determined that the batch number of the product is a batch number anomaly.

[0023] In the above technical solution, the system or algorithm will check and judge whether the text content of the batch number follows the established mapping rule between the batch number and the production date. These rules are usually set by the brand or manufacturer to ensure that the batch number can accurately reflect the production date or other key information of the product. The mapping rules may include specific coding methods, character combinations, digital sequences, etc., and there is a clear corresponding relationship between them and the actual production date of the product. If the text content of the batch number is found not to follow these mapping rules, that is, it cannot be correctly mapped to the corresponding production date or there are other logical inconsistencies, then the system or algorithm will determine that the batch number of the product is in an abnormal state. This may mean that the batch number has been tampered with, forged, or modified in other improper ways. This embodiment not only considers the appearance and writing process of the batch number, but also delves into the logic and compliance judgment of the batch number content, further improving the accuracy and reliability of product batch number detection. Such a detection method helps to maintain market order, protect the rights and interests of consumers, and also helps the brand or manufacturer to strengthen product quality control and anti-counterfeiting management.

[0024] In some alternative embodiments, after judging whether the text content of the batch number follows the mapping rule between the batch number and the production date, it further includes:

[0025] If the text content of the batch number follows the mapping rule between the batch number and the production date, then according to the text content of the batch number and the mapping rule, the production date of the product is obtained;

[0026] According to the production date of the product and the current date, judge whether the product is an approaching expiration or expired product.

[0027] In the above technical solution, according to the text content of the batch number and the established mapping rule between the batch number and the production date, the system or algorithm can accurately parse out the production date of the commodity. This is achieved through the coding method, character combination or digital sequence defined in the mapping rule, ensuring that the batch number can be accurately converted into the corresponding production date. According to the parsed production date and the current date (i.e., the date at the time of detection), it is determined whether the commodity is a near-expiry commodity or an expired commodity, including calculating the shelf life of the commodity and comparing the calculation result with a preset near-expiry or expired threshold. If the production date of the commodity plus the shelf life has reached or is about to exceed the current date, then the commodity will be regarded as a near-expiry or expired commodity. This embodiment not only provides the detection of the authenticity and compliance of the commodity batch number, but also further extends to the management of the commodity shelf life.

[0028] In some alternative embodiments, the bottom label recognition model includes: the MobileNetV3 model.

[0029] In the above technical solution, the MobileNetV3 model is a lightweight deep learning model. Using the MobileNetV3 model to identify the bottom label part of the product under ultraviolet light irradiation has the advantages of high accuracy and low time consumption.

[0030] In some alternative embodiments, the batch number recognition model includes the DETR model.

[0031] In the above technical solution, the DETR, an end-to-end object detection method based on Transformer, is used to complete the detection task of the batch number, which has the advantage of high detection accuracy, especially good effects on difficult cases such as batch number tampering, severe erasure and truncation.

[0032] In some alternative embodiments, the batch number writing process recognition model includes the MetaFormer model.

[0033] In the above technical solution, the MetaFormer model is used to complete the task of identifying the authenticity of the batch number process through a unified visual and meta-information fusion framework. By fusing the meta-information and picture information of the commodity, it significantly improves the performance of fine-grained visual recognition and enhances the recognition ability of the batch number process. Among them, the meta-information of the commodity includes key attributes such as the specifications and models of the commodity, and these information helps the model to more accurately identify the batch number process.

[0034] An electronic device provided by an embodiment of the present application includes: a processor and a memory. The memory stores machine-readable instructions executable by the processor, and when the machine-readable instructions are executed by the processor, the methods described in any of the above are executed.

[0035] A computer program product provided by an embodiment of the present application includes a computer program / instructions. When the computer program / instructions are executed by a processor, the steps of any of the above methods are implemented. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] To more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings required to be used in the embodiments of the present application. It should be understood that the following drawings only show some embodiments of the present application, and thus should not be regarded as limiting the scope. For those of ordinary skill in the art, other related drawings can also be obtained based on these drawings without creative efforts.

[0037] Figure 1 It is a flowchart of the steps of a batch number detection method for a commodity provided by an embodiment of the present application;

[0038] Figure 2 It is a flowchart of batch number detection provided by an embodiment of the present application;

[0039] Figure 3 It shows a possible structure of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0040] The following will describe the technical solutions in the embodiments of the present application with reference to the drawings in the embodiments of the present application.

[0041] One or more batch number detection methods in this embodiment are applicable to the batch number detection of various commodities, including but not limited to beauty products, drugs, foods, etc.

[0042] Please refer to Figure 1 , Figure 1 It is a flowchart of the steps of a batch number detection method for a commodity provided by an embodiment of the present application, specifically including:

[0043] Step S1: Photograph the commodity under ultraviolet lamp irradiation to obtain a photographed image of the commodity;

[0044] Step S2: Input the photographed image into a bottom label recognition model for bottom label recognition to obtain a bottom label area image;

[0045] Step S3: Input the bottom label area image into a batch number recognition model for batch number recognition to obtain a batch number image. If two or more batch numbers are recognized, it is determined that the batch number of the commodity is abnormal.

[0046] In the embodiments of the present application, the commodity is photographed under the irradiation of an ultraviolet lamp to obtain an ultraviolet irradiation image of the commodity. This step utilizes the characteristics of fluorescent agents or other chemical substances that may remain in the batch number ink and emit light under ultraviolet light. The captured image is input into a pre-trained base label recognition model to identify and extract the base label area, thereby obtaining a base label area image containing batch number information. The base label area image is input into a batch number recognition model to accurately recognize the batch number and extract the batch number image. If two or more batch number images are recognized, it is determined that the batch number of the commodity is in an abnormal state, indicating that the batch number may have been tampered with. The embodiments of the present application can effectively utilize the special light-emitting characteristics of the batch number ink under ultraviolet irradiation and combine advanced AI recognition technology to achieve accurate detection of whether the batch number of the commodity has been tampered with.

[0047] Please refer to Figure 2 , Figure 2 which is the flowchart of batch number detection provided by the embodiments of the present application.

[0048] In some alternative embodiments, after the base label area image is input into the batch number recognition model to perform batch number recognition and obtain the batch number image, it further includes: if one batch number is recognized in the base label area image, the batch number image is input into the batch number writing process recognition model to obtain the writing process of the batch number; if the writing process of the batch number does not conform to the writing process of the genuine commodity, it is determined that the batch number of the commodity is abnormal.

[0049] In the embodiments of the present application, the recognized batch number image is further input into the batch number writing process recognition model. This model is trained to recognize and analyze the writing process characteristics of the batch number, such as stroke thickness, font style, spacing, etc., so as to obtain the writing process information of the batch number. The recognized writing process of the batch number is compared with the known writing process of the genuine commodity. If the recognized writing process of the batch number does not conform to the writing process of the genuine commodity, that is, there are obvious differences, it is determined that the batch number of the commodity is in an abnormal state. This may mean that the batch number has been tampered with or printed with a non-genuine process. This embodiment can further improve the accuracy and reliability of commodity batch number detection. It not only pays attention to whether there are multiple batch numbers, but also can identify abnormalities in the batch number writing process, thereby more effectively combating counterfeit and shoddy commodities.

[0050] In some alternative embodiments, after the batch number image is input into the batch number writing process recognition model to obtain the writing process of the batch number, it further includes: if the writing process of the batch number conforms to the writing process of the genuine commodity, the batch number image is input into the batch number content recognition model to obtain the text content of the batch number; based on the text content of the batch number, it is determined whether the batch number of the commodity is abnormal.

[0051] In the embodiments of the present application, the batch number image that has been verified as a genuine writing process is input into the batch number content recognition model. This model has undergone deep learning and training and can accurately identify and extract the text content in the batch number image, that is, the production batch number information. Based on the text content recognized from the batch number image, further batch number anomaly judgment is performed, including comparing with the genuine batch number database provided by the brand or manufacturer to verify the authenticity of the batch number; or judging whether it conforms to the batch number standard of genuine products according to the format, rules, etc. of the batch number. If it is found that the batch number content does not meet the genuine standard, such as date logic errors, duplicate batch numbers, etc., then the batch number of the product is determined to be in an abnormal state.

[0052] In some alternative embodiments, to determine whether the batch number of a product is a batch number anomaly based on the text content of the batch number, it includes: judging whether the text content of the batch number follows the mapping rule between the batch number and the production date; if the text content of the batch number does not follow the mapping rule between the batch number and the production date, then it is determined that the batch number of the product is a batch number anomaly.

[0053] In the embodiments of the present application, the system or algorithm checks whether the text content of the batch number follows the established mapping rule between the batch number and the production date. These rules are usually set by the brand or manufacturer to ensure that the batch number can accurately reflect the production date or other key information of the product. The mapping rules may include specific coding methods, character combinations, digital sequences, etc., and there is a clear corresponding relationship between them and the actual production date of the product. If the text content of the batch number is found not to follow these mapping rules, that is, it cannot be correctly mapped to the corresponding production date or there are other logical inconsistencies, then the system or algorithm will determine that the batch number of the product is in an abnormal state. This may mean that the batch number has been tampered with, forged, or modified in other improper ways. This embodiment not only considers the appearance and writing process of the batch number, but also delves into the logic and compliance judgment of the batch number content, further improving the accuracy and reliability of product batch number detection. Such a detection method helps to maintain market order, protect the rights and interests of consumers, and also helps the brand or manufacturer to strengthen product quality control and anti-counterfeiting management.

[0054] In some alternative embodiments, after judging whether the text content of the batch number follows the mapping rule between the batch number and the production date, it further includes: if the text content of the batch number follows the mapping rule between the batch number and the production date, then according to the text content of the batch number and the mapping rule, obtain the production date of the product; according to the production date of the product and the current date, judge whether the product is a near-expiry product or an expired product.

[0055] In the embodiments of the present application, based on the text content of the batch number and the established mapping rule between the batch number and the production date, the system or algorithm can accurately parse out the production date of the product. This is achieved through the encoding method, character combination, or digital sequence defined in the mapping rule, ensuring that the batch number can be accurately converted into the corresponding production date. Based on the parsed production date and the current date (i.e., the date at the time of detection), it is determined whether the product is a near-expiry product or an expired product, including calculating the shelf life of the product and comparing the calculation result with a preset near-expiry or expiry threshold. If the production date of the product plus the shelf life has already exceeded or is about to exceed the current date, then the product will be regarded as a near-expiry or expired product. This embodiment not only provides the detection of the authenticity and compliance of the product batch number but also further extends to the management of the product shelf life.

[0056] In some alternative embodiments, the bottom label recognition model can adopt the YOLOv5 model.

[0057] In some alternative embodiments, considering that the batch number detection process is relatively long and the performance and time consumption of each link need to be strictly controlled, a relatively lightweight deep learning algorithm is selected to identify the bottom label part to meet the requirements of high precision and low time consumption. With the rapid development of mobile devices and Internet of Things technologies, the demand for running efficient deep learning models on resource-constrained devices is increasing day by day. Among them, the MobileNet series of models have been widely used in mobile vision applications due to their lightweight and high efficiency. Therefore, the bottom label recognition model in this embodiment adopts the MobileNetV3 model.

[0058] In the embodiments of the present application, the MobileNetV3 model is a lightweight deep learning model. Using the MobileNetV3 model to identify the bottom label part of the product under ultraviolet light irradiation has the advantages of high precision and low time consumption.

[0059] Specifically, the MobileNetV3 model has the following characteristics:

[0060] Lightweight architecture: By reducing the number of network layers and the number of parameters, MobileNetV3 designs a lightweight network architecture, thereby reducing the computational complexity.

[0061] Depthwise separable convolution: Depthwise separable convolution is introduced to further reduce the computational amount of the model. This convolution method decomposes the standard convolution into depth convolution and pointwise convolution, thereby reducing the computational cost. At the same time, MobileNetV3 also introduces a novel inverted residual structure. By using depthwise separable convolution as the bottleneck convolution, the efficiency of information flow is improved.

[0062] Linear bottleneck convolution reduces the number of parameters: Linear bottleneck convolution is used in the inverted residual structure to further reduce the number of parameters and computational complexity. This design helps to retain key feature information while reducing unnecessary computational overhead.

[0063] Attention mechanism module: The squeeze-and-excitation (SE) module is introduced to enhance the model's feature extraction ability by recalibrating the feature responses between channels. The SE module can adaptively adjust the importance of each channel, thereby improving the model's representation ability.

[0064] Model quantization: Model quantization technology is adopted to convert model parameters from 32-bit floating-point numbers to lower-bit representations (such as 8-bit or 16-bit) to reduce the model size and computational requirements. This quantization method significantly reduces the storage and computational costs of the model while ensuring a relatively small loss of model accuracy.

[0065] Memory optimization: Optimize the model's memory access pattern, reduce the demand for memory bandwidth, and improve the model's running speed on mobile devices. This includes operations such as using efficient memory allocation strategies and reducing unnecessary memory copies.

[0066] Mixed-precision training: Adopt a mixed-precision training strategy that combines single-precision and half-precision operations to improve training efficiency and model performance. This training method can significantly reduce the training time and computational resource consumption while ensuring the model's accuracy.

[0067] Knowledge distillation: Apply knowledge distillation technology to transfer the knowledge of a large and high-precision model to a lightweight model, further improving the performance of the lightweight model. This technology enables the lightweight model to learn the output or intermediate representations of the large model, thereby achieving better performance while maintaining a small model size.

[0068] In some optional embodiments, the batch number recognition model can adopt the EfficientDet model.

[0069] In some alternative embodiments, the batch number recognition model may employ the EfficientDet model.

[0070] In some alternative embodiments, the identification of batch numbers can adopt object detection algorithms. Object detection algorithms based on convolutional neural networks (CNNs) are mainly divided into two types: one-stage and two-stage. Among them, the two-stage algorithm is represented by the classic Faster R-CNN, which has high detection accuracy but long processing time. For one-stage algorithms, such as the YOLO series, the processing time is shorter, but the recognition in some complex scenarios is relatively large. Considering that there are a large number of product images, a large number of batch number images can be collected, which is very suitable for using the end-to-end object detection method based on Transformer, that is, the DETR (Detection Transformer) algorithm. Traditional object detection methods usually rely on the Region Proposal Network (RPN) to generate candidate boxes, and then classify and perform bounding box regression on each candidate box. These methods require complex post-processing steps, such as Non-Maximum Suppression (NMS) to eliminate duplicate detections, and their performance largely depends on the design of anchor boxes. To simplify this process, this embodiment proposes a direct set prediction method for object detection in an end-to-end manner without many manually designed components in the traditional object detection process. Therefore, the batch number identification model in this embodiment adopts the DETR model.

[0071] In the embodiments of this application, the end-to-end object detection method DETR based on Transformer is used to complete the detection task of batch numbers, which has the advantage of high detection accuracy, especially good results in difficult cases such as batch number tampering, severe erasure, and truncation.

[0072] Specifically, the DETR model has the following characteristics:

[0073] Encoder-decoder architecture: DETR is based on the encoder-decoder architecture of Transformer, where the encoder is responsible for extracting image features, and the decoder is responsible for generating a set of predictions for the objects. This architecture enables DETR to efficiently process image data and generate accurate detection results.

[0074] Self-attention mechanism: DETR uses the self-attention mechanism in Transformer to explicitly model the pairwise interactions between all elements in the sequence. This feature makes DETR particularly suitable for set prediction tasks, such as eliminating duplicate predictions, thus improving the accuracy and robustness of detection.

[0075] Set prediction loss: DETR adopts a global loss function based on bipartite graph matching, which forces a unique match between the predictions and the ground truth objects through bipartite graph matching. This loss function design enables DETR to continuously optimize the object-specific (bounding box) loss during training, thereby improving the detection accuracy.

[0076] Non-autoregressive decoding: Different from previous RNN-based autoregressive models, DETR adopts a parallel decoding method. This means that DETR can predict all targets in parallel in a single decoder layer, thus greatly improving the detection speed.

[0077] Removing manually designed components: DETR simplifies the detection process and removes manually designed components such as spatial anchor boxes and non-maximum suppression. This feature makes DETR more flexible and general, and can be applied to batch number recognition tasks in more complex scenarios.

[0078] In some alternative embodiments, the batch number writing process recognition model can adopt a ResNet model or an Inception-v3 model.

[0079] In some alternative embodiments, the batch number writing process recognition needs to adopt a fine-grained visual classification algorithm. Fine-Grained Visual Classification (FGVC) is a complex task in the field of computer vision, aiming to identify objects belonging to the same large category but with different sub-categories. Although many studies have made significant progress in recent years by designing complex learning processes, it is often difficult to achieve highly accurate classification results relying solely on visual information. To overcome this challenge, the batch number writing process recognition model in this embodiment introduces a MetaFormer model, which makes full use of visual information and meta information to achieve more accurate fine-grained classification.

[0080] Specifically, the MetaFormer model has the following characteristics:

[0081] Hybrid framework: MetaFormer adopts an innovative hybrid framework structure, which combines convolutional layers and Transformer layers skillfully. The convolutional layers are responsible for encoding the visual information in the image and gradually extracting multi-scale features through convolutional operations in different stages. The Transformer layers are responsible for fusing these visual features with meta information and capturing the complex relationships between image patches through the self-attention mechanism.

[0082] Convolutional layers: In the convolutional layer part, MetaFormer adopts a classic convolutional network structure. Through convolutional operations in multiple stages, the size of the input image is gradually reduced while the number of channels is increased to extract richer multi-scale features. These features provide a solid foundation for subsequent classification tasks.

[0083] Transformer Layer: In the advanced stage, MetaFormer introduces Transformer blocks. These Transformer blocks utilize the self-attention mechanism to effectively fuse visual features and meta information. By calculating the similarity between image patches, Transformer can capture subtle differences in the image, thus enabling accurate identification of fine-grained categories.

[0084] Relative Position Bias: To utilize the sequential information between image patches, MetaFormer introduces relative position bias. This mechanism considers the relative position relationship between image patches when calculating similarity in Transformer, thereby improving the robustness and accuracy of the model.

[0085] Aggregation Layer: MetaFormer fuses class tokens at different stages through the aggregation layer. This design can integrate multi-scale visual features and meta information, further improving the classification performance of the model.

[0086] Overlapping Patch Embedding: To reduce computational consumption, MetaFormer adopts the overlapping patch embedding method. This method tokenizes and downsamples the feature map through overlapping patches, effectively reducing the computational complexity while retaining more image details.

[0087] Nonlinear Embedding: For meta information (such as geographical coordinates, attribute lists, text descriptions, etc.), MetaFormer maps it to an embedding vector through a nonlinear embedding layer. This design enables the model to fully utilize this additional information, further improving the accuracy of classification.

[0088] Spatio-Temporal Information Mapping: For temporal information (such as month, hour, etc.), MetaFormer maps it to a periodic function. This mapping reflects the similarity at different time points, helping the model better capture time-related features.

[0089] Pre-trained Model: To improve the generalization ability of the model, MetaFormer makes full use of large-scale pre-trained models (such as ImageNet-1k and ImageNet-21k). These pre-trained models provide the model with rich prior knowledge, helping the model achieve better performance in fine-grained classification tasks.

[0090] In the embodiments of the present application, the MetaFormer model is used to complete the task of identifying the authenticity of batch number processes through a unified visual and meta-information fusion framework. By fusing the meta-information and picture information of the product, it significantly improves the performance of fine-grained visual recognition and enhances the ability to identify batch number processes. Among them, the meta-information of the product includes key attributes such as the specifications and models of the product, which helps the model to more accurately identify the batch number process.

[0091] In some alternative embodiments, for the identification of batch number content, the open-source PaddlePaddle-OCR interface can be used to complete the tasks of identifying and extracting batch number characters. This solution combines the advantages of OCR technology with business logic, achieving accurate identification and expiration date verification of batch number content, and providing strong support for the abnormal handling of expired or approaching-expiration products.

[0092] OCR (Optical Character Recognition) technology is a technology that can convert the text in an image into editable text. PaddlePaddle-OCR is an OCR tool open-sourced by Baidu. Based on the PaddlePaddle deep learning framework, it has characteristics such as high accuracy, high efficiency, and ease of use.

[0093] Using the PaddlePaddle-OCR interface, accurate identification of product batch number characters can be achieved. This interface can handle text in various fonts, sizes, and colors and can cope with complex background interference, thus ensuring the accurate extraction of batch number characters.

[0094] Developers can call the PaddlePaddle-OCR interface through the Python API or command-line tool and integrate it into the existing business system. When calling the interface, the path or data of the image file to be recognized needs to be passed in, and relevant parameters need to be set to obtain the best recognition effect.

[0095] To achieve the verification of the batch number expiration date, a mapping table of batch numbers and expiration dates needs to be prepared. This table should contain the batch numbers of all products and their corresponding production dates, expiration dates, and other information. In practical applications, this table can be stored in a database for quick query and verification.

[0096] After obtaining the batch number characters, the expiration date information of this batch can be obtained by querying the batch number expiration date mapping table. Then, by comparing the current date with the expiration date information, it can be judged whether the product is expired or approaching expiration. If the product has expired or is about to expire, an abnormal handling process will be triggered.

[0097] For expired or near-expired products, a series of exception handling processes can be set up. For example, expired products can be automatically taken off the shelf, reminder notifications can be sent to relevant personnel, and exception information can be recorded. These processes can be customized and adjusted according to actual business needs.

[0098] By integrating the PaddlePaddle-OCR interface and the batch number expiration mapping table, the automation and intelligence of batch number content recognition can be achieved. This not only improves work efficiency but also reduces the risk of human errors. At the same time, this solution can also be integrated with other business systems (such as ERP, WMS, etc.) to achieve more comprehensive product management and exception handling.

[0099] Figure 3 A possible structure of the electronic device provided by the embodiment of the present application is shown. Referring to Figure 3 , the electronic device includes: a processor, a memory, and a communication interface. These components are interconnected and communicate with each other through a communication bus and / or other forms of connection mechanisms (not shown).

[0100] Among them, the memory includes one or more (only one is shown in the figure), which can be, but is not limited to, random access memory (RAM), read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), etc. The processor and other possible components can access the memory, read and / or write the data therein.

[0101] The processor includes one or more (only one is shown in the figure), which can be an integrated circuit chip with the ability to process signals. The above-mentioned processor can be a general-purpose processor, including a Central Processing Unit (CPU), a Micro Controller Unit (MCU), a Network Processor (NP), or other conventional processors; it can also be a dedicated processor, including a Neural-network Processing Unit (NPU), a Graphics Processing Unit (GPU), a Digital Signal Processor (DSP), an Application Specific Integrated Circuits (ASIC), a Field Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. Moreover, when there are multiple processors, a part of them can be general-purpose processors and another part can be dedicated processors.

[0102] The communication interface includes one or more (only one is shown in the figure), which can be used to communicate directly or indirectly with other devices for data interaction. The communication interface can include interfaces for wired and / or wireless communication.

[0103] One or more computer program instructions can be stored in the memory, and the processor can read and run these computer program instructions to implement the method provided in the embodiments of the present application.

[0104] It can be understood that Figure 3 The structure shown is only schematic, and the electronic device may further include more or fewer components than those shown in Figure 3 or have a structure different from that shown in Figure 3 The components shown in can be implemented by hardware, software, or a combination thereof. The electronic device may be a physical device, such as a PC, a laptop, a tablet, a mobile phone, a server, an embedded device, etc., or a virtual device, such as a virtual machine, a virtualization container, etc. Moreover, the electronic device is not limited to a single device, and can also be a combination of multiple devices or a cluster composed of a large number of devices. Figure 3 The components shown in can be implemented by hardware, software, or a combination thereof. The electronic device may be a physical device, such as a PC, a laptop, a tablet, a mobile phone, a server, an embedded device, etc., or a virtual device, such as a virtual machine, a virtualization container, etc. Moreover, the electronic device is not limited to a single device, and can also be a combination of multiple devices or a cluster composed of a large number of devices.

[0105] A computer program product provided by an embodiment of the present application includes a computer program / instructions. When the computer program / instructions are executed by a processor, the steps of any of the above-mentioned methods are implemented.

[0106] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For another example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some communication interfaces. The indirect couplings or communication connections of the devices or units can be in electrical, mechanical or other forms.

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

[0108] Furthermore, in each embodiment of the present application, the various functional modules can be integrated together to form an independent part, or each module can exist alone, or two or more modules can be integrated to form an independent part.

[0109] In this document, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations.

[0110] The above are only the embodiments of the present application and are not used to limit the protection scope of the present application. For those skilled in the art, the present application can have various changes and modifications. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A method for detecting the batch number of a commodity, characterized in that: include: photographing the commodity under the irradiation of the ultraviolet light to obtain a photographed image of the commodity; Inputting the captured image into a base mark recognition model to perform base mark recognition to obtain a base mark area image; Inputting the base label area image into a batch number recognition model to perform batch number recognition to obtain a batch number image; If two or more batch numbers are identified, the batch number of the product is determined to be abnormal.

2. The method according to claim 1, characterized in that After inputting the base label area image into the batch number recognition model to perform batch number recognition and obtain the batch number image, the method further includes: If a batch number is recognized in the base label area image, the batch number image is input into the batch number writing process recognition model to obtain the writing process of the batch number; If the writing process of the batch number does not conform to the writing process of the genuine product, the batch number of the product is determined to be an abnormal batch number.

3. The method according to claim 2, characterized in that After inputting the batch number image into the batch number writing process recognition model to obtain the batch number writing process, the method further includes: If the writing process of the batch number is consistent with that of the genuine product, the batch number image is input into the batch number content recognition model to obtain the text content of the batch number; According to the text content of the batch number, it is determined whether the batch number of the commodity is abnormal.

4. The method according to claim 3, characterized in that The step of judging whether the batch number of the commodity is abnormal according to the text content of the batch number includes: Determining whether the text content of the batch number complies with the mapping rule between the batch number and the production date; If the text content of the batch number does not comply with the mapping rule between the batch number and the production date, the batch number of the commodity is determined to be abnormal.

5. The method according to claim 4, characterized in that After determining whether the text content of the batch number complies with the mapping rule between the batch number and the production date, the method further includes: If the text content of the batch number complies with the mapping rule between the batch number and the production date, the production date of the commodity is obtained according to the text content of the batch number and the mapping rule; According to the production date and current date of the commodity, determine whether the commodity is a near-expiry commodity or an expired commodity.

6. The method according to claim 1, characterized in that The base mark recognition model includes: a MobileNetV3 model.

7. The method according to claim 1, characterized in that The batch number recognition model includes a DETR model.

8. The method according to claim 2, characterized in that The batch number writing process recognition model includes a MetaFormer model.

9. An electronic device, characterized in that: include: A processor and a memory, wherein the memory stores machine-readable instructions executable by the processor, and when the machine-readable instructions are executed by the processor, the method according to any one of claims 1 to 8 is performed.

10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of any method described in claims 1-8 are implemented.