Method and device for predicting character image classification, computer equipment and storage medium

By extracting and combining image feature index values ​​of multiple feature categories, the problem of inaccurate prediction results caused by changes in clothes color under different lighting conditions is solved, and higher recognition accuracy and stability are achieved.

CN119540997AActive Publication Date: 2025-02-28INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411639091.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-15
Publication Date
2025-02-28
Estimated Expiration
2044-11-15

AI Technical Summary

Technical Problem

Under different lighting conditions, the colors of the same clothes will be different, resulting in inaccurate prediction results for laboratory wear inspections.

Method used

By obtaining the target person's image, extracting image feature index values ​​from multiple feature categories (such as color, texture, and outline), combining preset weight values ​​and clustering models, a comprehensive image feature index value is constructed, thereby improving the recognition accuracy.

Benefits of technology

This method can describe each pixel in the image more comprehensively, make up for the shortcomings of a single feature through the combination of multiple features, improve the overall recognition accuracy, and reduce the impact of light changes on the prediction results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119540997A_ABST
    Figure CN119540997A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of computers, and discloses a method and device for predicting character image classification, computer equipment and a storage medium, and the method comprises the steps: obtaining a target character image; extracting image feature index values of each pixel under various feature categories from the target person image; determining a comprehensive image feature index value of each pixel according to the image feature index value of each pixel under various feature categories and a preset weight value; selecting a plurality of target pixels from the target person image according to the comprehensive image feature index value of each pixel, the clustering model, the preset length and the preset width; constructing a first feature matrix according to the comprehensive image feature index value of each target pixel; and inputting the first feature matrix into a pre-constructed target classification model to obtain a prediction classification result of the target person image. According to the invention, the accuracy of character image classification can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a method, device, computer equipment and storage medium for predicting character image classification. Background Art

[0002] In order to ensure the safety of the laboratory, staff need to undergo a clothing inspection before entering the laboratory to confirm whether they are wearing the necessary protective equipment according to the regulations, such as lab coats, safety shoes, protective glasses and gloves, etc. The traditional inspection method is generally achieved through inspection by management personnel.

[0003] With the rapid progress of machine vision and artificial intelligence technology, it is possible to automatically take photos of workers and automatically identify them based on the images obtained in order to complete the clothing inspection of workers. The specific process of recognizing images is: extracting the color feature index value of each pixel from the image, and then determining the region of interest (ROI) in the image based on the color feature index value of each pixel, and then obtaining the prediction result based on the pre-built clothing standard recognition model and the color feature index value of each pixel in the ROI.

[0004] Due to different laboratory lighting conditions, the color of the same clothing will be different under different lighting, resulting in inaccurate prediction results. Summary of the invention

[0005] In view of this, the present invention provides a method, apparatus, computer device, storage medium and program product for predicting character image classification to solve the problem of inaccurate prediction results in the related art.

[0006] In a first aspect, the present invention provides a method for predicting character image classification, the method comprising:

[0007] Obtain the target person image;

[0008] According to the pre-built feature extraction model of multiple feature categories, the image feature index values ​​corresponding to each pixel in the multiple feature categories are extracted from the target person image;

[0009] Determine a comprehensive image feature index value corresponding to each pixel according to the image feature index values ​​corresponding to each pixel under the plurality of feature categories and a preset weight value corresponding to each feature category;

[0010] Selecting a plurality of target pixels from the target person image according to a comprehensive image feature index value corresponding to each of the pixels, a pre-built clustering model, a preset length, and a preset width;

[0011] Constructing a first feature matrix according to the comprehensive image feature index value corresponding to each of the target pixels;

[0012] The first feature matrix is ​​input into a pre-built target classification model to obtain a predicted classification result corresponding to the target person image.

[0013] The method for predicting character image classification provided by the present invention has the following advantages:

[0014] This solution can extract multiple dimensions of image information (i.e., image feature index values ​​of multiple feature categories) from the target person image. These multi-dimensional information can more comprehensively describe each pixel in the image, thereby providing richer details. There is complementarity between different feature categories. For example, color features may not be accurate enough in some cases, while texture features can provide additional information. By combining multiple features, the shortcomings of a single feature can be compensated and the overall recognition accuracy can be improved.

[0015] In an optional implementation, the target classification model includes a plurality of residual blocks, an attention mechanism module, a global pooling layer, a first activation function, and a first convolutional layer corresponding to each of the residual blocks;

[0016] The step of inputting the first feature matrix into a pre-built target classification model to obtain a prediction classification result corresponding to the target person image includes:

[0017] Inputting a first input matrix into a target residual block to obtain a first output matrix output by the target residual block, wherein the target residual block is any one of the plurality of residual blocks, and when the target residual block is the residual block ranked first among the plurality of residual blocks, the target input matrix is ​​the first characteristic matrix;

[0018] Inputting the first input matrix into the first convolutional layer corresponding to the target residual block to obtain a second output matrix output by the first convolutional layer;

[0019] Performing a residual connection operation on the first output matrix and the second output matrix to obtain a third output matrix;

[0020] When the target residual block is not the residual block that is ranked last among the multiple residual blocks, inputting the third output matrix as the first input matrix to the next residual block ranked after the target residual block;

[0021] or,

[0022] When the target residual block is the last residual block in the plurality of residual blocks, inputting the third output matrix into the attention mechanism module for feature extraction to obtain a target feature vector output by the attention mechanism module;

