CN111768457A - Image data compression method, device, electronic equipment and storage medium - Google Patents

Image data compression method, device, electronic equipment and storage medium Download PDF

Info

Publication number
CN111768457A
CN111768457A CN202010406318.5A CN202010406318A CN111768457A CN 111768457 A CN111768457 A CN 111768457A CN 202010406318 A CN202010406318 A CN 202010406318A CN 111768457 A CN111768457 A CN 111768457A
Authority
CN
China
Prior art keywords
data
image data
sample
loss function
vector
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010406318.5A
Other languages
Chinese (zh)
Other versions
CN111768457B (en
Inventor
李甲
沈鸿泽
付奎
穆凯
赵沁平
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beihang University
Original Assignee
Beihang University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beihang University filed Critical Beihang University
Priority to CN202010406318.5A priority Critical patent/CN111768457B/en
Publication of CN111768457A publication Critical patent/CN111768457A/en
Application granted granted Critical
Publication of CN111768457B publication Critical patent/CN111768457B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T9/00Image coding
    • G06T9/001Model-based coding, e.g. wire frame

Abstract

The application provides an image data compression method, an image data compression device, electronic equipment and a storage medium. Therefore, the original large-scale data set is screened based on the prediction result of the feature extraction model, representative data samples are extracted, redundant data are screened out, the scale of the data set is reduced, and the technical effect of greatly improving the model training speed on the premise of high accuracy is achieved.

Description

Image data compression method, device, electronic equipment and storage medium
Technical Field
The present application relates to the field of computer data processing, and in particular, to an image data compression method and apparatus, an electronic device, and a storage medium.
Background
At present, with the rapid development of the deep learning technology in the field of image recognition, the research and application of computer vision are continuously deep and increasingly complex, the data volume needing computer processing is increased sharply, and the requirements of people on the performance of a deep network are continuously improved.
The current solution to the increasing complexity of computer vision is to construct larger data sets and design and use deeper convolutional neural networks, which results in higher redundancy of related data and models. The prior art accelerates the training process of related image Processing models by using high-performance computing devices, such as Graphics Processing Unit (GPU) clusters, i.e. addresses the explosive increase in data volume by improving the computing performance of the computer. However, for general research and development enterprises or research and development units, the general research and development enterprises or research and development units are often limited by research and development environments, and the computing performance of research and development equipment cannot meet such high requirements, or the general research and development enterprises or research and development units are limited by time and cost and cannot be updated in time.
The redundancy of data and models presents the following problems: the model training speed is effectively improved under the condition of ensuring the model prediction accuracy.
Disclosure of Invention
The application provides an image data compression method, an image data compression device, electronic equipment and a storage medium, and aims to solve the problem of low computational efficiency caused by high redundancy of data and a model on the premise of ensuring a high-precision model prediction result in the prior art.
In a first aspect, the present application provides an image data compression method, including:
determining a first prediction feature vector of original image data according to a preset feature extraction model;
determining effective sample data from the original image data according to the first prediction feature vector;
and compressing the effective sample data by using a loss function to generate image compressed data.
Optionally, the raw image data includes: and the first real feature vector of the original image is used for comparing with the first prediction feature vector so as to determine effective sample data from the original image data according to the comparison result.
Optionally, the determining valid sample data from the original image data according to the comparison result includes:
if the comparison result meets the preset screening condition, determining the original image data as the data to be compressed;
generating a labeling vector according to a second real feature vector of the data to be compressed and a second prediction feature vector of the data to be compressed;
determining the sample classification difficulty of the second prediction characteristic vector and the labeling vector;
and determining the sample similarity between the second prediction characteristic vectors corresponding to different data to be compressed, wherein effective sample data comprises the data to be compressed, the labeling vector, the sample classification difficulty and the sample similarity.
Optionally, the compressing the effective sample image data by using a loss function includes:
and compressing the effective sample image data according to the labeling vector, the sample classification difficulty, the sample similarity and a loss function, wherein the loss function comprises: an inter-data class similarity loss function, an intra-data class difference loss function, an intra-data class selection and non-selection sample similarity loss function, a data selection balance constraint loss function, and a sample magnitude approximation constraint loss function.
Optionally, the compressing, by using the loss function, the effective sample image data according to the labeling vector, the sample classification difficulty, and the loss function includes:
determining an initial value of the selection probability according to the second prediction feature vector and a preset selection probability algorithm;
determining a selection probability value corresponding to effective sample data by using a preset gradient descent algorithm according to a selection probability initial value, a label vector, sample classification difficulty, sample similarity and a loss function;
and determining the image compressed data according to the selection probability value.
Optionally, the determining the image compression data according to the selection probability value includes:
and extracting and selecting effective sample data with probability value ordering meeting a preset rule as image compression data.
Optionally, after performing compression processing on the valid sample image data by using the loss function, the method further includes:
and generating a model performance sequencing mapping according to the image compression data and the original image data, wherein the model performance sequencing mapping is an accuracy evaluation index of the image compression data.
In a second aspect, the present application provides an image data compression apparatus comprising:
the acquisition module is used for acquiring original image data;
the characteristic processing module is used for determining a first prediction characteristic vector of the original image data according to a preset characteristic extraction model;
the screening module is used for determining effective sample data from the original image data according to the first prediction characteristic vector;
and the compression module is used for compressing the effective sample image data by using the loss function so as to generate image compression data.
Optionally, the original image data acquired by the acquiring module includes: a first true feature vector of the original image.
Optionally, the screening module is further configured to compare the first true feature vector with the first predicted feature vector, so as to determine valid sample data from the original image data according to a comparison result, and the method includes: if the comparison result meets the preset screening condition, determining the original image data as the data to be compressed;
the characteristic processing module is further used for generating an annotation vector according to a second real characteristic vector of the data to be compressed and a second prediction characteristic vector of the data to be compressed, determining the sample classification difficulty of the second prediction characteristic vector and the annotation vector, and determining the sample similarity between the second prediction characteristic vectors corresponding to different data to be compressed;
the characteristic processing module is also used for combining the data to be compressed, the labeling vector, the sample classification difficulty and the sample similarity into effective sample data.
Optionally, the compression module is configured to perform compression processing on the valid sample image data by using a loss function, and includes: and compressing the effective sample image data according to the labeling vector, the sample classification difficulty, the sample similarity and a loss function, wherein the loss function comprises: an inter-data class similarity loss function, an intra-data class difference loss function, an intra-data class selection and non-selection sample similarity loss function, a data selection balance constraint loss function, and a sample magnitude approximation constraint loss function.
Optionally, the compression module is further configured to determine an initial value of the selection probability according to the second prediction feature vector and a preset selection probability algorithm; determining a selection probability value corresponding to effective sample data by using a preset gradient descent algorithm according to a selection probability initial value, a label vector, sample classification difficulty, sample similarity and a loss function; and determining the image compressed data according to the selection probability value.
Optionally, the compression module is further configured to extract effective sample data with probability value ordering meeting a preset rule as the image compression data.
Optionally, the compression module is further configured to generate a model performance ranking map according to the image compression data and the original image data, where the model performance ranking map is an accuracy evaluation index of the image compression data.
In a third aspect, the present application provides an electronic device, comprising:
a memory for storing program instructions;
and the processor is used for calling and executing the program instructions in the memory and executing any one of the possible image data compression methods provided by the first aspect.
In a fourth aspect, the present application provides a storage medium, wherein a computer program is stored in the storage medium, and the computer program is configured to execute any one of the possible image data compression methods provided in the first aspect.
The application provides an image data compression method, an image data compression device, electronic equipment and a storage medium. Therefore, the original large-scale data set is screened based on the prediction result of the feature extraction model, representative data samples are extracted, redundant data are screened out, the scale of the data set is reduced, and the technical effect of greatly improving the model training speed on the premise of high accuracy is achieved.
Drawings
In order to more clearly illustrate the technical solutions in the present application or the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive labor.
Fig. 1 is a schematic diagram of an application data flow of an image data compression method provided in the present application;
FIG. 2 is a schematic flow chart of an image data compression method provided in the present application;
FIG. 3 is a schematic flow chart of another image data compression method provided in the present application;
FIG. 4 is a schematic structural diagram of an image data compression apparatus provided in the present application;
fig. 5 is a schematic structural diagram of an image data compression electronic device according to the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all the embodiments. All other embodiments, including but not limited to combinations of embodiments, which can be derived by a person skilled in the art from the embodiments disclosed herein without making any inventive step are within the scope of the present application.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims of the present application and in the above-described drawings (if any) are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are, for example, capable of operation in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Fig. 1 is a schematic diagram of an application data flow of an image data compression method provided by the present application, as shown in fig. 1, a large amount of high-redundancy image data 11 is predicted through a feature extraction model set 12, then a generated prediction result is subjected to data processing 13 to obtain preprocessed data, and finally the preprocessed data is subjected to compression distillation through a loss function 14 to obtain representative low-redundancy image data 15.
The application provides an image data compression method, an image data compression device, electronic equipment and a storage medium. Therefore, the original large-scale data set is screened based on the prediction result of the feature extraction model, representative data samples are extracted, redundant data are screened out, the scale of the data set is reduced, and the technical effect of greatly improving the model training speed on the premise of high accuracy is achieved.
Fig. 2 is a schematic flow chart of an image data compression method provided in the present application, as shown in fig. 2, the method includes:
s201, determining a first prediction feature vector of original image data according to a preset feature extraction model.
In this step, the received raw image data is input into a preset feature extraction model for training.
The original image data may be a picture, a picture set, or a video image, and the source of the original image data may be a picture taken by the intelligent terminal through a camera, or a video taken by a camera of the monitoring device, or a picture or a dynamic video taken by the face recognition device, or may be a picture or video data on a web page, or may be a video taken by the camera device, or the like.
The preset feature extraction model refers to an algorithm model capable of realizing image recognition, such as: scale-invariant feature transform (SIFT), Speeded Up Robust Features (SURF) algorithm, Convolutional Neural Networks (CNN) algorithm, etc.
The method comprises the steps of presetting a feature extraction model, extracting a candidate region such as a frame selection candidate region of an input original image to select a person or a specific animal or a human face, and then carrying out multi-level feature extraction training on the candidate region, wherein the multi-level feature extraction training is carried out on the candidate region, for example, the length of the face, the width of eyes, the length of the nose and the like in the human face recognition, or the hair color, the body length, the claw shape, the face shape, the ear length and the like of the animal in the animal recognition.
After feature extraction, the algorithm model combines the extracted features into a multi-dimensional feature vector, and then the multi-dimensional feature vector is classified by a classifier to form a first prediction feature vector containing classification category data.
S202, determining effective sample data from the original image data according to the first prediction feature vector.
In this embodiment of the present application, the original image data further includes, in addition to the image, a real feature vector corresponding to the image, where the real feature vector refers to an image feature that has been confirmed and has a valid identifier, for example, the original image data is a video of a segment of dog, and the original image data further includes a breed feature of the dog: husky.
Comparing the predicted feature vector and the real feature vector in the previous step in the same dimension, for example: in the face recognition, for the character of the character gender, whether the character gender in the predicted characteristic vector is consistent with the character gender in the real characteristic vector needs to be compared, if the character gender in the predicted characteristic vector is male but the character gender in the real characteristic vector is female, the fact that the preset characteristic extraction model is not applicable to the original image is indicated, and the sample data are invalid sample data; if the gender of the person in the predicted feature vector and the gender of the person in the real vector are both female, the original image data is considered to be capable of performing effective feature extraction by using a preset feature extraction model, namely the original image data is effective sample data.
The method has the advantages that the original image data are pre-screened, data exceeding the processing capacity of the preset feature extraction model are screened out, or invalid original image data which cannot be processed due to obvious errors exist are screened out, and the data volume needing to be processed by a computer is reduced.
And S203, compressing the effective sample data by using the loss function to generate image compressed data.
On the basis of eliminating invalid data in the previous step, the step is to screen the valid data in the aspect of characteristic representativeness, and further to extract image compressed data which can accurately represent the characteristics in the image and is the most representative data.
In order to achieve the above-described effects, in this step, effective sample data is evaluated and screened from a plurality of angles using a loss function. For example, for a piece of monitored video data, the identity of a person in a video needs to be recognized, obviously, there are many frames of pictures in the video, and these pictures can respectively extract feature data such as facial features and height features of the person, but since the person in the video is moving, there are images on the front of the face and images with facial features that are not clearly seen, so that the similarity comparison is performed on the extracted predicted feature values, optionally, the difference between the predicted feature values and the real feature values is also calculated, and for the data of different categories, the accuracy of classification needs to be evaluated, that is, the similarity and the difference between the categories are calculated, which can be realized by a specific algorithm, that is, a loss function, in this embodiment, the specific form of the loss function is not limited, and all calculation methods or model algorithms capable of realizing the above functions belong to the scope described in this application, the loss function can be chosen by the person skilled in the art as the case may be.
The embodiment provides an image data compression method, which includes determining a first predicted feature vector of original image data according to a preset feature extraction model, then determining effective sample data from the original image data by using the determined first predicted feature vector, and then compressing the effective sample data meeting conditions by using a loss function to generate image compressed data. Therefore, the original large-scale data set is screened based on the prediction result of the feature extraction model, representative data samples are extracted, redundant data are screened out, the scale of the data set is reduced, and the technical effect of greatly improving the model training speed on the premise of high accuracy is achieved.
Fig. 3 is a schematic flowchart of another image data compression method provided in the present application. As shown in fig. 3, the method includes:
s301, determining a first prediction feature vector of the original image data according to a preset feature extraction model.
In this step, the original image data may be a picture, a picture set, or a video image, and the source of the original image data may be a picture taken by the intelligent terminal through a camera, or a video taken by a camera of the monitoring device, or a picture or a dynamic video taken by the face recognition device, or may be a picture or video data on a web page, or may be a video taken by the camera device, or the like.
The preset feature extraction model refers to an algorithm model capable of realizing image recognition, such as: scale-invariant feature transform (SIFT), Speeded Up Robust Features (SURF) algorithm, Convolutional Neural Networks (CNN) algorithm, etc.
In this embodiment, a plurality of currently popular and representative pre-training models of the original image data set are selected as the pre-set feature extraction model, which includes: AlexNet, NIN, SqueezeNet, MobileNet-224, GoogleNet, VGG-16, ResNet-101, ResNet-152, ResNet-200, inclusion-V3, inclusion-V4, inclusion-ResNet-V2, ResNeXt-101, DenseNet-264, Attention-92, pyramidNet-200, DPN-131, SENET-154.
Inputting original image data into the 18 pre-trained models, extracting a prediction result output by the models, namely a first prediction characteristic vector, and corresponding to the distribution condition of the original image data in a characteristic space, wherein the characteristic space is a multi-dimensional evaluation system formed by taking each characteristic as one dimension, for example, a curve in a two-dimensional plane is the characteristic distribution condition in the two-dimensional space; and the extracted prediction results have the same evaluation system, namely the dimensions of the feature spaces are the same, so that the alignment of the feature dimensions of samples output by different models can be realized more easily, namely, the feature is measured at the same angle, for example, for the sizes of eyes, some models obtain the distance between the farthest ends of two eyes, some models obtain the distance between the middle points of the eyes, and the evaluation dimensions are not aligned. The dimension of alignment is such that the feature values can be evaluated with the same criteria.
For further explanation of the present embodiment, we will define the original image data containing more redundant data as the data set
Figure BDA0002491443850000081
It can be expressed by formula (1), and the specific form of formula (1) is as follows:
Figure BDA0002491443850000082
wherein N is the number of categories contained in the data set, u is the number of the categories,
Figure BDA0002491443850000083
is data of the u-th category.
U th class
Figure BDA0002491443850000084
In which contains NuData, then
Figure BDA0002491443850000085
Can be expressed by formula (2), and the specific form of formula (2) is as follows:
Figure BDA0002491443850000086
wherein N isuIs the total number of data in the category, IuiIs some data in that category.
The process and the noun explanation of the feature extraction refer to S201, which is not described herein again.
The image data compression method of the embodiment of the application is to the data set
Figure BDA0002491443850000087
Compressing to obtain image compressed data
Figure BDA0002491443850000088
For each data sample we
Figure BDA0002491443850000089
Defining a binary variable αui∈ {0, 1}, which is the selection variable for the data, αui1 means that
Figure BDA0002491443850000091
Otherwise, then
Figure BDA0002491443850000092
The function of the selection variable is to identify whether this data is the last compression result data, i.e., image compression data.
Therefore, we can express how to implement image data compression by equation (3), where equation (3) is specifically as follows:
Figure BDA0002491443850000093
where Ψ is a class loss function, Ψ represents: loss of inter-class similarity of data, loss of intra-class difference of data, and loss of similarity of intra-class selection and non-selection samples of data, i.e. corresponding to the following
Figure BDA0002491443850000094
And
Figure BDA0002491443850000095
Ω is a data loss function, and Ω represents: selective equilibrium constraint loss of data with sample-level approximation constraint loss, i.e., corresponding to the following
Figure BDA0002491443850000096
And
Figure BDA0002491443850000097
ρ∈[0,1]is a compression rate for determining image compression data
Figure BDA0002491443850000098
The amount of data of (a); λ is the weight; and N is a natural number set.
S302, comparing the first real feature vector with the first prediction feature vector to determine data to be compressed.
In this step, feature values in first prediction feature vectors extracted by the 18 feature extraction models in the previous step are compared with real feature values corresponding to images contained in original image data one by one, if prediction results generated by all models on certain original image data are error prediction, that is, the feature prediction results are not equal to the real features, or attribute judgment is wrong, or the difference is greater than a set value, it is judged that the current original image data exceeds the extraction capability of the current feature extraction model, the original image data is screened from a data set and does not participate in subsequent step processing, otherwise, the original image data is confirmed to be valid, that is, the data to be compressed.
It should be noted that the original image data and the data to be compressed both include: the image and the corresponding real characteristic value of the image. The data to be compressed also comprises a corresponding characteristic value extracted by the preset characteristic extraction model, namely a second prediction characteristic vector.
Specifically, in this step we use βiRepresenting a pre-selected probability, P, of the original image data1iRepresenting the prediction result of the first model for sample i, i.e. the first predicted feature vector, u represents the class of sample i, and then the probability β is pre-selectediCan be expressed by equation (4), equation (4) is as follows:
βi=(maxP1i=u||...||maxPni=u) (4)
wherein, (. cndot.) is an impact function, and can be understood as a function with 1 at one point and 0 at other points, | |. cn| | | represents that a plurality of conditions are juxtaposed, and k is less than or equal to n for any 1, if maxP existskiU, then βiThe pre-selection probability is 1, and the corresponding original image data i is reserved, namely determined as data to be compressed.
And S303, calculating the labeling vector, the sample classification difficulty and the sample similarity to obtain effective sample data.
In this step, the real feature value corresponding to the data to be compressed is used to generate a label vector with the same dimension according to the feature space dimension of the second predicted feature vector corresponding to the data to be compressed. For example: the second prediction feature vector is [2.5, 0, 0.89], the corresponding feature space is a 3-dimensional space, namely, three dimensions exist, and the value range of the first dimension is a numerical value larger than 1; the second dimension is an attribute judgment value, such as gender, 0 represents a woman, and 1 represents a man; the third dimension is a value with a value range between 0 and 1, and then the real feature value must generate a corresponding label vector according to the sequence and the value mode of the three dimensions.
Then, the Euclidean distance between the second prediction characteristic vector and the labeling vector of the data to be compressed is calculated, normalization processing is carried out on the Euclidean distance, namely the numerical value of the Euclidean distance is adjusted or mapped to the value between [0, 1 ], namely the numerical value is greater than or equal to 0 and smaller than 1, the numerical value obtained according to the requirement is called sample classification difficulty, and the sample classification difficulty reflects the difference between the prediction characteristic extraction result of the data to be compressed and the real characteristic label.
Specifically, we define the two-norm distance (also called euclidean distance) between the second predicted feature vector and the label vector of the data to be compressed as the sample classification difficulty, and then the sample classification difficulty can be expressed by equation (5), where equation (5) is as follows:
Di=||Pi-labeli||2(5)
wherein D isiFor the difficulty of sample classification, PiRepresenting the second predicted feature vector, labeliA second true feature vector representing the data i to be compressed.
Similarly, the Euclidean distance of a second prediction feature vector between any two data to be compressed of the data is calculated, normalization processing is carried out, and the obtained numerical value reflects the absolute distance of the data to be compressed in a feature space, namely the sample similarity degree.
The sample similarity between any two data i, j to be compressed can be expressed by equation (6), where equation (6) is as follows:
Si,j=||Pi-Pj||2(6)
data to be compressed, a labeling vector, sample classification difficulty and sample similarity are combined into a data set, and the data set is called effective sample data.
S304, compressing the effective sample image data according to the labeling vector, the sample classification difficulty, the sample similarity and the loss function, and determining a selection probability value corresponding to the effective sample data.
In this step, since simple 0 and 1 are not convenient to directly participate in the iterative calculation of the selection probability value, the pre-selection probability β in S302 is usediThe value range of the value is adjusted to be between [0, 1 ] by a preset selection probability algorithm according to the second real feature vector of the data to be compressed, namely the initial value of the selection probability. The preset selection probability algorithm has different implementation manners according to different image characteristics, and a person skilled in the art can select the prior art according to specific situations to implement the method, or obtain the result according to an empirical formula, or obtain a ratio of an image characteristic value to a similar maximum characteristic value.
The essence of this step is to solve the minimized loss function within the constraints of the optimization objective of equation (3)
Figure BDA0002491443850000111
We can express it by equation (7)
Figure BDA0002491443850000112
Equation (7) is as follows:
Figure BDA0002491443850000113
wherein the content of the first and second substances,
Figure BDA0002491443850000114
to optimize the loss function of the sub-targets, λiTo optimize the weight of the sub-goals, λiThe value of (A) is related to the order of magnitude presented by the loss function, is used for balancing the order of magnitude of the loss function, and can dynamically adjust the lambda through a self-learning algorithmiThe value of (a).
We define a specific loss function as follows:
1) loss of similarity function between data classes
Figure BDA0002491443850000115
As shown in equation (8):
Figure BDA0002491443850000116
where u, v represent two different feature classes of the data to be compressed, αuiRepresenting the selection probability, D, corresponding to the data i to be compressed in the class uuiFor data to be compressed αuiDifficulty of sample classification, NuRepresents the total amount of data in class u, PuiRepresenting data to be compressed αuiThe value of the second predicted feature vector of (1), S (P)ui,Pvj) For data i to be compressedui,ivjThe degree of similarity of the samples between them,1(u, v) is the shock function, ensuring that the polynomial is 0 overall when u, v represent the same class.
2) Intra-data class differential loss function
Figure BDA0002491443850000117
As shown in formula (9):
Figure BDA0002491443850000118
since calculating the intra-class differences of the data to be compressed is mutually exclusive from the similarity properties of the data to be compressed, 1-S (P) is usedui,Pvj) To represent a sample iui,ivjThe degree of difference therebetween. And what needs to be measured is the difference of any two samples in a single class, the impact function2The (u, v) setting is opposite to the similarity between the data classes, and the polynomials generated by different classes participating in the calculation are set to be 0, so that the two classes participating in the calculation are the same class.
3) Selecting and non-selecting sample similarity loss function in data class
Figure BDA0002491443850000121
As shown in equation (10):
Figure BDA0002491443850000122
wherein α is used for calculating similarity between selected sample (i.e. data to be compressed) and screened sample (i.e. screened data)vjItem is changed to 1- αvjIn this way, the polynomial under the condition of two selected samples and the condition of two screened samples can be set to be 0, so as to ensure that the description condition of the formula is true, and simultaneously, the distribution conditions of the considered samples are all in a single category, so that the impact function is used3To exclude the case where the samples come from different categories.
4) Selective balance constraint loss function of data
Figure BDA0002491443850000123
As shown in formula (11):
Figure BDA0002491443850000124
where ρ represents the compression ratio corresponding to the original image data, muRepresenting the ratio of the compressed image data in the class u to the number of data samples contained in the class u in the original dataset, i.e. the true compression ratio, m, of the class uuThe value of (a) should be as close to rho as possible, so as to ensure that the data sample size obtained after each class is compressed conforms to the sample size distribution rule of the original data set.
5) Sample magnitude approximation constraint loss function
Figure BDA0002491443850000125
As shown in equation (12):
Figure BDA0002491443850000126
wherein (1-D)ui) The function of the method is to retain representative samples in each category as much as possible while performing data compression screening, and in the embodiment, the representative characteristics of the samples are expressed by selecting the sample classification difficulty.
The multi-objective optimization problem is designed by utilizing the loss functions, the initial learning rate in a gradient descent algorithm is set to be 0.1, meanwhile, the weight of the loss functions is adjusted to enable the influence of the plurality of loss functions on the selection probability of the data samples to be close, the selection probability value of the data samples is continuously updated in an iterative mode by utilizing a gradient descent method, and the loss functions are continuously close to the convergence state. And (4) carrying out normalization operation on the iteratively updated selection probability value by using a sigmoid function, and strictly limiting a variable domain.
S305, extracting and selecting effective sample data with probability value sequencing according with a preset rule as image compression data.
In the step, the selection probability values corresponding to the data to be compressed, which are obtained by iterative computation of the gradient descent algorithm in the previous step, are sorted from large to small, and the data to be compressed, which is larger than the selection probability threshold, is taken as image compression data. The selection probability threshold may be a fixed value or a dynamically changing value, and may be a product of the compression ratio ρ corresponding to the original image data and the total amount of the original image data.
And S306, generating model performance sequencing mapping according to the image compressed data and the original image data.
And respectively inputting the image compressed data into the feature extraction models to be tested, and performing performance sequencing on the feature extraction models according to the closeness degree of the output feature vectors and the real feature vectors to obtain a first performance sequencing mapping.
And similarly, inputting the original image data into the feature extraction model to be tested, and performing performance sequencing on the feature extraction model according to the closeness degree of the output feature vector and the real feature vector to obtain a second performance sequencing mapping.
For example, the performance ranking of the first performance ranking map for the three feature extraction models a, B, and C is BCA, if the performance ranking of the second performance ranking map for the three feature extraction models a, B, and C is also BCA, the accuracy of the compressed data is 100%, if the second performance ranking map is BAC, the accuracy needs to be calculated according to an algorithm for calculating the specific accuracy, and this embodiment does not limit the calculation method of the accuracy.
The embodiment provides an image data compression method, which comprises the steps of using a plurality of currently popular and representative original data set pre-training models as basic models, inputting original image data and obtaining a prediction result generated by the models on the data; then, integrating prediction results generated by multiple models, pre-screening the original data, and calculating the sample classification difficulty and the sample similarity of the data to be compressed according to the real feature vector corresponding to the original image data; then, comprehensively considering the influence of the distribution of the data to be compressed in the feature space on the network training, designing the following loss functions: 1) the more similar the data samples of different classes, the closer the sample position is to the model classification interface in the feature space, which means that the sample is difficult to be classified correctly, and the higher the selection weight of the sample, the better the model construction classification interface can be helped. 2) The intra-class difference of the data is larger, the larger the difference of the data samples in the same class is, the more the samples can be ensured to be uniformly distributed in a characteristic space region of one class, the samples with larger similarity in the class can be excluded to a certain extent, and the representativeness of the samples in the class is improved. 3) The similarity between the selected sample and the unselected sample in the data class is higher, the higher the similarity between the sample with higher selection probability and the sample with lower selection probability in the same class is, the more redundant samples can be eliminated, and the distillation performance of the data set is improved. 4) The selected sample number ratio in each category can be close to the expected value by counting the selection probability of all samples in the category to the sample number in the category and enabling the ratio to be close to the expected set compression ratio. 5) And (3) sample magnitude approximation constraint, counting the samples selected in each category, taking the classification difficulty of the samples into consideration as the number representative of the categories, reducing the difference between the representative values of the number of the categories, reducing the difference between the number of the samples of the categories as much as possible, and ensuring that the retained samples have certain representativeness. Synthesizing the five loss functions, converting the data compression problem into a problem of solving multi-objective optimization, setting a proper initial learning rate by using a gradient descent method, circularly iterating and reducing the loss functions to obtain the selection probability of the data set samples, and sequencing according to the selection probability; and finally, sorting the data to be compressed according to the selection probability, calculating the size of the compressed image data set according to the expected data compression ratio and the total number of the original image data, and selecting equivalent samples from the sorted data to be compressed to form the image compressed data.
In the embodiment of the application, the image data compression method is used for compressing 500 samples of each type into only 100 samples on the Cifar data set, so that the scale of the data set is reduced by 80%, and the training speed is greatly increased. Compared with the prior art, the performance of the compressed data set training model is only reduced by about 2.58% compared with that of a source data set, and compared with the prior art, the performance of the compressed data set training model is only reduced by 3.35% under the same compression ratio condition. In addition, the performance of the plurality of models after being trained on the compressed data set obtained by the method provided by the application keeps the same sequence as the performance of the models after being trained on the original data set.
Compared with the existing data set compression method, the method provided by the application integrates a plurality of model prediction results to calculate, simultaneously designs strategies to analyze and screen data, can accurately extract representative samples, screens out redundant data, obviously improves the training speed of the model and keeps higher accuracy, forms model performance sequencing mapping from image compression data to original image data, and can evaluate the compression effect by utilizing the model performance sequencing mapping.
Those of ordinary skill in the art will understand that: all or part of the steps for implementing the method embodiments can be implemented by hardware related to program instructions, the program can be stored in a computer readable storage medium, and the program executes the steps including the method embodiments when executed; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Fig. 4 is a schematic structural diagram of an image data compression apparatus provided in the present application. The image data compression apparatus may be implemented by software, hardware, or a combination of both.
As shown in fig. 4, the present embodiment provides an image data compression apparatus 400 including:
an obtaining module 401, configured to obtain original image data;
a feature processing module 402, configured to determine a first predicted feature vector of original image data according to a preset feature extraction model;
a screening module 403, configured to determine valid sample data from the original image data according to the first predicted feature vector;
and a compression module 404, configured to perform compression processing on the valid sample image data by using a loss function to generate image compression data.
Optionally, the raw image data acquired by the acquiring module 401 includes: a first true feature vector of the original image.
Optionally, the screening module 403 is further configured to compare the first true feature vector with the first predicted feature vector, so as to determine valid sample data from the original image data according to a comparison result, where the method includes: if the comparison result meets the preset screening condition, determining the original image data as the data to be compressed;
the feature processing module 402 is further configured to generate an annotation vector according to a second true feature vector of the data to be compressed and a second predicted feature vector of the data to be compressed, determine a sample classification difficulty of the second predicted feature vector and the annotation vector, and determine a sample similarity between second predicted feature vectors corresponding to different data to be compressed;
the feature processing module 402 is further configured to combine the data to be compressed, the labeled vector, the sample classification difficulty and the sample similarity into effective sample data.
Optionally, the compressing module 404 is configured to perform compression processing on the valid sample image data by using a loss function, and includes: and compressing the effective sample image data according to the labeling vector, the sample classification difficulty, the sample similarity and a loss function, wherein the loss function comprises: an inter-data class similarity loss function, an intra-data class difference loss function, an intra-data class selection and non-selection sample similarity loss function, a data selection balance constraint loss function, and a sample magnitude approximation constraint loss function.
Optionally, the compressing module 404 is further configured to determine an initial value of the selection probability according to the second predicted feature vector and a preset selection probability algorithm; determining a selection probability value corresponding to effective sample data by using a preset gradient descent algorithm according to a selection probability initial value, a label vector, sample classification difficulty, sample similarity and a loss function; and determining the image compressed data according to the selection probability value.
Optionally, the compression module 404 is further configured to extract and select valid sample data with probability value ordering meeting a preset rule as the image compression data.
Optionally, the compression module 404 is further configured to generate a model performance ranking map according to the image compression data and the original image data, where the model performance ranking map is an accuracy evaluation index of the image compression data.
It should be noted that the image data compression apparatus provided in the embodiment shown in fig. 4 can execute an image data compression method provided in any of the above method embodiments, and the specific implementation principle, technical features, term explanation and technical effects thereof are similar and will not be described herein again.
Fig. 5 is a schematic structural diagram of an electronic device provided in the present application. As shown in fig. 5, the image data compression electronic device 500 may include: at least one processor 501 and memory 502. Fig. 5 shows an electronic device as an example of a processor.
The memory 502 is used for storing programs. In particular, the program may include program code including computer operating instructions.
Memory 502 may comprise high-speed RAM memory, and may also include non-volatile memory (non-volatile memory), such as at least one disk memory.
The processor 501 is used to execute the computer-executable instructions stored in the memory 502 to implement the image data compression method described in the above method embodiments.
The processor 501 may be a Central Processing Unit (CPU), an Application Specific Integrated Circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application.
Alternatively, the memory 502 may be separate or integrated with the processor 501. When the memory 502 is a device independent from the processor 501, the electronic device 500 may further include:
a bus 503 for connecting the processor 501 and the memory 502. The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended ISA (EISA) bus, or the like. Buses may be classified as address buses, data buses, control buses, etc., but do not represent only one bus or type of bus.
Alternatively, in a specific implementation, if the memory 502 and the processor 501 are integrated on a chip, the memory 502 and the processor 501 may communicate through an internal interface.
The present application also provides a computer-readable storage medium, which may include: various media that can store program codes, such as a usb disk, a removable hard disk, a read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk, specifically, the computer-readable storage medium stores program instructions for the image data compression method in the above embodiments.
Finally, it should be noted that: the above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present application.

