Search

CN-121982415-A - Image classification model construction method and device based on random forest and electronic equipment

CN121982415ACN 121982415 ACN121982415 ACN 121982415ACN-121982415-A

Abstract

The application is suitable for the technical field of computer application, and provides an image classification model construction method, device, electronic equipment and storage medium based on random forests, wherein the method comprises the steps of constructing an initial image classification model; the method comprises the steps of generating a feature layer feature matrix through a feature forest layer, generating an enhancement layer feature matrix through an enhancement forest layer, inputting the feature layer feature matrix and the enhancement layer feature matrix into an output layer, determining the prediction precision of an initial image classification model, determining the initial image classification model as a target image classification model when the prediction precision reaches a preset precision condition, and otherwise, increasing the number of first random forest groups and/or second random forest groups so as to generate the target image classification model. Therefore, an image classification model is built by utilizing the integrated structure of the multi-layer random forest group, and model accuracy is improved by increasing the number of the random forest groups, so that model training efficiency, generalization capability and image classification accuracy of the target image classification model are improved.

Inventors

  • LIU HAIQIANG
  • SU KE
  • LI YUAN
  • FANG SHUIBO
  • CHEN ZHILIE

Assignees

  • 深圳市九牛一毛智能物联科技有限公司

Dates

Publication Date
20260505
Application Date
20260130

Claims (10)

  1. 1. The image classification model construction method based on the random forest is characterized by comprising the following steps of: Constructing an initial image classification model according to the number T of preset first random forest groups and the number M of preset second random forest groups, wherein the initial image classification model comprises an input layer, a characteristic forest layer, an enhanced forest layer and an output layer, the characteristic forest layer comprises T first random forest groups, the enhanced forest layer comprises M second random forest groups, and T, M are all positive integers; respectively inputting a first training set into each first random forest group of the feature forest layer to generate a feature matrix of the feature layer, wherein the first training set is generated by the input layer according to a plurality of training samples; respectively inputting the feature layer feature matrix and the first training set into each second random forest group of the enhanced forest layer to generate an enhanced layer feature matrix; Inputting the feature layer feature matrix and the enhancement layer feature matrix into the output layer to determine the prediction precision of the initial image classification model; under the condition that the prediction precision of the initial image classification model reaches a preset precision condition, determining the initial image classification model as a target image classification model; and under the condition that the prediction precision of the initial image classification model does not reach the preset precision condition, iteratively updating the initial image classification model by increasing the number of the first random forest groups and/or the second random forest groups until the updated initial image classification model reaches the preset precision condition, and determining the updated initial image classification model as the target image classification model.
  2. 2. The method for constructing an image classification model based on random forests as claimed in claim 1, wherein each first random forest group includes P first random forests, P is a positive integer, each first random forest includes at least one decision tree, and the step of inputting a first training set into each first random forest group of the feature forest layer to generate a feature layer feature matrix includes: inputting the first training set into each first random forest respectively; sampling the first training set at least once through the p-th first random forest in the t-th first random forest group, respectively generating first training subsets for training the decision trees in the p-th first random forest, wherein, , ; Generating a prediction matrix corresponding to the p-th first random forest in the t-th first random forest group through the p-th first random forest in the t-th first random forest group and each first training subset corresponding to the p-th first random forest in the t-th first random forest group; Generating a feature matrix corresponding to the t first random forest group according to the prediction matrix corresponding to each first random forest in the t first random forest group; and splicing the feature matrixes corresponding to the first random forest groups respectively to generate the feature layer feature matrixes.
  3. 3. The method for constructing an image classification model based on random forests according to claim 1, wherein said first training set includes a plurality of first sample features respectively corresponding to said training samples, said feature layer feature matrix includes feature layer prediction vectors respectively corresponding to each of said training samples, each of said second random forest groups includes Q second random forests, Q is a positive integer, each of said second random forests includes at least one decision tree, said inputting said feature layer feature matrix and said first training set into each of said second random forest groups of said enhanced forest layer, generating an enhanced layer feature matrix, comprising: Splicing the first sample features corresponding to the training samples with the feature layer prediction vectors to generate second sample features corresponding to the training samples; screening the second sample features based on a maximum correlation minimum redundancy algorithm to generate third sample features corresponding to the training samples respectively; Constructing a second training set according to each third sample characteristic; Respectively inputting the second training sets into each second random forest; sampling the second training set at least once through the q-th second random forest in the m-th second random forest group, respectively generating each second training subset for training each decision tree in the q-th second random forest, wherein, , ; Generating a prediction matrix corresponding to the q-th second random forest in the m-th second random forest group through the q-th second random forest in the m-th second random forest group and each second training subset corresponding to the q-th second random forest in the m-th second random forest group; generating a feature matrix corresponding to the m second random forest group according to the prediction matrix corresponding to each second random forest in the m second random forest group; And splicing the feature matrixes corresponding to the second random forest groups respectively to generate the enhancement layer feature matrixes.
  4. 4. The method for constructing a random forest based image classification model according to claim 1, wherein the first training set includes at least one training sample corresponding to each real label, and the inputting the feature layer feature matrix and the enhancement layer feature matrix into the output layer to determine the prediction accuracy of the initial image classification model includes: generating connection weights of the output layer, the feature forest layer and the enhancement forest layer according to the feature layer feature matrix, the enhancement layer feature matrix and the real labels; And processing the feature layer feature matrix, the enhancement layer feature matrix and the connection weight through the output layer to determine the prediction precision.
  5. 5. A method of constructing a random forest based image classification model as claimed in any of claims 1-4, wherein said iteratively updating said initial image classification model by increasing the number of first random forest groups and/or said second random forest groups comprises: and under the condition that the total number of the second random forest groups added in the enhanced forest layer reaches a preset increment threshold, adding a second preset number of the first random forest groups in the characteristic forest layer in an iterative mode so as to perform iterative updating on the updated initial image classification model again.
  6. 6. A method of constructing a random forest based image classification model as claimed in any of claims 1-4 wherein said predetermined accuracy condition is said prediction accuracy being greater than or equal to a predetermined accuracy threshold.
  7. 7. An image classification model construction device based on random forests is characterized by comprising: The building module is used for building an initial image classification model according to the number T of preset first random forest groups and the number M of preset second random forest groups, wherein the initial image classification model comprises an input layer, a characteristic forest layer, an enhanced forest layer and an output layer, the characteristic forest layer comprises T first random forest groups, the enhanced forest layer comprises M second random forest groups, and T, M are all positive integers; The first generation module is used for respectively inputting a first training set into each first random forest group of the feature forest layer to generate a feature matrix of the feature layer, wherein the first training set is generated by the input layer according to a plurality of training samples; the second generation module is used for respectively inputting the feature layer feature matrix and the first training set into each second random forest group of the enhanced forest layer to generate an enhanced layer feature matrix; The first determining module is used for inputting the feature layer feature matrix and the enhancement layer feature matrix into the output layer so as to determine the prediction precision of the initial image classification model; The second determining module is used for determining the initial image classification model as a target image classification model under the condition that the prediction precision of the initial image classification model reaches a preset precision condition; And the third determining module is used for carrying out iterative updating on the initial image classification model by increasing the number of the first random forest groups and/or the second random forest groups under the condition that the prediction precision of the initial image classification model does not reach the preset precision condition until the updated initial image classification model reaches the preset precision condition, and determining the updated initial image classification model as the target image classification model.
  8. 8. An electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor, when executing the computer program, causes the electronic device to implement the method of any one of claims 1 to 6.
  9. 9. A computer readable storage medium storing a computer program, characterized in that the computer program, when executed by an electronic device, implements the method according to any one of claims 1 to 6.
  10. 10. A computer program product comprising a computer program which, when run on an electronic device, causes the electronic device to perform the method of any of claims 1-6.

Description

Image classification model construction method and device based on random forest and electronic equipment Technical Field The application belongs to the technical field of computer application, and particularly relates to an image classification model construction method, device, electronic equipment, computer readable storage medium and computer program product based on random forests. Background Image classification is a core task of computer vision, aimed at assigning predefined class labels to images. Image classification is a basic technology for numerous intelligent applications, such as mobile phone album automatic arrangement, social media content auditing, medical image auxiliary diagnosis, automatic driving vehicle perception environment and the like, but is not separated from efficient and accurate image classification. In the related technology, image classification can be realized by training a deep learning network model or a width learning system and the like, but the deep learning network model possibly needs to be trained for days or even weeks due to complex structure and numerous parameters, meanwhile, super parameters such as learning rate, iteration times, initialization mode, network depth/width and the like have great influence on training results, the parameter adjustment process is tedious and needs a great deal of experience, and the deep learning network model cannot effectively perform incremental learning on newly added data. The feature nodes of the width learning system are generated by random mapping, the problem of feature redundancy possibly exists among the feature nodes, and the problem of information loss easily occurs to newly added nodes of the incremental learning of the width learning system, so that the generalization capability of the model and the accuracy of image classification are affected. Therefore, when image classification is realized by the prior art, the problems of low model training efficiency, poor generalization capability and low image classification precision exist. Disclosure of Invention The application aims to provide a random forest-based image classification model construction method, a random forest-based image classification model construction device, electronic equipment and a computer readable storage medium, which can solve the problems of low model training efficiency, poor generalization capability and low image classification precision caused by realizing image classification by training a deep learning network model, a width learning system and the like in the related technology. According to the method, an initial image classification model is built according to the number T of preset first random forest groups and the number M of preset second random forest groups, the initial image classification model comprises an input layer, a feature forest layer, an enhancement forest layer and an output layer, the feature forest layer comprises T first random forest groups, the enhancement forest layer comprises M second random forest groups, T, M are positive integers, a first training set is respectively input into each first random forest group of the feature forest layer to generate a feature layer feature matrix, the feature layer feature matrix and the first training set are respectively input into each second random forest group of the enhancement forest layer to generate an enhancement layer feature matrix, the feature layer feature matrix and the enhancement layer feature matrix are input into the output layer to determine the prediction accuracy of the initial image classification model, the initial image classification model is determined to be a target image model under the condition that the prediction accuracy of the initial image classification model reaches the preset accuracy, the initial image classification model is updated after the random image classification model reaches the preset accuracy or the initial image classification model reaches the new initial image classification accuracy after the preset accuracy reaches the preset accuracy condition or the new random image classification model is updated by the first random model. In a possible implementation manner of the first aspect, each first random forest group includes P first random forests, where P is a positive integer, each first random forest includes at least one decision tree, and the step of inputting the first training set into each first random forest group of the feature forest layer to generate the feature layer feature matrix includes: respectively inputting the first training set into each first random forest; sampling the first training set at least once through a p-th first random forest in the t-th first random forest group, respectively generating first training subsets for training decision trees in the p-th first random forest, wherein, ,; Generating a prediction matrix corresponding to the p-th first random forest in the t-th first random forest