Ceramic tile color separation method, system, device and storage medium based on color difference feature extraction

The tiles color difference characteristics are extracted through the deep learning model and combined with the adaptive clustering threshold algorithm to realize online clustering, solving the problem of artificial color separation in the existing technology, and achieving efficient and accurate color difference of ceramic tiles.

CN115359269BActive Publication Date: 2025-05-23SOUTH CHINA UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210798806.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-08
Publication Date
2025-05-23
Estimated Expiration
2042-07-08

AI Technical Summary

Technical Problem

The prior art has problems such as time-consuming and labor-intensive and low accuracy in manually distinguishing color difference in ceramic tiles, and it is difficult to adapt to changes in the types and color numbers of ceramic tiles during production.

Method used

A chromatic aberration feature extraction model based on deep learning is adopted, combined with an adaptive clustering threshold algorithm to realize online clustering and accurately and efficiently complete the color separation task of tiles color aberration.

Benefits of technology

Reduced manual intervention, improved color separation accuracy and efficiency, strong adaptability, and did not need to retrain the model when the tile type was changed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115359269B_ABST
    Figure CN115359269B_ABST
Patent Text Reader

Abstract

The present invention discloses a method, system, computer equipment and storage medium for color separation of tiles based on color difference feature extraction, the method comprising: collecting images of tiles to be color separated, selecting a small number of tile images therefrom, and calculating clustering thresholds according to the small number of tile images; extracting high-dimensional tile color difference features from the images of tiles to be color separated using a color difference feature extraction model, and then constructing a feature matrix of the images to be clustered; implementing online clustering according to the clustering threshold and the feature matrix of the images to be clustered, and completing the color separation of all tiles; if the new tiles to be detected are of the same type as the previous tiles to be detected, adding the high-dimensional tile color difference features extracted from the images of the new tiles to be color separated to the feature matrix of the images to be clustered, and implementing online clustering according to the clustering threshold and the feature matrix of the images to be clustered; otherwise, repeating the above process again. The present invention can accurately and efficiently complete the color separation of tile color differences by combining the clustering threshold and the tile color difference features with online clustering.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of image processing and deep learning technology, and specifically relates to a tile color separation method, system, computer equipment and storage medium based on color difference feature extraction. Background Art

[0002] Generally speaking, the color difference of tiles refers to the phenomenon that there is a difference in color between one tile and another tile in the same batch of tiles or different batches of the same model of tiles. This color difference is sometimes very small, but if the user uses a large number of tiles with color difference for decoration, under uniform light, the junction of tiles with color difference can be seen to have obvious differences, which will have an adverse effect on the decoration effect. If a batch of products does not show obvious color difference under uniform light, it is considered that there is no color difference. The reason for the color difference of tiles is that there are a large number of mineral raw materials containing different elements in the formula of tiles. Since the raw materials of tiles cannot be kept constant, and the changes in environmental parameters such as furnace temperature that affect the color of tiles during the firing process are inevitable, different colors will be displayed, forming color difference. Therefore, the color difference problem of tiles cannot be eliminated from the root. At present, the commonly used solution is to manually separate the tiles according to the degree of color difference after the tile factory completes the production of tiles, and the tiles with small color difference are classified into the same group for sale, so as to solve the color difference problem of tiles. The disadvantage of this is that manual judgment of color difference not only consumes a lot of manpower and material resources, but also has a certain time lag. In addition, the human eye is very prone to fatigue when working in a highly concentrated state, and is disturbed by a series of different environmental factors such as light and mental state, which can easily lead to low color separation accuracy and large errors.

[0003] In recent years, machine vision technology and deep learning technology have emerged. Under a stable preset acquisition environment, the camera can ensure the acquisition of images with relatively stable lighting, while the deep learning model can extract color difference features with superior performance while ensuring the quality of the data set. The development of these two technologies makes it possible to use machine vision combined with deep learning technology instead of human eyes to perform color difference separation of tiles.

[0004] However, due to the difficulty of labeling tiles in the actual production process and the unpredictable characteristics of data distribution, it cannot be regarded as a classification task, but is closer to a clustering task, so higher performance requirements are placed on color difference features. Summary of the invention

[0005] In order to address the deficiencies of the above-mentioned prior art, the present invention provides a method, system, computer device and storage medium for tile color separation based on color difference feature extraction. The method extracts the tile color difference features by selecting a suitable deep learning network, and designs a clustering threshold based on a small number of tile images. According to the tile color difference features and the clustering threshold, online clustering is realized, which can accurately and efficiently complete the tile color difference color separation task.

[0006] The first object of the present invention is to provide a tile color separation method based on color difference feature extraction.

[0007] The second object of the present invention is to provide a tile color separation system based on color difference feature extraction.

[0008] A third object of the present invention is to provide a computer device.

[0009] A fourth object of the present invention is to provide a storage medium.

[0010] The first object of the present invention can be achieved by adopting the following technical solutions:

[0011] A method for color separation of tiles based on color difference feature extraction, the method comprising:

[0012] Collect images of tiles to be separated into different colors;

[0013] A small number of tile images are randomly selected from the images of tiles to be separated, and a clustering threshold is calculated using an adaptive clustering threshold algorithm based on the small number of tile images;

[0014] Input the image of the tile to be color-separated into the color difference feature extraction model to extract the high-dimensional tile color difference features;

[0015] According to the high-dimensional tile color difference features, a feature matrix of the image to be clustered is constructed; according to the clustering threshold and the feature matrix of the image to be clustered, online clustering is realized to complete the color separation of all tiles to be detected;