Claims (10)

1. An image data compression method, comprising:
determining a first prediction feature vector of original image data according to a preset feature extraction model;
determining valid sample data from the original image data according to the first prediction feature vector;
and compressing the effective sample data by using a loss function to generate image compressed data.
2. The image data compression method according to claim 1, wherein the original image data includes: a first true feature vector of an original image, the first true feature vector for comparison with the first predicted feature vector to determine the valid sample data from the original image data according to a comparison result.
3. The method according to claim 2, wherein said determining the valid sample data from the original image data according to the comparison result comprises:
if the comparison result meets the preset screening condition, determining the original image data as the data to be compressed;
generating a labeling vector according to a second real feature vector of the data to be compressed and a second prediction feature vector of the data to be compressed;
determining a sample classification difficulty of the second predicted feature vector and the annotation vector;
and determining sample similarity between the second prediction characteristic vectors corresponding to different data to be compressed, wherein the effective sample data comprises the data to be compressed, the labeling vector, the sample classification difficulty and the sample similarity.
4. The image data compression method according to claim 3, wherein the compressing the effective sample image data by using a loss function includes:
compressing the effective sample image data according to the labeling vector, the sample classification difficulty, the sample similarity and the loss function, wherein the loss function comprises: an inter-data class similarity loss function, an intra-data class difference loss function, an intra-data class selection and non-selection sample similarity loss function, a data selection balance constraint loss function, and a sample magnitude approximation constraint loss function.
5. The method according to claim 4, wherein said compressing the valid sample image data according to the annotation vector, the sample classification difficulty level, and the loss function by using a loss function comprises:
determining an initial value of a selection probability according to the second prediction feature vector and a preset selection probability algorithm;
determining a selection probability value corresponding to the effective sample data according to the initial value of the selection probability, the labeling vector, the sample classification difficulty, the sample similarity and the loss function by using a preset gradient descent algorithm;
and determining the image compressed data according to the selection probability value.
6. The method of claim 5, wherein said determining the image compression data according to the selection probability value comprises:
and extracting effective sample data with the selection probability value sequence conforming to a preset rule as the image compressed data.
7. The image data compression method according to claims 1 to 6, further comprising, after the compressing the effective sample image data by using the loss function:
and generating a model performance sequencing mapping according to the image compression data and the original image data, wherein the model performance sequencing mapping is an accuracy evaluation index of the image compression data.
8. An apparatus for image data compression, comprising:
the acquisition module is used for acquiring original image data;
the characteristic processing module is used for determining a first prediction characteristic vector of the original image data according to a preset characteristic extraction model;
the screening module is used for determining effective sample data from the original image data according to the first prediction characteristic vector;
and the compression module is used for compressing the effective sample image data by using a loss function so as to generate image compression data.
9. An electronic device, comprising:
a processor; and the number of the first and second groups,
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the image data compression method of any one of claims 1 to 7 via execution of the executable instructions.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the image data compression method according to any one of claims 1 to 7.
CN202010406318.5A 2020-05-14 2020-05-14 Image data compression method, device, electronic equipment and storage medium Active CN111768457B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010406318.5A CN111768457B (en) 2020-05-14 2020-05-14 Image data compression method, device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010406318.5A CN111768457B (en) 2020-05-14 2020-05-14 Image data compression method, device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111768457A true CN111768457A (en) 2020-10-13
CN111768457B CN111768457B (en) 2022-10-04