[0023] Inputting the target feature vector into the global pooling layer to obtain the target classification index value outputted by the global pooling layer;

[0024] The target classification index value is input into the first activation function to obtain a predicted classification result output by the first activation function.

[0025] Specifically, the residual block effectively solves the gradient vanishing problem in deep networks by introducing residual connections. During training, residual connections allow gradients to be directly passed from deeper layers to shallower layers, thereby accelerating convergence and improving model performance. In addition, residual blocks can learn more complex feature representations because they learn not only original features but also residual features. This dual learning mechanism enables the model to capture subtle changes in the image more accurately. The attention mechanism module can automatically learn the most important areas in the image and give these areas higher weights. This helps the model ignore background noise and other irrelevant parts and focus on key features, thereby improving classification accuracy. The global pooling layer compresses each channel of the feature map into a numerical value, reducing the number of parameters of the model and thus reducing the risk of overfitting. In addition, the global pooling layer retains the most important features of each channel by aggregating information in the feature map, which helps the model to better classify. The nonlinear transformation introduced by the first activation function enables the model to learn more complex feature representations, so that the model can better fit complex data distributions and improve classification accuracy. By stacking multiple residual blocks, the model can extract features at different levels layer by layer, from low-level edge and texture features to high-level semantic features, forming a hierarchical feature representation.

[0026] In an optional implementation, the residual block includes multiple filters, a normalization layer and a second activation function, and the number of the filters included in the residual block is 2 n+2 , where n is the order of the residual blocks, 2 n+2 2 of the filters n+1 The filters constitute the second convolutional layer in the residual block, 2 n+2 The remaining 2 filters n+1 The filters constitute the third convolutional layer in the residual block;

[0027] The step of inputting the first input matrix into the target residual block to obtain a first output matrix output by the target residual block includes:

[0028] Performing feature extraction on the first input matrix through the plurality of filters included in the second convolutional layer to obtain a second feature matrix;

[0029] Inputting the second feature matrix into the normalization layer for normalization processing to obtain a third feature matrix;

[0030] Inputting the third characteristic matrix into the second activation function to obtain a fourth characteristic matrix;

[0031] The first output matrix is ​​obtained by performing feature extraction on the fourth feature matrix through the multiple filters included in the third convolutional layer.

[0032] Specifically, the number of filters in each residual block is 2 n+2 , so that the model has different numbers of filters at different levels, and can more flexibly extract features of different scales. Each residual block contains two convolutional layers (the second convolutional layer and the third convolutional layer), each of which is responsible for extracting features at a different level. This multi-stage feature extraction method enables the model to capture complex patterns in the image more carefully. The normalization layer can speed up the training process of the model, reduce internal covariate shift, and make the input distribution of each layer more stable, thereby accelerating convergence. In addition, the normalization layer helps to improve the generalization ability of the model.

[0033] In an optional embodiment, the feature extraction models of the plurality of feature categories include a color feature extraction model, a texture feature extraction model and a contour feature extraction model;

[0034] The method of extracting image feature index values ​​corresponding to each pixel in the target person image according to the pre-constructed feature extraction model of multiple feature categories includes:

[0035] Inputting the target person image into the color feature extraction model to obtain the color feature index value of each pixel output by the color feature extraction model;

[0036] Inputting the target person image into the texture feature extraction model to obtain the texture feature index value of each pixel output by the texture feature extraction model;

[0037] The target person image is input into the contour feature extraction model to obtain the contour feature index value of each pixel output by the contour feature extraction model.

[0038] Specifically, color, texture, and contour are very important features in an image, describing different aspects of the image. Color features reflect the color information of an image, texture features describe the surface structure of an image, and contour features capture the edges and shapes of objects. By extracting these multi-dimensional information, each pixel in the image can be described more comprehensively. Moreover, different feature categories are complementary. For example, color features may not be accurate enough in some cases, while texture features and contour features can provide additional information. This combination of multiple features can make up for the shortcomings of a single feature and improve the overall recognition accuracy.

[0039] In an optional implementation, the preset weight value corresponding to the color feature, the preset weight value corresponding to the contour feature, and the preset weight value corresponding to the texture feature decrease in sequence.

[0040] Specifically, color features are the most intuitive and easily recognizable features when judging whether a person's clothing complies with the rules. Giving color features the highest weight can ensure that the model gives priority to color information when classifying, improving the accuracy and reliability of classification. Contour features are very important for identifying the shape and boundaries of objects, but may not be as intuitive as color features in some cases. Giving contour features the second highest weight can ensure that color features are prioritized while not losing attention to shape and boundaries. Texture features can provide detailed information about the surface structure of an object, but in many visual tasks, the importance of texture features is relatively low. Giving texture features the lowest weight can be used as auxiliary information to help the model make more detailed distinctions when necessary.

[0041] In an optional implementation, determining the comprehensive image feature index value corresponding to each pixel according to the image feature index values ​​corresponding to each pixel under the plurality of feature categories and the preset weight value corresponding to each feature category includes:

[0042] Determine a normalized image feature index value of a target feature category corresponding to each of the pixels according to the image feature index value of the target feature category corresponding to each of the pixels, a first preset threshold, and a second preset threshold, wherein the target feature category is any one of the multiple feature categories;