[0016] If the new tile to be detected is of the same type as the previous tile to be detected, then based on the image of the new tile to be separated, the new high-dimensional tile color difference feature is extracted, and the new high-dimensional tile color difference feature is added to the feature matrix of the image to be clustered; based on the feature matrix of the image to be clustered and the clustering threshold, online clustering is realized to complete the color separation of the tile to be detected; otherwise, the image of the tile to be separated is collected, and subsequent operations are continued to realize the color separation of the tile.

[0017] Furthermore, let the size of the image of the tile to be separated be a×b;

[0018] Assume that there are a small number of tile images, m;

[0019] The method of calculating the clustering threshold using an adaptive clustering threshold algorithm based on a small amount of tile images includes:

[0020] Use m tile images as threshold selection images;

[0021] For any threshold image n x , divide it evenly into k×k regions, and obtain k×k regional images; where x∈(1,…,m), k is a positive integer greater than 1;

[0022] According to k×k regional images, the feature matrix is ​​obtained;

[0023] Calculate the Euclidean distance according to the row vectors in the feature matrix to obtain a distance matrix;

[0024] Calculate the average value of all elements in the distance matrix to obtain the threshold selection image n x The average color difference distance F x ;

[0025] The average color difference distance (F 1 ,F 2 ,…,F m ), calculate the clustering threshold.

[0026] Furthermore, the feature matrix is ​​obtained according to the k×k regional images, including:

[0027] For any region image A, construct a blank image m of size a×b y , m y Uniformly divide into k×k regions, each of which is a copy of the regional image A; where y∈(1,…,k×k);

[0028] The k×k region images are obtained by (m 1 ,m 2 ,…,m k×k ) respectively input the color difference feature extraction model to obtain a feature matrix;

[0029] The color difference distance average value (F 1 ,F 2 ,…,F m ), calculate the clustering threshold, including:

[0030] According to the following formula, the clustering threshold t is calculated as:

[0031]

[0032] Among them, α is the set value.

[0033] Furthermore, m=n / 10.

[0034] Furthermore, suppose there are n images of tiles to be separated, n ≥ 10;

[0035] The extracted high-dimensional tile color difference features are n tile color difference features, and the feature matrix of the image to be clustered is updated according to the n tile color difference features;

[0036] The method of realizing online clustering according to the clustering threshold and the feature matrix of the image to be clustered, and completing the color separation of all tiles to be detected, includes:

[0037] Constructing a cluster center matrix according to the feature matrix of the image to be clustered;

[0038] Calculating a similarity matrix according to the feature matrix of the image to be clustered and the cluster center matrix;

[0039] Based on the similarity matrix and the clustering threshold, online clustering is implemented to complete the color separation of all tiles to be detected.

[0040] Furthermore, the size of the cluster center matrix is ​​l×(q+1), where l is the number of cluster centers, the first q columns are the characteristic vectors of the cluster centers, and the q+1th column is the number of cluster images within the range of the cluster center;

[0041] The implementing online clustering according to the similarity matrix and the clustering threshold comprises:

[0042] The feature vector of the first row in the feature matrix of the image to be clustered is updated to the cluster center matrix as the first cluster center;

[0043] j = 1;

[0044] Taking the feature vector of the jth row in the feature matrix of the image to be clustered as the current feature;

[0045] Calculating a similarity matrix according to the cluster center matrix and the feature matrix of the image to be clustered;

[0046] If the smallest element in the similarity matrix is ​​smaller than the clustering threshold, the current feature is assigned to the corresponding cluster center, the feature vector of the corresponding cluster center in the cluster center matrix and the number of images within the cluster center are updated, and the similarity matrix and the feature matrix of the image to be clustered are updated at the same time;

[0047] If the smallest element in the similarity matrix is ​​greater than the clustering threshold, the current feature is used as a new cluster center, and the cluster center matrix is ​​updated: the current feature is added to the cluster center matrix, and the number of clustered images within the new cluster center range is 1; the similarity matrix and the feature matrix of the image to be clustered are updated at the same time;

[0048] j=j+1;

[0049] The feature vector of the jth row in the feature matrix of the image to be clustered is added as the next cluster center to the cluster center matrix; the feature vector of the jth row in the feature matrix of the image to be clustered is returned as the current feature, and subsequent operations are continued until j>n, that is, the color separation of n tile images is completed.

[0050] Furthermore, the size of the feature matrix of the image to be clustered is n×q, where q is the dimension of the tile color difference feature;

[0051] The size of the cluster center matrix is ​​l×(q+1), where l is the number of cluster centers, the first q columns are the eigenvectors of the cluster centers, and the q+1th column is the number of cluster images within the range of the cluster center;

[0052] The calculating of the similarity matrix according to the feature matrix of the image to be clustered and the cluster center matrix comprises:

[0053] According to the following formula, calculate the element similarity_mat(x,y) in the similarity matrix:

[0054] similarity_mat(x, y)=d(cluster_mat[x], image_mat[y])

[0055]

[0056] Among them, x, y are the x-th row vector of the cluster center matrix and the y-th row vector of the feature matrix of the image to be clustered, respectively, and p is the p-th dimension in the x, y vectors.

[0057] Furthermore, before the image of the tile to be color-separated is input into the color difference feature extraction model, the color difference feature extraction model is trained using the acquired color difference tile image dataset, wherein the color difference tile image dataset is an image collection of tiles of various colors under a preset environment, and all the collected tile images constitute a color difference tile image dataset, and the preset environment refers to an environment with uniform lighting that can effectively reflect the true color of the tiles.

[0058] Furthermore, the image is normalized to a fixed size before being input into the color difference feature extraction model.

[0059] The second object of the present invention can be achieved by adopting the following technical solutions:

[0060] A tile color separation system based on color difference feature extraction, the system comprising:

[0061] An image acquisition module is used to acquire images of tiles to be color-separated;

[0062] The clustering threshold calculation module is used to randomly select a small number of tile images from the image of the tile to be separated, and calculate the clustering threshold by using the adaptive clustering threshold algorithm based on the small number of tile images;

[0063] The tile color difference feature extraction module is used to input the image of the tile to be color-separated into the color difference feature extraction model to extract the high-dimensional tile color difference features;

[0064] The first tile color separation module is used to construct a feature matrix of the image to be clustered according to the high-dimensional tile color difference characteristics; realize online clustering according to the clustering threshold and the feature matrix of the image to be clustered, and complete the color separation of all tiles to be detected;

[0065] The second tile color separation module is used to extract new high-dimensional tile color difference features based on the image of the new tile to be separated, and add the new high-dimensional tile color difference features to the feature matrix of the image to be clustered if the new tile to be detected is of the same type as the previous tile to be detected; realize online clustering according to the feature matrix of the image to be clustered and the clustering threshold to complete the color separation of the tile to be detected; otherwise, return to collect the image of the tile to be separated, and continue to perform subsequent operations to realize tile color separation.

[0066] The third object of the present invention can be achieved by adopting the following technical solutions:

[0067] A computer device comprises a processor and a memory for storing a program executable by the processor. When the processor executes the program stored in the memory, the above-mentioned tile color separation method is implemented.

[0068] The fourth object of the present invention can be achieved by adopting the following technical solutions:

[0069] A storage medium stores a program, and when the program is executed by a processor, the above-mentioned tile color separation method is implemented.

[0070] The present invention has the following beneficial effects compared with the prior art:

[0071] 1. The present invention applies image processing technology and deep learning technology to the actual problem of tile color separation, uses a color difference feature extraction model to complete the extraction of tile color difference features, and performs clustering processing on the extracted tile color difference features, and classifies tiles with similar tile color difference feature distances into the same category, thereby solving the problems of high difficulty, cumbersome steps, and time-consuming and labor-intensive manual color separation.

[0072] 2. The method provided by the present invention selects a suitable color difference feature extraction model, so that the model pays more attention to the color difference of tiles and reduces the sensitivity of the model to the tile pattern. The purpose is that each time the type of tile is changed in actual production, before the color difference feature of the color-separated tiles is extracted, there is no need to retrain the color difference feature extraction model.

[0073] 2. The method provided by the present invention designs an algorithm for calculating clustering thresholds based on a small number of tile images. The algorithm can calculate a suitable clustering threshold through a small number of tile images, avoiding the problem of manually setting the threshold when the tile type is changed, meeting the production needs of the actual production line, and reducing the difficulty of applying the color separation method in the production process and the required manpower and material resources. The idea of ​​the clustering threshold algorithm is that for the same tile, different areas inside are of the same category. Therefore, this algorithm is not affected by the tile type and color number.

[0074] 3. Through the method provided by the present invention, if the tiles to be separated are not of the same type as the tiles previously detected, the clustering threshold needs to be recalculated; otherwise, there is no need to recalculate, and the previously calculated clustering threshold can be directly used, which reduces the repeated calculation process and speeds up the detection rate. BRIEF DESCRIPTION OF THE DRAWINGS

[0075] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying creative work.

[0076] Figure 1 This is a flow chart of a tile color separation method based on color difference feature extraction according to Example 1 of the present invention.

[0077] Figure 2 This is a schematic diagram of a tile color separation method based on color difference feature extraction according to Example 2 of the present invention.

[0078] Figure 3 This is a structural block diagram of a tile color separation system based on color difference feature extraction according to Example 3 of the present invention.

[0079] Figure 4 This is a structural block diagram of a computer device according to Embodiment 4 of the present invention. DETAILED DESCRIPTION

[0080] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention. It should be understood that the specific embodiments described are only used to explain the present application and are not used to limit the present application.

[0081] Embodiment 1:

[0082] like Figure 1 , 2 As shown, the tile color separation method based on color difference feature extraction provided in this embodiment mainly includes the following steps:

[0083] S101, collecting a color difference tile image dataset.

[0084] Using high-definition cameras and other equipment to collect images of tiles with two or more color numbers in a preset environment, all the collected tile images constitute a color difference tile image dataset. Among them, the preset environment refers to an environment with uniform lighting that can effectively reflect the true color of the tiles.

[0085] All tile images in the color difference tile image dataset are divided into training set and test set according to proportion, and all tile images in the training set and test set are normalized to a fixed size.

[0086] S102, training a color difference feature extraction model using a color difference tile image dataset.

[0087] Further, step S102 includes:

[0088] (1) Build a color difference feature extraction model.

[0089] The color difference feature extraction model includes a preprocessing convolution pooling module, module group 1, module group 2, module group 3, module group 4 and a global average pooling layer connected in sequence. The output of each module is the input of the next module, and each module group includes four residual modules. Each residual module contains a convolution layer with the same convolution kernel size and a rectified linear unit.

[0090] In this embodiment, the convolution kernel size of residual modules 1, 2, 3, and 4 of module group 1 is 3×3, and the step size is 1; the convolution kernel size of residual modules 5 and 6 of module group 2 is 3×3, and the step size is 2, and the convolution kernel size of residual modules 7 and 8 is 3×3, and the step size is 1; the convolution kernel size of residual modules 9 and 10 of module group 3 is 3×3, and the step size is 2, and the convolution kernel size of residual modules 11 and 12 is 3×3, and the step size is 1; the convolution kernel size of residual modules 13 and 14 of module group 4 is 3×3, and the step size is 2, and the convolution kernel size of residual modules 15 and 16 is 3×3, and the step size is 1.