Family

ID=72719066

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010406318.5A Active CN111768457B (en) 2020-05-14 2020-05-14 Image data compression method, device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111768457B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112200255A (en) * 2020-10-16 2021-01-08 浙江大学 Information redundancy removing method for sample set
CN112364913A (en) * 2020-11-09 2021-02-12 重庆大学 Federal learning communication traffic optimization method and system based on core data set
CN112559618A (en) * 2020-12-23 2021-03-26 光大兴陇信托有限责任公司 External data integration method based on financial wind control service
CN113055677A (en) * 2021-04-07 2021-06-29 南京云格信息技术有限公司 Image compression method based on FPGA
CN114255354A (en) * 2021-12-31 2022-03-29 智慧眼科技股份有限公司 Face recognition model training method, face recognition device and related equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109492666A (en) * 2018-09-30 2019-03-19 北京百卓网络技术有限公司 Image recognition model training method, device and storage medium
CN109934300A (en) * 2019-03-21 2019-06-25 腾讯科技(深圳)有限公司 Model compression method, apparatus, computer equipment and storage medium
CN110009013A (en) * 2019-03-21 2019-07-12 腾讯科技(深圳)有限公司 Encoder training and characterization information extracting method and device
US20190244362A1 (en) * 2018-02-06 2019-08-08 Google Llc Differentiable Jaccard Loss Approximation for Training an Artificial Neural Network

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20190244362A1 (en) * 2018-02-06 2019-08-08 Google Llc Differentiable Jaccard Loss Approximation for Training an Artificial Neural Network
CN109492666A (en) * 2018-09-30 2019-03-19 北京百卓网络技术有限公司 Image recognition model training method, device and storage medium
CN109934300A (en) * 2019-03-21 2019-06-25 腾讯科技(深圳)有限公司 Model compression method, apparatus, computer equipment and storage medium
CN110009013A (en) * 2019-03-21 2019-07-12 腾讯科技(深圳)有限公司 Encoder training and characterization information extracting method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
王海洋等: "基于分段贪婪的SVM训练算法研究", 《商业文化(学术版)》 *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112200255A (en) * 2020-10-16 2021-01-08 浙江大学 Information redundancy removing method for sample set
CN112200255B (en) * 2020-10-16 2021-09-14 浙江大学 Information redundancy removing method for sample set
CN112364913A (en) * 2020-11-09 2021-02-12 重庆大学 Federal learning communication traffic optimization method and system based on core data set
CN112559618A (en) * 2020-12-23 2021-03-26 光大兴陇信托有限责任公司 External data integration method based on financial wind control service
CN112559618B (en) * 2020-12-23 2023-07-11 光大兴陇信托有限责任公司 External data integration method based on financial wind control business
CN113055677A (en) * 2021-04-07 2021-06-29 南京云格信息技术有限公司 Image compression method based on FPGA
CN114255354A (en) * 2021-12-31 2022-03-29 智慧眼科技股份有限公司 Face recognition model training method, face recognition device and related equipment

