CN-121982402-A - Multi-specification card image recognition and packaging parameter self-adaption method and system
Abstract
The invention relates to the technical field of machine vision detection, and discloses a multi-specification card image recognition and packaging parameter self-adaptation method and a system, wherein the method constructs a specification feature library, recognizes specification categories based on measurement learning, quick production change is realized through three-level parameter fusion and small sample fine adjustment, abnormal early warning is set to support new specification input, production change time is shortened to be within 2 minutes, and identification accuracy reaches 99.9%.
Inventors
- YANG CHAO
Assignees
- 广东望京卡牌科技有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20260126
Claims (10)
- 1. The method for identifying and self-adapting the image of the cards with multiple specifications and the packaging parameters is characterized by comprising the following steps: step S1, a specification feature library is constructed, geometric parameters, printing features and material properties of various specification cards are stored in a structured coding mode, wherein the geometric parameters comprise normalized values of the length, the width and the thickness of the cards, the printing features comprise color space distribution features and edge sharpness indexes, and the material properties comprise surface glossiness and reflectivity parameters to form a specification feature knowledge library; S2, when a card enters a detection station, performing specification recognition on an acquired image through a specification classification network, mapping the acquired image to a high-dimensional embedding space to generate a specification embedding vector, calculating Euclidean distance between the specification embedding vector and each specification prototype vector in a specification feature library, and determining the specification class of the current card through a softmax function based on the Euclidean distance; Step S3, retrieving a corresponding parameter template from the specification feature library based on the specification category identified in the step S2, and decomposing the detection parameter into three levels of specification-independent layer parameters, specification-related layer parameters and batch-related layer parameters, wherein the specification-independent layer parameters comprise light source intensity and camera gain, the specification-related layer parameters comprise an interesting region division scheme and an edge detection threshold value, the batch-related layer parameters comprise template reference images and defect detection sensitivity coefficients, and the parameters of the three levels are subjected to weighted fusion through a multi-granularity parameter inheritance mechanism; step S4, performing batch-level optimization adaptation on the parameters fused in the step S3 by adopting a small sample fine tuning strategy, collecting support set samples of the current batch, updating the batch-related layer parameters by using the support set samples through gradient descent, and introducing regularization items in the updating process to restrict parameter offset amplitude; And S5, starting an online continuous learning module in a normal detection process, identifying boundary samples with detection confidence in a preset interval, storing the boundary samples in a boundary sample buffer zone, generating pseudo labels of the boundary samples based on high-confidence samples when the number of the samples in the boundary sample buffer zone reaches a threshold value, and using the boundary samples with the pseudo labels to unsupervised optimize a classifier decision boundary.
- 2. The method for identifying and adaptively matching multiple card images according to claim 1, wherein in step S1, the color space distribution characteristic is represented by a hue histogram of HSV color space, the hue histogram is quantized by 36 bins, each bin covers a hue range of 10 degrees, and the edge sharpness index is obtained by calculating an average value of gradient magnitudes by a Sobel operator, and the value range is 50 to 200.
- 3. The method according to claim 1, wherein in step S2, the specification classification network includes 4 convolution blocks and two full-connection layers, the output channels of the 4 convolution blocks are 64, 128, 256, 512, and downsampling is performed between the convolution blocks through a maximum pooling layer, and the full-connection layers output 256-dimensional embedded vectors and apply L2 normalization.
- 4. The method according to claim 1, wherein in step S2, the prototype vector of the specification is a mean center of embedded vectors of all training samples of the specification, the softmax function is introduced with a temperature coefficient τ, and the value of the temperature coefficient τ ranges from 0.1 to 1.0.
- 5. The method according to claim 1, wherein in step S2, the training of the specification classification network uses a triplet loss function, the triplet loss function gathers samples of the same specification in the embedding space, samples of different specifications are far away from each other, and the interval boundary parameter in the triplet loss function ranges from 0.3 to 0.7.
- 6. The method for identifying and adaptively packaging parameters of multi-specification playing card images according to claim 1, wherein in step S3, the parameter fusion of the multi-granularity parameter inheritance mechanism adopts a layered superposition strategy, the parameter fusion weights of three levels are α, β, γ, respectively, and the constraint condition of α+β+γ=1 is satisfied, wherein the weight β of the parameter of the specification-related layer is greater than the weight of the parameter of the other two layers.
- 7. The method according to claim 1, wherein in step S4, the number of samples in the support set is 3 to 10, the gradient descent uses a combined loss function, the combined loss function includes a detection loss term and a regularization term, the regularization term calculates a parameter offset using an L2 norm, and the regularization coefficient has a value ranging from 0.001 to 0.1.
- 8. The method for identifying and adaptively matching card images according to claim 1, wherein in step S5, the identification condition of the boundary samples is that the normal class probability outputted by the detection model falls within a range formed by a lower threshold and an upper threshold, the value of the lower threshold ranges from 0.2 to 0.4, the value of the upper threshold ranges from 0.6 to 0.8, and the maximum capacity of the boundary sample buffer ranges from 50 to 200 samples.
- 9. The method for identifying and adaptively packaging the card images according to the multiple specifications as set forth in claim 1, further comprising step S6 of calculating a characteristic distance between the specification embedded vector of the current input image and all prototype vectors of known specifications, when a minimum value of all the distances exceeds a preset characteristic distance threshold value, determining that the current input image belongs to an unknown specification and triggering an abnormal specification early warning mechanism, supporting calculation of prototype vectors of new specifications by collecting a small number of sample images to realize one-key entry of new specifications, wherein the characteristic distance threshold value is set based on an intra-class distance standard deviation of the known specification embedded vector in such a manner that a maximum value of the intra-class distance standard deviation of all the classes is multiplied by a safety factor, the safety factor has a value range of 2.5 to 3.5, and the one-key entry of the new specifications requires collection of 3 to 10 sample images of the new specifications.
- 10. A multi-gauge card image recognition and packaging parameter adaptation system for implementing the method of any one of claims 1 to 9, comprising: the specification feature library construction module is used for carrying out structural coding storage on geometric parameters, printing features and material properties of various specification cards to form a specification feature knowledge base; The specification identification module is used for carrying out specification identification on the acquired images through a specification classification network when the cards enter the detection station, extracting specification embedding vectors of the current cards, and determining the specification category of the current cards in the specification embedding space based on measurement learning; The parameter retrieval and fusion module is used for retrieving a corresponding parameter template from the specification feature library based on the specification category obtained by recognition, decomposing the detection parameters into three levels of specification irrelevant layer parameters, specification relevant layer parameters and batch relevant layer parameters, and carrying out parameter fusion through a multi-granularity parameter inheritance mechanism; the small sample fine adjustment module is used for carrying out batch-level optimization adaptation on the fused parameters by adopting a small sample fine adjustment strategy, and carrying out gradient update on the batch-related layer parameters by utilizing a small number of sample images of the current batch; The online continuous learning module is used for continuously collecting boundary samples positioned near the decision boundary in the normal detection process and optimizing the decision boundary of the classifier without supervision; the abnormal specification early warning module is used for calculating the characteristic distance between the specification embedded vector of the current input image and all the prototype vectors of the known specification, and triggering an abnormal specification early warning mechanism and supporting one-key input of a new specification when all the distances exceed a preset characteristic distance threshold value.
Description
Multi-specification card image recognition and packaging parameter self-adaption method and system Technical Field The invention relates to the technical field of machine vision detection, in particular to a multi-specification card image recognition and packaging parameter self-adaption method and system. Background In the field of modern card production and manufacturing, a visual detection system has become a key link for guaranteeing product quality. Along with the diversification development of market demands, card manufacturers need to produce products with various specifications such as playing cards, talons, trading cards, table game cards and the like at the same time, and the products have obvious differences in geometric dimensions, printing characteristics, material properties and the like. However, existing visual inspection systems face serious adaptability problems when dealing with multi-variety small volume production modes. The Chinese patent with publication number CN118762243A discloses a machine vision detection method and a system based on feature calibration, wherein the method comprises the steps of dynamically obtaining a continuous image sequence of a detected object, performing scale transformation on the image sequence to generate an image pyramid with multi-level resolution, extracting features from the image pyramid hierarchy, performing real-time calibration, identifying the types and changes of the features by comparing a preset dynamic feature template library, and finally adopting a self-adaptive decision algorithm to adjust a detection strategy. Although the technical scheme realizes a certain degree of environmental adaptability, the updating mechanism of the characteristic template library depends on passive learning, samples are gradually accumulated and manually adjusted in the detection process, and active adaptation in a quick production changing scene cannot be realized. In addition, the support vector machine classifier adopted by the scheme needs enough training samples to achieve an ideal classifying effect, which is contradictory to the reality that samples are scarce in the small-batch production of multiple varieties. In a practical production environment, when a card production line needs to be switched from one specification to another, the existing visual inspection system usually needs to manually recalibrate the parameters of the camera, manually adjust the boundaries of the inspection area, replace or retrain the template image, which usually takes 20 to 30 minutes, and severely limits the production efficiency. Particularly, for high-end products such as collection and replacement cards, custom table games and the like, the single-batch production quantity can be only hundreds to thousands, and the replacement time is excessively high in the total production time, so that the equipment utilization rate is low and the production cost is increased. In addition, when new specifications of card products appear, the existing system needs to collect a large number of sample images for model training, which not only prolongs the product marketing period, but also increases the workload of technicians. Some enterprises try to adopt generalized detection parameters to reduce production change adjustment, but this approach often leads to reduced detection accuracy, and cannot meet the detection requirements of high-quality products. Therefore, an intelligent detection method which can be rapidly adapted to various card specifications, supports new specification input under the condition of few samples and has online continuous learning capability is needed, so as to solve the problem of rapid production change in the production of various small-batch cards. Disclosure of Invention Aiming at the technical problems of long time consumption and poor adaptability of parameter adjustment when the visual detection system changes production of multi-specification card products in the prior art, the invention provides a multi-specification card image recognition and packaging parameter self-adaptation method and a system. The first aspect of the invention provides a multi-specification card image recognition and packaging parameter self-adaption method, which comprises the following steps: step S1, a specification feature library is constructed, and geometric parameters, printing features and material properties of various specification cards are subjected to structural coding storage to form a specification feature knowledge library; S2, when the cards enter the detection station, carrying out specification recognition on the acquired images through a specification classification network, extracting specification embedding vectors of the current cards, and determining the specification category of the current cards in a specification embedding space based on measurement learning; Step S3, retrieving a corresponding parameter template from a specification feature library