[0091] (2) The color difference feature extraction model is trained using the color difference tile image dataset.

[0092] The color difference feature extraction model is trained using the training set in the color difference tile image dataset. The Adam algorithm is used as the optimization parameter of the model. The training cycle, batch size and learning rate are set. The model is trained to converge and a trained color difference feature extraction model is obtained.

[0093] S103, randomly selecting a small number of tile images from the collected images of the tiles to be separated, and calculating the clustering threshold using an adaptive clustering threshold algorithm based on the small number of tile images.

[0094] In this embodiment, it is assumed that the number of images of tiles to be separated is n, and the image size is a×b, where n is any positive integer greater than or equal to 10.

[0095] Randomly select m tile images from n images of tiles to be separated, and calculate the clustering threshold using an adaptive clustering threshold algorithm based on the m tile images, including:

[0096] In this embodiment, the value of m is n / 10.

[0097] Take m tile images as threshold selection images, and select image n for each threshold. x , It is evenly divided into k×k regions, where k is a positive integer greater than 1.

[0098] In this embodiment, the value of k is 2.

[0099] The threshold selected image is divided into four 2×2 regions A, B, C, and D. The image ranges are In the above coordinates (left, top, right, bot), the left parameter represents the leftmost value of the area, the top parameter represents the topmost value of the area, the right parameter represents the rightmost value of the area, and the bot parameter represents the bottommost value of the area.

[0100] For the region image A, construct a blank image m of size a×b A , m A In The positions are all copies of the A image.

[0101] Similarly, according to the regional images B, C, and D, we can get m B ,m C ,m D . A ,m B ,m C ,m D After normalization, they are input into the color difference feature extraction model to obtain a feature matrix T of size 4×512. The Euclidean distance d(x, y) is calculated for each row in the matrix T. The Euclidean distance d(x, y) is defined as:

[0102]

[0103] Where x and y are row vectors in the matrix T respectively.

[0104] According to the above method, a distance matrix of size 4×3 can be calculated, and the average value of each element of this matrix is ​​calculated to obtain image n x The average color difference distance F of the four areas A, B, C, and D x .

[0105] The average color difference distance calculated based on n / 10 threshold images Then calculate the clustering threshold t:

[0106]

[0107] in α is the value to be set, usually 0.8.

[0108] S104, inputting the collected image of the tile to be color-separated into a color difference feature extraction model to extract high-dimensional tile color difference features.

[0109] After normalizing n tile images, input them into the trained color difference feature extraction model, and output n tile color difference features, including:

[0110] The n tile images to be detected are normalized and input into the preprocessing convolution pooling module respectively, and then processed by module group 1, module group 2, module group 3, module group 4 and a global average pooling layer, and finally n high-dimensional tile color difference features are obtained.

[0111] S105, constructing a feature matrix of the image to be clustered according to the high-dimensional tile color difference features, and realizing online clustering according to the clustering threshold and the feature matrix of the image to be clustered, so as to complete the color separation of all the tiles to be detected.

[0112] According to the high-dimensional tile color difference features, the image feature matrix to be clustered is constructed. According to the clustering threshold and the image feature matrix to be clustered, the vector clustering of the image feature matrix to be clustered is calculated, and each high-dimensional tile color difference feature is divided into the corresponding color number group to realize tile color separation.

[0113] Further, step S105 includes:

[0114] (1) Construct the image feature matrix to be clustered based on n tile color difference features.

[0115] Input the n tile color difference features into the clustering image feature matrix to obtain the image feature matrix image_mat to be clustered with a size of n×512, where 512 is the 512-dimensional color difference feature vector output by the color difference feature extraction model of the image of the tile to be separated.

[0116] (2) Construct a cluster center matrix based on the feature matrix of the image to be clustered.

[0117] The size of the cluster center matrix cluster_mat is l×513, where l is the number of cluster centers, the first 512 columns are the eigenvectors of the cluster centers, and the 513th column is the number of cluster images within the range of the cluster center.

[0118] (3) Calculate the similarity matrix based on the cluster image feature matrix and the cluster center matrix.

[0119] The size of the similarity matrix similarity_mat is l×n, where l is the number of rows in the cluster center matrix, that is, the number of cluster centers, and n is the number of rows in the feature matrix of the image to be clustered, that is, the number of images to be clustered. The calculation formula of the element similarity_mat(x,y) in the similarity matrix is ​​as follows:

[0120] similarity_mat(x, y)=d(cluster_mat[x], image_mat[y])

[0121]

[0122] Among them, x, y are the x-th row feature vector of the cluster center matrix and the y-th row vector of the feature matrix of the image to be clustered, p is the p-th dimension in the x, y vectors, and q is the size of the x, y vectors.

[0123] The above formula can be used to calculate the distance between the image features to be clustered and the features of each cluster center and output the similarity matrix similarity_mat.

[0124] (4) Realize online clustering based on the similarity matrix and clustering threshold.

[0125] Furthermore, step (4) specifically includes:

[0126] (4-1) When the algorithm is initialized, the feature vector of the first row in the feature matrix image_mat of the image to be clustered is used as the first cluster center to update the cluster center matrix;

[0127] Calculate the similarity matrix similarity_mat based on the cluster center matrix and the feature matrix of the image to be clustered.

[0128] (4-2) After the clustering algorithm is initialized, the smallest element in the similarity matrix is ​​compared with the clustering threshold t to achieve a tile color separation.

