WO2021018218A1 - 一种数据存储方法、及其数据获取方法、装置 - Google Patents

一种数据存储方法、及其数据获取方法、装置 Download PDF

Info

Publication number
WO2021018218A1
WO2021018218A1 PCT/CN2020/105590 CN2020105590W WO2021018218A1 WO 2021018218 A1 WO2021018218 A1 WO 2021018218A1 CN 2020105590 W CN2020105590 W CN 2020105590W WO 2021018218 A1 WO2021018218 A1 WO 2021018218A1
Authority
WO
WIPO (PCT)
Prior art keywords
parameter vector
data
parameter
neural network
network model
Prior art date
Application number
PCT/CN2020/105590
Other languages
English (en)
French (fr)
Inventor
张营营
钟巧勇
谢迪
浦世亮
Original Assignee
杭州海康威视数字技术股份有限公司
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 杭州海康威视数字技术股份有限公司 filed Critical 杭州海康威视数字技术股份有限公司
Priority to EP20848629.0A priority Critical patent/EP4007173A4/en
Priority to US17/630,660 priority patent/US20220261433A1/en
Publication of WO2021018218A1 publication Critical patent/WO2021018218A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/50Information retrieval; Database structures therefor; File system structures therefor of still image data
    • G06F16/51Indexing; Data structures therefor; Storage structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/06Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons
    • G06N3/063Physical realisation, i.e. hardware implementation of neural networks, neurons or parts of neurons using electronic means
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/084Backpropagation, e.g. using gradient descent
    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03MCODING; DECODING; CODE CONVERSION IN GENERAL
    • H03M7/00Conversion of a code where information is represented by a given sequence or number of digits to a code where the same, similar or subset of information is represented by a different sequence or number of digits
    • H03M7/30Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction
    • H03M7/3059Digital compression and data reduction techniques where the original information is represented by a subset or similar information, e.g. lossy compression
    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03MCODING; DECODING; CODE CONVERSION IN GENERAL
    • H03M7/00Conversion of a code where information is represented by a given sequence or number of digits to a code where the same, similar or subset of information is represented by a different sequence or number of digits
    • H03M7/30Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction
    • H03M7/3082Vector coding
    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03MCODING; DECODING; CODE CONVERSION IN GENERAL
    • H03M7/00Conversion of a code where information is represented by a given sequence or number of digits to a code where the same, similar or subset of information is represented by a different sequence or number of digits
    • H03M7/30Compression; Expansion; Suppression of unnecessary data, e.g. redundancy reduction
    • H03M7/60General implementation details not specific to a particular type of compression
    • H03M7/6041Compression optimized for errors
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/0409Adaptive resonance theory [ART] networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/044Recurrent networks, e.g. Hopfield networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • G06N3/088Non-supervised learning, e.g. competitive learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N7/00Computing arrangements based on specific mathematical models
    • G06N7/01Probabilistic graphical models, e.g. probabilistic networks