[0043] According to the normalized image feature index value corresponding to each of the feature categories of the first pixel and the preset weight value, the comprehensive image feature index value corresponding to the first pixel is determined, wherein the first pixel is any pixel in the target person image.

[0044] Specifically, normalization unifies the feature index values ​​of different feature categories into the same range. This eliminates the dimensional differences between different feature categories, allowing the contributions of different features to be compared and weighted fairly. By presetting weight values, the contributions of different feature categories can be reasonably allocated. This weight setting method ensures that the model prioritizes the most important features when classifying.

[0045] In an optional implementation, the selecting a plurality of target pixels from the target person image according to the comprehensive image feature index value corresponding to each pixel, the pre-built clustering model, the preset length and the preset width includes:

[0046] Selecting a plurality of candidate pixels from the target person image according to the comprehensive image feature index value corresponding to each pixel and the clustering model;

[0047] Obtaining position information of a plurality of candidate pixels in the target person image;

[0048] Determine a central pixel among the plurality of target pixels according to position information of the plurality of candidate pixels in the target person image, wherein the central pixel includes one or more;

[0049] A plurality of target pixels are selected from the target person image according to the central pixel, the preset length and the preset width.

[0050] Specifically, multiple candidate pixels are selected from multiple pixels through the clustering model. The clustering model can effectively cluster pixels with similar features together, reducing the complexity of subsequent processing. Through the constraints of the center pixel and the preset length and width, the distribution of the selected target pixels in the image is ensured to be more reasonable and concentrated. This helps to reduce the influence of noise and irrelevant pixels and improve the accuracy of the final result.

[0051] In a second aspect, the present invention provides a device for predicting character image classification, the device comprising:

[0052] An acquisition module is used to acquire an image of a target person;

[0053] An extraction module, used to extract the image feature index values ​​corresponding to each pixel in the target person image under the multiple feature categories according to a pre-built feature extraction model of multiple feature categories;

[0054] A determination module, configured to determine a comprehensive image feature index value corresponding to each pixel according to the image feature index values ​​corresponding to each pixel under the plurality of feature categories and a preset weight value corresponding to each feature category;

[0055] A selection module, for selecting a plurality of target pixels from the target person image according to a comprehensive image feature index value corresponding to each pixel, a pre-built clustering model, a preset length and a preset width;

[0056] A construction module, used to construct a first feature matrix according to the comprehensive image feature index value corresponding to each of the target pixels;

[0057] A prediction module is used to input the first feature matrix into a pre-built target classification model to obtain a prediction classification result corresponding to the target person image.

[0058] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method for predicting character image classification of the above-mentioned first aspect or any corresponding embodiment thereof by executing the computer instructions.

[0059] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the method for predicting character image classification of the first aspect or any corresponding embodiment thereof.

[0060] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions for causing a computer to execute the method for predicting character image classification according to the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the related technologies, the drawings required for use in the specific embodiments or the related technical descriptions will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0062] Figure 1 is a system architecture diagram according to an embodiment of the present invention;

[0063] Figure 2 is a flow chart of a method for predicting character image classification according to an embodiment of the present invention;

[0064] Figure 3 is a schematic diagram of an RGB model according to an embodiment of the present invention;

[0065] Figure 4 is a schematic diagram of the structure of a target classification model according to an embodiment of the present invention;

[0066] Figure 5 is a schematic diagram of a ReLU function according to an embodiment of the present invention;

[0067] Figure 6 is a flow chart of a method for training a classification model according to an embodiment of the present invention;

[0068] Figure 7 is a structural block diagram of a device for predicting character image classification according to an embodiment of the present invention;

[0069] Figure 8 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0070] 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 of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0071] The embodiment of the present invention can be implemented by a system consisting of an image acquisition device and an image analysis device. The system can be implemented as follows: Figure 1 As shown. Among them, the image acquisition device can be a camera installed at the entrance of the laboratory, or a camera on the terminal. The image analysis device can be a server, a server cluster, a terminal, etc. The image acquisition device can take a photo when a person is recognized to obtain the image of the person, and transmit it to the image analysis device. Alternatively, the image acquisition device can shoot a video and transmit the video to the image analysis device. The image analysis device can perform an analysis operation based on the acquired person image, or capture the person image from the video to determine whether the person's clothing in the person image meets the specifications, or whether it meets the preset dressing rules.

[0072] The embodiment of the present invention provides a method for predicting the classification of a person image, which is more accurate in identifying whether the person's clothing conforms to preset dressing rules by combining image feature indicators corresponding to multiple feature categories in the person image.

[0073] According to an embodiment of the present invention, a method embodiment for predicting character image classification is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0074] In this embodiment, a method for predicting the classification of a person image is provided, which can be performed by the above-mentioned image analysis device. Figure 2 is a flowchart of a method for predicting character image classification according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:

[0075] Step S201, obtaining a target person image.

[0076] Specifically, before the staff enters the laboratory, the image acquisition device at the door of the laboratory can take the target person image of the staff and transmit it to the image analysis device, and the image analysis device can obtain the target person image. Alternatively, a camera can be set up in the laboratory to transmit the video data taken in the laboratory to the image analysis device. For every second of video, the image analysis device can extract a frame of the person image as the target person image, that is, the image analysis device obtains the target person image.