[0129] If the smallest element in the similarity matrix is ​​less than or equal to the clustering threshold t, it means that the feature should be assigned to the corresponding cluster center, update the feature vector of the corresponding cluster center in the cluster center matrix and the number of images within the cluster center range, update the similarity matrix and the feature matrix of the images to be clustered, and remove the corresponding rows in the similarity matrix and the feature matrix of the images to be clustered;

[0130] If the smallest element in the similarity matrix is ​​greater than the clustering threshold t, it means that the feature should be used as a new cluster center, and the feature vector is used as the new cluster center feature vector. The number of images within the new cluster center range is 1, and the cluster center matrix is ​​updated. According to the above rules, a new row vector is added to the cluster center matrix, and the similarity matrix and the feature matrix of the images to be clustered are updated. The corresponding rows in the similarity matrix and the feature matrix of the images to be clustered are removed.

[0131] After each update, the processed elements are sorted into the corresponding cluster center folders to complete the color separation of the tile.

[0132] (4-3) Realize color separation of all tiles.

[0133] The vector of the next row in the feature matrix image_mat of the images to be clustered is added to the cluster center matrix as a new row vector. The similarity matrix similarity_mat is calculated and updated based on the cluster center matrix and the feature matrix of the images to be clustered. Return to the above step (4-2) and continue to perform subsequent operations until the last row vector in the feature matrix image_mat of the images to be clustered is processed.

[0134] Through the above three steps (4-1), (4-2) and (4-3), n tile images can be separated into colors, thereby completing the color separation of n tiles.

[0135] S106. If the new tile to be detected is of the same type as the previous tile to be detected, the new high-dimensional tile color difference features extracted from the image of the new tile to be separated are added to the feature matrix of the image to be clustered, and the tile color separation is achieved according to the clustering threshold and the feature matrix of the image to be clustered; otherwise, repeat steps S103 to S105 to achieve tile color separation.

[0136] If the new tile to be tested is of the same type as the previous tile to be tested, then:

[0137] Extract new high-dimensional tile color difference features according to the new image of the tile to be color-separated, and add the new high-dimensional tile color difference features to the feature matrix of the image to be clustered;

[0138] According to the feature matrix of the image to be clustered and the previously calculated clustering threshold, the vector clustering of the feature matrix of the image to be clustered is calculated, and each new high-dimensional tile color difference feature is divided into a corresponding color number group to realize tile color separation;

[0139] Otherwise, return to step S103 and continue to perform subsequent operations to achieve new color separation of tiles to be detected.

[0140] Embodiment 2:

[0141] This embodiment is based on the Pycharm development environment, OpenCV computer vision library and Pytorch deep learning framework, among which OpenCV covers a large number of image processing-related encapsulation function interfaces and can complete related image processing tasks; the Pytorch deep learning framework is a Python-first deep learning framework that can not only achieve powerful GPU acceleration, but also support dynamic neural networks; the Pycharm development environment under the Windows platform is currently one of the preferred development environments for completing image processing and machine learning tasks.

[0142] The tile color separation method based on color difference feature extraction provided in this embodiment mainly includes the following steps:

[0143] (1) Obtaining a color difference tile image dataset: The color difference tile image dataset includes tile images with two or more color numbers;

[0144] (2) Training the color difference feature extraction model: The feature extraction model is trained using the color difference tile image dataset;

[0145] (3) Calculating the clustering threshold: Calculating the clustering threshold based on the adaptive clustering threshold algorithm according to the collected image of the tile to be separated;

[0146] (4) Real-time online clustering: The image of the tiles to be separated is input into the color difference extraction model, and the feature matrix of the image to be clustered is constructed by extracting the high-dimensional tile color difference features. Based on the feature matrix of the image to be clustered and the clustering threshold, online clustering is implemented until the color separation task of all tiles is completed.

[0147] Furthermore, the above four steps specifically include:

[0148] (1) Obtain the color difference tile image dataset.

[0149] Firstly, 10,000 tile images of two colors are collected as the color difference tile image dataset; then, the 10,000 tile images of two colors are divided into 8:2, with 4,000 images of color 1 and 4,000 images of color 2 in the training set and 1,000 images of color 1 and 1,000 images of color 2 in the test set.

[0150] All tile images in the training set and the test set are normalized to a fixed size. In this embodiment, all image sizes are normalized to 224*224.

[0151] (2) Train the color difference feature extraction model.

[0152] In this embodiment, in the preprocessing convolution pooling module, the convolution kernel size is 11×11, the step size is 2, and the number of channels is 64; the convolution kernel size of residual modules 1, 2, 3, and 4 of module group 1 is 3×3, the step size is 1, and the number of channels is 64; the convolution kernel size of residual modules 5 and 6 of module group 2 is 3×3, the step size is 2, and the number of channels is 128, and the convolution kernel size of residual modules 7 and 8 is 3×3, the step size is 1, and the number of channels is 1 28; the convolution kernel size of residual modules 9 and 10 of module group 3 is 3×3, the step size is 2, and the number of channels is 256; the convolution kernel size of residual modules 11 and 12 is 3×3, the step size is 1, and the number of channels is 256; the convolution kernel size of residual modules 13 and 14 of module group 4 is 3×3, the step size is 2, and the number of channels is 512; the convolution kernel size of residual modules 15 and 16 is 3×3, the step size is 1, and the number of channels is 512.

[0153] The color difference feature extraction model is trained using the training set, including:

[0154] The Adam algorithm is used as the optimization parameter of the model, the training cycle is set to 200, the batch size is set to 256, and the learning rate is set to 0.0001. The model training is completed so that the model converges and the color difference feature extraction model is obtained.

[0155] (3) Calculate the clustering threshold.

[0156] The number n of images to be clustered is 100 (simulating that there are 100 images that need to be separated and clustered in actual production). When calculating the threshold, 10 images are randomly selected. The collected image size is 8192×8192, and the pixels are (0, 0, 4096, 4096), (4096, 0, 8192, 4096), (0, 4096, 4096, 8192), and (4096, 4096, 8192, 8192) respectively.

[0157] The four pixel regions are copied and translated to construct four new images of size 8192×8192. These four images are normalized and input into the color difference feature extraction model to obtain the corresponding feature vector F A 、F B 、F C 、F D . Calculate the Euclidean distance between the four eigenvectors and calculate the average. Repeat the above steps for 10 images to obtain 10 average values ​​{f 1 ,f 2 ,…,f 9 ,f 10}, parameter α is 1, find f 1 to f 10 The clustering threshold t is obtained by taking the average value of

[0158] (4) Real-time online clustering.

[0159] (4-1) When the algorithm is initialized.

[0160] Initialize the algorithm, normalize 100 images to be clustered and input them into the color difference feature extraction model, output image features and input them into the image feature matrix image_mat to be clustered, the size is 100×512, 100 is the number of images to be clustered, 512 is the 512-dimensional color difference feature vector output by the color difference feature extraction model of the clustered image; update the cluster center matrix cluster_mat to 1×513, where 1 is the number of cluster centers, the first 512 columns are the feature vectors of the cluster centers, and the 513th column is the number of images within the range of the cluster center; update the first row in the image feature matrix image_mat to be clustered as the first cluster center to the cluster center matrix; calculate and update the similarity matrix similarity_mat based on the cluster center matrix and the image feature matrix to be clustered, at this time the similarity matrix size is 1×100, where l is the number of rows in the cluster center matrix, i.e. the number of cluster centers, and 100 is the number of rows in the image feature matrix to be clustered, i.e. the number of images to be clustered. The element values ​​in the similarity matrix are calculated according to the following formula:

[0161] similarity_mat(x, y)=d(cluster_mat[x], image_mat[y])

[0162]

[0163] Among them, x and y are the x-th row feature vector of the cluster center matrix and the y-th row vector of the feature matrix of the image to be clustered, respectively, and p is the p-th dimension in the x and y vectors.

[0164] (4-2) After the clustering algorithm is initialized, the size relationship between the smallest element in the similarity matrix and the clustering threshold t is compared to achieve tile color separation.

[0165] Find the relationship between the smallest element in the similarity matrix and the clustering threshold t: if the element in the similarity matrix is ​​less than the clustering threshold t, it means that the feature should be assigned to the corresponding cluster center, update the feature vector of the corresponding cluster center in the cluster center matrix and the number of images within the cluster center range, update the similarity matrix and the feature matrix of the images to be clustered, and remove the corresponding rows in the similarity matrix; if the smallest element in the similarity matrix is ​​greater than the clustering threshold t, it means that the feature should be used as a new cluster center, and the feature vector is used as the new cluster center feature vector. The number of images within the new cluster center range is 1, and the cluster center matrix is ​​updated. According to the above rules, a new row vector is added to the cluster center matrix, and the similarity matrix and the feature matrix of the images to be clustered are updated, and the corresponding rows in the similarity matrix are removed; after each update, the processed elements are sorted into the corresponding cluster center folders to complete the color separation of the tile.

[0166] Those skilled in the art will appreciate that all or part of the steps in the method for implementing the above embodiments may be completed by instructing related hardware through a program, and the corresponding program may be stored in a computer-readable storage medium.

[0167] It should be noted that although the method operations of the above embodiments are described in a specific order in the accompanying drawings, this does not require or imply that these operations must be performed in this specific order, or that all the operations shown must be performed to achieve the desired results. On the contrary, the steps depicted can be performed in a different order. Additionally or alternatively, some steps can be omitted, multiple steps can be combined into one step, and / or one step can be decomposed into multiple steps.

[0168] Embodiment 3:

[0169] like Figure 3As shown, this embodiment provides a tile color separation system based on color difference feature extraction, the system includes an image acquisition module 301, a clustering threshold calculation module 302, a tile color difference feature extraction module 303, a first tile color separation module 304 and a second tile color separation module 305, wherein:

[0170] Image acquisition module 301, used to acquire images of tiles to be separated into different colors;

[0171] The clustering threshold calculation module 302 is used to randomly select a small number of tile images from the image of the tile to be separated, and calculate the clustering threshold using an adaptive clustering threshold algorithm based on the small number of tile images;

[0172] The tile color difference feature extraction module 303 is used to input the image of the tile to be separated into colors into the color difference feature extraction model to extract the high-dimensional tile color difference features;

[0173] The first tile color separation module 304 is used to construct a feature matrix of the image to be clustered according to the high-dimensional tile color difference feature; realize online clustering according to the clustering threshold and the feature matrix of the image to be clustered, and complete the color separation of all tiles to be detected;

[0174] The second tile color separation module 305 is used to extract new high-dimensional tile color difference features based on the image of the new tile to be color separated, and add the new high-dimensional tile color difference features to the feature matrix of the image to be clustered if the new tile to be detected is of the same type as the previous tile to be detected; realize online clustering according to the feature matrix of the image to be clustered and the clustering threshold to complete the color separation of the tile to be detected; otherwise, return to collect the image of the tile to be color separated, and continue to perform subsequent operations to realize tile color separation.

[0175] The specific implementation of each module in this embodiment can refer to the above-mentioned embodiment 1, which will not be described one by one here; it should be noted that the system provided in this embodiment is only illustrated by the division of the above-mentioned functional modules. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure can be divided into different functional modules to complete all or part of the functions described above.

[0176] Embodiment 4:

[0177] This embodiment provides a computer device, which may be a computer, such as Figure 4As shown, a processor 402, a memory, an input device 403, a display 404 and a network interface 405 connected via a system bus 401 are provided. The processor is used to provide computing and control capabilities. The memory includes a non-volatile storage medium 406 and an internal memory 407. The non-volatile storage medium 406 stores an operating system, a computer program and a database. The internal memory 407 provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. When the processor 702 executes the computer program stored in the memory, the tile color separation method of the above-mentioned embodiment 1 is implemented as follows:

[0178] Collect images of tiles to be separated into different colors;

[0179] A small number of tile images are randomly selected from the images of tiles to be color-separated, and a clustering threshold is calculated using an adaptive clustering threshold algorithm based on the small number of tile images;

[0180] Input the image of the tile to be color-separated into the color difference feature extraction model to extract the high-dimensional tile color difference features;

[0181] According to the high-dimensional tile color difference features, a feature matrix of the image to be clustered is constructed; according to the clustering threshold and the feature matrix of the image to be clustered, online clustering is realized to complete the color separation of all tiles to be detected;

[0182] If the new tile to be detected is of the same type as the previous tile to be detected, then based on the image of the new tile to be separated, the new high-dimensional tile color difference feature is extracted, and the new high-dimensional tile color difference feature is added to the feature matrix of the image to be clustered; based on the feature matrix of the image to be clustered and the clustering threshold, online clustering is realized to complete the color separation of the tile to be detected; otherwise, the image of the tile to be separated is collected, and subsequent operations are continued to realize the color separation of the tile.

[0183] Embodiment 5:

[0184] This embodiment provides a storage medium, which is a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the tile color separation method of the above embodiment 1 is implemented as follows:

[0185] Collect images of tiles to be separated into different colors;

[0186] A small number of tile images are randomly selected from the images of tiles to be color-separated, and a clustering threshold is calculated using an adaptive clustering threshold algorithm based on the small number of tile images;

[0187] Input the image of the tile to be color-separated into the color difference feature extraction model to extract the high-dimensional tile color difference features;

[0188] According to the high-dimensional tile color difference features, a feature matrix of the image to be clustered is constructed; according to the clustering threshold and the feature matrix of the image to be clustered, online clustering is realized to complete the color separation of all tiles to be detected;

[0189] If the new tile to be detected is of the same type as the previous tile to be detected, then based on the image of the new tile to be separated, the new high-dimensional tile color difference feature is extracted, and the new high-dimensional tile color difference feature is added to the feature matrix of the image to be clustered; based on the feature matrix of the image to be clustered and the clustering threshold, online clustering is realized to complete the color separation of the tile to be detected; otherwise, the image of the tile to be separated is collected, and subsequent operations are continued to realize the color separation of the tile.

[0190] It should be noted that the computer-readable storage medium of the present embodiment may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0191] The above is only a preferred embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can make equivalent replacements or changes according to the technical solution and inventive concept of the present invention within the scope disclosed by the present invention, which shall fall within the protection scope of the present invention.

Claims

1. A tile color separation method based on color difference feature extraction, characterized in that, the method includes: Collecting images of n tiles to be color-separated; n≥10; Randomly selecting a small number of tile images from the images of tiles to be color-separated, and calculating a clustering threshold according to the small number of tile images by using an adaptive clustering threshold algorithm; Inputting the images of tiles to be color-separated into a color difference feature extraction model to extract high-dimensional tile color difference features; Constructing a feature matrix of images to be clustered according to the high-dimensional tile color difference features; realizing online clustering according to the clustering threshold and the feature matrix of images to be clustered to complete the color separation of all tiles to be detected; If the new tile to be detected is of the same type as the previous tile to be detected, extracting new high-dimensional tile color difference features according to the image of the new tile to be color-separated, and adding the new high-dimensional tile color difference features to the feature matrix of images to be clustered; realizing online clustering according to the feature matrix of images to be clustered and the clustering threshold to complete the color separation of tiles to be detected; otherwise, returning to collect the images of tiles to be color-separated and continuing to execute subsequent operations to realize tile color separation; Let the small number of tile images be m; Among them, the calculating the clustering threshold according to the small number of tile images by using an adaptive clustering threshold algorithm includes: Taking m tile images as threshold selection images; For any threshold image n x , divide it evenly into k×k regions, and obtain k×k regional images; where x∈(1,…,m), k is a positive integer greater than 1; Obtaining a feature matrix according to k×k regional images; Calculating the Euclidean distance according to the row vectors in the feature matrix to obtain a distance matrix; Calculate the average value of all elements in the distance matrix to obtain the threshold selection image n x The average color difference distance F x ; The average color difference distance (F 1 ,F 2 ,…,F m ), calculate the clustering threshold; The realizing online clustering according to the clustering threshold and the feature matrix of images to be clustered to complete the color separation of all tiles to be detected includes: Constructing a clustering center matrix according to the feature matrix of images to be clustered; Calculating a similarity matrix according to the feature matrix of images to be clustered and the clustering center matrix; Realizing online clustering according to the similarity matrix and the clustering threshold to complete the color separation of all tiles to be detected.

2. The tile color separation method according to claim 1, characterized in that, Let the size of the image of the tile to be color-separated be a×b; The obtaining a feature matrix according to k×k regional images includes: For any region image A, construct a blank image m of size a×b y , m y Uniformly divide into k×k regions, each of which is a copy of the regional image A; where y∈(1,…,k×k); The k×k region images are obtained by (m 1 ,m 2 ,…,m k×k ) respectively input the color difference feature extraction model to obtain a feature matrix; The color difference distance average value (F 1 ,F 2 ,…,F m ), calculate the clustering threshold, including: Calculating the clustering threshold t according to the following formula: where α is a set value.

3. The tile color separation method according to claim 1, characterized in that, m = n / 10.

4. The tile color separation method according to claim 1, characterized in that, The size of the clustering center matrix is l×(q + 1), where l is the number of clustering centers, the first q columns are the feature vectors of the clustering centers, and the (q + 1)-th column is the number of clustering images within the range of this clustering center; The realizing online clustering according to the similarity matrix and the clustering threshold includes: Updating the feature vector of the first row in the feature matrix of images to be clustered as the first clustering center to the clustering center matrix; j=1; Taking the feature vector of the j-th row in the feature matrix of images to be clustered as the current feature; Calculating a similarity matrix according to the clustering center matrix and the feature matrix of images to be clustered; If the smallest element in the similarity matrix is ​​smaller than the clustering threshold, the current feature is assigned to the corresponding cluster center, the feature vector of the corresponding cluster center in the cluster center matrix and the number of images within the cluster center are updated, and the similarity matrix and the feature matrix of the image to be clustered are updated at the same time; If the smallest element in the similarity matrix is ​​greater than the clustering threshold, the current feature is used as a new cluster center, and the cluster center matrix is ​​updated: the current feature is added to the cluster center matrix, and the number of clustered images within the new cluster center range is 1; the similarity matrix and the feature matrix of the image to be clustered are updated at the same time; j=j+1; The feature vector of the jth row in the feature matrix of the image to be clustered is added as the next cluster center to the cluster center matrix; the feature vector of the jth row in the feature matrix of the image to be clustered is returned as the current feature, and subsequent operations are continued until j>n, that is, the color separation of n tile images is completed.

5. The method for color separation of ceramic tiles according to claim 1, It is characterized in that The size of the feature matrix of the image to be clustered is n×q, where q is the dimension of the tile color difference feature; The size of the cluster center matrix is ​​l×(q+1), where l is the number of cluster centers, the first q columns are the eigenvectors of the cluster centers, and the q+1th column is the number of cluster images within the range of the cluster center; The calculating of the similarity matrix according to the feature matrix of the image to be clustered and the cluster center matrix comprises: According to the following formula, calculate the element similarity_mat(x,y) in the similarity matrix: similarity_mat(x,y)=d(cluster_mat[x],image_mat[y]) Among them, x, y are the x-th row vector of the cluster center matrix and the y-th row vector of the feature matrix of the image to be clustered, respectively, and p is the p-th dimension in the x, y vectors.

6. The method for color separation of ceramic tiles according to claim 1, It is characterized in that Before the image of the tile to be color-separated is input into the color difference feature extraction model, the color difference feature extraction model is trained using the acquired color difference tile image dataset, wherein the color difference tile image dataset is image collection of tiles of various colors under a preset environment, and all collected tile images constitute the color difference tile image dataset, and the preset environment refers to an environment with uniform lighting that can effectively reflect the true color of the tiles.

7. The method for color separation of ceramic tiles according to any one of claims 1 to 6, It is characterized in that The image is normalized to a fixed size before being input into the color difference feature extraction model.

8. A tile color separation system based on color difference feature extraction, It is characterized in that The system comprises: An image acquisition module is used to acquire n images of tiles to be separated; n≥10; The clustering threshold calculation module is used to randomly select a small number of tile images from the image of the tile to be separated, and calculate the clustering threshold by using the adaptive clustering threshold algorithm based on the small number of tile images; The tile color difference feature extraction module is used to input the image of the tile to be color-separated into the color difference feature extraction model to extract the high-dimensional tile color difference features; The first tile color separation module is used to construct a feature matrix of the image to be clustered according to the high-dimensional tile color difference characteristics; realize online clustering according to the clustering threshold and the feature matrix of the image to be clustered, and complete the color separation of all tiles to be detected; The second tile color separation module is used to extract new high-dimensional tile color difference features according to the image of the new tile to be color separated, and add the new high-dimensional tile color difference features to the feature matrix of the image to be clustered if the new tile to be detected is of the same type as the previous tile to be detected; realize online clustering according to the feature matrix of the image to be clustered and the clustering threshold to complete the color separation of the tile to be detected; otherwise, return to collect the image of the tile to be color separated, and continue to perform subsequent operations to realize the color separation of the tile; Assume that there are a small number of tile images, m; The step of calculating the clustering threshold using an adaptive clustering threshold algorithm based on a small amount of tile images includes: Use m tile images as threshold selection images; For any threshold image n x , divide it evenly into k×k regions, and obtain k×k regional images; where x∈(1,…,m), k is a positive integer greater than 1; According to k×k regional images, the feature matrix is ​​obtained; Calculate the Euclidean distance according to the row vectors in the feature matrix to obtain a distance matrix; Calculate the average value of all elements in the distance matrix to obtain the threshold selection image n x The average color difference distance F x ; The average color difference distance (F 1 ,F 2 ,…,F m ), calculate the clustering threshold; The method of realizing online clustering according to the clustering threshold and the feature matrix of the image to be clustered, and completing the color separation of all tiles to be detected, includes: Constructing a cluster center matrix according to the feature matrix of the image to be clustered; Calculating a similarity matrix according to the feature matrix of the image to be clustered and the cluster center matrix; Based on the similarity matrix and the clustering threshold, online clustering is implemented to complete the color separation of all tiles to be detected.

Citation Information

Patent Citations

  • Generated color difference detection model and ceramic tile color separation method and device

    CN111160476A

  • Few-sample ceramic tile color separation method based on color space features

    CN113724339A