A method for constructing a classification and recognition model for minority art works
By constructing a classification recognition model, the problem of difficulty for designers to distinguish characteristics when applying minority art works is solved, efficient classification and identification of minority art works is achieved, and valuable national and folk cultural heritage is protected and inherited.
Patent Information
- Application Number
- CN202411900105.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-04-08
AI Technical Summary
When designers apply minority art works, it is difficult for them to accurately distinguish the characteristics of different ethnic groups' art works, resulting in confusion in the use scenarios.
A classification recognition model is constructed, and by collecting and preprocessing data of ethnic minority characteristic patterns, defining feature extraction models and relationship models, and performing model training to achieve multi-dimensional feature recognition and classification of ethnic minority art works.
It has improved the classification efficiency and accuracy of ethnic minority cultural works, and can accurately identify and classify ethnic folk works in complex backgrounds and diverse styles, making it easier to manage and protect cultural heritage.
Smart Images

Figure CN119785097A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing, and in particular to a method for constructing a classification and recognition model for minority art works. Background Art
[0002] With the advancement of globalization and digitalization, people are increasingly eager to explore and experience the unique charm of diverse cultures; ethnic minority artworks, with their unique colors, forms and connotations, meet this demand and become an important bridge connecting different cultures and promoting cultural exchanges. In this context, the application scope of ethnic minority artworks is becoming more and more extensive. From cultural teaching to fashion design to interior decoration, and then to industrial product appearance design, ethnic minority art elements have become an important means to increase the added value of products. However, there are many types of ethnic minority artworks, and large-scale application still faces many challenges. For example, designers need to have a deep understanding of ethnic culture before they can understand the meaning of colors and patterns in the works of the ethnic group; for another example, multiple ethnic groups have similar characteristic cultural and artistic works, such as: the Miao and Buyi people both have characteristic art works silver jewelry, but the typical patterns of Miao silver jewelry include animals and insects, and the typical patterns of Buyi silver jewelry are flowers. When designers apply ethnic minority artworks, it is difficult to accurately distinguish these characteristics.
[0003] In order to avoid confusion among designers when applying ethnic artworks due to a lack of in-depth understanding of their background, a technical solution is needed to identify the features of ethnic minority artworks in multiple dimensions. Summary of the invention
[0004] To achieve the above purpose, the present application provides a method for constructing a classification and recognition model for minority art works, comprising the following steps:
[0005] Collect original data, which are ethnic minority characteristic patterns. The composition of characteristic patterns includes: ethnic type, pattern type, work type and color type; pattern types include: geometric patterns, plant patterns, animal patterns, and humanistic patterns; work types include: batik, silver ornaments, embroidery, and carving; color types include: red, blue, and green;
[0006] Data preprocessing: labeling, cleaning and transforming the original data to generate a data set of ethnic minority patterns. The data set includes pattern files and category labels.
[0007] Define the relationship model, including: define the feature extraction model, define the characteristic pattern standard and label tensor, set the output mode of the classification recognition model, select the loss function, and associate the features with the components;
[0008] Conduct model training on the relationship model and build a classification and recognition model;
[0009] Among them, a feature extraction model is defined to extract feature vectors of characteristic patterns from a minority characteristic pattern data set and construct a characteristic pattern feature set; wherein the feature vector is a combination of low-level features of the characteristic pattern and a feature matrix; the feature vector is composed of vector fragments representing the constituent content.
[0010] Among them, the characteristic pattern standards include image width, image height and number of channels; the label tensor is composed of four layers of pattern classification, each layer of classification corresponds to a binary vector, and the binary vectors store the characteristics of ethnic type, pattern type, work type, and color type respectively; the length of the vector storing the ethnic type is 55, the length of the vector storing the work type is 10, the length of the vector storing the pattern type is 10, and the length of the vector storing the color type is 12; the label tensor is a one-hot encoded vector with a length of 87.
[0011] Wherein, setting the output mode of the classification recognition model means: the output mode of the classification recognition model corresponds to the composition of the characteristic pattern, and an output is set for each composition;
[0012] Among them, the ethnic classification output is a probability distribution vector with a length of 55, which represents the probability distribution of the output ethnic classification;
[0013] The output of the work type is a probability distribution vector of length 10, which represents the probability distribution of the work type classification;
[0014] The pattern type output is a probability distribution vector of length 10, which represents the probability distribution of the output pattern type classification;
[0015] The color classification output is a probability distribution vector of length 12, which represents the probability distribution of the output color classification.
[0016] Among them, the loss function is the cross entropy loss function. The loss function performs four loss function calculations on the four-layer classification, and sums up the calculation results of each time as the final loss function calculation result;
[0017] Wherein, the cross entropy function is expressed as: Among them, N is the number of samples, K is the number of categories, and y ij is the true label, p ij is the probability of the predicted classification and L is a scalar value representing the gap between the model prediction and the true label.
[0018] Further, extracting the feature vector of the characteristic pattern in the ethnic minority characteristic pattern data set includes the following steps:
[0019] Convert the characteristic pattern image into a 224×224×3 3D matrix;
[0020] Use the 3D matrix as the original data for convolution calculation to obtain a low-level feature matrix. The low-level feature matrix contains features such as the edge, corner points, and texture of the ethnic minority pattern.
[0021] The low-level feature matrix is used as the original data to perform multiple residual block calculations to obtain the feature matrix, which combines the low-level features of ethnic minority art pictures and the semantic features corresponding to the low-level features.
[0022] Furthermore, the characteristics and components are associated with:
[0023] The feature vectors are defined as content categories, where the types of content categories are ethnicity, work, pattern, and color. The feature vectors are used to map feature matrices of the types of content categories.
[0024] Define multiple feature learning tasks to associate content classification and characteristic patterns;
[0025] Among them, each feature learning task has a dedicated output layer and a fully connected layer activation function to realize the prediction of the content classification.
[0026] Furthermore, the data preprocessing also includes: unifying the ethnic minority characteristic patterns into a standard size, wherein the standard size refers to: a width of 224, a height of 224 and 3 channels.
[0027] Before data annotation, a label index mapping table is defined to record the relationship between the label and the output vector. The structure of the label index mapping table includes: content, type, and index value.
[0028] Furthermore, each of the feature learning tasks has a dedicated output layer and a fully connected layer activation function to implement predictions of content classification including: ethnic type prediction, color type prediction, work type and pattern type prediction.
[0029] Among them, ethnic type prediction includes:
[0030] The input information of the ethnic classification task is determined to be the feature vector of the minority characteristic pattern, and the output information of the ethnic classification task is determined to be the probability distribution of the feature vector among 55 ethnic groups;
[0031] Initialize the weight matrix and bias, the size of the weight matrix and bias corresponds to the number of ethnic groups, the weight matrix is defined as 2048×55, and the size of the bias is 1×55;
[0032] A linear function is defined to obtain a 1×55 vector, wherein the 55 elements in the vector represent the scores of the 55 ethnic groups; the linear function is expressed as: z=w×f+b, wherein w is a weight matrix, f is a feature vector, b is a bias, and z is a score vector;
[0033] The softmax function is used to convert the score vector z into the probability score of each ethnic group.
[0034] According to the present invention, the classification efficiency and accuracy of ethnic minority cultural works can be improved, and it is suitable for accurately identifying and classifying ethnic folk works in complex backgrounds and diverse styles. The application of the classification and recognition model provided by the present invention can efficiently manage and organize a large number of ethnic folk works, facilitate subsequent research and utilization, and through accurate classification, it can better protect and inherit the precious ethnic folk cultural heritage, and provide reliable data support for related research and education. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 It is a schematic diagram of the steps of a method for constructing a classification recognition model provided according to an embodiment of the present invention. DETAILED DESCRIPTION
[0036] The patterns and colors in ethnic minority cultural works not only reflect the aesthetic tendencies and cultural accumulation formed by the ethnic group in the long river of history, but also reflect its unique aesthetic taste and cultural identity; and the types of works reveal the development and evolution of the ethnic group in terms of living habits, living environment and technical skills. In view of this feature, the present invention proposes a method for constructing a classification recognition model for realizing the recognition of ethnic minority art works. In the process of constructing the classification recognition model, the ethnic minority characteristic patterns are classified in terms of pattern, color and work dimensions, feature extraction and model training are carried out to realize the construction of the classification recognition model; in the process of sample preparation, the multi-dimensional features of the pattern are extracted to form a feature data set based on the characteristics of multiple dimensions of ethnic minority art works, and a relationship model combined with the pattern characteristics is defined for the feature data set, and subsequent training is carried out to form a classification recognition model applied to ethnic minority art works.
[0037] The specific implementation of the present invention is described in detail below with reference to the accompanying drawings.
[0038] Figure 1 A method for constructing a classification and recognition model for minority art works is provided, comprising the following steps:
[0039] Step S100: collecting original data, the original data is a pattern with ethnic minority characteristics;
[0040] In this step, it is necessary to collect enough data for model learning. The data collected in the present invention are patterns with ethnic minority characteristics, and the composition content can be reflected from the patterns.
[0041] Specifically, the composition of ethnic minority characteristic patterns includes four aspects: ethnic type, pattern type, work type and color type;
[0042] The ethnic groups include 55 ethnic groups such as Miao, Dong, Tujia, Yao, Buyi, Yi, Shui, etc.
[0043] The pattern types include ten types of patterns, including how patterns, plant patterns, animal patterns, and human patterns;
[0044] The types of works include ten forms of display such as batik, silver jewelry, embroidery, and carving;
[0045] The color types include 12 typical colors such as red, blue, green, etc.
[0046] Step S110: data preprocessing, labeling, cleaning and converting the original data to generate a minority characteristic pattern data set, which includes pattern files and category labels;
[0047] In this step, when data annotation is performed, ethnic folk culture labels representing cultural characteristics are defined for each image, including ethnic type, work type, pattern type, and color type;
[0048] This label is associated with the output vector of the subsequent classification and recognition model. Therefore, before defining the cultural label, define a label index mapping table to record the relationship between the label of each category and the output vector. The structure of the label index mapping table includes: content, type, and index value. For example, in the ethnic classification, index 1 represents the Miao nationality, and index 2 represents the Bouyei nationality. In the color classification, index 1 represents red, and index 2 represents black, etc.
[0049] In this step, data cleaning is also performed, and the ethnic minority patterns are converted into a format suitable for model processing: while ensuring data quality, the data patterns are unified in size: width is 224, height is 224, and channels are 3 channels.
[0050] When cleaning the data, use image similarity detection tools to check and delete duplicate pattern images, remove irrelevant and fuzzy meaningless patterns, and apply methods such as rotation, flipping, scaling, brightness adjustment, and noise addition to increase data diversity.
[0051] After the cleaning is completed, the folder structure is defined according to the composition content, and a CSV file is created to record the metadata of each ethnic minority pattern, including pattern path, category label, description information, etc. A minority pattern dataset is formed by combining pattern folders and CSV files.
[0052] Furthermore, the dataset is divided into training set, validation set and test set, with the commonly used ratio being 70% training set, 15% validation set and 15% test set.
[0053] Step S120: defining a relationship model, including: defining a feature extraction model, defining a characteristic pattern standard and a label tensor, setting an output mode of a classification recognition model, selecting a loss function, and associating features with components;
[0054] Firstly, a feature extraction model is defined. The feature extraction model is used to extract feature vectors from the pattern files and category labels of the ethnic minority characteristic pattern dataset and construct a characteristic pattern feature dataset.
[0055] In the present invention, the characteristic vector of the characteristic pattern is a combination of the low-level features and the characteristic matrix of the ethnic minority characteristic pattern, that is, the characteristic vector is composed of vector fragments representing the content of the pattern;
[0056] Extracting feature vectors includes the following steps:
[0057] 1) Corresponding to the standard of the patterns in the ethnic minority characteristic pattern dataset, the pictures of the characteristic patterns are converted into a 224×224×3 3-dimensional matrix;
[0058] 2) The initial layer is a convolutional layer, which obtains the low-level features of ethnic minority art pictures through convolution calculation.
[0059] In the specific implementation, the 3D matrix is used as the original data for convolution calculation to obtain a low-level feature matrix with simple features; the low-level feature matrix contains features such as edges, corners, and textures of ethnic minority characteristic patterns;
[0060] When performing convolution calculations, the sliding convolution kernel is used to perform local point multiplication and weighted summation on the matrix, the calculated values are used to form a new matrix, and the new matrix is subjected to maximum pooling calculations.
[0061] In order to capture enough image features from ethnic minority patterns and cover more pixel areas, the size of the convolution kernel for obtaining low-level features is set to a 7×7 matrix, and the Kaiming initialization method is used to initialize the value of the convolution kernel (convolution and weight); then the convolution kernel is used to move step by step from left to right and from top to bottom on the 3D matrix with a step size of 2. Each time it moves, the 7×7 part of the 3D matrix and the convolution kernel are point multiplied and weighted summed to obtain a scalar value; when the convolution kernel completes the calculation of all 7×7 parts on the 3D matrix, a new picture feature matrix is generated, and the scalar value result obtained each time is calculated as one of the data elements of the picture feature matrix.
[0062] In order to obtain different features of ethnic minority patterns, an initialization parameter bias is introduced during the convolution calculation. The bias is used to adjust the output of the convolution operation so that it can better fit the data. In the present invention, the bias is initialized by the Kaiming initialization method: the 7×7 local 3D matrix is defined as X, the convolution kernel weight is defined as K, and the bias is defined as b. Each time the convolution kernel is moved, a dot multiplication operation and a weighted sum calculation of X and K are performed. After obtaining the scalar, the bias is added to obtain a data element Y of the feature matrix, which is specifically embodied in the formula:
[0063] Y=K×X+b,
[0064] Multiple data elements Y constitute the feature matrix.
[0065] In the process of convolution calculation, the image features that can be obtained by one convolution kernel calculation are far from enough. In order to obtain more comprehensive features of ethnic minority patterns, 64 convolution kernels are set up, and convolution operations are performed in parallel on 224×224×3 ethnic minority patterns, and finally a 112×112×64 low-level feature image matrix is output. Each 112×112 matrix part represents a low-level ethnic minority art image feature.
[0066] In order to reduce the amount of computation in the convolutional layer and speed up model training and reasoning, it is necessary to perform maximum pooling on the calculated feature matrix: set a 3×3 pooling window with a step size of 2, and then use the window to move from left to right and from top to bottom on the feature matrix in steps of 2 to extract the maximum value in each window. When the window finishes moving on the feature matrix in steps, the maximum values obtained in all windows are recombined into a new feature matrix, which not only reduces the dimensionality of the original feature matrix, but also retains the most significant eigenvalues in the original feature matrix; since the maximum pooling calculation is performed with a step size of 2 in this step, the output low-level feature matrix size of ethnic minority art pictures is 56×56×64.
[0067] 3) The low-level feature matrix is used as the original data to perform multiple residual block calculations to obtain a feature matrix with higher-level semantics. The feature matrix combines the low-level features of ethnic minority art pictures and the high-level semantic features corresponding to the low-level features.
[0068] Specifically, the residual block calculation contains many convolution calculations similar to the initial convolution layer. The core idea of the residual block is to superimpose the results of each convolution calculation in the residual block in series through jump connections, thereby retaining the different pattern features calculated by each convolution calculation in the residual block.
[0069] This superposition structure can help the model keep its focus on low-level features while learning complex features of feature patterns, thereby extracting more detailed and advanced semantic information. After multiple layers of residual blocks, the final feature map contains rich high-level information, such as the shape, texture, color distribution, etc. of the object, all of which will be used for category classification in the fully connected layer.
[0070] In order to obtain deeper advanced features of folk art pictures, four residual blocks are set in the present invention, each residual block has two convolutional layers, and the convolution kernels of the two convolutional layers are set to 3×3 and 1×1 respectively; a 3×3 convolution kernel is used to extract new features, and a 1×1 convolution layer is used to increase the number of convolution kernels. Through these two convolutional layers, the dimensions of the features of ethnic minority art pictures are expanded so that more feature information can be obtained.
[0071] Specifically, the 56×56×64 low-level feature matrix of ethnic minority art pictures obtained by initializing the convolution layer is subjected to the first convolution calculation to obtain a 28×28×64 feature matrix, the convolution kernel size of the convolution calculation is 3×3, the number of convolution kernels is 64, and the step length is 2; then the second convolution calculation is performed to obtain a 28×28×256 feature matrix, at this time the convolution kernel size is 1×1, the number of convolution kernels is 256, and the step length is 1. Through two layers of convolution calculation, not only the dimension of the ethnic minority characteristic patterns is expanded from the original 64 to 256, but also the features in the low-level feature matrix are inherited and visualized.
[0072] During the calculation process of the four residual blocks, the calculation result of the first residual block is used as the input of the second residual block, and convolution kernels are added to the second residual block with a number that is four times that of the first residual block to expand the dimension of the features of the ethnic minority art pictures, and finally a 7×7×2048 feature matrix of the ethnic minority art pictures is output.
[0073] Subsequently, the feature matrix is globally averaged and pooled, that is, the average value of each feature dimension in the 2048 feature dimensions is calculated. This preserves the global information of each feature dimension, helps preserve the important features in the feature map, removes redundant information, smoothes the noise in the feature map, and makes the feature vector more stable and robust. The final output result is a 1×2048 feature vector, which realizes the mapping of the feature matrix to the constituent content.
[0074] In the present invention, Resnet50 is selected as the relational model for classifying and identifying minority art works;
[0075] The main purpose of the present invention is to train a relational model so that the relational model can be classified according to the constituent contents of minority art pictures, and the four types are ethnic type, pattern type, work type and color type. In the process of obtaining the characteristics of the minority characteristic pattern, in step S120, a feature vector with high-level characteristics of the minority characteristic pattern is obtained through a series of calculations, and the size of the vector is 2048; in order to map the feature matrix to the classification of the four constituent contents, the present invention adopts a multi-task learning method to associate the characteristics of the image with the ethnic type, pattern type, work type and color type. Each task has a dedicated output layer and a fully connected layer, and uses a suitable activation function to predict the four classifications respectively.
[0076] The definition of the relational model in this step includes the following:
[0077] 1) Define characteristic pattern standards and label tensors: The characteristic pattern standards include image width, image height and number of channels; based on the classification of the constituent content, define the label tensor to consist of four layers of pattern classification, each layer of classification corresponds to a binary vector, and the binary vectors of the four layers of classification respectively store ethnic type, pattern type, work type, and color type; the vector length storing the ethnic type is 55, the vector length storing the work type is 10, the vector length storing the pattern type is 10, and the vector length storing the color type is 12; the label tensor is a one-hot encoded vector with a length of 87.
[0078] 2) setting the output mode of the classification recognition model to correspond to the composition of the characteristic pattern, and setting an output for each composition;
[0079] Among them, the ethnic classification output is a probability distribution vector with a length of 55, which represents the probability distribution of the output ethnic classification;
[0080] The output of the work type is a probability distribution vector of length 10, which represents the probability distribution of the work type classification;
[0081] The pattern type output is a probability distribution vector of length 10, which represents the probability distribution of the output pattern type classification;
[0082] The color classification output is a probability distribution vector of length 12, which represents the probability distribution of the output color classification.
[0083] 3) Select the cross entropy loss function as the loss function. The loss function performs four loss function calculations on the four-layer classification, and sums the calculation results of each time as the final loss function calculation result;
[0084] Wherein, the cross entropy function is expressed as: Among them, N is the number of samples, K is the number of categories, and y ij is the true label, p ij is the probability of the predicted classification and L is a scalar value representing the gap between the model prediction and the true label.
[0085] 4) Characteristics and composition associations include:
[0086] Defining the constituent content classification of the feature vector, wherein the types of the constituent content classification are ethnic type, work type, pattern type and color type; the feature vector is used to map the feature matrix of each type of the constituent content classification;
[0087] defining a plurality of feature learning tasks, associating the constituent content classifications with characteristic patterns;
[0088] Each of the feature learning tasks has a dedicated output layer and a fully connected layer activation function to implement the prediction of the content classification.
[0089] Specifically, the predictions that constitute the content classification include ethnic type prediction, color type prediction, work type prediction, and pattern type prediction.
[0090] Ethnic type prediction: The input information of the ethnic classification task is determined to be the feature vector of the ethnic minority characteristic pattern. The feature vector of the ethnic minority characteristic pattern with a length of 2048 includes the input information of the ethnic classification task. The output is defined as the probability distribution of the feature vector among 55 ethnic minorities. In order to convert the feature vector into a probability distribution, the Kaiming initialization method is used to initialize a weight matrix and a bias. The size of the weight matrix and the bias corresponds to the number of ethnic groups. The size of the weight matrix is 2048×55, and the size of the bias is 1×55. A linear function z=w×f+b is used to obtain a 1×55 vector. The 55 elements in the vector represent the scores of the 55 ethnic groups. In the linear function, w represents the weight matrix, f is the feature vector, b is the bias, and z is the score vector.
[0091] Furthermore, in order to convert the score vector z into probability, the softmax function is used to calculate the probability, which is expressed as: where e is the natural constant e≈2.718, z i Indicates the score of a certain nation, and represents the exponential operation of the ethnicity score. The probability value is between 0 and 1, so the score vector is converted into the probability score of each ethnicity; since the label index mapping table has defined which ethnicity 1 to 55 represent, z1 to z 55 That is, the index value of 55 ethnic groups.
[0092] Color type prediction: There are 12 color classifications in the present invention. The feature vector of the ethnic minority pattern includes the input information of the color classification, and the output is the probability distribution of the feature vector in the 12 colors. Similarly, the Kaiming initialization method is used to initialize the weight matrix and bias. The size of the weight matrix is 2048×12, and the size of the bias is 1×12. The linear function c=m×f+b is used to obtain a 1×12 vector. The 12 elements in the vector represent the scores of the 12 colors. In the linear function, m represents the weight matrix, f is the feature vector, b is the bias, and c is the score vector. The softmax function is used to obtain the probability distribution of each color, where c1 to c 12 Represents the probability of matching each color.
[0093] The work type and pattern type are processed using a task similar to ethnic classification. The difference from the ethnic classification task is that the initialization weight matrix size is different.
[0094] Step S140: Perform model training on the relationship model to construct a classification recognition model.
[0095] In the present invention, after obtaining the high-level feature vectors of ethnic minority characteristic patterns, the relationship model is made to learn how to classify through four different classification tasks, and the learning process is the process of training the model. During the model training process, the weight matrix bias is continuously adjusted according to the loss function to construct a classification recognition model.
[0096] The training process specifically includes the following:
[0097] Set the input. Based on the model Resnet50 and the existing characteristic pattern dataset, the input parameters are set as follows: preprocessed image files of ethnic minority characteristic patterns (width: 224, height: 224, channels: 3 channels) and a two-dimensional label tensor. The label tensor consists of four layers of pattern classification, each layer of classification corresponds to a binary vector, and the label is defined according to the label index mapping table. For example, the Miao ethnic group is: [1,0,0,...,0] (vector length is 55), silver ornaments [0,1,...,0,0] (vector length is 10), animal patterns [0,0,1,...,0] (vector length is 10), blue [0,0,0,1,...0] (vector length is 12), which together form a one-hot encoding vector of length 55+10+10+12=87.
[0098] Set the output, set an output for each classification, including using a probability distribution vector with a length of 55 to represent the ethnic classification output, using a probability distribution vector with a length of 10 to represent the work classification output, using a probability distribution vector with a length of 10 to represent the pattern classification output, and using a probability distribution vector with a length of 12 to represent the color classification output; merge the outputs of each type into a vector with a length of 78 as the unified output of the model.
[0099] Loss function, the loss function for classification selects the cross entropy loss function, the cross entropy function is as follows:
[0100]
[0101] The output of this function is a scalar value that represents the difference between the model prediction and the true label. The smaller the loss value, the closer the model's prediction is to the true label; the larger the loss value, the greater the difference in the prediction results. During the training process, the model parameters are optimized by minimizing the value of the loss function. The change in the loss value can be used to judge the improvement of the model performance. If the loss value continues to decrease, it means that the model is gradually learning; if the loss value no longer decreases or increases, it may be necessary to adjust the learning rate or other hyperparameters.
[0102] Model training: After preparing the data set, setting the input and output, and confirming the loss function, you can start model training. Model training is a cyclic process, and each cycle must perform the following steps: 1. Forward propagation, 2. Calculate the loss, 3. Backward propagation. After multiple cycles of the above steps and constantly adjusting the calculation parameters, the parameters that are most likely to be classified as the final parameters of the model are determined:
[0103] First, the data set is input into the model in batches. After the steps of associating features with components, the model outputs a classification prediction result. This process is called forward propagation. Then, the loss calculation between the prediction result and the true result is performed. At this time, the effective classification result is passed to the model through the data set input. After calculating the predicted classification result, the loss result is calculated for each classification prediction result and the effective result through the loss function. The true label vector is a one-hot encoding vector with a length of 87, recorded as y, and the predicted result is also a vector with a length of 87, recorded as p. The loss function is recorded as:
[0104]
[0105] Where N represents the number of data sets for batch training, K is the number of categories (in this invention, the total number of 4 categories is 87), y is ij is the characteristic coefficient, p ij is a probability value between 0 and 1; when y ij 0 has no meaning. ij 1 indicates a specific classification, while in log(p ij ) If p ij The closer to 1, the higher the log(p ij ) is closer to 0, and 0 multiplied by any number is 0, so p ij The closer it is to 1, the smaller the loss function calculation result is, indicating that the predicted classification is more accurate. ij is much smaller than 1, then log(p ij ) is a negative number. Its absolute value is taken to participate in the loss function calculation. The larger the result, the less accurate the predicted classification. ij When it is 1, the effective judgment is made. If it is 0, the calculated loss value is always 0, because y ij When it is 0, there is no classification meaning. ij If it is much less than 1, it means that the prediction is inaccurate, and it is necessary to modify the parameters in the model (weight matrix and bias) to adjust the result of the loss function.
[0106] After the loss function is calculated, if the loss value fails to reach the set target value, the back propagation algorithm is used to adjust the linear parameters in the model to prepare for the next round of training cycles. Specifically, the ResNet50 model uses the back propagation algorithm to update its weights and bias parameters during the forward propagation process. These updated parameters are then applied to the forward propagation of the model, providing an optimized basis for the next round of training iterations. This process is a key step in deep learning training, which ensures that the model can gradually approach the optimal solution.
[0107] By continuously executing the above model training process, closely monitor the changes in the loss value on the training set. When the loss value is observed to remain stable for multiple consecutive training cycles and there is no significant downward trend, it can be determined that the model has reached a convergence state. At this point, it can be considered that the performance and parameters of the model have tended to be stable, and this is used as a judgment condition to terminate the current training cycle. At this point, a classification recognition model is constructed. The application of the judgment condition helps to avoid overfitting and ensure that the model has achieved the best learning effect on the training data.
[0108] After the model training is completed, the model can also be verified to determine the effectiveness of the classification recognition model: evaluate the performance of the model through the validation set, record the loss and accuracy on the validation set, and use the early stopping strategy to avoid overfitting. Plot the loss and accuracy curves of the training set and validation set to observe the convergence of the model and the overfitting / underfitting phenomenon. Commonly used verification indicators include accuracy, precision, recall, F1 score, and confusion matrix, which can help comprehensively evaluate the performance of the model in different categories.
[0109] In order to improve the performance and generalization ability of the model, a variety of optimization methods can be used to achieve model optimization. First, tune the hyperparameters through grid search, random search or Bayesian optimization to find the optimal model configuration; second, use data enhancement techniques such as rotation, scaling, cropping, flipping and color transformation to increase the diversity of training data; in addition, apply L1 / L2 regularization and Dropout regularization techniques to prevent overfitting; if the amount of data is insufficient, consider collecting more training data or using generative adversarial networks (GANs) to generate synthetic data; finally, through ensemble learning methods such as voting, weighted averaging or stacking, combine the prediction results of multiple models to further improve classification performance.
[0110] At this point, the classification recognition model can be deployed to the production environment: first, select a suitable deployment platform, such as using a local server; second, export the model to the standard format Torchscript format, and ensure that the model file and related dependencies are intact; then, configure the model service, use containerization technology such as Docker to encapsulate the model and operating environment to ensure consistency and portability; then, set up the API interface, use the FastAPI framework to develop a RESTful API, and provide model reasoning services; finally, perform performance testing and monitoring to ensure the stability and responsiveness of the model in the production environment, and set up logging and exception handling mechanisms to promptly discover and solve problems. Through these steps, you can ensure that the model runs efficiently and stably in the production environment.
[0111] In specific applications, a data warehouse of pictures with ethnic and folk cultural content is collected for model training. After the classification and recognition model is trained, a calling interface is provided and deployed in the ethnic and folk cultural related systems. Users can upload pictures of ethnic minority art. After receiving the pictures, the system will perform standardization on the pictures. The processing method is similar to the picture preprocessing when training the model. The pictures are transmitted to the classification and recognition model through the interface, and the classification and recognition model will return the predicted classification of the picture to the user.
[0112] The works of art of ethnic minorities in my country are diversified and have deep-level characteristics. In the use of colors and patterns, different regions and ethnic groups have different styles. In the use of processing methods, they also show exquisite skills with regional characteristics. The characteristics often displayed in terms of color, pattern, and work type can distinguish the national cultural background to which a work belongs. Professionals need a lot of accumulation to accurately identify the background of ethnic minority art works from these dimensions, such as the pattern differences and color characteristics of different ethnic groups; at the same time, traditional manual classification methods are time-consuming and laborious, and are prone to subjective judgment errors. The technical solution provided by the present invention conducts in-depth analysis of the pattern differences, color characteristics and work types displayed in the pictures of cultural works of 55 ethnic minorities in my country, establishes a mapping relationship between the characteristics of the pictures and the multidimensional characteristics, and constructs a classification recognition model through this relationship, which can not only improve the classification efficiency and accuracy of ethnic minority cultural works, but also adapt to complex backgrounds and diverse styles, and accurately identify and classify ethnic folk works. The application of the technical solution provided by the present invention can efficiently manage and organize a large number of ethnic folk works, which is convenient for subsequent research and utilization. And through precise classification, we can better protect and inherit precious national and folk cultural heritage and provide reliable data support for related research and education.
[0113] The above disclosures are only several specific embodiments of the present invention; however, the present invention is not limited thereto, and any changes that can be conceived by those skilled in the art should fall within the protection scope of the present invention.
Claims
1. A method for constructing a classification and recognition model for minority art works, characterized in that: The following steps are involved: Collecting original data, the original data is the characteristic patterns of ethnic minorities, the composition of the characteristic patterns includes: ethnic type, pattern type, work type and color type; the pattern types include: geometric patterns, plant patterns, animal patterns, humanities patterns, the work types include: batik, silver ornaments, embroidery, carving, the color types include: red, blue, green; Data preprocessing, labeling, cleaning and transforming the raw data to generate a minority pattern dataset, wherein the minority pattern dataset includes a pattern file and a category label; Define the relationship model, including: define the feature extraction model, define the characteristic pattern standard and label tensor, set the output mode of the classification recognition model, select the loss function, and associate the features with the components; Performing model training on the relationship model to construct a classification and recognition model; Among them, the defined feature extraction model is used to extract the feature vector of the characteristic pattern from the minority characteristic pattern data set to construct a characteristic pattern feature set; the feature vector is a combination of the low-level features and the feature matrix of the characteristic pattern; the feature vector is composed of vector fragments representing the constituent content.
2. The construction method according to claim 1, characterized in that: The characteristic pattern standard includes image width, image height and number of channels; the label tensor consists of four layers of pattern classification, each layer of classification corresponds to a binary vector, and the binary vectors store the characteristics of ethnic type, pattern type, work type, and color type respectively; the length of the vector storing the ethnic type is 55, the length of the vector storing the work type is 10, the length of the vector storing the pattern type is 10, and the length of the vector storing the color type is 12; the label tensor is a one-hot encoded vector with a length of 87.
3. The construction method according to claim 1, characterized in that: The setting of the output mode of the classification recognition model means that the output mode of the classification recognition model corresponds to the composition of the characteristic pattern, and an output is set for each composition; Among them, the ethnic classification output is a probability distribution vector with a length of 55, which represents the probability distribution of the output ethnic classification; The output of the work type is a probability distribution vector of length 10, which represents the probability distribution of the work type classification; The pattern type output is a probability distribution vector of length 10, which represents the probability distribution of the output pattern type classification; The color classification output is a probability distribution vector of length 12, which represents the probability distribution of the output color classification.
4. The construction method according to claim 2, characterized in that: The loss function is a cross entropy loss function, which performs four loss function calculations on the four-layer classification, and sums up the calculation results of each time as the final loss function calculation result; Wherein, the cross entropy function is expressed as: Among them, N is the number of samples, K is the number of categories, and y ij is the true label, p ij is the probability of the predicted classification and L is a scalar value representing the gap between the model prediction and the true label.
5. The construction method according to claim 1, characterized in that: The extracting of the feature vector of the characteristic pattern in the ethnic minority characteristic pattern data set comprises the following steps: Convert the characteristic pattern image into a 224×224×3 3-dimensional matrix; Using the three-dimensional matrix as original data to perform convolution calculation, obtaining a low-level feature matrix, wherein the low-level feature matrix contains features including edges, corner points, and textures of ethnic minority characteristic patterns; The low-level feature matrix is used as original data to perform multiple residual block calculations to obtain a feature matrix, which combines the low-level features of ethnic minority art pictures and the semantic features corresponding to the low-level features.
6. The construction method according to claim 1, characterized in that: The characteristics and composition associations include: Defining the content classification of the feature vector, the types of the content classification are ethnic type, work type, pattern type and color type; the feature vector is used to map the feature matrix of the type of the content classification; defining a plurality of feature learning tasks, associating the constituent content classifications with the characteristic patterns; Each of the feature learning tasks has a dedicated output layer and a fully connected layer activation function to realize the prediction of the content classification.
7. The construction method according to claim 1, characterized in that: The data preprocessing further includes: unifying the ethnic minority characteristic patterns into a standard size, wherein the standard size refers to: a width of 224, a height of 224 and 3 channels.
8. The construction method according to claim 1, characterized in that: Before the data is labeled, a label index mapping table is defined to record the relationship between the label and the output vector. The structure of the label index mapping table includes: content, type, and index value.
9. The construction method according to claim 6, characterized in that: Each of the feature learning tasks has a dedicated output layer and a fully connected layer activation function to implement predictions of content classification including: ethnic type prediction, color type prediction, work type and pattern type prediction.
10. The construction method according to claim 9, characterized in that: The ethnic type predictions include: The input information of the ethnic classification task is determined to be the feature vector of the minority characteristic pattern, and the output information of the ethnic classification task is determined to be the probability distribution of the feature vector among 55 ethnic groups; Initialize the weight matrix and bias, the size of the weight matrix and bias corresponds to the number of ethnic groups, the weight matrix is defined as 2048×55, and the size of the bias is 1×55; A linear function is defined to obtain a 1×55 vector, wherein the 55 elements in the vector represent the scores of the 55 ethnic groups; the linear function is expressed as: z=w×f+b, wherein w is a weight matrix, f is a feature vector, b is a bias, and z is a score vector; The softmax function is used to convert the score vector z into the probability score of each ethnic group.