[0077] Step S202 , extracting the image feature index values ​​corresponding to each pixel in the target person image under the multiple feature categories according to the pre-constructed feature extraction model of the multiple feature categories.

[0078] The feature extraction models of multiple feature categories may include multiple of a color feature extraction model, a texture feature extraction model, and a contour feature extraction model. For example, the color feature extraction model may be a red green blue (RGB) model, and the RGB model may be as follows: Figure 3 As shown. The texture feature extraction model can be a Gray-Level Co-occurrence Matrix (GLCM), a Local Binary Pattern (LBP), etc. The contour feature extraction model can be a Canny edge detector, a Hough transform, etc.

[0079] Specifically, the image analysis device may be installed with feature extraction models of the above three feature categories. Accordingly, the image feature index values ​​of the three feature categories may be extracted according to the following specific steps:

[0080] First, the target person image is input into the color feature extraction model to obtain the color feature index value of each pixel output by the color feature extraction model.

[0081] The color feature index value may be an index value calculated based on the intensity of the pixel in red, green, and blue colors, and may specifically be an average value or a weighted average value of the intensities corresponding to the three colors.

[0082] Second, the target person image is input into the texture feature extraction model to obtain the texture feature index value of each pixel output by the texture feature extraction model.

[0083] Third, the target person image is input into the contour feature extraction model to obtain the contour feature index value of each pixel output by the contour feature extraction model.

[0084] Step S203, determining a comprehensive image feature index value corresponding to each pixel according to the image feature index values ​​corresponding to each pixel under multiple feature categories and a preset weight value corresponding to each feature category.

[0085] Among them, the preset weight value corresponding to the color feature, the preset weight value corresponding to the contour feature, and the preset weight value corresponding to the texture feature can be adjusted according to the usage scenario. The preset weight value corresponding to the color feature, the preset weight value corresponding to the contour feature, and the preset weight value corresponding to the texture feature can be reduced in sequence, for example, the preset weight value corresponding to the color feature is 0.5, the preset weight value corresponding to the contour feature is 0.3, and the preset weight value corresponding to the texture feature is 0.2.

[0086] Specifically, since the order of magnitude of image feature values ​​extracted by feature extraction models of different feature categories is different, and the influence of features of different categories in the image on the prediction results is also different, the specific process of calculating the comprehensive image feature index value corresponding to each pixel can be as follows:

[0087] Step 1: Determine the normalized image feature index value of the target feature category corresponding to each pixel according to the image feature index value of the target feature category corresponding to each pixel, the first preset threshold and the second preset threshold.

[0088] The target feature category is any feature category among a plurality of feature categories. For example, the first preset threshold value may be 0, and the second preset threshold value may be 1.

[0089] Specifically, the image analysis device can determine the number of pixels (that is, the number of image feature index values ​​corresponding to the target feature category), the maximum image feature index value and the minimum image feature index value according to the image feature index value of the target feature category corresponding to each pixel, and then calculate the first difference between the maximum image feature index value and the minimum image feature index value, and the second difference between the second preset threshold and the first preset threshold. Then, the target ratio of the second difference to the first difference is calculated. Finally, for the image feature index value corresponding to each pixel, the third difference between the image feature index value of the pixel and the minimum image feature index value can be calculated, and the product of the third difference and the target ratio plus the first preset threshold is determined as the corresponding normalized image feature index value. Alternatively, the fourth difference between the maximum image feature index value and the image feature index value of the pixel can be calculated, and the value obtained by subtracting the product of the fourth difference and the target ratio from the second preset threshold is determined as the corresponding normalized image feature index value.

[0090] Step 2: Determine the comprehensive image feature index value corresponding to the first pixel according to the normalized image feature index value corresponding to each feature category of the first pixel and the preset weight value.

[0091] The first pixel is any one of the multiple pixels.

[0092] Specifically, taking the first pixel as an example, the image analysis device can determine the target image feature index value corresponding to the target feature category according to the target feature category normalized image feature index value and the preset weight value of the first pixel, and then determine the sum of the target image feature index values ​​corresponding to all feature categories of the first pixel as the comprehensive image feature index value corresponding to the first pixel.

[0093] Step S204 , selecting a plurality of target pixels from the target person image according to the comprehensive image feature index value corresponding to each pixel, the pre-built clustering model, the preset length and the preset width.

[0094] Optionally, step S204 may be processed as follows:

[0095] Step 1: Select multiple candidate pixels from the target person image based on the comprehensive image feature index value and clustering model corresponding to each pixel.

[0096] Step 2: Obtain position information of multiple candidate pixels in the target person image.

[0097] Step three: determine a central pixel among multiple target pixels according to position information of multiple candidate pixels in the target person image.

[0098] The central pixel may include one or more central pixels.

[0099] Step 4: Select multiple target pixels from the target person image according to the central pixel, the preset length and the preset width.

[0100] The preset length and the preset width may both be represented by the number of pixels. For example, the preset length and the preset width may both be 256.

[0101] Specifically, first, the image analysis device can input the comprehensive image feature index value corresponding to each pixel into the clustering model to obtain the clustering result (including multiple clusters) output by the clustering model, and then determine the rectangular frame corresponding to each cluster in the target person image according to the position information of the pixels included in each cluster. Then, the image analysis device can select the rectangle with the largest area as the region of interest (ROI), and select all pixels in the ROI as candidate pixels. Since the size of the ROI determined in different person images is different, and the target classification model is used to process data of a specified size, the image analysis device also needs to obtain the position information of multiple candidate pixels in the target person image, and determine the center pixel among the multiple target pixels according to the position information of the multiple candidate pixels in the target person image. Finally, the image analysis device can use the center pixel as a reference to select the target pixel within the range of a preset length and a preset width in the target person image.

[0102] In some optional implementations, before step 2, the image analysis device may first determine whether the length value of the ROI is equal to a preset length, and whether the width value of the ROI is equal to a preset width. If the length value of the ROI is equal to the preset length and the width value of the ROI is equal to the preset width, the candidate pixel of the ROI region may be determined as the target pixel. If the length value of the ROI is not equal to the preset length, or the width value of the ROI is not equal to the preset width, the subsequent step 3 is performed. In this way, processing resources can be saved.

[0103] Step S205: construct a first feature matrix according to the comprehensive image feature index value corresponding to each target pixel.

[0104] Specifically, the image analysis device may place the comprehensive pre-feature index values ​​of the target pixels at corresponding positions of a matrix of a preset size according to the arrangement of the target pixels in the target person image, to obtain a first feature matrix.

[0105] Step S206: input the first feature matrix into a pre-built target classification model to obtain a predicted classification result corresponding to the target person image.

[0106] The predicted classification result is used to indicate whether the clothing of the person in the target person image meets the preset clothing rules.

[0107] Optionally, the target classification model may be a convolutional neural network (CNN) model. For example, the structure of the target classification model may be as follows: Figure 4 As shown, it includes multiple residual blocks, an attention mechanism module (Squeeze-and-Excitation, SE), a global average pooling layer (Global Average Pooling Layer, GAP), a first activation function, and a first convolution layer corresponding to each residual block. The residual block includes multiple filters, a normalization layer and a second activation function, and the number of filters included in the residual block is 2 n+2 , where n is the order of the residual blocks, 2 n+2 2 of the filters n+1 The filters constitute the second convolutional layer in the residual block, 2 n+2 The remaining 2 filters n+1 The filters constitute the third convolutional layer in the residual block. Accordingly, the specific processing of step S206 may include the following steps:

[0108] Step 1: Input the first input matrix into the target residual block to obtain the first output matrix output by the target residual block.

[0109] The target residual block is any one of the multiple residual blocks. When the target residual block is the first-ranked residual block among the multiple residual blocks, the target input matrix is ​​the first characteristic matrix.

[0110] Step 1: extract features from the first input matrix using multiple filters included in the second convolutional layer to obtain a second feature matrix.

[0111] Step 2: Input the second feature matrix into the normalization layer for normalization to obtain the third feature matrix.

[0112] Step 3: Input the third feature matrix into the second activation function to obtain a fourth feature matrix.

[0113] Step 4: extract features from the fourth feature matrix using multiple filters included in the third convolutional layer to obtain a first output matrix.

[0114] Step 2: Input the first input matrix into the first convolutional layer corresponding to the target residual block to obtain the second output matrix output by the first convolutional layer.

[0115] Step three, performing a residual connection operation on the first output matrix and the second output matrix to obtain a third output matrix.

[0116] Step 4: When the target residual block is not the residual block ranked last among the multiple residual blocks, the third output matrix is ​​input as the first input matrix to the next residual block ranked after the target residual block.

[0117] or,

[0118] Step 5: When the target residual block is the last residual block in the multiple residual blocks, the third output matrix is ​​input into the attention mechanism module for feature extraction to obtain the target feature vector output by the attention mechanism module.

[0119] Step six, input the target feature vector into the global pooling layer to obtain the target classification index value output in the global pooling layer.

[0120] Step seven, input the target classification index value into the first activation function to obtain the predicted classification result output by the first activation function.

[0121] For example, the number of residual blocks can be 6, and the number of filters included in the residual blocks from front to back are 8, 16, 32, 64, 128 and 256 respectively, and the size of the filter included in the residual block can be 3×3. When the size of the first feature matrix is ​​256×256, the matrix size changes to 256×256, 128×128, 64×64, 32×32, 16×16, and 8×8 after processing by 6 residual blocks. The first convolutional layer may include one filter, and the size of the filter may be 1×1. The first activation function may be a rectified linear unit (ReLU) function, and its function graph may be as shown below: Figure 5 As shown. The second activation function can be Softmax. The attention mechanism module can include a feature adaptive fusion layer. Adaptive feature fusion learns the best fusion weights according to the input features and their correlation. The fusion process in the adaptive fusion layer is controlled by a set of fusion functions, which can be linear, nonlinear or a combination thereof.

[0122] Specifically, when the predicted classification result is used to indicate that the clothing of the person in the target person image does not meet the preset clothing rules, an alarm can be issued.

[0123] The method for predicting character image classification provided in this embodiment can extract multiple dimensions of image information (i.e., image feature index values ​​of multiple feature categories), such as color, texture, contour, etc., from the target character image. These multi-dimensional information can more comprehensively describe each pixel in the image, thereby providing richer details. There is complementarity between different feature categories. For example, color features may not be accurate enough in some cases, while texture features can provide additional information. By combining multiple features, the shortcomings of a single feature can be compensated and the overall recognition accuracy can be improved.

[0124] In this embodiment, a method for training a classification model is provided, which can be performed by the above-mentioned image analysis device. Figure 6 is a flowchart of a method for training a classification model according to an embodiment of the present invention. Figure 6 As shown, the process includes the following steps:

[0125] Step S601, obtaining a training data set.

[0126] The training data set includes multiple person images and a true classification result corresponding to each person image. Each person image includes multiple pixels, and the true classification result is used to indicate whether the person in the person image is dressed in a standard manner.

[0127] Specifically, the user can first collect images of people whose clothes conform to the preset dressing rules and those that do not conform to the preset dressing rules (these images of people may include people of different genders, ages, and body shapes, and images of clothes under different lighting, angles, and background conditions), and annotate these images of people, marking the clothing type (for example, white coat, protective clothing), color, style, wearing status (clothing is neat and intact, whether the white coat buttons are fastened, etc.) and other relevant features of the image of the person. Further, the user can determine whether the image of the person conforms to the preset dressing rules based on the annotation, and classify and annotate, that is, annotate the real classification result of the image of the person. For example, the image of the person who conforms to the preset dressing rules can be marked as "1", and the image of the person who does not conform to the dressing rules can be marked as "0". In this way, the user can collect multiple images of the person. Furthermore, the image acquisition device can use a certain proportion of the collected image of the person as a training data set.

[0128] Step S602: extracting image feature index values ​​corresponding to each pixel in multiple feature categories from the first person image according to a pre-constructed feature extraction model of multiple feature categories.

[0129] The first character image is any one of the multiple character images.

[0130] Step S603, determining a comprehensive image feature index value corresponding to each pixel according to the image feature index values ​​corresponding to each pixel under multiple feature categories and a preset weight value corresponding to each feature category.

[0131] Step S604 , selecting a plurality of target pixels from the first person image according to the comprehensive image feature index value corresponding to each pixel, the pre-built clustering model, the preset length and the preset width.

[0132] Step S605: construct a target feature matrix according to the comprehensive image feature index value corresponding to each target pixel.

[0133] Step S606: input the target feature matrix into the classification model to be trained to obtain a predicted classification result corresponding to the first person image.

[0134] The predicted classification result is used to indicate whether the clothing of the person in the first person image meets the preset clothing rules.

[0135] The specific processing from step S602 to step S606 is similar to that from step S202 to step S206, and will not be repeated here.

[0136] Step S607, determining a target loss value according to the actual classification result and the predicted classification result corresponding to each person image.

[0137] Specifically, the image analysis device can calculate the actual classification result and the predicted classification result corresponding to each person image according to the pre-built loss function to obtain the target loss value. For example, the loss function can be a cross-entropy loss function and a mean squared error loss function.

[0138] During the training process, a learning rate of 1.0×10^(-4) can be used to train the classification model.

[0139] Step S608, when the target loss value is less than the preset loss value threshold, it is determined that the training stop condition is met, and the prediction classification model that has completed the training is determined as the target classification model.

[0140] Step S609, when the target loss value is greater than or equal to the preset loss value threshold, the classification model is continued to be trained according to the target loss value until the calculated loss value is less than the preset loss value threshold, and the trained prediction classification model is determined as the target classification model.

[0141] The method for predicting the classification of person images provided in this embodiment, first, not only uses image color attributes in the feature engineering of the training data set, but also introduces image texture features and contour analysis, and integrates the advantages of the three methods into one image feature processing, which helps to improve the accuracy of detection and minimize the false positives and false negatives of traditional deep learning models. Secondly, the use of residual blocks helps to improve the efficiency of model training and detection, and to a certain extent reduces the overfitting of model training. The attention mechanism module is used to process the interactive relationship between different feature sequences, and realizes the interaction and fusion of information by paying attention to the information related to each other in multiple sequences, so as to improve the efficiency and accuracy of the model in processing complex data. The attention mechanism allows the model to selectively focus on relevant features while suppressing less important features. Linear and nonlinear fusion functions are used to combine the features in the adaptive fusion layer, which are responsible for converting the input features into feature space, where they can be adaptively combined to make the trained classification model more accurate.

[0142] In this embodiment, a device for predicting character image classification is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware for a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0143] This embodiment provides a device for predicting the classification of a person image. Figure 7 As shown, including:

[0144] An acquisition module 701 is used to acquire an image of a target person;

[0145] An extraction module 702 is used to extract the image feature index values ​​corresponding to each pixel in multiple feature categories from the target person image according to a pre-built feature extraction model of multiple feature categories;

[0146] A determination module 703 is used to determine a comprehensive image feature index value corresponding to each pixel according to the image feature index values ​​corresponding to each pixel under multiple feature categories and a preset weight value corresponding to each feature category;

[0147] A selection module 704 is used to select a plurality of target pixels from the target person image according to the comprehensive image feature index value corresponding to each pixel, the pre-built clustering model, the preset length and the preset width;

[0148] A construction module 705 is used to construct a first feature matrix according to the comprehensive image feature index value corresponding to each target pixel;

[0149] The prediction module 706 is used to input the first feature matrix into a pre-built target classification model to obtain a prediction classification result corresponding to the target person image.

[0150] In an optional embodiment, the target classification model includes a plurality of residual blocks, an attention mechanism module, a global pooling layer, a first activation function, and a first convolutional layer corresponding to each residual block;

[0151] The prediction module 706 is specifically used for:

[0152] Inputting the first input matrix into the target residual block to obtain a first output matrix output by the target residual block, wherein the target residual block is any residual block among the multiple residual blocks, and when the target residual block is the residual block ranked first among the multiple residual blocks, the target input matrix is ​​the first characteristic matrix;

[0153] Inputting the first input matrix into the first convolutional layer corresponding to the target residual block to obtain a second output matrix output by the first convolutional layer;

[0154] Performing a residual connection operation on the first output matrix and the second output matrix to obtain a third output matrix;

[0155] When the target residual block is not the residual block that is ranked last among the multiple residual blocks, inputting the third output matrix as the first input matrix to the next residual block ranked after the target residual block;

[0156] or,

[0157] When the target residual block is the last residual block in the order of the multiple residual blocks, the third output matrix is ​​input into the attention mechanism module for feature extraction to obtain the target feature vector output by the attention mechanism module;

[0158] Input the target feature vector into the global pooling layer to obtain the target classification index value output in the global pooling layer;

[0159] The target classification index value is input into the first activation function to obtain the predicted classification result output by the first activation function.

[0160] In an optional implementation, the residual block includes multiple filters, a normalization layer, and a second activation function, and the number of filters included in the residual block is 2 n+2 , where n is the order of the residual blocks, 2 n+2 2 of the filters n+1 The filters constitute the second convolutional layer in the residual block, 2 n+2 The remaining 2 filters n+1 The filters constitute the third convolutional layer in the residual block;

[0161] The prediction module 706 is specifically used for:

[0162] Extracting features from the first input matrix using a plurality of filters included in the second convolutional layer to obtain a second feature matrix;

[0163] The second feature matrix is ​​input into the normalization layer for normalization to obtain the third feature matrix;

[0164] Input the third characteristic matrix into the second activation function to obtain a fourth characteristic matrix;

[0165] The fourth feature matrix is ​​subjected to feature extraction through a plurality of filters included in the third convolutional layer to obtain a first output matrix.

[0166] In an optional embodiment, the feature extraction models of the multiple feature categories include a color feature extraction model, a texture feature extraction model, and a contour feature extraction model;

[0167] The extraction module 702 is specifically used for:

[0168] Input the target person image into the color feature extraction model to obtain the color feature index value of each pixel output by the color feature extraction model;

[0169] Input the target person image into the texture feature extraction model to obtain the texture feature index value of each pixel output by the texture feature extraction model;

[0170] The target person image is input into the contour feature extraction model to obtain the contour feature index value of each pixel output by the contour feature extraction model.

[0171] In an optional implementation, the preset weight value corresponding to the color feature, the preset weight value corresponding to the contour feature, and the preset weight value corresponding to the texture feature decrease in sequence.

[0172] In an optional implementation manner, the determination module 703 is specifically configured to:

[0173] Determine a normalized image feature index value of a target feature category corresponding to each pixel according to an image feature index value of a target feature category corresponding to each pixel, a first preset threshold, and a second preset threshold, wherein the target feature category is any one of a plurality of feature categories;

[0174] According to the normalized image feature index value corresponding to each feature category of the first pixel and the preset weight value, the comprehensive image feature index value corresponding to the first pixel is determined, wherein the first pixel is any pixel in the target person image.

[0175] In an optional implementation, the selection module 704 is specifically configured to:

[0176] Selecting multiple candidate pixels from the target person image according to the comprehensive image feature index value and the clustering model corresponding to each pixel;

[0177] Obtaining position information of multiple candidate pixels in the target person image;

[0178] Determine a central pixel among the multiple target pixels according to position information of the multiple candidate pixels in the target person image, wherein the central pixel includes one or more;

[0179] A plurality of target pixels are selected from the target person image according to a central pixel, a preset length and a preset width.

[0180] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.

[0181] The device for predicting character image classification in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0182] The embodiment of the present invention also provides a computer device having the above Figure 8 The device shown is for predicting character image classification.

[0183] See also Figure 8 , Figure 8 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 8 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 8 A processor 10 is taken as an example.

[0184] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware integrated circuit. The hardware integrated circuit may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.

[0185] The memory 20 stores instructions executable by at least one processor 10, so that the at least one processor 10 executes the method shown in the above embodiment.

[0186] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0187] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.

[0188] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.

[0189] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.

[0190] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.

[0191] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A method for predicting character image classification, characterized in that: The method comprises: Obtain the target person image; According to the pre-built feature extraction model of multiple feature categories, the image feature index values ​​corresponding to each pixel in the multiple feature categories are extracted from the target person image; Determine a comprehensive image feature index value corresponding to each pixel according to the image feature index values ​​corresponding to each pixel under the plurality of feature categories and a preset weight value corresponding to each feature category; Selecting a plurality of target pixels from the target person image according to a comprehensive image feature index value corresponding to each of the pixels, a pre-built clustering model, a preset length, and a preset width; Constructing a first feature matrix according to the comprehensive image feature index value corresponding to each of the target pixels; The first feature matrix is ​​input into a pre-built target classification model to obtain a predicted classification result corresponding to the target person image.

2. The method according to claim 1, characterized in that The target classification model includes a plurality of residual blocks, an attention mechanism module, a global pooling layer, a first activation function, and a first convolutional layer corresponding to each of the residual blocks; The step of inputting the first feature matrix into a pre-built target classification model to obtain a prediction classification result corresponding to the target person image includes: Inputting a first input matrix into a target residual block to obtain a first output matrix output by the target residual block, wherein the target residual block is any one of the plurality of residual blocks, and when the target residual block is the residual block ranked first among the plurality of residual blocks, the target input matrix is ​​the first characteristic matrix; Inputting the first input matrix into the first convolutional layer corresponding to the target residual block to obtain a second output matrix output by the first convolutional layer; Performing a residual connection operation on the first output matrix and the second output matrix to obtain a third output matrix; When the target residual block is not the residual block that is ranked last among the multiple residual blocks, inputting the third output matrix as the first input matrix to the next residual block ranked after the target residual block; or, When the target residual block is the last residual block in the plurality of residual blocks, inputting the third output matrix into the attention mechanism module for feature extraction to obtain a target feature vector output by the attention mechanism module; Inputting the target feature vector into the global pooling layer to obtain the target classification index value outputted by the global pooling layer; The target classification index value is input into the first activation function to obtain a predicted classification result output by the first activation function.

3. The method according to claim 2, characterized in that The residual block includes a plurality of filters, a normalization layer and a second activation function, and the number of the filters included in the residual block is 2 n+2 , where n is the order of the residual blocks, 2 n+2 2 of the filters n+1 The filters constitute the second convolutional layer in the residual block, 2 n+2 The remaining 2 filters n+1 The filters constitute the third convolutional layer in the residual block; The step of inputting the first input matrix into the target residual block to obtain a first output matrix output by the target residual block includes: Performing feature extraction on the first input matrix through the plurality of filters included in the second convolutional layer to obtain a second feature matrix; Inputting the second feature matrix into the normalization layer for normalization processing to obtain a third feature matrix; Inputting the third characteristic matrix into the second activation function to obtain a fourth characteristic matrix; The first output matrix is ​​obtained by performing feature extraction on the fourth feature matrix through the multiple filters included in the third convolutional layer.

4. The method according to any one of claims 1 to 3, characterized in that: The feature extraction models of the plurality of feature categories include a color feature extraction model, a texture feature extraction model and a contour feature extraction model; The method of extracting image feature index values ​​corresponding to each pixel in the target person image according to the pre-constructed feature extraction model of multiple feature categories includes: Inputting the target person image into the color feature extraction model to obtain the color feature index value of each pixel output by the color feature extraction model; Inputting the target person image into the texture feature extraction model to obtain the texture feature index value of each pixel output by the texture feature extraction model; The target person image is input into the contour feature extraction model to obtain the contour feature index value of each pixel output by the contour feature extraction model.

5. The method according to claim 4, characterized in that The preset weight value corresponding to the color feature, the preset weight value corresponding to the contour feature, and the preset weight value corresponding to the texture feature decrease in sequence.

6. The method according to any one of claims 1 to 3, characterized in that: Determining the comprehensive image feature index value corresponding to each pixel according to the image feature index values ​​corresponding to each pixel under the plurality of feature categories and the preset weight value corresponding to each feature category includes: Determine a normalized image feature index value of a target feature category corresponding to each of the pixels according to the image feature index value of the target feature category corresponding to each of the pixels, a first preset threshold, and a second preset threshold, wherein the target feature category is any one of the multiple feature categories; According to the normalized image feature index value corresponding to each of the feature categories of the first pixel and the preset weight value, the comprehensive image feature index value corresponding to the first pixel is determined, wherein the first pixel is any pixel in the target person image.

7. The method according to any one of claims 1 to 3, characterized in that: The step of selecting a plurality of target pixels from the target person image according to the comprehensive image feature index value corresponding to each pixel, the pre-built clustering model, the preset length and the preset width comprises: Selecting a plurality of candidate pixels from the target person image according to the comprehensive image feature index value corresponding to each pixel and the clustering model; Obtaining position information of a plurality of candidate pixels in the target person image; Determine a central pixel among the plurality of target pixels according to position information of the plurality of candidate pixels in the target person image, wherein the central pixel includes one or more; A plurality of target pixels are selected from the target person image according to the central pixel, the preset length and the preset width.

8. A device for predicting character image classification, characterized in that: The device comprises: An acquisition module is used to acquire an image of a target person; An extraction module, used to extract the image feature index values ​​corresponding to each pixel in the target person image under the multiple feature categories according to a pre-built feature extraction model of multiple feature categories; A determination module, configured to determine a comprehensive image feature index value corresponding to each pixel according to the image feature index values ​​corresponding to each pixel under the plurality of feature categories and a preset weight value corresponding to each feature category; A selection module, for selecting a plurality of target pixels from the target person image according to a comprehensive image feature index value corresponding to each pixel, a pre-built clustering model, a preset length and a preset width; A construction module, used to construct a first feature matrix according to the comprehensive image feature index value corresponding to each of the target pixels; A prediction module is used to input the first feature matrix into a pre-built target classification model to obtain a prediction classification result corresponding to the target person image.

9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method for predicting character image classification according to any one of claims 1 to 7 by executing the computer instructions.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the method for predicting character image classification according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Object classification method and device, equipment and storage medium

    CN113449725A

  • Superpixel segmentation method and device for natural image

    CN117292133A

  • Rapid classification method for fabric images

    CN118262174A

  • Feature extraction method and apparatus

    US20230419646A1