Definitions

  • This application relates to the field of data storage, and in particular, to a data storage method, and a data acquisition method and device thereof.
  • Data dimension refers to the descriptive attributes or characteristics of an object. For example, a picture with 16 ⁇ 16 pixels, each pixel has a corresponding pixel value, that is, each pixel is a descriptive attribute of the picture, then the picture can be regarded as having 256 data dimensions.
  • autoencoders are used to establish a one-to-one mapping relationship between low-dimensional data and high-dimensional data. In this way, based on the stored low-dimensional data, the autoencoder can Obtain the corresponding high-dimensional data, so that the storage space can be reduced.
  • this type of autoencoder reduces the data storage space to a certain extent, it still needs to store a large amount of compressed low-dimensional data while storing the network model parameters of the autoencoder. In this way, if the amount of data is very large, based on The algorithm of the autoencoder still requires a lot of storage space.
  • the embodiments of the present application provide a data storage method, and a data acquisition method and device thereof, so as to reduce the storage space required for storing high-dimensional data.
  • An embodiment of the present application provides a data storage method, which includes:
  • the model parameters of the neural network model and/or the first parameter vector are adjusted until the current second parameter vector is based on the expected data samples of the N data to be stored obtained by the trained neural network model.
  • the method further includes, if the current second parameter vector is based on the expected data samples of the N to-be-stored data obtained by the trained neural network model and does not regress to the N-to-be-stored data, then the current Perform N-dimensional replacement of the first parameter vector of, and return to execute the step of adjusting the model parameters and/or the first parameter vector of the neural network model.
  • the method further includes: distinguishing the N pieces of data to be stored according to categories, and/or respectively assigning an identifier to each of the data to be stored, and storing the category and/or identifier with the first Correspondence of parameter vectors;
  • the method also includes: storing model parameters of the trained neural network model;
  • the initial values of the parameters of each dimension in the first parameter vector are obtained by sampling the N pieces of to-be-stored data according to Gaussian distribution random values.
  • the performing N-dimensional permutation on the first parameter vector to obtain N second parameter vectors each having N dimensions includes: performing N-dimensional permutation on the first parameter vector through N affine transformation matrices to obtain N Second parameter vectors each having N dimensions, so that one of the N second parameter vectors each having N dimensions is the same as the first parameter vector, and the other second parameter vectors in each dimension The value is different from the value of the first parameter vector in the corresponding dimension.
  • the N-dimensional permutation of the first parameter vector is performed by using N affine transformation matrices to obtain N current second parameter vectors each having N dimensions, so that the N second parameters each having N dimensions
  • One second parameter vector in the vector is the same as the first parameter vector, and the values of other second parameter vectors in each dimension are different from the values in the corresponding dimension of the first parameter vector, including:
  • the performing N-dimensional permutation on the first parameter vector through N affine transformation matrices includes:
  • the N affine transformation matrices are N ⁇ N matrices, and the elements a ij in the affine transformation matrix satisfy:
  • the performing N-dimensional permutation on the first parameter vector to obtain N second parameter vectors each having N dimensions includes:
  • the value of the dimension corresponding to the identifier of the N data to be stored in the first parameter vector is exchanged with the value of the first dimension in the first parameter vector to obtain N second parameter vectors with N dimensions respectively.
  • the value of the dimension corresponding to the identification of the N data to be stored in the first parameter vector is exchanged with the value of the first dimension in the first parameter vector to obtain N dimensionality values respectively.
  • the second parameter vector includes:
  • the performing N-dimensional permutation on the first parameter vector by using N affine transformation matrices respectively includes:
  • the N affine transformation matrices are N ⁇ N matrices, and the elements a ij in the affine transformation matrix satisfy:
  • Returning samples to the N pieces of data to be stored includes: using the N second parameter vectors each having N dimensions as input variables of the neural network model, and using the output data of the neural network model as the N
  • the expected data samples of the data to be stored are trained on the model parameters of the neural network model, and/or the first parameter vector is updated during the training process, until the expected data samples of the N data to be stored return to the N data to be stored.
  • the training the neural network model and/or updating the first parameter vector in the training process until the expected data samples of the N data to be stored return to the N data to be stored include:
  • the principle of convergence is to optimize the model parameters and/or the first parameter vector of the current neural network model to obtain the model parameters of the neural network model optimized for this iteration and/or the updated first parameter vector;
  • An embodiment of the present application provides a data acquisition method, which includes:
  • the N second parameter vectors are used as input variables of the trained neural network model, and the output data of the trained neural network model is used as the data to be acquired.
  • the obtaining the stored first parameter vector according to the data to be obtained includes:
  • the first parameter vector is obtained based on the correspondence between the stored category and/or identification and the first parameter vector;
  • the obtaining of the trained neural network model used for data storage includes obtaining the stored model parameters of the trained neural network model, and loading the model parameters into the neural network model to obtain the trained neural network model.
  • the performing N-dimensional permutation on the first parameter vector to obtain N second parameter vectors each having N dimensions includes: performing N-dimensional on the first parameter vector through N affine transformation matrices Permutation to obtain N second parameter vectors each having N dimensions, so that one of the N second parameter vectors each having N dimensions is the same as the first parameter vector, and the other second parameter vectors are The value in each dimension is different from the value in the corresponding dimension of the first parameter vector.
  • the N-dimensional permutation of the first parameter vector is performed by using N affine transformation matrices to obtain N second parameter vectors each having N dimensions, so that the N second parameter vectors each having N dimensions
  • One second parameter vector in the parameter vector is the same as the first parameter vector, and the values of other second parameter vectors in each dimension are different from the values in the corresponding dimension of the first parameter vector, including:
  • the performing N-dimensional replacement of the first parameter vector by using N affine transformation matrices includes:
  • the N affine transformation matrices are N ⁇ N matrices, and the elements a ij in the affine transformation matrix satisfy:
  • the performing N-dimensional permutation on the first parameter vector to obtain N second parameter vectors each having N dimensions includes:
  • the value of the dimension corresponding to the identifier of the data to be acquired in the first parameter vector is exchanged with the value of the first dimension in the first parameter vector to obtain N pieces with N dimensions respectively
  • the second parameter vector includes:
  • the performing N-dimensional permutation on the first parameter vector through N affine transformation matrices respectively includes:
  • the N affine transformation matrices are N ⁇ N matrices, and the elements a ij in the affine transformation matrix satisfy:
  • An embodiment of the present application provides a data acquisition method, which includes:
  • the second parameter vector is used as the input variable of the trained neural network model, and the output data of the trained neural network model is used as the data to be acquired.
  • An embodiment of the application provides a data storage device, which includes:
  • the permutation module is used to perform N-dimensional permutation on the first parameter vector to obtain N second parameter vectors each having N dimensions;
  • the construction module is used to construct a neural network model that maps the current second parameter vector to the expected data samples of the N data to be stored; and performs the model parameters and/or the first parameter vector of the neural network model Adjust until the current second parameter vector is based on the expected data samples of the N to-be-stored data obtained by the trained neural network model and regresses to the N-to-be-stored data;
  • the storage module is used to store the current first parameter vector.
  • An embodiment of the present application provides a data acquisition device, which includes:
  • the first obtaining module is configured to obtain the stored first parameter vector according to the information of the data to be obtained;
  • a permutation module configured to perform N-dimensional permutation on the first parameter vector to obtain N second parameter vectors each having N dimensions, where N is the dimension of the first parameter vector;
  • the second acquisition module is used to acquire the trained neural network model used in data storage; the N second parameter vectors are used as input variables of the trained neural network model, and the output of the trained neural network model The data serves as the data to be acquired.
  • An embodiment of the present application provides a data acquisition device, which includes:
  • the first obtaining module is configured to obtain the stored first parameter vector according to the information of the data to be obtained;
  • the replacement module is used to obtain the trained neural network model used in data storage
  • the second acquisition module is configured to use the second parameter vector as an input variable of the trained neural network model, and use the output data of the trained neural network model as the data to be acquired.
  • An embodiment of the present application provides an electronic device, the electronic device includes a processor and a storage medium, the storage medium stores a computer program, and when the computer program is executed by the processor, any one of the data storage Method steps.
  • An embodiment of the present application provides an electronic device, the electronic device includes a processor and a storage medium, the storage medium stores a computer program, and when the computer program is executed by the processor, any one of the data acquisitions is achieved Method steps.
  • An embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the steps of any of the data storage methods are implemented.
  • An embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the steps of any of the data acquisition methods are implemented.
  • An embodiment of the present application provides a computer program, which implements the steps of any of the data storage methods when the computer program is executed by a processor.
  • An embodiment of the present application provides a computer program, which implements the steps of any of the data acquisition methods when the computer program is executed by a processor.
  • N N-dimensional second parameter vectors are obtained through affine transformation, and the second parameter vector is mapped to the first parameter vector through the trained neural network model
  • the corresponding N data so that an N-dimensional first parameter vector is stored, is equivalent to storing N data, and multiple high-dimensional data is reduced to a low-dimensional data for storage, so that the storage of high-dimensional data is The required storage space is greatly reduced.
  • Fig. 1 is a flowchart of a data storage method provided by an embodiment of the present application.
  • Fig. 2 is a flow chart of the neural network model training method provided by an embodiment of the application.
  • FIG. 3 is a schematic diagram of a data mapping process involved in an embodiment of this application.
  • FIG. 4 is a schematic flowchart of a data acquisition method provided by an embodiment of the application.
  • FIG. 5 is a schematic diagram of a data storage device provided by an embodiment of the application.
  • FIG. 6 is a schematic diagram of a data acquisition device provided by an embodiment of the application.
  • the affine transformation is to perform multi-dimensional permutation on the parameter vector, that is, permutate multiple dimensions of the parameter vector.
  • Data dimension refers to the descriptive attributes or characteristics of an object. Among them, the data dimension is referred to as “dimension” or “dimension” for short.
  • High-dimensional data is data with higher data dimensions. For example, data whose data dimension is higher than a preset threshold.
  • Low-dimensional data is data with lower data dimensions.
  • data whose dimensions are lower than or equal to a preset threshold can be set according to actual needs.
  • the preset threshold may be 100, 200, and so on.
  • the data sample is the sample data
  • the data to be stored is simply referred to as the data to be stored
  • the adjusted first parameter vector is the updated first parameter vector
  • an embodiment of the present application provides a data storage method, including:
  • Step 11 Allocate an N-dimensional first parameter vector for N to-be-stored data
  • Step 12 Perform N-dimensional permutation on the first parameter vector to obtain N second parameter vectors each having N dimensions;
  • Step 13 building a neural network model that maps the current second parameter vector to the expected data samples of the N data to be stored;
  • Step 13 is to construct a neural network model for mapping the current second parameter vector to the expected data samples of the N data to be stored.
  • Step 14 Adjust the model parameters of the neural network model and/or the first parameter vector until the current second parameter vector is returned to N based on the expected data samples of the N data to be stored obtained by the trained neural network model Data to be stored;
  • Step 14 is to adjust the model parameters of the neural network model and/or the first parameter vector until the trained neural network model returns to the expected data samples of the N data to be stored obtained based on the current second parameter vector For N data to be stored.
  • Step 15 Store the current first parameter vector.
  • the model parameters of the trained neural network model can also be stored.
  • the data storage method proposed in the embodiment of the present application allocates an N-dimensional first parameter vector to N V-dimensional data to be stored, where V is greater than or equal to N, and replaces the N dimensions of the first parameter vector to obtain N N Dimensional second parameter vector, so that a first parameter vector corresponds to N second parameter vectors, the second parameter vector is used as the training sample of the neural network model, and the loss function is iteratively optimized to train the neural network model and/or adjust the first parameter vector A parameter vector.
  • the mapping relationship between the first parameter vector and the N data to be stored is established, so that when the N data to be stored are stored, the first parameter vector and the trained neural network model parameters can be stored.
  • the embodiment of the present application performs a determined affine transformation on the first parameter vector based on a neural network model, and realizes that one low-dimensional data can represent multiple high-dimensional data, thereby greatly reducing the storage space required for storing high-dimensional data.
  • FIG. 1 is a flowchart of a data storage method provided by an embodiment of the application.
  • the storage method includes the following steps.
  • Step 101 For data to be stored with V dimensions, for the convenience of storage and query, the data to be stored can be distinguished by category, and the categories are numbered to obtain a category label; for each of the data to be stored in the same category
  • the stored data is assigned an identifier (ID, Identity) as the sample identifier of the data to be stored in the category data.
  • ID, Identity an identifier
  • a data to be stored is characteristic data composed of a set of characteristic values, and a characteristic data can be regarded as a sample data .
  • the category of the image data may include a character category, a landscape category, etc., wherein the character image data may include several sample data, for example, several pieces of image data including characters.
  • V is a positive integer
  • the data to be stored with the V dimension may also be referred to as the data to be stored in the V dimension.
  • Step 102 Assign an N-dimensional first parameter vector h 1 to N sample data ⁇ x 1 ,..., x N ⁇ with different IDs:
  • the initial value ⁇ b 1 , ??, b N ⁇ of the first parameter vector can be obtained by sampling random values according to Gaussian distribution, N is a positive integer, and V is greater than or equal to N. Optionally, V is greater than N.
  • the initial values of each dimension parameter in the first parameter vector are obtained by sampling N pieces of data to be stored according to Gaussian distribution random values. At this time, the value of the first parameter vector in each dimension is different.
  • Step 103 By permuting the N different dimensions of the first parameter vector, N second parameter vectors h k each having N dimensions are obtained, so that the first parameter vector can correspond to N samples.
  • the foregoing step 103 is to perform N-dimensional replacement on the first parameter vector to obtain N N-dimensional second parameter vectors h k , so that the first parameter vector can correspond to N second parameter vectors.
  • h k represents the second parameter vector
  • h 1 represents the first parameter vector
  • Ak represents the affine transformation matrix
  • the element a ij in the i-th row and j-th column can be expressed by the following formula:
  • the affine transformation matrix Ak is the identity matrix.
  • the second parameter vector h k is the first parameter vector h 1 .
  • k may be an identifier of the sample data, or it may be obtained by transforming the identifier of the sample data according to a certain rule.
  • an affine transformation matrix A k and a second parameter vector h k can be obtained . That is, the affine transformation matrix Ak corresponds to the second parameter vector h k one-to-one, and the second parameter vector corresponds to the data to be stored one-to-one. Therefore, the data to be stored corresponds to the affine transformation matrix one-to-one.
  • This affine transformation method establishes a mapping relationship from a low-dimensional parameter vector h 1 to N high-dimensional sample data ⁇ x 1 ,..., x N ⁇ , and realizes the relationship between the first parameter vector and the second parameter vector Maximizing the difference is conducive to representing different sample data.
  • a low-dimensional first parameter vector can be directly stored, and then the first parameter vector is restored to high-dimensional sample data through the above mapping relationship. Since a low-dimensional parameter vector can be mapped to obtain N high-dimensional sample data, and the dimension of the low-dimensional parameter vector is lower than that of the high-dimensional sample data, the storage space required for storing high-dimensional data is greatly compressed.
  • the ID of the sample data may be numbered in the order of 1 to N.
  • the aforementioned affine transformation matrix can be generated online according to the value of k or the identification of the sample data. In this way, the affine transformation matrix does not need to occupy storage space.
  • the affine transformation matrix may also be in other forms, as long as the affine transformation matrix is generated according to a preset rule.
  • the element a ij of the affine transformation matrix A k ⁇ R N ⁇ N can also be:
  • Step 104 Construct a neural network model, train the neural network model, and/or update the first parameter vector during the training process, so that the second parameter vector h k is mapped through the trained neural network model f To sample data x k :
  • f represents the neural network model after training
  • the second parameter vector h k is the input variable of the neural network model after training
  • x k is the output data of the neural network model after training.
  • the above neural network model can be a deep neural network model, error back propagation (BP, error Back Propagation) neural network model, recurrent neural network model (Hopfield neural network model), adaptive resonance theory (ART, Adaptive Resonance Theory) neural network Model or self-organizing feature mapping (SOM, Self-Organizing Feature Mapping) neural network model, etc. The details can be determined according to the characteristics of the sample data.
  • Step 105 Store the corresponding relationship between the identification ID and the first parameter vector, the first parameter vector, and the model parameters of the trained neural network model.
  • Step 105 is that, in step 105, the corresponding relationship between the sample ID of the N sample data used for training the neural network model and the first parameter vector is stored, and the first parameter vector and the model parameters of the trained neural network model are stored.
  • FIG. 2 is a flowchart of a training method of a neural network model provided by an embodiment of this application.
  • f 0 represents the initial neural network model
  • the goal of training the neural network model is to make the expected data sample As close as possible to the real data sample x k .
  • the training method for the constructed neural network model may include the following steps.
  • Step 201 accumulate the current iteration times.
  • Step 202 Calculate the loss function of the current neural network model, optimize the model parameters of the current neural network model according to the principle of making the loss function converge, and obtain the current neural network model f m after the optimization (m represents the number of iterations), and/ Or update the first parameter vector according to the learning result of the neural network model, so that the first parameter vector becomes a learnable parameter vector.
  • the calculation of the loss function may be:
  • the loss function is the sum of the squares of the Euclidean distance of two vectors (the expected data sample and the real data sample); Is the expected data sample, x k is the real data sample, such as the data to be stored above.
  • the aforementioned loss function may also be a kind of regression loss function.
  • the aforementioned loss function may be a mean square error loss function, an average absolute error loss function, a smooth average absolute error loss function, a log-hyperbolic cosine (Log-Cosh) loss function, or a quantile loss (Quantile Loss) function. It can be determined according to the characteristics of the sample data, the neural network model used, the efficiency of the iteration, and the expected data sample obtained during each iteration.
  • Step 203 Based on the optimized current neural network model f m and/or the updated first parameter vector, the second parameter vector or the updated second parameter vector obtained by permuting the updated first parameter vector Input to the neural network model f m to get the current expected data sample
  • Step 203 is to input the current second parameter vector into the neural network model f m based on the optimized current neural network model f m and/or the updated first parameter vector to obtain the current expected data sample
  • the current second parameter vector is the second parameter vector after the previous iteration, or the current second parameter vector is the second parameter vector obtained by performing N-dimensional replacement on the updated first parameter vector.
  • step 201 until the current number of iterations reaches the predetermined number of iterations, and/or the loss function converges to the set threshold, and then save the current first parameter vector and the current model parameters, and save the ID and ID of the N sample data Correspondence of the current first parameter vector.
  • the neural network model training is completed, for N data samples, only the final first parameter vector after learning, the correspondence between the ID of the N sample data and the final first parameter vector, and the trained neural network are stored.
  • the model parameters of the model realize that one low-dimensional data can represent multiple high-dimensional data, thereby greatly reducing the storage space required for storing high-dimensional data.
  • step 203 can be specifically divided into the following situations:
  • a first case when the current optimizing neural network model f m, a first non-updated parameter vector, for the neural network model f m loading model optimized parameters, the neural network model f m obtained after optimization; the last iteration
  • the second parameter vector of is input to the optimized neural network model f m to obtain the current expected data sample
  • the updated first parameter vector will be replaced by N-dimensional replacement, and the updated second parameter vector will be the updated
  • the second parameter vector is input to the current neural network model f m to obtain the current expected data sample
  • the updated first parameter vector is subjected to N-dimensional replacement, and the updated second parameter vector obtained will be updated
  • the second parameter vector of is input to the optimized current neural network model f m to obtain the current expected data sample
  • the current number of iterations After getting the expected data sample Then, it is judged whether the current number of iterations reaches the predetermined number of iterations, and it is judged whether the loss function converges to the set threshold. If the current number of iterations does not reach the predetermined number of iterations and the loss function does not converge to the set threshold, return to step 201. If the current number of iterations reaches the predetermined number of iterations, and/or the loss function converges to the set threshold, the current first parameter vector and the current model parameters are saved, and the IDs of the N data samples and the current first Correspondence of parameter vectors.
  • the saved current first parameter vector is the final updated first parameter vector
  • the current model parameters are the final optimization After the model parameters.
  • step 203 may be executed first, and then step 202 may be executed.
  • FIG. 3 is a schematic diagram of a data mapping process involved in an embodiment of the application.
  • an N-dimensional first parameter vector is subjected to N-dimensional replacement through an affine transformation matrix to obtain N second parameter vectors each having N dimensions, and the N second parameter vectors are respectively input to the trained neural network model, N data samples ⁇ x 1 ,..., x N ⁇ after mapping can be obtained.
  • an embodiment of the present application also provides a data acquisition method, including:
  • the second parameter vector is used as the input variable of the trained neural network model, and the output data of the trained neural network model is used as the data to be acquired.
  • the trained neural network model is the neural network model obtained after training in the aforementioned data storage method.
  • the training process of the trained neural network model refer to the description of the above-mentioned Figure 1-2.
  • the foregoing obtaining the stored first parameter vector according to the information of the data to be obtained may include:
  • the first parameter vector is obtained based on the correspondence between the stored category and/or identification and the first parameter vector;
  • Obtaining the trained neural network model used in data storage includes: acquiring the stored model parameters of the trained neural network model, and loading the acquired model parameters into the neural network model to obtain the trained neural network model.
  • performing N-dimensional permutation on the first parameter vector to obtain an N-dimensional second parameter vector corresponding to the data to be obtained may include: performing an affine transformation matrix corresponding to the data to be obtained to perform the first parameter vector N-dimensional replacement to obtain the N-dimensional second parameter vector corresponding to the data to be acquired.
  • performing the N-dimensional replacement on the first parameter vector through the affine transformation matrix corresponding to the data to be obtained to obtain the second parameter vector of N dimensions corresponding to the data to be obtained may include:
  • performing the N-dimensional replacement of the first parameter vector through the affine transformation matrix corresponding to the data to be obtained may include:
  • the affine transformation matrix is an N ⁇ N matrix
  • the affine transformation matrix corresponding to the data to be acquired is the k-th affine transformation matrix
  • the elements a ij in the affine transformation matrix corresponding to the data to be acquired satisfy :
  • performing the N-dimensional replacement on the first parameter vector to obtain the N-dimensional second parameter vector corresponding to the data to be obtained may include:
  • the value of the dimension corresponding to the identifier of the data to be acquired in the first parameter vector is exchanged with the value of the first dimension in the first parameter vector to obtain an N-dimensional second parameter vector corresponding to the data to be acquired.
  • the value of the dimension in the first parameter vector corresponding to the identification of the data to be acquired and the value of the first dimension in the first parameter vector are exchanged with each other to obtain the second N-dimensional corresponding to the data to be acquired.
  • the parameter vector can include:
  • the first parameter vector is replaced by N-dimensional, so that: the affine transformation matrix corresponding to the data to be acquired is the k-th affine transformation matrix, when k is equal to 1, the The N-dimensional second parameter vector corresponding to the data is equal to the first parameter vector; when k is not equal to 1, the k-th element of the first parameter vector is exchanged with the first element to obtain the N-dimensional corresponding to the data to be obtained
  • performing the N-dimensional replacement of the first parameter vector through the affine transformation matrix corresponding to the data to be acquired may include:
  • the affine transformation matrix is an N ⁇ N matrix
  • the affine transformation matrix corresponding to the data to be acquired is the k-th affine transformation matrix
  • the elements a ij in the affine transformation matrix corresponding to the data to be acquired satisfy :
  • the above data acquisition method is a data acquisition method corresponding to the above data storage method. Therefore, the description of the above data acquisition method part is relatively simple, and the corresponding part can refer to the description of the above data storage method part.
  • FIG. 4 is a schematic flowchart of a data acquisition method provided by an embodiment of the application.
  • step 41 When the sample data needs to be acquired, the first parameter vector corresponding to the identification is obtained according to the identification of the acquired sample data. For ease of description, this step is referred to as step 41.
  • the one-to-one correspondence between the category and the first parameter vector may be stored, or the correspondence between multiple identifiers and the first parameter vector may be stored, that is, one first parameter vector corresponds to multiple identifiers.
  • the first parameter vector corresponding to the category can be obtained according to the category of the sample data to be obtained, and the obtained first parameter vector is used as the first parameter vector corresponding to the sample data to be obtained. It is also possible to obtain the first parameter vector corresponding to the identifier according to the identifier of the sample data to be acquired, and use the obtained first parameter vector as the first parameter vector corresponding to the sample data to be acquired.
  • step 41 the sample data that needs to be acquired is the data to be acquired, and step 41 is to acquire the stored first parameter vector based on the information of the data to be acquired.
  • N-dimensional replacement is performed through the affine transformation matrix to obtain the second parameter vector.
  • the specific calculation formula is the same as step 103. For ease of description, this step is referred to as step 42.
  • Step 42 is to perform N-dimensional replacement of the first parameter vector through the affine transformation matrix to obtain N second parameter vectors each having N dimensions.
  • the output result of the neural network model is the sample data that needs to be obtained.
  • this step is referred to as step 43.
  • the foregoing obtaining the stored first parameter vector according to the information of the data to be obtained may include:
  • the first parameter vector is obtained based on the correspondence between the stored category and/or identification and the first parameter vector;
  • Obtaining the trained neural network model used in data storage includes acquiring the stored model parameters of the trained neural network model, and loading the model parameters into the neural network model to obtain the trained neural network model.
  • performing N-dimensional permutation on the first parameter vector to obtain N second parameter vectors each having N dimensions may include: performing N-dimensional permutation on the first parameter vector through N affine transformation matrices to obtain N Second parameter vectors each having N dimensions, so that one of the N second parameter vectors each having N dimensions is the same as the first parameter vector, and the values of the other second parameter vectors in each dimension are The first parameter vector has different values in corresponding dimensions.
  • the above-mentioned N-dimensional replacement of the first parameter vector by N affine transformation matrices obtains N second parameter vectors each having N dimensions, so that one of the N second parameter vectors each having N dimensions
  • the second parameter vector is the same as the first parameter vector, and the values of the other second parameter vectors in each dimension are different from the values in the corresponding dimension of the first parameter vector, which may include:
  • performing the N-dimensional permutation of the first parameter vector by using N affine transformation matrices may include:
  • the N affine transformation matrices are N ⁇ N matrices, and the elements a ij in the affine transformation matrix satisfy:
  • performing N-dimensional permutation on the first parameter vector to obtain N second parameter vectors each having N dimensions may include:
  • the value of the dimension corresponding to the identifier of the data to be obtained in the first parameter vector is exchanged with the value of the first dimension in the first parameter vector to obtain N second parameter vectors with N dimensions respectively.
  • the value of the dimension corresponding to the identifier of the data to be acquired in the first parameter vector is exchanged with the value of the first dimension in the first parameter vector to obtain N second parameter vectors with N dimensions, respectively,
  • N affine transformation matrices Perform N-dimensional permutation on the first parameter vector through N affine transformation matrices, so that: for the kth affine transformation matrix, when k is equal to 1, the second parameter vector is equal to the first parameter vector; when k is not equal to 1
  • performing N-dimensional permutation on the first parameter vector by using N affine transformation matrices respectively includes:
  • the N affine transformation matrices are N ⁇ N matrices, and the elements a ij in the affine transformation matrix satisfy:
  • the embodiment of the present application can quickly query the required data, and has high data acquisition efficiency and convenient use.
  • Image data includes a large number of pixels and the pixel value of each pixel, which is one of the typical high-dimensional data. For example, in an incremental learning scenario, a large number of feature maps of images output by the middle layer of the convolutional neural network need to be used. At this time, the image data included in the feature map has a very high dimension. If you directly store the image data included in the feature map , It will consume storage space very much.
  • the image data to be stored includes 10 pieces of image data, and each image data includes pixel values of 16 ⁇ 16 pixels.
  • the image data to be stored includes 10 sample data with different IDs, and each sample data includes 256 data dimensions.
  • a 10-dimensional first parameter vector h 1 is allocated to the 10 image data, and the initial value of the parameter in the vector is obtained by sampling the 10 sample data according to Gaussian distribution random values.
  • the process of training the constructed deep learning neural network model may include setting each initial model parameter in the deep learning neural network model, and using the deep learning neural network model f 0 to convert the second parameter vector ⁇ h 1 ,..., h 10 ⁇ Perform mapping to get the expected data samples of 10 image data, that is, the expected image data
  • f 0 represents the initial deep learning neural network model
  • x k is the image data of the k-th picture to be stored
  • the current second parameter vector is input to the deep learning neural network model f m to obtain current desired image data.
  • the current second parameter vector can be the second parameter vector after the previous iteration as the current second parameter vector; the current second parameter vector can also be obtained by performing N-dimensional replacement on the updated first parameter vector The current second parameter vector.
  • FIG. 5 is a schematic diagram of a data storage device according to an embodiment of the application.
  • the device includes:
  • the allocation module is used to allocate an N-dimensional first parameter vector to N data to be stored with at least V dimensions; wherein the initial value of each dimension parameter of the first parameter vector is obtained by sampling N data to be stored according to Gaussian distribution random values , V and N are natural numbers, and V is greater than or equal to N.
  • V is greater than or equal to N;
  • the permutation module is used to perform N-dimensional permutation on the first parameter vector to obtain N second parameter vectors each having N dimensions;
  • the neural network module is used to construct a neural network model that maps the current second parameter vector to N expected data samples of the data to be stored, and adjusts the model parameters and/or the first parameter vector of the neural network model until The current second parameter vector is based on the expected data samples of the N data to be stored obtained by the trained neural network model and is regressed to the N data to be stored.
  • the storage module is used to store the current first parameter vector and store the model parameters of the trained neural network model.
  • the above neural network module can also be called a building module.
  • the image data contains a larger data dimension
  • the N data to be stored with a higher storage dimension are replaced with the first parameter vector with a lower storage dimension, so Save a lot of storage space and reduce the amount of calculations.
  • the neural network module may also be used to: if the current second parameter vector is based on the expected data samples of the N data to be stored obtained by the trained neural network model and does not return to the N data to be stored, then Perform N-dimensional replacement of the current first parameter vector, and return to executing the step of adjusting the model parameters of the neural network model and/or the first parameter vector.
  • the data storage device may further include:
  • the data identification module is used to distinguish the N data to be stored according to their categories, and/or to assign an identifier to each data to be stored, and to correspond the category and/or identifier of the N data to be stored with the first parameter vector
  • the relationship is stored in the storage module.
  • the permutation module may be specifically used to perform N-dimensional permutation on the first parameter vector through N affine transformation matrices to obtain N N-dimensional second parameter vectors, so that the N each have N-dimensional One of the second parameter vectors in the second parameter vector is the same as the first parameter vector, and the values of the other second parameter vectors in each dimension are different from the values in the corresponding dimension of the first parameter vector.
  • the first parameter vector is replaced in N dimensions by N affine transformation matrices.
  • N affine transformation matrices For the kth affine transformation matrix, when k is equal to 1, the second parameter vector is equal to the first parameter vector; when k is not equal to 1.
  • the permutation module may be specifically used to exchange the value of the dimension corresponding to the identification of the N data to be stored in the first parameter vector and the value of the first dimension in the first parameter vector to obtain N A second parameter vector with N dimensions.
  • the first parameter vector is replaced by N affine transformation matrices.
  • the replacement module may include an online affine transformation matrix generation module, which is used to generate each affine transformation matrix online according to a preset transformation rule.
  • the neural network module may be specifically used to use N second parameter vectors each having N dimensions as input variables of the neural network model, and the output data of the neural network model as the expected data of the N data to be stored Sample, training the model parameters of the neural network model, and/or adjusting the first parameter vector during the training process, until the expected data samples of the N data to be stored return to the N data to be stored.
  • the device may further include a training module for:
  • the neural network model is a deep learning neural network model.
  • FIG. 6 is a schematic diagram of a data acquisition device provided by an embodiment of the application.
  • the device includes:
  • the first parameter vector obtaining module is configured to obtain the stored first parameter vector according to the data information to be obtained;
  • the permutation module is used to perform N-dimensional permutation on the first parameter vector to obtain N second parameter vectors each having N dimensions, where N is the dimension of the first parameter vector, that is, N is the data included in the first parameter vector The number of dimensions;
  • the neural network model module is used to obtain the trained neural network model used for data storage; use N second parameter vectors as the input variables of the trained neural network model, and use the output data of the trained neural network model as Data to be obtained.
  • the aforementioned first parameter vector acquisition module may also be called the first acquisition module, and the neural network model module may be called the second acquisition module.
  • the first parameter vector obtaining module may be specifically configured to obtain the first parameter vector based on the corresponding relationship between the stored category and/or identifier and the first parameter vector according to the category and/or identification of the data to be obtained .
  • the neural network model module may be specifically used to obtain the stored model parameters of the trained neural network model, and load the acquired model parameters into the neural network model to obtain the trained neural network model.
  • the permutation module may be specifically used to perform N-dimensional permutation on the first parameter vector through N affine transformation matrices to obtain N second parameter vectors each having N dimensions, so that N each have N dimensions
  • One of the second parameter vectors in the second parameter vector is the same as the first parameter vector, and the values of the other second parameter vectors in each dimension are different from the values in the corresponding dimension of the first parameter vector.
  • the permutation module may be specifically used to exchange the value of the dimension corresponding to the identifier of the data to be acquired in the first parameter vector and the value of the first dimension in the first parameter vector to obtain N values with N-dimensional second parameter vector.
  • the permutation module may further include an online affine transformation matrix generation module, which is used to generate each affine transformation matrix online according to a preset transformation rule.
  • An embodiment of the present application also provides a data storage device, which is characterized in that the device includes a memory and a processor, wherein the memory is used to store instructions that, when executed by the processor, cause the processor to execute the data storage Method steps.
  • An embodiment of the present application also provides a data acquisition device, which is characterized in that the device includes a memory and a processor, wherein the memory is used to store instructions that, when executed by the processor, cause the processor to perform the data acquisition Method steps.
  • the memory may include random access memory (RAM, Random Access Memory), and may also include non-volatile memory (NVM, Non-Volatile Memory), such as at least one disk memory.
  • RAM random access memory
  • NVM non-volatile memory
  • the memory may also be at least one storage device located far away from the foregoing processor.
  • the above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU, Central Processing Unit), a network processor (NP, Network Processor), etc.; it can also be a digital signal processor (DSP, Digital Signal Processing), a dedicated integrated Circuit (ASIC, Application Specific Integrated Circuit), Field-Programmable Gate Array (FPGA, Field-Programmable Gate Array) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components.
  • CPU Central Processing Unit
  • NP Network Processor
  • DSP Digital Signal Processing
  • ASIC Application Specific Integrated Circuit
  • FPGA Field-Programmable Gate Array
  • FPGA Field-Programmable Gate Array
  • An embodiment of the application also provides a data acquisition device, which includes:
  • the first obtaining module is configured to obtain the stored first parameter vector according to the information of the data to be obtained;
  • the replacement module is used to obtain the trained neural network model used in data storage
  • the second acquisition module is configured to use the second parameter vector as the input variable of the trained neural network model, and use the output data of the trained neural network model as the data to be acquired.
  • the above-mentioned first obtaining module may be specifically used for:
  • the first parameter vector is obtained based on the correspondence between the stored category and/or identification and the first parameter vector;
  • the second acquiring module may be specifically used to acquire the stored model parameters of the trained neural network model, and load the acquired model parameters into the neural network model to obtain the trained neural network model.
  • the above-mentioned permutation module may be specifically used to perform N-dimensional permutation on the first parameter vector through an affine transformation matrix corresponding to the data to be acquired, to obtain an N-dimensional second parameter vector corresponding to the data to be acquired.
  • the aforementioned replacement module may be specifically used for:
  • the aforementioned replacement module may be specifically used for:
  • the affine transformation matrix is an N ⁇ N matrix
  • the affine transformation matrix corresponding to the data to be acquired is the k-th affine transformation matrix
  • the elements a ij in the affine transformation matrix corresponding to the data to be acquired satisfy :
  • the aforementioned replacement module may be specifically used for:
  • the value of the dimension corresponding to the identifier of the data to be acquired in the first parameter vector is exchanged with the value of the first dimension in the first parameter vector to obtain an N-dimensional second parameter vector corresponding to the data to be acquired.
  • the value of the dimension in the first parameter vector corresponding to the identification of the data to be acquired and the value of the first dimension in the first parameter vector are exchanged with each other to obtain the second N-dimensional corresponding to the data to be acquired.
  • the parameter vector can include:
  • the first parameter vector is replaced by N-dimensional, so that: the affine transformation matrix corresponding to the data to be acquired is the k-th affine transformation matrix, when k is equal to 1, the The N-dimensional second parameter vector corresponding to the data is equal to the first parameter vector; when k is not equal to 1, the k-th element of the first parameter vector is exchanged with the first element to obtain the N-dimensional corresponding to the data to be obtained
  • the aforementioned replacement module may be specifically used for:
  • the affine transformation matrix is an N ⁇ N matrix
  • the affine transformation matrix corresponding to the data to be acquired is the k-th affine transformation matrix
  • the elements a ij in the affine transformation matrix corresponding to the data to be acquired satisfy :
  • the embodiments of the present application also provide an electronic device.
  • the electronic device includes a processor and a storage medium.
  • the storage medium stores a computer program. When the computer program is executed by the processor, the following steps are implemented:
  • the model parameters of the neural network model and/or the first parameter vector are adjusted until the current second parameter vector is based on the expected data samples of the N data to be stored obtained by the trained neural network model.
  • the embodiments of the present application also provide an electronic device.
  • the electronic device includes a processor and a storage medium.
  • the storage medium stores a computer program. When the computer program is executed by the processor, the following steps are implemented:
  • the N second parameter vectors are used as input variables of the trained neural network model, and the output data of the trained neural network model is used as the data to be acquired.
  • the embodiments of the present application also provide an electronic device.
  • the electronic device includes a processor and a storage medium.
  • the storage medium stores a computer program. When the computer program is executed by the processor, the following steps are implemented:
  • the second parameter vector is used as the input variable of the trained neural network model, and the output data of the trained neural network model is used as the data to be acquired.
  • the embodiment of the present application also provides a computer-readable storage medium in which a computer program is stored.
  • a computer program is stored.
  • the following steps are implemented:
  • the embodiment of the present application also provides a computer-readable storage medium in which a computer program is stored.
  • a computer program is stored.
  • the following steps are implemented:
  • the N second parameter vectors are used as input variables of the trained neural network model, and the output data of the trained neural network model is used as the data to be acquired.
  • the embodiment of the present application also provides a computer-readable storage medium in which a computer program is stored.
  • a computer program is stored.
  • the following steps are implemented:
  • the second parameter vector is used as the input variable of the trained neural network model, and the output data of the trained neural network model is used as the data to be acquired.
  • the embodiment of the present application also provides a computer program, which implements the following steps when the computer program is executed by a processor:
  • the embodiment of the present application also provides a computer program, which implements the following steps when the computer program is executed by a processor:
  • the N second parameter vectors are used as input variables of the trained neural network model, and the output data of the trained neural network model is used as the data to be acquired.
  • the embodiment of the present application also provides a computer program, which implements the following steps when the computer program is executed by a processor:
  • the second parameter vector is used as the input variable of the trained neural network model, and the output data of the trained neural network model is used as the data to be acquired.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computing Systems (AREA)
  • Molecular Biology (AREA)
  • Evolutionary Computation (AREA)
  • Mathematical Physics (AREA)
  • Computational Linguistics (AREA)
  • Artificial Intelligence (AREA)
  • Databases & Information Systems (AREA)
  • Neurology (AREA)
  • Image Analysis (AREA)

Abstract

一种数据存储方法、及其数据获取方法、装置,该存储方法包括,为N个待存储数据分配一个N维第一参数向量;对第一参数向量进行N维置换,获得N个分别具有N维的第二参数向量,构建一将当前的第二参数向量映射到N个待存储数据的期望数据样本的神经网络模型,对所述神经网络模型参数、和/或第一参数向量进行调整,直至当前的第二参数向量基于训练后的神经网络模型所获得的N个待存储数据的期望数据样本回归于N个待存储数据,存储当前的第一参数向量。该存储方法使得存储了第一参数向量,就相当于存储了N个待存储的数据,将高维数据降低为低维数据来存储,使得存储空间大大降低。

Description

一种数据存储方法、及其数据获取方法、装置
本申请要求于2019年07月29日提交中国专利局、申请号为201910687185.0发明名称为“一种数据存储的方法、及其数据获取方法、装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及数据存储领域,特别地,涉及一种数据存储方法、及其数据获取方法、装置。
背景技术
数据维度是指对象的描述性属性或特征。例如,一张具有16×16像素的图片,每个像素均具有相应的像素值,即每个像素均为该图片的描述性属性,则可视为该图片具有256个数据维度。
为了解决存储数据维度高所需存储空间大的问题,自编码器被用于为低维数据和高维数据建立一一对应的映射关系,这样,基于存储的低维数据,通过自编码器可得到对应的高维数据,从而使得存储空间能够减少。这类自编码器虽然一定程度降低了数据存储空间,但是在存储自编码器的网络模型参数的同时,仍需要大量存储压缩过的低维数据,这样,如果数据量非常大的情况下,基于自编码器的算法仍要大量存储空间。
如何进一步降低高维数据所对应的低维数据的存储量是一个亟待解决的问题。
发明内容
本申请实施例提供了一种数据存储方法、及其数据获取方法、装置,以降低存储高维数据所需要的存储空间。
本申请实施例提供的一种数据存储方法,该方法包括:
为N个待存储数据分配一个N维第一参数向量;
对第一参数向量进行N维置换,获得N个分别具有N维的第二参数向量;
构建一将当前的第二参数向量映射到所述N个待存储数据的期望数据样本的神经网络模型;
对所述神经网络模型的模型参数、和/或第一参数向量进行调整,直至当 前的第二参数向量基于训练后的神经网络模型所获得的所述N个待存储数据的期望数据样本回归于所述N个待存储数据;
存储当前的第一参数向量。
可选的,该方法还包括,如果当前第二参数向量基于训练后的神经网络模型所获得的所述N个待存储数据的期望数据样本未回归于所述N个待存储数据,则对当前的第一参数向量进行N维置换,返回执行所述对所述神经网络模型的模型参数和/或第一参数向量进行调整的步骤。
可选的,该方法还包括:对所述N个待存储数据按照类别进行区分,和/或,分别为每个所述待存储数据分配标识,并存储所述类别和/或标识与第一参数向量的对应关系;
该方法还包括:存储训练后的神经网络模型的模型参数;
所述第一参数向量中各维参数初始值按照高斯分布随机值分别采样所述N个待存储数据获得。
可选的,所述对第一参数向量进行N维置换,获得N个分别具有N维的第二参数向量,包括:通过N个仿射变换矩阵对第一参数向量进行N维置换,获得N个分别具有N维的第二参数向量,使得所述N个分别具有N维的第二参数向量中的一个第二参数向量与第一参数向量相同,其他第二参数向量在每个维度上的值与所述第一参数向量在对应维度上的值不同。
可选的,所述通过N个仿射变换矩阵对第一参数向量进行N维置换,获得N个分别具有N维的当前第二参数向量,使得所述N个分别具有N维的第二参数向量中的一个第二参数向量与第一参数向量相同,其他第二参数向量在每个维度上的值与所述第一参数向量对应维度上的值不同,包括:
通过N个仿射变换矩阵分别对第一参数向量进行N维置换,使得:对于第k个仿射变换矩阵,当k等于1时,第二参数向量等于第一参数向量;当k不等于1时,分别把第一参数向量的前k-1个元素放到第一参数向量的末端,得到N-1个分别具有N维的第二参数向量,其中,k=1,…N。
可选的,所述通过N个仿射变换矩阵对第一参数向量进行N维置换,包括:
将所述N个仿射变换矩阵分别与第一参数向量相乘,
其中,N个仿射变换矩阵分别为N×N的矩阵,且,所述仿射变换矩阵中的元素a ij满足:
Figure PCTCN2020105590-appb-000001
可选的,所述对第一参数向量进行N维置换,获得N个分别具有N维的第二参数向量,包括:
将第一参数向量中对应于所述N个待存储数据的标识的维度之值和第一参数向量中第一个维度之值互相交换,分别获得N个具有N维的第二参数向量。
可选的,所述将第一参数向量中对应于所述N个待存储数据的标识的维度之值和第一参数向量中第一个维度之值互相交换,分别获得N个具有N维的第二参数向量,包括:
通过N个仿射变换矩阵分别对第一参数向量进行N维置换,使得:对于第k个仿射变换矩阵,当k等于1时,第二参数向量等于第一参数向量;当k不等于1时,分别把第一参数向量的第k个元素与第一个元素互换,得到N-1个具有N维的第二参数向量,其中,k表示所述N个待存储数据的标识,k=1,…N。
可选的,所述通过N个仿射变换矩阵分别对第一参数向量进行N维置换,包括:
将所述N个仿射变换矩阵分别与第一参数向量相乘;
其中,N个仿射变换矩阵分别为N×N的矩阵,且,所述仿射变换矩阵中的元素a ij满足:
a 1k=1;
a k1=1;
Figure PCTCN2020105590-appb-000002
可选的,对所述神经网络模型的模型参数、和/或第一参数向量进行调整,直至当前第二参数向量基于训练后的神经网络模型所获得的所述N个待存储数据的期望数据样本回归于所述N个待存储数据,包括:将所述N个分别具有N维的第二参数向量作为所述神经网络模型的输入变量,将所述神经网络模型的输出数据作为所述N个待存储数据的期望数据样本,对所述神经网络模型的模型参数进行训练,和/或在训练过程中更新第一参数向量,直至所述N个待存储数据的期望数据样本回归于所述N个待存储数据。
可选的,所述对所述神经网络模型进行训练,和/或在训练过程中更新第一参数向量,直至所述N个待存储数据的期望数据样本回归于所述N个待存储数据,包括:
对所述神经网络模型的模型参数进行初始化;
累计当前迭代次数;
将当前的第二参数向量输入至当前的神经网络模型,得到所述N个待存储数据的当前期望数据样本,计算当前期望数据样本与所述N个待存储数据的损失函数,按照使得损失函数收敛的原则,优化当前的神经网络模型的模型参数和/或第一参数向量,得到该次迭代优化后的神经网络模型的模型参数、和/或更新后的第一参数向量;
将上一次迭代后的第二参数向量作为当前的第二参数向量,或对更新后的第一参数向量进行N维置换得到当前的第二参数向量;
返回执行所述累计当前迭代次数的步骤,直至当前迭代次数达到预定的迭代次数,或者损失函数收敛于设定的阈值,得到训练后的神经网络模型的模型参数和/或更新后的第一参数向量。
可选的,所述神经网络模型为深度学习神经网络模型;所述损失函数为回归类损失函数;所述仿射变换矩阵根据当前k值在线生成,其中,k=1,…N。
本申请实施例提供的一种数据获取方法,该方法包括:
根据待获取数据的信息,获取存储的第一参数向量;
对所述第一参数向量进行N维置换,获得N个分别具有N维的第二参数向量,其中,N为所述第一参数向量的维数;
获取数据存储时所使用的训练后的神经网络模型;
将所述N个第二参数向量作为训练后的神经网络模型的输入变量,将训练后的神经网络模型的输出数据作为所述待获取数据。
可选的,所述根据待获取数据,获取存储的第一参数向量,包括:
根据待获取数据的类别和/或标识,基于存储的类别和/或标识与第一参数向量的对应关系,获得第一参数向量;
所述获取数据存储时所使用的训练后的神经网络模型,包括,获取存储的训练后的神经网络模型的模型参数,并将所述模型参数加载至神经网络模型中,得到训练后的神经网络模型。
可选的,所述对所述第一参数向量进行N维置换,获得N个分别具有N维的第二参数向量,包括:通过N个仿射变换矩阵对所述第一参数向量进行N维置换,获得N个分别具有N维的第二参数向量,使得所述N个分别具有N维的第二参数向量中的一个第二参数向量与第一参数向量相同,其他第二参数向量在每个维度上的值与所述第一参数向量对应维度上的值不同。
可选的,所述通过N个仿射变换矩阵对所述第一参数向量进行N维置换,获得N个分别具有N维的第二参数向量,使得所述N个分别具有N维的第二参数向量中的一个第二参数向量与第一参数向量相同,其他第二参数向量在每个维度上的值与所述第一参数向量对应维度上的值不同,包括:
通过N个仿射变换矩阵分别对所述第一参数向量进行N维置换,使得:对于第k个仿射变换矩阵,当k等于1时,第二参数向量等于所述第一参数向量;当k不等于1时,分别把所述第一参数向量的前k-1个元素放到所述第一参数向量的末端,得到N-1个分别具有N维的第二参数向量,其中,k=1,…N。
可选的,所述通过N个仿射变换矩阵对所述第一参数向量进行N维置换,包括:
将所述N个仿射变换矩阵分别与所述第一参数向量相乘;
其中,N个仿射变换矩阵分别为N×N的矩阵,且,所述仿射变换矩阵中的元素a ij满足:
Figure PCTCN2020105590-appb-000003
可选的,所述对所述第一参数向量进行N维置换,获得N个分别具有N维的第二参数向量,包括:
将所述第一参数向量中对应于所述待获取数据的标识的维度之值和所述第一参数向量中第一个维度之值互相交换,分别获得N个具有N维的第二参数向量。
可选的,所述将所述第一参数向量中对应于所述待获取数据的标识的维度之值和第一参数向量中第一个维度之值互相交换,分别获得N个具有N维的第二参数向量,包括:
通过N个仿射变换矩阵分别对所述第一参数向量进行N维置换,使得:对于第k个仿射变换矩阵,当k等于1时,第二参数向量等于所述第一参数向量;当k不等于1时,分别把所述第一参数向量的第k个元素与第一个元素互换,得到N-1个具有N维的第二参数向量,其中,k表示所述待获取数据的标识,k=1,…N。
可选的,所述通过N个仿射变换矩阵分别对所述第一参数向量进行N维置换,包括:
将所述N个仿射变换矩阵分别与所述第一参数向量相乘;
其中,N个仿射变换矩阵分别为N×N的矩阵,且,所述仿射变换矩阵中的元素a ij满足:
a 1k=1;
a k1=1;
Figure PCTCN2020105590-appb-000004
本申请实施例提供的一种数据获取方法,该方法包括:
根据待获取数据的信息,获取存储的第一参数向量;
对所述第一参数向量进行N维置换,获得所述待获取数据对应的N维的第二参数向量,其中,N为所述第一参数向量的维数;
获取数据存储时所使用的训练后的神经网络模型;
将所述第二参数向量作为训练后的神经网络模型的输入变量,将训练后 的神经网络模型的输出数据作为所述待获取数据。
本申请实施例提供的一种数据存储装置,该装置包括:
分配模块,用于为N个待存储数据分配一个N维第一参数向量;
置换模块,用于对第一参数向量进行N维置换,获得N个分别具有N维的第二参数向量;
构建模块,用于构建一将当前的第二参数向量映射到所述N个待存储数据的期望数据样本的神经网络模型;对所述神经网络模型的模型参数、和/或第一参数向量进行调整,直至当前的第二参数向量基于训练后的神经网络模型所获得的所述N个待存储数据的期望数据样本回归于所述N个待存储数据;
存储模块,用于存储当前的第一参数向量。
本申请实施例提供的一种数据获取装置,该装置包括:
第一获取模块,用于根据待获取数据的信息,获取存储的第一参数向量;
置换模块,用于对所述第一参数向量进行N维置换,获得N个分别具有N维的第二参数向量,其中,N为所述第一参数向量的维数;
第二获取模块,用于获取数据存储时所使用的训练后的神经网络模型;将所述N个第二参数向量作为训练后的神经网络模型的输入变量,将训练后的神经网络模型的输出数据作为所述待获取数据。
本申请实施例提供的一种数据获取装置,该装置包括:
第一获取模块,用于根据待获取数据的信息,获取存储的第一参数向量;
对所述第一参数向量进行N维置换,获得所述待获取数据对应的N维的第二参数向量,其中,N为所述第一参数向量的维数;
置换模块,用于获取数据存储时所使用的训练后的神经网络模型;
第二获取模块,用于将所述第二参数向量作为训练后的神经网络模型的输入变量,将训练后的神经网络模型的输出数据作为所述待获取数据。
本申请实施例提供的一种电子设备,所述电子设备包括处理器和存储介质,所述存储介质内存储有计算机程序,所述计算机程序被所述处理器执行时实现任一所述数据存储方法的步骤。
本申请实施例提供的一种电子设备,所述电子设备包括处理器和存储介质,所述存储介质内存储有计算机程序,所述计算机程序被所述处理器执行 时实现任一所述数据获取方法的步骤。
本申请实施例提供的一种计算机可读存储介质,所述存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现任一所述数据存储方法的步骤。
本申请实施例提供的一种计算机可读存储介质,所述存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现任一所述数据获取方法的步骤。
本申请实施例提供的一种计算机程序,所述计算机程序被处理器执行时实现任一所述数据存储方法的步骤。
本申请实施例提供的一种计算机程序,所述计算机程序被处理器执行时实现任一所述数据获取方法的步骤。
本申请实施例中,基于一个N维的第一参数向量,通过仿射变换得到N个N维的第二参数向量,通过训练后的神经网络模型,将第二参数向量映射到第一参数向量所对应的N个数据,从而使得存储了一个N维的第一参数向量,就相当于存储了N个数据,将多个高维数据降低为一个低维数据来存储,使得存储高维数据所需的存储空间大大降低。
附图说明
图1是本申请实施例提供的数据存储数据方法的一种流程图。
图2为本申请实施例提供的神经网络模型的训练方法的一种流程图。
图3为本申请实施例所涉及的数据映射过程的一种示意图。
图4为本申请实施例提供的数据获取方法的一种流程示意图。
图5为本申请实施例提供的数据存储装置的一种示意图。
图6为本申请实施例提供的数据获取装置的一种示意图。
具体实施方式
为了使本申请的目的、技术手段和优点更加清楚明白,以下结合附图对本申请做进一步详细说明。
为便于理解,下面对本申请实施例中出现的词语进行解释。
仿射变换为,对参数向量进行多维置换,也就是,对参数向量的多个维度进行置换。
数据维度是指对象的描述性属性或特征。其中,数据维度简称为“维度”或“维”。
高维数据为,数据维度较高的数据。例如,数据维度高于预设阈值的数据。
低维数据为数据维度较低的数据。例如,数据维度低于等于预设阈值的数据。上述预设阈值可以根据实际需求进行设定。例如,预设阈值可以为100、200等。
数据样本即为样本数据,待存储的数据简称为待存储数据,调整后的第一参数向量即为更新后的第一参数向量。
为降低存储高维数据所需要的存储空间,本申请实施例提供了一种数据存储方法,包括:
步骤11,为N个待存储数据分配一个N维第一参数向量;
步骤12,对第一参数向量进行N维置换,获得N个分别具有N维的第二参数向量;
步骤13,构建一将当前的第二参数向量映射到所述N个待存储数据的期望数据样本的神经网络模型;
步骤13即为,构建一神经网络模型,该神经网络模型用于将当前的第二参数向量映射到所述N个待存储数据的期望数据样本。
步骤14,对神经网络模型的模型参数、和/或第一参数向量进行调整,直至当前的第二参数向量基于训练后的神经网络模型所获得的N个待存储数据的期望数据样本回归于N个待存储数据;
步骤14即为,对神经网络模型的模型参数、和/或第一参数向量进行调整,直至训练后的神经网络模型基于当前的第二参数向量所获得的N个待存储数据的期望数据样本回归于N个待存储数据。
步骤15,存储当前的第一参数向量。
本申请实施例中,在当前的第一参数向量的同时,还可以存储训练后的神经网络模型的模型参数。
本申请实施例提出的数据存储方法,为N个V维待存储的数据分配一个N维的第一参数向量,V大于等于N,将第一参数向量的N个维度进行置换, 得到N个N维的第二参数向量,使得一个第一参数向量对应N个第二参数向量,将第二参数向量作为神经网络模型的训练样本,通过迭代优化损失函数来训练该神经网络模型和/或调整第一参数向量。由此,建立第一参数向量与N个待存储数据的映射关系,从而在存储N个待存储数据时,存储第一参数向量以及训练后的神经网络模型参数即可。本申请实施例基于神经网络模型对第一参数向量进行确定的仿射变换,实现了一个低维数据能够表示多个高维数据,从而极大地降低了存储高维数据所需的存储空间。
参见图1,图1为本申请实施例提供的数据存储方法的一种流程图。该存储方法包括如下步骤。
步骤101,对于具有V维的待存储数据,为方便存储和查询,可以按照类别对待存储数据进行区分,并对类别进行编号,以获得类别标签;为同一类别的待存储数据中的每个待存储数据分别分配一个标识(ID,Identity),作为该类别数据中待存储数据的样本标识,其中,一个待存储数据是由特征值集合所构成的特征数据,一特征数据可以视为一样本数据。例如,图像数据的类别可以包括人物类、风景类等等,其中,人物类图像数据中可以包括若干个样本数据,譬如,若干张包括人物的图像数据。
本申请实施例中,也可以不区分样本数据的类别,直接为每个样本数据分配样本标识。
本申请实施例中,V为正整数,具有V维的待存储数据又可以称为V维的待存储数据。
步骤102,为N个不同ID的样本数据{x 1,…,x N}分配一个N维第一参数向量h 1
Figure PCTCN2020105590-appb-000005
该第一参数向量的初始值{b 1,…..,b N}可以按照高斯分布随机值采样获得,N为正整数,V大于等于N。可选地,V大于N。
本申请实施例中,第一参数向量中各维参数初始值按照高斯分布随机值分别采样N个待存储数据获得。此时,第一参数向量在各个维度上的值均不 同。
步骤103,通过对第一参数向量的N个不同维度进行置换,得到N个分别具有N维的第二参数向量h k,从而能够使得第一参数向量对应N个样本。
上述步骤103即为,对第一参数向量进行N维置换,得到N个N维的第二参数向量h k,从而能够使得第一参数向量对应N个第二参数向量。
本申请实施例中,可以利用如下公式,对第一参数向量进行N维置换:
h k=A kh 1,k=1,…,N
其中,h k表示第二参数向量,h 1表示第一参数向量,A k表示仿射变换矩阵,A k∈R N×N,R N×N表示N×N维矩阵的集合,A k中第i行第j列的元素a ij可由下式表示:
Figure PCTCN2020105590-appb-000006
上述仿射变换矩阵中,
当k=1时,仿射变换矩阵A k为单位矩阵。此时,第二参数向量h k即为第一参数向量h 1
当k≠1时,仿射变换矩阵A k相当于,把A 1前k-1行元素放到A 1末端后所得到的矩阵。通过上述仿射变换后,第二参数向量h k相当于,把h 1前k-1个元素放到h 1末端所得到的参数向量。
本申请实施例中,k可以为样本数据的标识,也可以按照一定的规则对样本数据的标识进行变换获得。基于一个k值,可得到一个仿射变换矩阵A k,一个第二参数向量h k。即仿射变换矩阵A k与第二参数向量h k一一对应,而第二参数向量与待存储数据一一对应,因此,待存储数据与仿射变换矩阵一一对应。
通过上述仿射变换所得到的第二参数向量,除了k=1时的第二参数向量之外,其它第二参数向量在每个维度上的值与第一参数向量在对应维度上的值不同,例如图3所示。这种仿射变换方法,建立了从一个低维参数向量h 1到N个高维样本数据{x 1,…,x N}的映射关系,实现了第一参数向量和第二参数向量之间差异最大化,有利于代表不同的样本数据。本申请实施例中,通 过这种映射关系,可以直接存储低维的第一参数向量,然后通过上述映射关系将第一参数向量恢复成高维样本数据。由于一个低维参数向量可以映射得到N个高维样本数据,而且低维参数向量的维度低于高维样本数据的维度,从而使得存储高维数据所需的存储空间被极大地压缩了。
本申请实施例中,样本数据的ID可以按照1到N的顺序编号。这样,上述仿射变换矩阵可以根据k的取值或样本数据的标识在线生成。这样,仿射变换矩阵不必占用存储空间。此外,仿射变换矩阵还可以是其他形式,只要根据预先设定的规则所生成的仿射变换矩阵都是可以的。例如,仿射变换矩阵A k∈R N×N的元素a ij还可以是:
a 1k=1
a k1=1
Figure PCTCN2020105590-appb-000007
通过上述仿射变换后,第二参数向量h k相当于,相当于把h 1的第k个元素与h 1的第1个元素互换后所得到的参数向量。
步骤104,构建一神经网络模型,并对该神经网络模型进行训练,和/或在训练过程中对第一参数向量进行更新,使得通过训练后的神经网络模型f将第二参数向量h k映射到样本数据x k
x k=f(h k)
其中,f表示训练后的神经网络模型,第二参数向量h k为该训练后的神经网络模型的输入变量,x k为该训练后的神经网络模型的输出数据。上述神经网络模型可以为深度神经网络模型、误差反向传播(BP,error Back Propagation)神经网络模型、递归神经网络模型(Hopfield神经网络模型)、自适应共振理论(ART,Adaptive Resonance Theory)神经网络模型或自组织特征映射(SOM,Self-Organizing Feature Mapping)神经网络模型等。具体可以根据样本数据的特点确定。
步骤105,存储标识ID与第一参数向量的对应关系、第一参数向量、以 及训练后的神经网络模型的模型参数。
步骤105即为,步骤105中,存储训练神经网络模型所使用的N个样本数据的样本ID与第一参数向量的对应关系,存储第一参数向量以及训练后的神经网络模型的模型参数。
一种实施方式,参见图2所示,图2为本申请实施例提供的神经网络模型的训练方法的一种流程图。
设置神经网络模型中的各初始模型参数,通过该神经网络模型f 0对第二参数向量h k进行样本映射,得到数据样本
Figure PCTCN2020105590-appb-000008
Figure PCTCN2020105590-appb-000009
其中,f 0表示初始神经网络模型,
Figure PCTCN2020105590-appb-000010
是神经网络模型所恢复的期望数据样本,训练该神经网络模型的目标是:使得期望数据样本
Figure PCTCN2020105590-appb-000011
尽可能接近真实的数据样本x k
对构建的神经网络模型的训练方法可以包括如下步骤。
步骤201,累计当前迭代次数。
步骤202,计算当前神经网络模型的损失函数,按照使得损失函数收敛的原则,优化当前神经网络模型的模型参数,得到该次优化后的当前神经网络模型f m(m表示迭代次数),和/或根据神经网络模型的学习结果更新第一参数向量,使得第一参数向量成为可学习参数向量。所述损失函数的计算可以为:
Figure PCTCN2020105590-appb-000012
其中,
Figure PCTCN2020105590-appb-000013
表示损失函数,本申请实施例中,损失函数为两个向量(期望数据样本和真实数据样本)欧式距离平方和;
Figure PCTCN2020105590-appb-000014
为期望数据样本,x k为真实数据样本,如上述待存储数据。
上述损失函数还可以是回归类损失函数的一种。例如,上述损失函数可以为均方误差损失函数、平均绝对误差损失函数、平滑平均绝对误差损失函数、对数双曲余弦(Log-Cosh)损失函数或分位数损失(Quantile Loss)函数等。具体可根据样本数据的特点、所采用的神经网络模型、迭代的效率和每次迭代时所得到的期望数据样本等因素确定。
步骤203,基于优化后的当前神经网络模型f m和/或更新后的第一参数向量,将第二参数向量或基于更新后的第一参数向量进行置换而得到的更新后 的第二参数向量输入至神经网络模型f m,得到当前期望数据样本
Figure PCTCN2020105590-appb-000015
Figure PCTCN2020105590-appb-000016
步骤203即为,基于优化后的当前神经网络模型f m和/或更新后的第一参数向量,将当前的第二参数向量输入至神经网络模型f m,得到当前期望数据样本
Figure PCTCN2020105590-appb-000017
其中,当前的第二参数向量为上一次迭代后的第二参数向量,或当前的第二参数向量为对更新后的第一参数向量进行N维置换得到第二参数向量。
返回步骤201,直至当前迭代次数达到预定的迭代次数,和/或者损失函数收敛于设定的阈值,然后保存当前的第一参数向量、以及当前的模型参数,并保存N个样本数据的ID与当前的第一参数向量的对应关系。
当神经网络模型训练结束后,对于N个数据样本,只需存储学习后的最终的第一参数向量、N个样本数据的ID与最终的第一参数向量的对应关系、以及训练后的神经网络模型的模型参数,实现了一个低维数据能够表示多个高维数据,从而极大地降低了存储高维数据所需要的存储空间。
上述步骤203具体可以分为以下几种情况:
第一种情况,若优化了当前神经网络模型f m,未更新第一参数向量,则为神经网络模型f m加载优化后的模型参数,得到优化后的神经网络模型f m;将上一次迭代的第二参数向量输入至优化后的神经网络模型f m,得到当前期望数据样本
Figure PCTCN2020105590-appb-000018
第二种情况,若更新了第一参数向量,未优化当前神经网络模型f m,则对更新后的第一参数向量进行N维置换,得到的更新后的第二参数向量,将更新后的第二参数向量输入至当前神经网络模型f m,得到当前期望数据样本
Figure PCTCN2020105590-appb-000019
第三种情况,若优化了当前神经网络模型f m,且更新了第一参数向量,则对更新后的第一参数向量进行N维置换,得到的更新后的第二参数向量,将更新后的第二参数向量输入至优化后的当前神经网络模型f m,得到当前期望数据样本
Figure PCTCN2020105590-appb-000020
在得到期望数据样本
Figure PCTCN2020105590-appb-000021
后,判断当前迭代次数是否达到预定的迭代次数,并判断损失函数是否收敛于设定的阈值。若当前迭代次数未达到预定的迭代 次数,且损失函数未收敛于设定的阈值,则返回步骤201。若当前迭代次数达到预定的迭代次数,和/或损失函数收敛于设定的阈值,则保存当前的第一参数向量、以及当前的模型参数,并保存N个数据样本的ID与当前的第一参数向量的对应关系。这里,若当前迭代次数达到预定的迭代次数,和/或损失函数收敛于设定的阈值,则保存当前的第一参数向量即为最终更新后的第一参数向量,当前的模型参数为最终优化后的模型参数。
本申请实施例中,不限定上述步骤203和202的执行顺序,例如,可以先执行步骤203,后执行步骤202。
参见图3所示,图3为本申请实施例所涉及的数据映射过程的一种示意图。其中,一个N维的第一参数向量通过仿射变换矩阵进行N维置换,得到N个分别具有N维的第二参数向量,该N个第二参数向量分别输入至训练后的神经网络模型,可得到映射后的N个数据样本{x 1,…,x N}。
与上述数据存储方法对应,本申请实施例还提供了一种数据获取方法,包括:
根据待获取数据的信息,获取存储的第一参数向量;
对第一参数向量进行N维置换,获得待获取数据对应的N维的第二参数向量,其中,N为第一参数向量的维数;
获取数据存储时所使用的训练后的神经网络模型;
将第二参数向量作为训练后的神经网络模型的输入变量,将训练后的神经网络模型的输出数据作为待获取数据。
本申请实施例中,训练后的神经网络模型即为,上述数据存储方法中训练后所得到的神经网络模型。该训练后的神经网络模型的训练过程具体参考上述图1-2部分的描述。
一种实施例中,上述根据待获取数据的信息,获取存储的第一参数向量,可以包括:
根据待获取数据的类别和/或标识,基于存储的类别和/或标识与第一参数向量的对应关系,获得第一参数向量;
获取数据存储时所使用的训练后的神经网络模型,包括:获取存储的训练后的神经网络模型的模型参数,并将获取的模型参数加载至神经网络模型 中,得到训练后的神经网络模型。
一种实施例中,上述对第一参数向量进行N维置换,获得待获取数据对应的N维的第二参数向量,可以包括:通过待获取数据对应仿射变换矩阵,对第一参数向量进行N维置换,获得待获取数据对应的N维的第二参数向量。
一种实施例中,上述通过待获取数据对应的仿射变换矩阵,对第一参数向量进行N维置换,获得待获取数据对应的N维的第二参数向量,可以包括:
通过待获取数据对应的仿射变换矩阵,对第一参数向量进行N维置换,使得:对于待获取数据对应的仿射变换矩阵为第k个仿射变换矩阵,当k等于1时,待获取数据对应的N维的第二参数向量等于第一参数向量;当k不等于1时,把第一参数向量的前k-1个元素放到第一参数向量的末端,得到第二参数向量,其中,k=1,…N。
一种实施例中,上述通过待获取数据对应的仿射变换矩阵对第一参数向量进行N维置换,可以包括:
将待获取数据对应的仿射变换矩阵与第一参数向量相乘;
其中,仿射变换矩阵分别为N×N的矩阵,且,对于待获取数据对应的仿射变换矩阵为第k个仿射变换矩阵,待获取数据对应的仿射变换矩阵中的元素a ij满足:
Figure PCTCN2020105590-appb-000022
一种实施例中,上述对第一参数向量进行N维置换,获得待获取数据对应的N维的第二参数向量,可以包括:
将第一参数向量中对应于待获取数据的标识的维度之值和第一参数向量中第一个维度之值互相交换,获得待获取数据对应的N维的第二参数向量。
一种实施例中,上述将第一参数向量中对应于待获取数据的标识的维度之值和第一参数向量中第一个维度之值互相交换,获得待获取数据对应的N维的第二参数向量,可以包括:
通过待获取数据对应的仿射变换矩阵,对第一参数向量进行N维置换,使得:对于待获取数据对应的仿射变换矩阵为第k个仿射变换矩阵,当k等于 1时,待获取数据对应的N维的第二参数向量等于第一参数向量;当k不等于1时,把第一参数向量的第k个元素与第一个元素互换,获得待获取数据对应的N维的第二参数向量,其中,k=1,…N,k表示所述待获取数据的标识,。
一种实施例中,上述通过待获取数据对应的仿射变换矩阵,对第一参数向量进行N维置换,可以包括:
将待获取数据对应的仿射变换矩阵与第一参数向量相乘;
其中,仿射变换矩阵分别为N×N的矩阵,且,对于待获取数据对应的仿射变换矩阵为第k个仿射变换矩阵,待获取数据对应的仿射变换矩阵中的元素a ij满足:
a 1k=1;
a k1=1;
Figure PCTCN2020105590-appb-000023
上述数据获取方法为与上述数据存储方法对应的数据获取方法,因此,上述数据获取方法部分的描述相对简单,相应部分可参考上述数据存储方法部分的描述。
参见图4所示,图4为本申请实施例提供的数据获取方法的一种流程示意图。
当需要获取样本数据时,根据所需获取样本数据的标识,得到该标识对应的第一参数向量。为便于描述,将该步骤称之为步骤41。
本申请实施例中,可以存储了类别与第一参数向量的一一对应关系,也可以存储多个标识与第一参数向量的对应关系,即一个第一参数向量对应多个标识。可以根据所需获取样本数据的类别,得到该类别对应的第一参数向量,将得到的第一参数向量作为所需获取样本数据对应的第一参数向量。也可以根据所需获取样本数据的标识,得到该标识对应的第一参数向量,将得到的第一参数向量作为所需获取样本数据对应的第一参数向量。
步骤41中,需要获取样本数据即为待获取数据,步骤41即为根据待获 取数据的信息,获取存储的第一参数向量。
根据所存储的第一参数向量,通过仿射变换矩阵进行N维置换,得到第二参数向量。具体计算公式与步骤103相同。为便于描述,将该步骤称之为步骤42。
步骤42即为,通过仿射变换矩阵对第一参数向量进行N维置换,获得N个分别具有N维的第二参数向量。
将神经网络模型用所存储的模型参数加载,即,调用存储数据时所使用的神经网络模型,并使用所存储的模型参数为该神经网络模型赋值,将第二参数向量作为神经网络模型的输入变量,神经网络模型的输出结果即为所需获取的样本数据。为便于描述,将该步骤称之为步骤43。
可选的,上述根据待获取数据的信息,获取存储的第一参数向量,可以包括:
根据待获取数据的类别和/或标识,基于存储的类别和/或标识与第一参数向量的对应关系,获得第一参数向量;
获取数据存储时所使用的训练后的神经网络模型,包括,获取存储的训练后的神经网络模型的模型参数,并将模型参数加载至神经网络模型中,得到训练后的神经网络模型。
可选的,上述对第一参数向量进行N维置换,获得N个分别具有N维的第二参数向量,可以包括:通过N个仿射变换矩阵对第一参数向量进行N维置换,获得N个分别具有N维的第二参数向量,使得N个分别具有N维的第二参数向量中的一个第二参数向量与第一参数向量相同,其他第二参数向量在每个维度上的值与第一参数向量对应维度上的值不同。
可选的,上述通过N个仿射变换矩阵对第一参数向量进行N维置换,获得N个分别具有N维的第二参数向量,使得N个分别具有N维的第二参数向量中的一个第二参数向量与第一参数向量相同,其他第二参数向量在每个维度上的值与第一参数向量对应维度上的值不同,可以包括:
通过N个仿射变换矩阵分别对第一参数向量进行N维置换,使得:对于第k个仿射变换矩阵,当k等于1时,第二参数向量等于第一参数向量;当k不等于1时,分别把第一参数向量的前k-1个元素放到第一参数向量的末端, 得到N-1个分别具有N维的第二参数向量,其中,k=1,…N。
可选的,上述通过N个仿射变换矩阵对第一参数向量进行N维置换,可以包括:
将N个仿射变换矩阵分别与第一参数向量相乘;
其中,N个仿射变换矩阵分别为N×N的矩阵,且,仿射变换矩阵中的元素a ij满足:
Figure PCTCN2020105590-appb-000024
可选的,上述对第一参数向量进行N维置换,获得N个分别具有N维的第二参数向量,可以包括:
将第一参数向量中对应于待获取数据的标识的维度之值和第一参数向量中第一个维度之值互相交换,分别获得N个具有N维的第二参数向量。
可选的,上述将第一参数向量中对应于待获取数据的标识的维度之值和第一参数向量中第一个维度之值互相交换,分别获得N个具有N维的第二参数向量,可以包括:
通过N个仿射变换矩阵分别对第一参数向量进行N维置换,使得:对于第k个仿射变换矩阵,当k等于1时,第二参数向量等于第一参数向量;当k不等于1时,分别把第一参数向量的第k个元素与第一个元素互换,得到N-1个具有N维的第二参数向量,其中,k表示待获取数据的标识,k=1,…N。
可选的,上述通过N个仿射变换矩阵分别对第一参数向量进行N维置换,包括:
将N个仿射变换矩阵分别与第一参数向量相乘;
其中,N个仿射变换矩阵分别为N×N的矩阵,且,仿射变换矩阵中的元素a ij满足:
a 1k=1;
a k1=1;
Figure PCTCN2020105590-appb-000025
本申请实施例通过上述步骤,能够快速地查询到所需要的数据,数据获取效率高,且使用方便。
为说明本申请实施例,以下以一图像数据的存储为实施例来说明。
图像数据包括了大量的像素点及各个像素点的像素值,是典型高维数据中的一种。例如,在增量学习场景中,需要用到大量经过卷积神经网络中间层输出的图像的特征图,这时特征图包括的图像数据具有很高的维度,如果直接存储特征图包括的图像数据,将非常耗费存储空间。
假设,待存储的图像数据包括10张图像数据,每个图像数据包括有16×16个像素点的像素值。按照本申请实施例的描述方式来说,待存储的图像数据,包括有10个不同ID的样本数据,每个样本数据包括256个数据维度。
为该10个图像数据分配一个10维的第一参数向量h 1,该向量中的参数初始值为按照高斯分布随机值采样所述10个样本数据获得的。
通过对第一参数向量的10个维度进行置换,得到10个分别具有10维的第二参数向量{h 1,…,h 10}。
构建深度学习神经网络模型,并对该深度学习神经网络模型进行训练,使得通过训练后的深度学习神经网络模型f能够将10个10维的第二参数向量{h 1,…,h 10}映射到10个图像数据。
其中,对构建的深度学习神经网络模型进行训练的过程可以包括,设置深度学习神经网络模型中的各初始模型参数,通过该深度学习神经网络模型f 0将第二参数向量{h 1,…,h 10}进行映射,得到10张图像数据的期望数据样本,即期望图像数据
Figure PCTCN2020105590-appb-000026
Figure PCTCN2020105590-appb-000027
其中,f 0表示初始深度学习神经网络模型,
Figure PCTCN2020105590-appb-000028
是深度学习神经网络模型所输出的第k张图像数据的期望图像数据,k=1,2,…10。
累计当前迭代次数。
计算当前深度学习神经网络模型的损失函数,按照使得损失函数收敛的原则,优化当前深度学习神经网络模型的模型参数,得到该次优化后的当前 深度学习神经网络模型f m(m表示迭代次数),和/或根据深度学习神经网络模型的学习结果更新第一参数向量,使得第一参数向量成为可学习参数向量。上述损失函数的计算可以为:
Figure PCTCN2020105590-appb-000029
其中,
Figure PCTCN2020105590-appb-000030
表示损失函数,x k为待存储的第k张图片的图像数据,
Figure PCTCN2020105590-appb-000031
为第k张图像数据的期望图像数据。
基于优化后的当前深度学习神经网络模型f m和/或更新后的第一参数向量,将当前的第二参数向量输入至深度学习神经网络模型f m,得到当前期望图像数据。其中,当前的第二参数向量可以为将上一次迭代后的第二参数向量作为当前的第二参数向量;当前的第二参数向量也可以为对更新后的第一参数向量进行N维置换得到当前的第二参数向量。
返回累计当前迭代次数步骤,直至达到预定的迭代次数,和/或损失函数收敛于设定的阈值。
当深度学习神经网络模型训练结束后,对于10张图像数据,只需存储学习后的最终第一参数向量的10个值、以及训练后的深度学习神经网络模型的模型参数。而对于待存储的10张图像数据,实际有2560个像素值需要存储。由此可见,采用本申请实施例提供的技术方案,能够极大地压缩数据的存储空间。
参见图5所示,图5为本申请实施例的数据存储装置的一种示意图。该装置包括:
分配模块,用于为N个具有至少V维的待存储数据分配一个N维第一参数向量;其中,第一参数向量的各维参数初始值按照高斯分布随机值分别采样N个待存储数据获得,V、N为自然数,V大于等于N。可选地,V大于等于N;
置换模块,用于对第一参数向量进行N维置换,获得N个分别具有N维的第二参数向量;
神经网络模块,用于构建一将当前的第二参数向量映射到N个待存储数据的期望数据样本的神经网络模型,对神经网络模型的模型参数、和/或第一 参数向量进行调整,直至当前的第二参数向量基于训练后的神经网络模型所获得的N个待存储数据的期望数据样本回归于N个待存储数据,。
存储模块,用于存储当前的第一参数向量,存储训练后的神经网络模型的模型参数。
上述神经网络模块又可以称为构建模块。
本申请实施例中,针对待存储数据,如图像数据,图像数据包含的数据维度较大,将存储维度较高的N个待存储数据,替换为存储维度较低的第一参数向量,因此可以大量节省存储空间,降低运算量。
一种实施例中,神经网络模块还可以用于:如果当前第二参数向量基于训练后的神经网络模型所获得的N个待存储数据的期望数据样本未回归于N个待存储数据,则对当前的第一参数向量进行N维置换,返回执行所述对所述神经网络模型的模型参数、和/或第一参数向量进行调整的步骤。
一种实施例中,该数据存储装置还可以包括,
数据标识模块,用于对N个待存储数据按照类别进行区分,和/或,为每个待存储数据分配标识,并将N个待存储数据的类别和/或标识与第一参数向量的对应关系存储到存储模块中。
一种实施例中,置换模块具体可以用于,通过N个仿射变换矩阵对第一参数向量进行N维置换,获得N个N维的第二参数向量,使得所述N个分别具有N维的第二参数向量中的一个第二参数向量与第一参数向量相同,其他第二参数向量在每个维度上的值与所述第一参数向量对应维度上的值不同。
例如,通过N个仿射变换矩阵分别对第一参数向量进行N维置换,对于第k个仿射变换矩阵,当k等于1时,第二参数向量等于第一参数向量;当k不等于1时,分别把第一参数向量的前k-1个元素放到第一参数向量的末端,得到N-1个分别具有N维的第二参数向量,其中,k=1,…N。
一种实施例中,置换模块具体可以用于,将第一参数向量中对应于N个待存储数据的标识的维度之值和第一参数向量中第一个维度之值互相交换,分别获得N个具有N维的第二参数向量。
例如,通过N个仿射变换矩阵分别对第一参数向量进行N维置换,当k等于1时,第二参数向量等于第一参数向量;当k不等于1时,分别把第一 参数向量的第k个元素与第一个元素互换,其中,k=1,…N。
一种实施例中,置换模块可以包括仿射变换矩阵在线生成模块,用于根据预先设置的变换规则在线生成各个仿射变换矩阵。
一种实施例中,神经网络模块具体可以用于,将N个分别具有N维的第二参数向量作为神经网络模型的输入变量,将神经网络模型的输出数据作为N个待存储数据的期望数据样本,对神经网络模型的模型参数进行训练,和/或在训练过程中调整第一参数向量,直至N个待存储数据的期望数据样本回归于N个待存储数据。
一种实施例中,所述装置还可以包括训练模块,用于:
对神经网络模型的模型参数进行初始化;
累计当前迭代次数;
将当前的第二参数向量输入至当前的神经网络模型,得到N个待存储数据的当前期望数据样本,计算当前期望数据样本与待存储数据的损失函数,按照使得损失函数收敛的原则,优化当前的神经网络模型的模型参数和/或第一参数向量,得到该次迭代优化后的神经网络模型的模型参数和/或更新后的第一参数向量;
将上一次迭代后的第二参数向量作为当前的第二参数向量,或对调整后的第一参数向量进行N维置换得到第二参数向量,作为当前的第二参数向量;
返回执行所述累计当前迭代次数的步骤,直至当前迭代次数达到预定的迭代次数,或者损失函数收敛于设定的阈值,得到训练后的神经网络模型的模型参数和/或更新后的第一参数向量。
一种实施例中,神经网络模型为深度学习神经网络模型。
参见图6所示,图6为本申请实施例提供的数据获取装置的一种示意图。该装置包括:
第一参数向量获取模块,用于根据待获取数据信息,获取存储的第一参数向量;
置换模块,用于对第一参数向量进行N维置换,获得N个分别具有N维的第二参数向量,其中,N为第一参数向量的维数,即N为第一参数向量包括的数据维度的个数;
神经网络模型模块,用于获取数据存储时所使用的训练后的神经网络模型;将N个第二参数向量作为训练后的神经网络模型的输入变量,将训练后的神经网络模型的输出数据作为待获取数据。
上述第一参数向量获取模块又可以称为第一获取模块,神经网络模型模块有可以称为第二获取模块。
一种实施例中,第一参数向量获取模块具体可以用于,根据待获取数据的类别和/或标识,基于存储的类别和/或标识与第一参数向量的对应关系,获得第一参数向量。
神经网络模型模块具体可以用于,获取存储的训练后的神经网络模型的模型参数,并将获取的模型参数加载至神经网络模型中,得到训练后的神经网络模型。
一种实施例中,置换模块具体可以用于,通过N个仿射变换矩阵对第一参数向量进行N维置换,获得N个分别具有N维的第二参数向量,使得N个分别具有N维的第二参数向量中的一个第二参数向量与第一参数向量相同,其他第二参数向量在每个维度上的值与第一参数向量对应维度上的值不同。
例如,对于第k个仿射变换矩阵,当k等于1时,第二参数向量等于第一参数向量;当k不等于1时,分别把第一参数向量的前k-1个元素放到该第一参数向量的末端,得到N-1个分别具有N维的第二参数向量,其中,k=1,…N。
一种实施例中,置换模块具体可以用于,将第一参数向量中对应于待获取数据的标识的维度之值和第一参数向量中第一个维度之值互相交换,分别获得N个具有N维的第二参数向量。
例如,对于第k个仿射变换矩阵,当k等于1时,第二参数向量等于第一参数向量;当k不等于1时,分别把第一参数向量的第k个元素与第一个元素互换,得到N-1个具有N维的第二参数向量,其中,k表示待获取数据的标识,k=1,…N。
一种实施例中,置换模块还可以包括仿射变换矩阵在线生成模块,用于根据预先设置的变换规则在线生成各个仿射变换矩阵。
本申请实施例还提供了一种数据存储装置,其特征在于,该装置包括,存储器以及处理器,其中,存储器用于存储指令,该指令在由处理器执行时 使得处理器执行所述数据存储方法的步骤。
本申请实施例还提供了一种数据获取装置,其特征在于,该装置包括,存储器以及处理器,其中,存储器用于存储指令,该指令在由处理器执行时使得处理器执行所述数据获取方法的步骤。
存储器可以包括随机存取存储器(RAM,Random Access Memory),也可以包括非易失性存储器(NVM,Non-Volatile Memory),例如至少一个磁盘存储器。可选的,存储器还可以是至少一个位于远离前述处理器的存储装置。
上述的处理器可以是通用处理器,包括中央处理器(CPU,Central Processing Unit)、网络处理器(NP,Network Processor)等;还可以是数字信号处理器(DSP,Digital Signal Processing)、专用集成电路(ASIC,Application Specific Integrated Circuit)、现场可编程门阵列(FPGA,Field-Programmable Gate Array)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。
本申请实施例还提供了一种数据获取装置,该装置包括:
第一获取模块,用于根据待获取数据的信息,获取存储的第一参数向量;
对第一参数向量进行N维置换,获得待获取数据对应的N维的第二参数向量,其中,N为第一参数向量的维数;
置换模块,用于获取数据存储时所使用的训练后的神经网络模型;
第二获取模块,用于将第二参数向量作为训练后的神经网络模型的输入变量,将训练后的神经网络模型的输出数据作为待获取数据。
一种实施例中,上述第一获取模块,具体可以用于:
根据待获取数据的类别和/或标识,基于存储的类别和/或标识与第一参数向量的对应关系,获得第一参数向量;
第二获取模块,具体可以用于:获取存储的训练后的神经网络模型的模型参数,并将获取的模型参数加载至神经网络模型中,得到训练后的神经网络模型。
一种实施例中,上述置换模块,具体可以用于:通过待获取数据对应仿射变换矩阵,对第一参数向量进行N维置换,获得待获取数据对应的N维的第二参数向量。
一种实施例中,上述置换模块,具体可以用于:
通过待获取数据对应的仿射变换矩阵,对第一参数向量进行N维置换,使得:对于待获取数据对应的仿射变换矩阵为第k个仿射变换矩阵,当k等于1时,待获取数据对应的N维的第二参数向量等于第一参数向量;当k不等于1时,把第一参数向量的前k-1个元素放到第一参数向量的末端,得到第二参数向量,其中,k=1,…N。
一种实施例中,上述置换模块,具体可以用于:
将待获取数据对应的仿射变换矩阵与第一参数向量相乘;
其中,仿射变换矩阵分别为N×N的矩阵,且,对于待获取数据对应的仿射变换矩阵为第k个仿射变换矩阵,待获取数据对应的仿射变换矩阵中的元素a ij满足:
Figure PCTCN2020105590-appb-000032
一种实施例中,上述置换模块,具体可以用于:
将第一参数向量中对应于待获取数据的标识的维度之值和第一参数向量中第一个维度之值互相交换,获得待获取数据对应的N维的第二参数向量。
一种实施例中,上述将第一参数向量中对应于待获取数据的标识的维度之值和第一参数向量中第一个维度之值互相交换,获得待获取数据对应的N维的第二参数向量,可以包括:
通过待获取数据对应的仿射变换矩阵,对第一参数向量进行N维置换,使得:对于待获取数据对应的仿射变换矩阵为第k个仿射变换矩阵,当k等于1时,待获取数据对应的N维的第二参数向量等于第一参数向量;当k不等于1时,把第一参数向量的第k个元素与第一个元素互换,获得待获取数据对应的N维的第二参数向量,其中,k=1,…N,k表示所述待获取数据的标识,。
一种实施例中,上述置换模块,具体可以用于:
将待获取数据对应的仿射变换矩阵与第一参数向量相乘;
其中,仿射变换矩阵分别为N×N的矩阵,且,对于待获取数据对应的仿射变换矩阵为第k个仿射变换矩阵,待获取数据对应的仿射变换矩阵中的元 素a ij满足:
a 1k=1;
a k1=1;
Figure PCTCN2020105590-appb-000033
本申请实施例还提供了一种电子设备,电子设备包括处理器和存储介质,存储介质内存储有计算机程序,计算机程序被处理器执行时实现如下步骤:
为N个待存储数据分配一个N维第一参数向量;
对第一参数向量进行N维置换,获得N个分别具有N维的第二参数向量;
构建一将当前的第二参数向量映射到所述N个待存储数据的期望数据样本的神经网络模型;
对所述神经网络模型的模型参数、和/或第一参数向量进行调整,直至当前的第二参数向量基于训练后的神经网络模型所获得的所述N个待存储数据的期望数据样本回归于所述N个待存储数据;
存储当前的第一参数向量。
本申请实施例还提供了一种电子设备,电子设备包括处理器和存储介质,存储介质内存储有计算机程序,计算机程序被处理器执行时实现如下步骤:
根据待获取数据的信息,获取存储的第一参数向量;
对第一参数向量进行N维置换,获得N个分别具有N维的第二参数向量,其中,N为第一参数向量的维数;
获取数据存储时所使用的训练后的神经网络模型;
将N个第二参数向量作为训练后的神经网络模型的输入变量,将训练后的神经网络模型的输出数据作为待获取数据。
本申请实施例还提供了一种电子设备,电子设备包括处理器和存储介质,存储介质内存储有计算机程序,计算机程序被处理器执行时实现如下步骤:
根据待获取数据的信息,获取存储的第一参数向量;
对第一参数向量进行N维置换,获得待获取数据对应的N维的第二参数 向量,其中,N为第一参数向量的维数;
获取数据存储时所使用的训练后的神经网络模型;
将第二参数向量作为训练后的神经网络模型的输入变量,将训练后的神经网络模型的输出数据作为待获取数据。
本申请实施例还提供了一种计算机可读存储介质,存储介质内存储有计算机程序,计算机程序被处理器执行时实现如下步骤:
为N个待存储数据分配一个N维第一参数向量;
对第一参数向量进行N维置换,获得N个分别具有N维的第二参数向量;
构建一将当前的第二参数向量映射到N个待存储数据的期望数据样本的神经网络模型;
对神经网络模型的模型参数、和/或第一参数向量进行调整,直至当前的第二参数向量基于训练后的神经网络模型所获得的N个待存储数据的期望数据样本回归于N个待存储数据;
存储当前的第一参数向量。
本申请实施例还提供了一种计算机可读存储介质,存储介质内存储有计算机程序,计算机程序被处理器执行时实现如下步骤:
根据待获取数据的信息,获取存储的第一参数向量;
对第一参数向量进行N维置换,获得N个分别具有N维的第二参数向量,其中,N为第一参数向量的维数;
获取数据存储时所使用的训练后的神经网络模型;
将N个第二参数向量作为训练后的神经网络模型的输入变量,将训练后的神经网络模型的输出数据作为待获取数据。
本申请实施例还提供了一种计算机可读存储介质,存储介质内存储有计算机程序,计算机程序被处理器执行时实现如下步骤:
根据待获取数据的信息,获取存储的第一参数向量;
对第一参数向量进行N维置换,获得待获取数据对应的N维的第二参数向量,其中,N为第一参数向量的维数;
获取数据存储时所使用的训练后的神经网络模型;
将第二参数向量作为训练后的神经网络模型的输入变量,将训练后的神 经网络模型的输出数据作为待获取数据。
本申请实施例还提供了一种计算机程序,计算机程序被处理器执行时实现如下步骤:
为N个待存储数据分配一个N维第一参数向量;
对第一参数向量进行N维置换,获得N个分别具有N维的第二参数向量;
构建一将当前的第二参数向量映射到N个待存储数据的期望数据样本的神经网络模型;
对神经网络模型的模型参数、和/或第一参数向量进行调整,直至当前的第二参数向量基于训练后的神经网络模型所获得的N个待存储数据的期望数据样本回归于N个待存储数据;
存储当前的第一参数向量。
本申请实施例还提供了一种计算机程序,计算机程序被处理器执行时实现如下步骤:
根据待获取数据的信息,获取存储的第一参数向量;
对第一参数向量进行N维置换,获得N个分别具有N维的第二参数向量,其中,N为第一参数向量的维数;
获取数据存储时所使用的训练后的神经网络模型;
将N个第二参数向量作为训练后的神经网络模型的输入变量,将训练后的神经网络模型的输出数据作为待获取数据。
本申请实施例还提供了一种计算机程序,计算机程序被处理器执行时实现如下步骤:
根据待获取数据的信息,获取存储的第一参数向量;
对第一参数向量进行N维置换,获得待获取数据对应的N维的第二参数向量,其中,N为第一参数向量的维数;
获取数据存储时所使用的训练后的神经网络模型;
将第二参数向量作为训练后的神经网络模型的输入变量,将训练后的神经网络模型的输出数据作为待获取数据。
对于装置/电子设备/存储介质/计算机程序实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即 可。
需要说明的是,本申请尽管是以数据存储、和获取为实施例进行的说明,所应理解的是,本申请不仅仅用于数据的存储,还可应用于数据表征,例如,将复杂数据信息用简化的数据信息来表征,也可用于数据维度的降低,例如,将高维数据降低为低维数据。
在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。
以上所述仅为本申请的较佳实施例而已,并不用以限制本申请,凡在本申请的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本申请保护的范围之内。

Claims (24)

  1. 一种数据存储方法,其特征在于,该方法包括:
    为N个待存储数据分配一个N维第一参数向量;
    对第一参数向量进行N维置换,获得N个分别具有N维的第二参数向量;
    构建一将当前的第二参数向量映射到所述N个待存储数据的期望数据样本的神经网络模型;
    对所述神经网络模型的模型参数、和/或第一参数向量进行调整,直至当前的第二参数向量基于训练后的神经网络模型所获得的所述N个待存储数据的期望数据样本回归于所述N个待存储数据;
    存储当前的第一参数向量。
  2. 如权利要求1所述的方法,其特征在于,该方法还包括,如果当前第二参数向量基于训练后的神经网络模型所获得的所述N个待存储数据的期望数据样本未回归于所述N个待存储数据,则对当前的第一参数向量进行N维置换,返回执行所述对所述神经网络模型的模型参数和/或第一参数向量进行调整的步骤。
  3. 如权利要求1所述的方法,其特征在于,该方法还包括:对所述N个待存储数据按照类别进行区分,和/或,分别为每个所述待存储数据分配标识,并存储所述类别和/或标识与第一参数向量的对应关系;
    该方法还包括:存储训练后的神经网络模型的模型参数;
    所述第一参数向量中各维参数初始值按照高斯分布随机值分别采样所述N个待存储数据获得。
  4. 如权利要求3所述的方法,其特征在于,所述对第一参数向量进行N维置换,获得N个分别具有N维的第二参数向量,包括:通过N个仿射变换矩阵对第一参数向量进行N维置换,获得N个分别具有N维的第二参数向量,使得所述N个分别具有N维的第二参数向量中的一个第二参数向量与第一参数向量相同,其他第二参数向量在每个维度上的值与所述第一参数向量在对应维度上的值不同。
  5. 如权利要求4所述的方法,其特征在于,所述通过N个仿射变换矩阵对第一参数向量进行N维置换,获得N个分别具有N维的当前第二参数向量, 使得所述N个分别具有N维的第二参数向量中的一个第二参数向量与第一参数向量相同,其他第二参数向量在每个维度上的值与所述第一参数向量对应维度上的值不同,包括:
    通过N个仿射变换矩阵分别对第一参数向量进行N维置换,使得:对于第k个仿射变换矩阵,当k等于1时,第二参数向量等于第一参数向量;当k不等于1时,分别把第一参数向量的前k-1个元素放到第一参数向量的末端,得到N-1个分别具有N维的第二参数向量,其中,k=1,…N。
  6. 如权利要求5所述的方法,其特征在于,所述通过N个仿射变换矩阵对第一参数向量进行N维置换,包括:
    将所述N个仿射变换矩阵分别与第一参数向量相乘,
    其中,N个仿射变换矩阵分别为N×N的矩阵,且,所述仿射变换矩阵中的元素a ij满足:
    Figure PCTCN2020105590-appb-100001
  7. 如权利要求3所述的方法,其特征在于,所述对第一参数向量进行N维置换,获得N个分别具有N维的第二参数向量,包括:
    将第一参数向量中对应于所述N个待存储数据的标识的维度之值和第一参数向量中第一个维度之值互相交换,分别获得N个具有N维的第二参数向量。
  8. 如权利要求7所述的方法,其特征在于,所述将第一参数向量中对应于所述N个待存储数据的标识的维度之值和第一参数向量中第一个维度之值互相交换,分别获得N个具有N维的第二参数向量,包括:
    通过N个仿射变换矩阵分别对第一参数向量进行N维置换,使得:对于第k个仿射变换矩阵,当k等于1时,第二参数向量等于第一参数向量;当k不等于1时,分别把第一参数向量的第k个元素与第一个元素互换,得到N-1个具有N维的第二参数向量,其中,k表示所述N个待存储数据的标识,k=1,…N。
  9. 如权利要求8所述的方法,其特征在于,所述通过N个仿射变换矩阵 分别对第一参数向量进行N维置换,包括:
    将所述N个仿射变换矩阵分别与第一参数向量相乘;
    其中,N个仿射变换矩阵分别为N×N的矩阵,且,所述仿射变换矩阵中的元素a ij满足:
    a 1k=1;
    a k1=1;
    Figure PCTCN2020105590-appb-100002
  10. 如权利要求1至9任一所述的方法,其特征在于,对所述神经网络模型的模型参数、和/或第一参数向量进行调整,直至当前第二参数向量基于训练后的神经网络模型所获得的所述N个待存储数据的期望数据样本回归于所述N个待存储数据,包括:将所述N个分别具有N维的第二参数向量作为所述神经网络模型的输入变量,将所述神经网络模型的输出数据作为所述N个待存储数据的期望数据样本,对所述神经网络模型的模型参数进行训练,和/或在训练过程中更新第一参数向量,直至所述N个待存储数据的期望数据样本回归于所述N个待存储数据。
  11. 如权利要求10所述的方法,其特征在于,所述对所述神经网络模型进行训练,和/或在训练过程中更新第一参数向量,直至所述N个待存储数据的期望数据样本回归于所述N个待存储数据,包括:
    对所述神经网络模型的模型参数进行初始化;
    累计当前迭代次数;
    将当前的第二参数向量输入至当前的神经网络模型,得到所述N个待存储数据的当前期望数据样本,计算当前期望数据样本与所述N个待存储数据的损失函数,按照使得损失函数收敛的原则,优化当前的神经网络模型的模型参数和/或第一参数向量,得到该次迭代优化后的神经网络模型的模型参数、和/或更新后的第一参数向量;
    将上一次迭代后的第二参数向量作为当前的第二参数向量,或对更新后的第一参数向量进行N维置换得到当前的第二参数向量;
    返回执行所述累计当前迭代次数的步骤,直至当前迭代次数达到预定的迭代次数,或者损失函数收敛于设定的阈值,得到训练后的神经网络模型的模型参数和/或更新后的第一参数向量。
  12. 如权利要求11所述的方法,其特征在于,所述神经网络模型为深度学习神经网络模型;所述损失函数为回归类损失函数;所述仿射变换矩阵根据当前k值在线生成,其中,k=1,…N。
  13. 一种数据获取方法,其特征在于,所述方法包括:
    根据待获取数据的信息,获取存储的第一参数向量;
    对所述第一参数向量进行N维置换,获得N个分别具有N维的第二参数向量,其中,N为所述第一参数向量的维数;
    获取数据存储时所使用的训练后的神经网络模型;
    将所述N个第二参数向量作为训练后的神经网络模型的输入变量,将训练后的神经网络模型的输出数据作为所述待获取数据。
  14. 如权利要求13所述的方法,其特征在于,所述根据待获取数据,获取存储的第一参数向量,包括:
    根据待获取数据的类别和/或标识,基于存储的类别和/或标识与第一参数向量的对应关系,获得第一参数向量;
    所述获取数据存储时所使用的训练后的神经网络模型,包括,获取存储的训练后的神经网络模型的模型参数,并将所述模型参数加载至神经网络模型中,得到训练后的神经网络模型。
  15. 如权利要求13或14所述的方法,其特征在于,所述对所述第一参数向量进行N维置换,获得N个分别具有N维的第二参数向量,包括:通过N个仿射变换矩阵对所述第一参数向量进行N维置换,获得N个分别具有N维的第二参数向量,使得所述N个分别具有N维的第二参数向量中的一个第二参数向量与第一参数向量相同,其他第二参数向量在每个维度上的值与所述第一参数向量对应维度上的值不同。
  16. 如权利要求15所述的方法,其特征在于,所述通过N个仿射变换矩阵对所述第一参数向量进行N维置换,获得N个分别具有N维的第二参数向 量,使得所述N个分别具有N维的第二参数向量中的一个第二参数向量与第一参数向量相同,其他第二参数向量在每个维度上的值与所述第一参数向量对应维度上的值不同,包括:
    通过N个仿射变换矩阵分别对所述第一参数向量进行N维置换,使得:对于第k个仿射变换矩阵,当k等于1时,第二参数向量等于所述第一参数向量;当k不等于1时,分别把所述第一参数向量的前k-1个元素放到所述第一参数向量的末端,得到N-1个分别具有N维的第二参数向量,其中,k=1,…N。
  17. 如权利要求16所述的方法,其特征在于,所述通过N个仿射变换矩阵对所述第一参数向量进行N维置换,包括:
    将所述N个仿射变换矩阵分别与所述第一参数向量相乘;
    其中,N个仿射变换矩阵分别为N×N的矩阵,且,所述仿射变换矩阵中的元素a ij满足:
    Figure PCTCN2020105590-appb-100003
  18. 如权利要求13或14所述的方法,其特征在于,所述对所述第一参数向量进行N维置换,获得N个分别具有N维的第二参数向量,包括:
    将所述第一参数向量中对应于所述待获取数据的标识的维度之值和所述第一参数向量中第一个维度之值互相交换,分别获得N个具有N维的第二参数向量。
  19. 如权利要求18所述的方法,其特征在于,所述将所述第一参数向量中对应于所述待获取数据的标识的维度之值和第一参数向量中第一个维度之值互相交换,分别获得N个具有N维的第二参数向量,包括:
    通过N个仿射变换矩阵分别对所述第一参数向量进行N维置换,使得:对于第k个仿射变换矩阵,当k等于1时,第二参数向量等于所述第一参数向量;当k不等于1时,分别把所述第一参数向量的第k个元素与第一个元素互换,得到N-1个具有N维的第二参数向量,其中,k表示所述待获取数据的标识,k=1,…N。
  20. 如权利要求19所述的方法,其特征在于,所述通过N个仿射变换矩 阵分别对所述第一参数向量进行N维置换,包括:
    将所述N个仿射变换矩阵分别与所述第一参数向量相乘;
    其中,N个仿射变换矩阵分别为N×N的矩阵,且,所述仿射变换矩阵中的元素a ij满足:
    a 1k=1;
    a k1=1;
    Figure PCTCN2020105590-appb-100004
  21. 一种数据获取方法,其特征在于,所述方法包括:
    根据待获取数据的信息,获取存储的第一参数向量;
    对所述第一参数向量进行N维置换,获得所述待获取数据对应的N维的第二参数向量,其中,N为所述第一参数向量的维数;
    获取数据存储时所使用的训练后的神经网络模型;
    将所述第二参数向量作为训练后的神经网络模型的输入变量,将训练后的神经网络模型的输出数据作为所述待获取数据。
  22. 一种数据获取装置,其特征在于,所述装置包括:
    第一获取模块,用于根据待获取数据的信息,获取存储的第一参数向量;
    对所述第一参数向量进行N维置换,获得所述待获取数据对应的N维的第二参数向量,其中,N为所述第一参数向量的维数;
    置换模块,用于获取数据存储时所使用的训练后的神经网络模型;
    第二获取模块,用于将所述第二参数向量作为训练后的神经网络模型的输入变量,将训练后的神经网络模型的输出数据作为所述待获取数据。
  23. 一种计算机可读存储介质,其特征在于,所述存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现如权利要求1至12任一所述数据存储方法的步骤。
  24. 一种计算机可读存储介质,其特征在于,所述存储介质内存储有计算机程序,所述计算机程序被处理器执行时实现如权利要求13至21任一所述数据获取方法的步骤。
PCT/CN2020/105590 2019-07-29 2020-07-29 一种数据存储方法、及其数据获取方法、装置 WO2021018218A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
EP20848629.0A EP4007173A4 (en) 2019-07-29 2020-07-29 DATA STORAGE METHODS AND DATA COLLECTION METHODS AND DEVICE THEREFOR
US17/630,660 US20220261433A1 (en) 2019-07-29 2020-07-29 Data storage method, data acquisition method and device thereof

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910687185.0A CN112307230B (zh) 2019-07-29 2019-07-29 一种数据存储的方法、及其数据获取方法、装置
CN201910687185.0 2019-07-29

Publications (1)

Publication Number Publication Date
WO2021018218A1 true WO2021018218A1 (zh) 2021-02-04

Family

ID=74230219

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/105590 WO2021018218A1 (zh) 2019-07-29 2020-07-29 一种数据存储方法、及其数据获取方法、装置

Country Status (4)

Country Link
US (1) US20220261433A1 (zh)
EP (1) EP4007173A4 (zh)
CN (1) CN112307230B (zh)
WO (1) WO2021018218A1 (zh)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101183873A (zh) * 2007-12-11 2008-05-21 中山大学 一种基于bp神经网络的嵌入式系统数据压缩解压缩方法
CN107749757A (zh) * 2017-10-18 2018-03-02 广东电网有限责任公司电力科学研究院 一种基于堆栈式自编码和pso算法的数据压缩方法及装置
WO2018106805A1 (en) * 2016-12-09 2018-06-14 William Marsh Rice University Signal recovery via deep convolutional networks
CN109903351A (zh) * 2019-03-02 2019-06-18 复旦大学 基于卷积神经网络和传统编码相结合的图像压缩方法

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2004061702A1 (en) * 2002-12-26 2004-07-22 The Trustees Of Columbia University In The City Of New York Ordered data compression system and methods
US9870199B2 (en) * 2015-05-12 2018-01-16 Google Llc Generating compact representations of high-dimensional data
US10748062B2 (en) * 2016-12-15 2020-08-18 WaveOne Inc. Deep learning based adaptive arithmetic coding and codelength regularization
CN108229644A (zh) * 2016-12-15 2018-06-29 上海寒武纪信息科技有限公司 压缩/解压缩神经网络模型的装置、设备和方法
CN109558899A (zh) * 2018-11-13 2019-04-02 中国石油天然气股份有限公司 数据降维方法及装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101183873A (zh) * 2007-12-11 2008-05-21 中山大学 一种基于bp神经网络的嵌入式系统数据压缩解压缩方法
WO2018106805A1 (en) * 2016-12-09 2018-06-14 William Marsh Rice University Signal recovery via deep convolutional networks
CN107749757A (zh) * 2017-10-18 2018-03-02 广东电网有限责任公司电力科学研究院 一种基于堆栈式自编码和pso算法的数据压缩方法及装置
CN109903351A (zh) * 2019-03-02 2019-06-18 复旦大学 基于卷积神经网络和传统编码相结合的图像压缩方法

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP4007173A4

Also Published As

Publication number Publication date
CN112307230B (zh) 2024-01-26
US20220261433A1 (en) 2022-08-18
EP4007173A4 (en) 2022-11-16
EP4007173A1 (en) 2022-06-01
CN112307230A (zh) 2021-02-02

Similar Documents

Publication Publication Date Title
CN110288030B (zh) 基于轻量化网络模型的图像识别方法、装置及设备
Alquier et al. Regret bounds for lifelong learning
US10885379B2 (en) Multi-view image clustering techniques using binary compression
WO2022042123A1 (zh) 图像识别模型生成方法、装置、计算机设备和存储介质
CN109522435B (zh) 一种图像检索方法及装置
EP4163831A1 (en) Neural network distillation method and device
CN107943938A (zh) 一种基于深度乘积量化的大规模图像相似检索方法及系统
CN109284411B (zh) 一种基于有监督超图离散化图像二值编码方法
WO2022105108A1 (zh) 一种网络数据分类方法、装置、设备及可读存储介质
CN112733933B (zh) 基于统一优化目标框架图神经网络的数据分类方法及装置
CN113377964B (zh) 知识图谱链接预测方法、装置、设备及存储介质
CN110188825A (zh) 基于离散多视图聚类的图像聚类方法、系统、设备及介质
EP3115908A1 (en) Method and apparatus for multimedia content indexing and retrieval based on product quantization
CN109829474B (zh) 一种电路图识别方法
WO2021253938A1 (zh) 一种神经网络的训练方法、视频识别方法及装置
US9852185B2 (en) Approximate distinct counting in a bounded memory
WO2021018218A1 (zh) 一种数据存储方法、及其数据获取方法、装置
WO2024022082A1 (zh) 信息分类的方法、装置、设备和介质
CN112966054A (zh) 基于企业图谱节点间关系的族群划分方法和计算机设备
CN110009091B (zh) 学习网络在等价类空间中的优化
WO2023155299A1 (zh) 图像增强处理方法、装置、计算机设备及存储介质
CN114821140A (zh) 基于曼哈顿距离的图像聚类方法、终端设备及存储介质
CN114707655A (zh) 一种量子线路转换方法、系统、存储介质和电子设备
CN113705635A (zh) 基于自适应图的半监督宽度学习分类方法及设备
CN116821171B (zh) 一种生成新虚拟视图加速计算任务的方法

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20848629

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 2020848629

Country of ref document: EP

Effective date: 20220228