Also Published As

Publication number Publication date
CN111768457B (en) 2022-10-04

Similar Documents

Publication Publication Date Title
CN111768457B (en) Image data compression method, device, electronic equipment and storage medium
Zhang et al. Generative domain-migration hashing for sketch-to-image retrieval
CN107944020B (en) Face image searching method and device, computer device and storage medium
CN108491817B (en) Event detection model training method and device and event detection method
US11417148B2 (en) Human face image classification method and apparatus, and server
WO2020125216A1 (en) Pedestrian re-identification method, device, electronic device and computer-readable storage medium
CN109543602B (en) Pedestrian re-identification method based on multi-view image feature decomposition
Naikal et al. Informative feature selection for object recognition via sparse PCA
CN103403739B (en) For the method and system of movement images
CN112446476A (en) Neural network model compression method, device, storage medium and chip
CN110765860A (en) Tumble determination method, tumble determination device, computer apparatus, and storage medium
Fang et al. Deep3DSaliency: Deep stereoscopic video saliency detection model by 3D convolutional networks
CN109726725B (en) Oil painting author identification method based on large-interval inter-class mutual-difference multi-core learning
CN111401339B (en) Method and device for identifying age of person in face image and electronic equipment
WO2014055874A1 (en) Fast computation of kernel descriptors
CN112016450A (en) Training method and device of machine learning model and electronic equipment
CN110222718A (en) The method and device of image procossing
CN111783779A (en) Image processing method, apparatus and computer-readable storage medium
CN110909817B (en) Distributed clustering method and system, processor, electronic device and storage medium
CN110414431B (en) Face recognition method and system based on elastic context relation loss function
JP2017129990A (en) Device, method, and program for image recognition
Zhang et al. Discriminative tensor sparse coding for image classification.
CN117315377B (en) Image processing method and device based on machine vision and electronic equipment
CN116310462B (en) Image clustering method and device based on rank constraint self-expression
Dong et al. A supervised dictionary learning and discriminative weighting model for action recognition

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant