WO2021189908A1 - 基于深度学习的图像分类方法、装置、服务器及介质 - Google Patents

基于深度学习的图像分类方法、装置、服务器及介质 Download PDF

Info

Publication number
WO2021189908A1
WO2021189908A1 PCT/CN2020/131988 CN2020131988W WO2021189908A1 WO 2021189908 A1 WO2021189908 A1 WO 2021189908A1 CN 2020131988 W CN2020131988 W CN 2020131988W WO 2021189908 A1 WO2021189908 A1 WO 2021189908A1
Authority
WO
WIPO (PCT)
Prior art keywords
classification model
classification
sample
image
parameter
Prior art date
Application number
PCT/CN2020/131988
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 平安科技(深圳)有限公司
Publication of WO2021189908A1 publication Critical patent/WO2021189908A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/217Validation; Performance evaluation; Active pattern learning techniques

Definitions

  • This application relates to the field of intelligent decision-making, and in particular to an image classification method, device, server and medium based on deep learning.
  • each bank train a public classification model through deep learning to classify images.
  • the local databases of each bank store user data in the form of images (document images retained by users when handling business, images collected on site) , Business content images, return receipt images, etc.).
  • the image classification method based on deep learning provided in this application is applied to a first server, and the first server is in communication connection with multiple second servers, and the method includes:
  • Construct a first classification model use the first sample to train the first classification model, determine the first parameter of the first classification model, obtain the adjusted first classification model, and compare the first Input the adjusted first classification model to obtain the first feature data;
  • the structure of the first classification model is compressed to obtain a second classification model, the first feature data and the second classification model are sent to each of the second servers, and each of the second servers is received based on the The first feature data and the second parameter obtained by training the second classification model with the second sample, and the third parameter of the adjusted first classification model is determined based on the first parameter and the second parameter , Obtain an updated first classification model, and train the updated first classification model by using the first sample to obtain a target classification model;
  • Analyze the image classification request sent by the user based on the client obtain the image to be classified in the image classification request, and input the image to be classified into the target classification model to obtain an image classification result.
  • the present application also provides an image classification method based on deep learning, which is applied to a second server, and the second server is in communication connection with the first server, and the method includes:
  • first feature data includes a second feature map and a first correlation coefficient matrix
  • the feature extraction area of the second classification model is divided to obtain multiple second network sets and multiple second combination pairs corresponding to each of the second network sets Calculate the second correlation coefficient value of each channel of the two-layer network in each second combination pair based on the third characteristic map to obtain a second correlation coefficient matrix corresponding to each second combination pair, based on the The first correlation coefficient matrix and the second correlation coefficient matrix to solve the correlation coefficient loss value;
  • the second parameter of the second classification model is determined by minimizing the similarity loss value, the error loss value, and the correlation coefficient loss value to obtain the trained second classification model, and the second parameter Sent to the first server.
  • This application also provides an image classification device, which includes:
  • An obtaining module configured to obtain public image data of each of the second servers, using the public image data as a first sample, and using the private image data of each of the second servers as a second sample;
  • the construction module is used to construct a first classification model, use the first sample to train the first classification model, determine the first parameter of the first classification model, and obtain the adjusted first classification model, and Inputting the first sample into the adjusted first classification model to obtain first feature data;
  • the training module is used to compress the structure of the first classification model to obtain a second classification model, send the first feature data and the second classification model to each of the second servers, and receive each of the The second server trains the second parameter obtained by training the second classification model based on the first feature data and the second sample, and determines the adjusted first classification based on the first parameter and the second parameter
  • the third parameter of the model obtains an updated first classification model, and trains the updated first classification model by using the first sample to obtain a target classification model;
  • the classification module is used to analyze the image classification request sent by the user based on the client, obtain the image to be classified in the image classification request, and input the image to be classified into the target classification model to obtain the image classification result.
  • This application also provides a first server, and the first server includes:
  • At least one processor and,
  • a memory communicatively connected with the at least one processor; wherein,
  • the memory stores an image classification program executable by the at least one processor, and when the image classification program is executed by the at least one processor, the following steps are implemented:
  • Construct a first classification model use the first sample to train the first classification model, determine the first parameter of the first classification model, obtain the adjusted first classification model, and compare the first Input the adjusted first classification model to obtain the first feature data;
  • the structure of the first classification model is compressed to obtain a second classification model, the first feature data and the second classification model are sent to each of the second servers, and each of the second servers is received based on the The first feature data and the second parameter obtained by training the second classification model with the second sample, and the third parameter of the adjusted first classification model is determined based on the first parameter and the second parameter , Obtain an updated first classification model, and train the updated first classification model by using the first sample to obtain a target classification model;
  • Analyze the image classification request sent by the user based on the client obtain the image to be classified in the image classification request, and input the image to be classified into the target classification model to obtain an image classification result.
  • the present application also provides a second server, the second server is in communication connection with the first server, and the second server includes:
  • At least one processor and,
  • a memory communicatively connected with the at least one processor; wherein,
  • the memory stores an image classification program executable by the at least one processor, and the image classification program is executed by the at least one processor, so that the at least one processor can execute the following steps:
  • first feature data includes a second feature map and a first correlation coefficient matrix
  • the feature extraction area of the second classification model is divided to obtain multiple second network sets and multiple second combination pairs corresponding to each of the second network sets Calculate the second correlation coefficient value of each channel of the two-layer network in each second combination pair based on the third characteristic map to obtain a second correlation coefficient matrix corresponding to each second combination pair, based on the The first correlation coefficient matrix and the second correlation coefficient matrix to solve the correlation coefficient loss value;
  • the second parameter of the second classification model is determined by minimizing the similarity loss value, the error loss value, and the correlation coefficient loss value to obtain the trained second classification model, and the second parameter Sent to the first server.
  • the present application also provides a computer-readable storage medium having an image classification program stored on the computer-readable storage medium, and when the image classification program is executed by one or more processors, the following steps are implemented:
  • Construct a first classification model use the first sample to train the first classification model, determine the first parameter of the first classification model, obtain the adjusted first classification model, and compare the first Input the adjusted first classification model to obtain the first feature data;
  • the structure of the first classification model is compressed to obtain a second classification model, the first feature data and the second classification model are sent to each of the second servers, and each of the second servers is received based on the The first feature data and the second parameter obtained by training the second classification model with the second sample, and the third parameter of the adjusted first classification model is determined based on the first parameter and the second parameter , Obtain an updated first classification model, and train the updated first classification model by using the first sample to obtain a target classification model;
  • Analyze the image classification request sent by the user based on the client obtain the image to be classified in the image classification request, and input the image to be classified into the target classification model to obtain an image classification result.
  • FIG. 1 is a schematic flowchart of an image classification method based on deep learning provided by an embodiment of this application;
  • FIG. 2 is a schematic flowchart of an image classification method based on deep learning provided by another embodiment of the application;
  • FIG. 3 is a schematic diagram of modules of an image classification device provided by an embodiment of the application.
  • FIG. 4 is a schematic diagram of modules of an image classification device provided by another embodiment of this application.
  • FIG. 5 is an image classification system including a first server and a second server provided by an embodiment of the application;
  • FIG. 6 is a schematic structural diagram of a first server provided by an embodiment of this application.
  • FIG. 7 is a schematic structural diagram of a second server provided by an embodiment of this application.
  • This application provides an image classification method based on deep learning.
  • FIG. 1 it is a schematic flowchart of an image classification method based on deep learning provided by an embodiment of this application.
  • the deep learning-based image classification method is applied to a first server, and the first server is in communication connection with multiple second servers, and the deep learning-based image classification method includes:
  • the first server corresponds to a large bank
  • the second server corresponds to a small bank.
  • the first server and each second server are jointly modeled and jointly trained to obtain a Public image classification model.
  • the obtaining public image data of each of the second servers includes:
  • A1. Receive the hash value set of each image identifier stored locally and sent by each of the second servers;
  • A3. Receive the public image data ciphertext encrypted with the private key in the RSA key pair, which is fed back by each of the second servers based on the hash value of the public image identifier, and decrypt it with the public key in the RSA key pair
  • the data ciphertext obtains the public image data.
  • the image identification corresponds to a user ID, and the image data generated by each user when handling a business is marked with a user ID.
  • the user ID may be the user's mobile phone number or the user's ID number.
  • the image identification is re-encoded by hashing each image identification, which increases the security of the image identification.
  • x ij is the key value of the j-th image identifier in the i-th second server
  • a and b are constants
  • y ij is the hash value of the j-th image identifier in the i-th second server.
  • Each second server encrypts the public image data and transmits it to the first server, ensuring transmission security.
  • the first classification model is a heavyweight deep neural network model, which includes a feature extraction area and an image classification area.
  • the feature extraction area includes a multi-layer network, and each layer of the network includes multiple channels.
  • the second classification model is a lightweight deep neural network model.
  • the compressing the structure of the first classification model to obtain the second classification model includes: compressing the number of channels of each layer of the network in the first classification model according to the number of second servers to obtain the second classification model.
  • the number of channels in each layer of the network in the second classification model is C n :
  • C t is the number of channels in each layer of the network in the first classification model
  • n is the number of second servers.
  • the inputting the first sample into the adjusted first classification model to obtain first feature data includes:
  • this embodiment performs dimensionality reduction processing on the first feature map to obtain the second feature map.
  • a 1*1 convolution kernel is used to perform a convolution operation on the first feature map to achieve the reduction of the first feature map. dimension.
  • the set of networks outputting feature maps of the same size in the feature extraction area of the adjusted first classification model is used as the first network set, and the networks in the first network set are combined in pairs to obtain For multiple first combination pairs, calculate the first correlation coefficient values of each channel of the two-layer network in each first combination pair based on the first feature map to obtain the first correlation corresponding to each first combination pair Coefficient matrix
  • the network layer serves as a network set, and every two layers of the network in the network set form a combined pair.
  • F ij1 (x, y, a) is the first feature map corresponding to the xth row and yth column in the jth first combination pair in the i-th first network set of the first classification model
  • the feature value of the a-th channel of the pixel, F ij2 (x, y, a) is the first corresponding to the second network layer in the j-th first combination pair in the i-th first network set of the first classification model b th channel characteristic value of the first pixel column y x row in FIG feature
  • r (F ij1, F ij2 , a, b) is the i-th first network of a first classification model j-th first concentrated
  • the a-th channel of the pixel in the x-th row and the y-th column in the first feature map corresponding to the first network layer in the combined pair corresponds to the second network layer in the j-th first combined pair in the i-th first network set
  • the first correlation coefficient value corresponding to each channel of the two-layer network in each first combination pair is solved to obtain the first correlation coefficient matrix corresponding to each first combination pair.
  • the calculation formula of the third parameter is:
  • Z is the third parameter
  • Q is the first parameter
  • a is the weight parameter corresponding to the second classification model
  • W 1*1 is the 1*1 convolution operation
  • R i is the first parameter corresponding to the i-th second server.
  • Two parameters, n is the number of second servers.
  • the training of the updated first classification model based on the first sample to obtain the target classification model includes:
  • the target parameter of the first classification model is determined by minimizing the loss value between the predicted class and the real class of the first sample, so as to obtain the target classification model.
  • q mn is the predicted category of the m-th sub-sample in the first sample
  • p mn is the true category of the m-th sub-sample in the first sample
  • loss(q mn ,p mn ) is the m-th sub-sample in the first sample
  • the loss value between the predicted category and the true category of the sub-samples, c is the total number of sub-samples in the first sample.
  • the method for image classification based on deep learning first constructs a first classification model, trains the first classification model with the first sample to obtain the adjusted first classification model, and divides the first sample Input the adjusted first classification model to obtain the first feature data, and send the first feature data and the second classification model obtained by compressing the first classification model to each second server.
  • This step is the first server and the second server Separately constructed classification models with different structures, so that their respective computing power can be fully utilized, which can make subsequent training more efficient; then, receive the second classification model obtained by each second server based on the first feature data and the second sample training
  • the second parameter is to determine the third parameter of the adjusted first classification model based on the first parameter and the second parameter to obtain the updated first classification model.
  • each second server uses its local data training model to obtain its own
  • the second parameter is fed back to the first server, and the first server updates the first classification model according to each second parameter. Because the data involved in training is more abundant, the classification accuracy of the updated first classification model obtained is higher; and finally; , Use the first sample to train the updated first classification model to obtain the target classification model. Therefore, the present application improves the efficiency of model training and the accuracy of image classification.
  • FIG. 2 it is a schematic flowchart of an image classification method based on deep learning provided by another embodiment of this application.
  • an image classification method based on deep learning is applied to a second server, and the second server is in communication connection with the first server, and the method includes:
  • t k (x, y) is the feature value of the pixel in the x-th row and y-th column of the third feature map corresponding to the k-th layer of the second classification model
  • s k (x, y) is the adjusted first
  • 2 is the solution of the L2 norm, and L sim is the similarity between the second feature map and the third feature map Degree loss value.
  • P i is the second sample of the i-th category real samples
  • Q i is the predicted category i-th sample of the second sample
  • m is the number of samples of the second sample of neutrons
  • G ij is the second correlation coefficient matrix corresponding to the j-th second combination pair in the i-th second network set of the second classification model
  • T ij is the j-th one in the i-th first network set of the first classification model
  • the first correlation coefficient matrix corresponding to the first combination pair, m is the number of the first or second combination pair, n is the number of the first or second network, ⁇ j is the j-th first or second network set corresponding
  • the weight parameter, L FSP is the loss value of the correlation coefficient.
  • the number of network layers of the first classification model and the second classification model are the same, only the number of channels is different, and this embodiment only groups the network layers, so the number of the first network set and the number of the second network set obtained after grouping Similarly, the number of combination pairs corresponding to each network set is also the same.
  • FIG. 3 it is a schematic diagram of modules of an image classification device provided by an embodiment of this application.
  • the image classification device 100 described in this application is installed in the first server. According to the implemented functions, the image classification device 100 may include an acquisition module 110, a construction module 120, a training module 130, and a classification module 140.
  • the module described in this application can also be called a unit, which refers to a series of computer program segments that can be executed by the processor of the first server and can complete fixed functions, and are stored in the memory of the first server.
  • each module/unit is as follows:
  • the obtaining module 110 is configured to obtain public image data of each of the second servers, use the public image data as a first sample, and use the private image data of each second server as a second sample.
  • the first server corresponds to a large bank
  • the second server corresponds to a small bank.
  • the first server and each second server are jointly modeled and jointly trained to obtain a Public image classification model.
  • the obtaining public image data of each of the second servers includes:
  • A1. Receive the hash value set of each image identifier stored locally and sent by each of the second servers;
  • A3. Receive the public image data ciphertext that is encrypted by the private key in the RSA key pair and decrypted by the public key in the RSA key pair, fed back by each of the second servers based on the hash value of the public image identifier The data ciphertext obtains the public image data.
  • the image identification corresponds to a user ID, and the image data generated by each user when handling a business is marked with a user ID.
  • the user ID may be the user's mobile phone number or the user's ID number.
  • the image identification is re-encoded by hashing each image identification, which increases the security of the image identification.
  • x ij is the key value of the j-th image identifier in the i-th second server
  • a and b are constants
  • y ij is the hash value of the j-th image identifier in the i-th second server.
  • Each second server encrypts the public image data and transmits it to the first server, ensuring transmission security.
  • the construction module 120 is configured to construct a first classification model, use the first sample to train the first classification model, determine the first parameters of the first classification model, and obtain the adjusted first classification model, Inputting the first sample into the adjusted first classification model to obtain first feature data;
  • the training module 130 is configured to compress the structure of the first classification model to obtain a second classification model, send the first feature data and the second classification model to each of the second servers, and receive The second server trains the second classification model to obtain second parameters based on the first feature data and the second samples, and determines the adjusted first parameters based on the first parameters and the second parameters.
  • the third parameter of the classification model obtains the updated first classification model, and the first sample is used to train the updated first classification model to obtain the target classification model.
  • the first classification model is a heavyweight deep neural network model, which includes a feature extraction area and an image classification area.
  • the feature extraction area includes a multi-layer network, and each layer of the network includes multiple channels.
  • the second classification model is a lightweight deep neural network model.
  • the compressing the structure of the first classification model to obtain the second classification model includes: compressing the number of channels of each layer of the network in the first classification model according to the number of second servers to obtain the second classification model.
  • the number of channels in each layer of the network in the second classification model is C n :
  • C t is the number of channels in each layer of the network in the first classification model
  • n is the number of second servers.
  • the inputting the first sample into the adjusted first classification model to obtain first feature data includes:
  • this embodiment performs dimensionality reduction processing on the first feature map to obtain the second feature map. dimension.
  • the set of networks outputting feature maps of the same size in the feature extraction area of the adjusted first classification model is used as the first network set, and the networks in the first network set are combined in pairs to obtain For multiple first combination pairs, calculate the first correlation coefficient values of each channel of the two-layer network in each first combination pair based on the first feature map to obtain the first correlation corresponding to each first combination pair Coefficient matrix
  • the network layer serves as a network set, and every two layers of the network in the network set form a combined pair.
  • F ij1 (x, y, a) is the first feature map corresponding to the xth row and yth column in the jth first combination pair in the i-th first network set of the first classification model
  • the feature value of the a-th channel of the pixel, F ij2 (x, y, a) is the first corresponding to the second network layer in the j-th first combination pair in the i-th first network set of the first classification model b th channel characteristic value of the first pixel column y x row in FIG feature
  • r (F ij1, F ij2 , a, b) is the i-th first network of a first classification model j-th first concentrated
  • the a-th channel of the pixel in the x-th row and the y-th column in the first feature map corresponding to the first network layer in the combined pair corresponds to the second network layer in the j-th first combined pair in the i-th first network set
  • the first correlation coefficient value corresponding to each channel of the two-layer network in each first combination pair is solved to obtain the first correlation coefficient matrix corresponding to each first combination pair.
  • the calculation formula of the third parameter is:
  • Z is the third parameter
  • Q is the first parameter
  • a is the weight parameter corresponding to the second classification model
  • W 1*1 is the 1*1 convolution operation
  • R i is the first parameter corresponding to the i-th second server.
  • Two parameters, n is the number of second servers.
  • the training of the updated first classification model based on the first sample to obtain the target classification model includes:
  • the target parameter of the first classification model is determined by minimizing the loss value between the predicted class and the real class of the first sample, so as to obtain the target classification model.
  • q mn is the predicted category of the m-th sub-sample in the first sample
  • p mn is the true category of the m-th sub-sample in the first sample
  • loss(q mn ,p mn ) is the m-th sub-sample in the first sample
  • the loss value between the predicted category and the true category of the sub-samples, c is the total number of sub-samples in the first sample.
  • the classification module 140 is configured to analyze the image classification request sent by the user based on the client, obtain the image to be classified in the image classification request, and input the image to be classified into the target classification model to obtain an image classification result.
  • FIG. 4 it is a schematic diagram of modules of an image classification device provided by another embodiment of this application.
  • the image classification device 200 described in this application is installed in the second server. According to the implemented functions, the image classification device 200 may include a receiving module 210, a first solving module 220, a second solving module 230, a third solving module 240, and a determining module 250.
  • the module described in this application can also be called a unit, which refers to a series of computer program segments that can be executed by the processor of the first server and can complete fixed functions, and are stored in the memory of the first server.
  • each module/unit is as follows:
  • the receiving module 210 is configured to receive first feature data and a second classification model, where the first feature data includes a second feature map and a first correlation coefficient matrix;
  • the first solving module 220 is configured to input a second sample into the feature extraction area of the second classification model to obtain a third feature map, and solve the similarity loss value between the second feature map and the third feature map;
  • t k (x, y) is the feature value of the pixel in the x-th row and y-th column of the third feature map corresponding to the k-th layer of the second classification model
  • s k (x, y) is the adjusted first
  • 2 is the solution of the L2 norm, and L sim is the similarity between the second feature map and the third feature map Degree loss value.
  • the second solving module 230 is configured to input the third feature map into the image classification area of the second classification model to obtain the predicted category of the second sample, and obtain the second sample based on the label information of the second sample.
  • the true category of the sample, and the error loss value between the predicted category and the true category is solved;
  • P i is the second sample of the i-th category real samples
  • Q i is the predicted category i-th sample of the second sample
  • m is the number of samples of the second sample of neutrons
  • the third solving module 240 is configured to divide the feature extraction area of the second classification model according to the grouping mode of the first network set and the first combination pair to obtain a plurality of second network sets and each of the second network sets Corresponding multiple second combination pairs, calculate the second correlation coefficient values of each channel of the two-layer network in each second combination pair based on the third characteristic map, and obtain the first correlation coefficient value corresponding to each second combination pair Two correlation coefficient matrices, based on the first correlation coefficient matrix and the second correlation coefficient matrix to find the correlation coefficient loss value;
  • G ij is the second correlation coefficient matrix corresponding to the j-th second combination pair in the i-th second network set of the second classification model
  • T ij is the j-th one in the i-th first network set of the first classification model
  • the first correlation coefficient matrix corresponding to the first combination pair, m is the number of the first or second combination pair, n is the number of the first or second network, ⁇ j is the j-th first or second network set corresponding
  • the weight parameter, L FSP is the loss value of the correlation coefficient.
  • the number of network layers of the first classification model and the second classification model are the same, only the number of channels is different, and this embodiment only groups the network layers, so the number of the first network set and the number of the second network set obtained after grouping Similarly, the number of combination pairs corresponding to each network set is also the same.
  • the determining module 250 is configured to determine the second parameter of the second classification model by minimizing the similarity loss value, the error loss value, and the correlation coefficient loss value to obtain the second classification model after training, and Sending the second parameter to the first server.
  • an image classification system including a first server and a second server provided by an embodiment of this application.
  • the first server 1 is in communication connection with multiple second servers 2.
  • the first server 1 and the second server 2 can be computing devices such as rack servers, blade servers, tower servers, or cabinet servers.
  • the first server 1 and the second server 2 can be independent servers or multiple servers.
  • a server cluster composed of two servers.
  • the first server 1 is used to:
  • Construct a first classification model use the first sample to train the first classification model, determine the first parameter of the first classification model, obtain the adjusted first classification model, and compare the first Input the adjusted first classification model to obtain the first feature data;
  • Compress the structure of the first classification model to obtain a second classification model send the first feature data and the second classification model to each of the second servers 2, and receive each of the second servers 2
  • the second parameter obtained by training the second classification model based on the first feature data and the second sample, and the first parameter of the adjusted first classification model is determined based on the first parameter and the second parameter
  • Three parameters are used to obtain an updated first classification model, and the updated first classification model is trained using the first sample to obtain a target classification model;
  • Analyze the image classification request sent by the user based on the client obtain the image to be classified in the image classification request, and input the image to be classified into the target classification model to obtain an image classification result.
  • the second server 2 is used for:
  • first feature data includes a second feature map and a first correlation coefficient matrix
  • the feature extraction area of the second classification model is divided to obtain multiple second network sets and multiple second combination pairs corresponding to each of the second network sets Calculate the second correlation coefficient value of each channel of the two-layer network in each second combination pair based on the third characteristic map to obtain a second correlation coefficient matrix corresponding to each second combination pair, based on the The first correlation coefficient matrix and the second correlation coefficient matrix to solve the correlation coefficient loss value;
  • the second parameter of the second classification model is determined by minimizing the similarity loss value, the error loss value, and the correlation coefficient loss value to obtain the trained second classification model, and the second parameter Sent to the first server 1.
  • FIG. 6 it is a schematic structural diagram of a first server 1 for implementing a deep learning-based image classification method provided by an embodiment of this application.
  • the first server 1 includes, but is not limited to, a memory 11, a processor 12, and a network interface 13 that can be communicably connected to each other through a system bus.
  • the memory 11 stores an image classification program 10, and the image classification The program 10 can be executed by the processor 12.
  • FIG. 6 only shows the first server 1 with components 11-13 and the image classification program 10. Those skilled in the art can understand that the structure shown in FIG. 6 does not constitute a limitation on the first server 1, and may include Fewer or more parts than shown, or some parts in combination, or different parts arrangement.
  • the memory 11 includes a memory and at least one type of readable storage medium.
  • the memory provides a cache for the operation of the first server 1;
  • the readable storage medium can be, for example, flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory ( Non-volatile storage media such as SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disks, and optical disks.
  • the readable storage medium may be an internal storage unit of the first server 1, for example, the hard disk of the first server 1.
  • the non-volatile storage medium may also be the first server 1.
  • the external storage device of 1 such as the plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, Flash Card (Flash Card), etc., equipped on the first server 1.
  • the readable storage medium of the memory 11 is generally used to store the operating system and various application software installed in the first server 1, for example, to store the code of the image classification program 10 in an embodiment of the present application.
  • the memory 11 can also be used to temporarily store various types of data that have been output or will be output.
  • the processor 12 may be a central processing unit (Central Processing Unit, CPU), a controller, a microcontroller, a microprocessor, or other data processing chips.
  • the processor 12 is generally used to control the overall operation of the first server 1, such as performing data interaction or communication-related control and processing with other devices.
  • the processor 12 is used to run the program code or process data stored in the memory 11, for example, to run the image classification program 10 and so on.
  • the network interface 13 may include a wireless network interface or a wired network interface, and the network interface 13 is used to establish a communication connection between the first server 1 and a client (not shown in the figure).
  • the first server 1 may further include a user interface.
  • the user interface may include a display (Display) and an input unit such as a keyboard (Keyboard).
  • the optional user interface may also include a standard wired interface and a wireless interface.
  • the display may be an LED display, a liquid crystal display, a touch liquid crystal display, an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, etc.
  • the display can also be called a display screen or a display unit as appropriate, and is used to display the information processed in the first server 1 and to display a visualized user interface.
  • the image classification program 10 stored in the memory 11 in the first server 1 is a combination of multiple instructions, and when running in the processor 12, it can realize:
  • Construct a first classification model use the first sample to train the first classification model, determine the first parameter of the first classification model, obtain the adjusted first classification model, and compare the first Input the adjusted first classification model to obtain the first feature data;
  • Compress the structure of the first classification model to obtain a second classification model send the first feature data and the second classification model to each of the second servers 2, and receive each of the second servers 2
  • the second parameter obtained by training the second classification model based on the first feature data and the second sample, and the first parameter of the adjusted first classification model is determined based on the first parameter and the second parameter
  • Three parameters are used to obtain an updated first classification model, and the updated first classification model is trained using the first sample to obtain a target classification model;
  • Analyze the image classification request sent by the user based on the client obtain the image to be classified in the image classification request, and input the image to be classified into the target classification model to obtain an image classification result.
  • the image to be classified may also be stored in a node of a blockchain.
  • FIG. 7 it is a schematic structural diagram of the second server 2 for implementing a deep learning-based image classification method provided by an embodiment of this application.
  • the second server 2 includes, but is not limited to, a memory 21, a processor 22, and a network interface 23 that can be communicably connected to each other through a system bus.
  • the memory 21 stores an image classification program 20, and the image classification The program 20 can be executed by the processor 22.
  • the image classification program 20 stored in the memory 21 in the second server 2 is a combination of multiple instructions, and when running in the processor 22, it can realize:
  • first feature data includes a second feature map and a first correlation coefficient matrix
  • the feature extraction area of the second classification model is divided to obtain multiple second network sets and multiple second combination pairs corresponding to each of the second network sets Calculate the second correlation coefficient value of each channel of the two-layer network in each second combination pair based on the third characteristic map to obtain a second correlation coefficient matrix corresponding to each second combination pair, based on the The first correlation coefficient matrix and the second correlation coefficient matrix to solve the correlation coefficient loss value;
  • the second parameter of the second classification model is determined by minimizing the similarity loss value, the error loss value, and the correlation coefficient loss value to obtain the trained second classification model, and the second parameter Sent to the first server 1.
  • the integrated modules/units of the first server 1 and/or the second server 2 are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer readable storage medium .
  • the computer-readable medium may be non-volatile or non-volatile.
  • the computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory) .
  • An image classification program 10 is stored on the computer-readable storage medium, and the image classification program 10 can be executed by one or more processors.
  • the learned image classification method is basically the same in each embodiment.
  • the computer-readable storage medium may also store an image classification program 20, and the image classification program 20 may be executed by one or more processors.
  • image classification program 20 may be executed by one or more processors.
  • modules described as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • the functional modules in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated unit may be implemented in the form of hardware, or may be implemented in the form of hardware plus software functional modules.
  • the blockchain referred to in this application is a new application mode of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm.
  • Blockchain essentially a decentralized database, is a series of data blocks associated with cryptographic methods. Each data block contains a batch of network transaction information for verification. The validity of the information (anti-counterfeiting) and the generation of the next block.
  • the blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.

Landscapes

  • Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Artificial Intelligence (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Image Analysis (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种基于深度学习的图像分类方法,涉及智能决策,包括:构建第一分类模型,训练第一分类模型得到调整后的第一分类模型,将第一样本输入调整后的第一分类模型得到第一特征数据(S2);对第一分类模型的结构进行压缩处理得到第二分类模型,将第一特征数据及第二分类模型发送给各个第二服务器(2),接收各个第二服务器(2)反馈的第二参数,基于第二参数得到更新后的第一分类模型,训练更新后的第一分类模型得到目标分类模型;将待分类图像输入目标分类模型得到图像分类结果。还提供一种图像分类装置、服务器及介质。提高了模型训练效率、提升了图像分类准确度。

Description

基于深度学习的图像分类方法、装置、服务器及介质
本申请要求于2020年10月14日提交中国专利局、申请号为CN202011099982.6、名称为“基于深度学习的图像分类方法、装置、服务器及介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及智能决策领域,尤其涉及一种基于深度学习的图像分类方法、装置、服务器及介质。
背景技术
随着人工智能的发展,深度学习的应用愈加广泛。例如,某大型银行联合多家小型银行通过深度学习训练一个公用分类模型以实现对图像分类,各家银行本地数据库以图像形式存储了用户数据(用户办理业务时留存的证件图像、现场采集的图像、业务内容图像、回执图像等)。
发明人意识到,深度学习时,由于每个小型银行对应的模型都比较庞大,从而对小型银行的算力要求较高,而大型银行潜在的算力又得不到充分的利用,从而使得模型训练效率低、训练得到的模型参数不准确,导致公有分类模型的图像分类准确度不高。因此,亟需一种基于深度学习的图像分类方法,以提高模型训练效率、提升图像分类准确度。
发明内容
本申请提供的基于深度学习的图像分类方法,应用于第一服务器,所述第一服务器与多个第二服务器通信连接,所述方法包括:
获取各个所述第二服务器的公用图像数据,将所述公用图像数据作为第一样本,将各个所述第二服务器的私有图像数据作为第二样本;
构建第一分类模型,利用所述第一样本对所述第一分类模型进行训练,确定所述第一分类模型的第一参数,得到调整后的第一分类模型,将所述第一样本输入所述调整后的第一分类模型得到第一特征数据;
对所述第一分类模型的结构进行压缩处理得到第二分类模型,将所述第一特征数据及所述第二分类模型发送给各个所述第二服务器,接收各个所述第二服务器基于所述第一特征数据及所述第二样本训练所述第二分类模型得到的第二参数,基于所述第一参数及所述第二参数确定所述调整后的第一分类模型的第三参数,得到更新后的第一分类模型,利用所述第一样本训练所述更新后的第一分类模型得到目标分类模型;
解析用户基于客户端发出的图像分类请求,获取所述图像分类请求携带的待分类图像,将所述待分类图像输入所述目标分类模型得到图像分类结果。
本申请还提供一种基于深度学习的图像分类方法,应用于第二服务器,所述第二服务器与第一服务器通信连接,所述方法包括:
接收第一特征数据及第二分类模型,所述第一特征数据包括第二特征图及第一相关系数矩阵;
将第二样本输入所述第二分类模型的特征提取区得到第三特征图,求解所述第二特征图与所述第三特征图的相似度损失值;
将所述第三特征图输入所述第二分类模型的图像分类区得到所述第二样本的预测类别,基于所述第二样本的标注信息获取所述第二样本的真实类别,求解所述预测类别与真实类别的误差损失值;
依照第一网络集及第一组合对的分组方式,对所述第二分类模型的特征提取区进行划分得到多个第二网络集及各个所述第二网络集对应的多个第二组合对,基于所述第三特征 图计算每个所述第二组合对中两层网络的各个通道的第二相关系数值,得到各个所述第二组合对对应的第二相关系数矩阵,基于所述第一相关系数矩阵及所述第二相关系数矩阵求解相关系数损失值;
通过最小化所述相似度损失值、所述误差损失值及所述相关系数损失值确定所述第二分类模型的第二参数,得到训练后的第二分类模型,并将所述第二参数发送给所述第一服务器。
本申请还提供一种图像分类装置,所述装置包括:
获取模块,用于获取各个所述第二服务器的公用图像数据,将所述公用图像数据作为第一样本,将各个所述第二服务器的私有图像数据作为第二样本;
构建模块,用于构建第一分类模型,利用所述第一样本对所述第一分类模型进行训练,确定所述第一分类模型的第一参数,得到调整后的第一分类模型,将所述第一样本输入所述调整后的第一分类模型得到第一特征数据;
训练模块,用于对所述第一分类模型的结构进行压缩处理得到第二分类模型,将所述第一特征数据及所述第二分类模型发送给各个所述第二服务器,接收各个所述第二服务器基于所述第一特征数据及所述第二样本训练所述第二分类模型得到的第二参数,基于所述第一参数及所述第二参数确定所述调整后的第一分类模型的第三参数,得到更新后的第一分类模型,利用所述第一样本训练所述更新后的第一分类模型得到目标分类模型;
分类模块,用于解析用户基于客户端发出的图像分类请求,获取所述图像分类请求携带的待分类图像,将所述待分类图像输入所述目标分类模型得到图像分类结果。
本申请还提供一种第一服务器,所述第一服务器包括:
至少一个处理器;以及,
与所述至少一个处理器通信连接的存储器;其中,
所述存储器存储有可被所述至少一个处理器执行的图像分类程序,所述图像分类程序被所述至少一个处理器执行时实现如下步骤:
获取各个所述第二服务器的公用图像数据,将所述公用图像数据作为第一样本,将各个所述第二服务器的私有图像数据作为第二样本;
构建第一分类模型,利用所述第一样本对所述第一分类模型进行训练,确定所述第一分类模型的第一参数,得到调整后的第一分类模型,将所述第一样本输入所述调整后的第一分类模型得到第一特征数据;
对所述第一分类模型的结构进行压缩处理得到第二分类模型,将所述第一特征数据及所述第二分类模型发送给各个所述第二服务器,接收各个所述第二服务器基于所述第一特征数据及所述第二样本训练所述第二分类模型得到的第二参数,基于所述第一参数及所述第二参数确定所述调整后的第一分类模型的第三参数,得到更新后的第一分类模型,利用所述第一样本训练所述更新后的第一分类模型得到目标分类模型;
解析用户基于客户端发出的图像分类请求,获取所述图像分类请求携带的待分类图像,将所述待分类图像输入所述目标分类模型得到图像分类结果。
本申请还提供一种第二服务器,所述第二服务器与第一服务器通信连接,所述第二服务器包括:
至少一个处理器;以及,
与所述至少一个处理器通信连接的存储器;其中,
所述存储器存储有可被所述至少一个处理器执行的图像分类程序,所述图像分类程序被所述至少一个处理器执行,以使所述至少一个处理器能够执行如下步骤:
接收第一特征数据及第二分类模型,所述第一特征数据包括第二特征图及第一相关系数矩阵;
将第二样本输入所述第二分类模型的特征提取区得到第三特征图,求解所述第二特征 图与所述第三特征图的相似度损失值;
将所述第三特征图输入所述第二分类模型的图像分类区得到所述第二样本的预测类别,基于所述第二样本的标注信息获取所述第二样本的真实类别,求解所述预测类别与真实类别的误差损失值;
依照第一网络集及第一组合对的分组方式,对所述第二分类模型的特征提取区进行划分得到多个第二网络集及各个所述第二网络集对应的多个第二组合对,基于所述第三特征图计算每个所述第二组合对中两层网络的各个通道的第二相关系数值,得到各个所述第二组合对对应的第二相关系数矩阵,基于所述第一相关系数矩阵及所述第二相关系数矩阵求解相关系数损失值;
通过最小化所述相似度损失值、所述误差损失值及所述相关系数损失值确定所述第二分类模型的第二参数,得到训练后的第二分类模型,并将所述第二参数发送给所述第一服务器。
本申请还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有图像分类程序,所述图像分类程序被一个或者多个处理器执行时实现如下步骤:
获取各个所述第二服务器的公用图像数据,将所述公用图像数据作为第一样本,将各个所述第二服务器的私有图像数据作为第二样本;
构建第一分类模型,利用所述第一样本对所述第一分类模型进行训练,确定所述第一分类模型的第一参数,得到调整后的第一分类模型,将所述第一样本输入所述调整后的第一分类模型得到第一特征数据;
对所述第一分类模型的结构进行压缩处理得到第二分类模型,将所述第一特征数据及所述第二分类模型发送给各个所述第二服务器,接收各个所述第二服务器基于所述第一特征数据及所述第二样本训练所述第二分类模型得到的第二参数,基于所述第一参数及所述第二参数确定所述调整后的第一分类模型的第三参数,得到更新后的第一分类模型,利用所述第一样本训练所述更新后的第一分类模型得到目标分类模型;
解析用户基于客户端发出的图像分类请求,获取所述图像分类请求携带的待分类图像,将所述待分类图像输入所述目标分类模型得到图像分类结果。
附图说明
图1为本申请一实施例提供的基于深度学习的图像分类方法的流程示意图;
图2为本申请另一实施例提供的基于深度学习的图像分类方法的流程示意图;
图3为本申请一实施例提供的图像分类装置的模块示意图;
图4为本申请另一实施例提供的图像分类装置的模块示意图;
图5为本申请一实施例提供的包括第一服务器和第二服务器的图像分类***;
图6为本申请一实施例提供的第一服务器的结构示意图;
图7为本申请一实施例提供的第二服务器的结构示意图;
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
具体实施方式
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
需要说明的是,在本申请中涉及“第一”、“第二”等的描述仅用于描述目的,而不能理解为指示或暗示其相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括至少一个该特征。另外,各个实施例之间的技术方案可以相互结合,但是必须是以本领域普通技术人员能够实现为基础,当技术方案的结合 出现相互矛盾或无法实现时应当认为这种技术方案的结合不存在,也不在本申请要求的保护范围之内。
本申请提供一种基于深度学习的图像分类方法。参照图1所示,为本申请一实施例提供的基于深度学习的图像分类方法的流程示意图。
本实施例中,基于深度学习的图像分类方法,应用于第一服务器,所述第一服务器与多个第二服务器通信连接,所述基于深度学习的图像分类方法包括:
S1、获取各个所述第二服务器的公用图像数据,将所述公用图像数据作为第一样本,将各个所述第二服务器的私有图像数据作为第二样本。
本实施例中,第一服务器对应大型银行,第二服务器对应小型银行,为实现对用户办理业务时所产生的图像数据进行分类,第一服务器与各个第二服务器联合建模,共同训练得到一个公有图像分类模型。
所述获取各个所述第二服务器的公有图像数据,包括:
A1、接收各个所述第二服务器发送的其本地存储的各个图像标识的哈希值集合;
A2、求解所述哈希值集合的交集,得到公有图像标识的哈希值,将所述公用图像标识的哈希值发送给各个所述第二服务器;
A3、接收各个所述第二服务器基于所述公有图像标识的哈希值反馈的采用RSA密钥对中的私钥加密的公有图像数据密文,采用所述RSA密钥对中的公钥解密所述数据密文得到所述公有图像数据。
本实施例中,所述图像标识对应用户ID,每个用户在办理业务时所产生的图像数据标注有用户ID,所述用户ID可以是用户的手机号码,也可以是用户的身份证号码。确定公有图像数据时,通过对各个图像标识进行哈希运算实现了对图像标识的重新编码,增加了图像标识的安全性。
所述哈希函数的计算公式为:
y ij=ax ij+b
其中,x ij为第i个第二服务器中第j个图像标识的key值,a、b为常数,y ij为第i个第二服务器中第j个图像标识的哈希值。
各个第二服务器将公有图像数据加密后传输给第一服务器,保证了传输安全性。
S2、构建第一分类模型,利用所述第一样本对所述第一分类模型进行训练,确定所述第一分类模型的第一参数,得到调整后的第一分类模型,将所述第一样本输入所述调整后的第一分类模型得到第一特征数据;
S3、对所述第一分类模型的结构进行压缩处理得到第二分类模型,将所述第一特征数据及所述第二分类模型发送给各个所述第二服务器,接收各个所述第二服务器基于所述第一特征数据及所述第二样本训练所述第二分类模型得到的第二参数,基于所述第一参数及所述第二参数确定所述调整后的第一分类模型的第三参数,得到更新后的第一分类模型,利用所述第一样本训练所述更新后的第一分类模型得到目标分类模型。
本实施例中,所述第一分类模型为重量级的深度神经网络模型,包括特征提取区和图像分类区,特征提取区包括多层网络,每层网络包括多个通道。所述第二分类模型为轻量级的深度神经网络模型。
所述对所述第一分类模型的结构进行压缩处理得到第二分类模型包括:按照第二服务器的数量对所述第一分类模型中每层网络的通道数进行压缩,得到第二分类模型。
第二分类模型中每层网络的通道数为C n
C n=C t/n
其中,C t为第一分类模型中每层网络的通道数,n为第二服务器的数量。
通过为第一服务器配置重量级的深度神经网络模型、对第二服务器配置轻量级的深度神经网络模型,充分考虑到了各个服务器的算力,使得后续的训练更为通畅,训练效率更高。
采用第一样本训练第一分类模型直到模型收敛得到调整后的第一分类模型。
本实施例中,所述将所述第一样本输入所述调整后的第一分类模型得到第一特征数据包括:
B1、将所述第一样本输入所述调整后的第一分类模型的所述特征提取区,得到第一特征图,对所述第一特征图进行降维处理得到第二特征图;
为降低通信开销,本实施例对第一特征图进行降维处理得到第二特征图,本实施例通过1*1的卷积核对第一特征图进行卷积操作实现对第一特征图的降维。
B2、将所述调整后的第一分类模型的所述特征提取区中输出同样尺寸特征图的网络的集合作为第一网络集,将所述第一网络集中的所述网络两两组合,得到多个第一组合对,基于所述第一特征图计算每个所述第一组合对中两层网络的各个通道的第一相关系数值,得到各个所述第一组合对对应的第一相关系数矩阵;
特征图经过卷积核计算后通常是越变越小的,有的网络层未进行卷积计算,这些网络层的输出和输入是同样大小的,本实施例中,将输出相同大小特征图的网络层作为一个网络集,所述网络集中的每两层网络形成一个组合对。
所述相关系数值的计算公式为:
Figure PCTCN2020131988-appb-000001
其中,F ij1(x,y,a)为第一分类模型的第i个第一网络集中第j个第一组合对中第1个网络层对应的第一特征图中第x行第y列像素点的第a个通道的特征值,F ij2(x,y,a)为第一分类模型的第i个第一网络集中第j个第一组合对中第2个网络层对应的第一特征图中第x行第y列像素点的第b个通道的特征值,r(F ij1,F ij2,a,b)为第一分类模型的第i个第一网络集中第j个第一组合对中第1个网络层对应的第一特征图中第x行第y列像素点的第a个通道与第i个第一网络集中第j个第一组合对中第2个网络层对应的第一特征图中第x行第y列像素点的第b个通道的第一相关系数值。
求解每个第一组合对中两层网络的各个通道对应的第一相关系数值,得到每个第一组合对对应的第一相关系数矩阵。
B3、将所述第二特征图及所述第一相关系数矩阵作为第一特征数据。
本实施例中,所述第三参数的计算公式为:
Figure PCTCN2020131988-appb-000002
其中,Z为第三参数,Q为第一参数,a为第二分类模型对应的权重参数,W 1*1为1*1的卷积操作,R i为第i个第二服务器对应的第二参数,n为第二服务器的数量。
本实施例中,所述基于所述第一样本训练所述更新后的第一分类模型得到目标分类模型,包括:
将所述第一样本输入所述更新后的第一分类模型,得到所述第一样本的预测类别,基于所述第一样本的标注信息获取所述第一样本的真实类别,通过最小化所述第一样本的预测类别与真实类别之间的损失值确定所述第一分类模型的目标参数,得到目标分类模型。
所述第一样本的预测类别与真实类别之间的损失值的计算公式为:
Figure PCTCN2020131988-appb-000003
其中,q mn为第一样本中第m个子样本的预测类别,p mn为第一样本中第m个子样本的真实类别,loss(q mn,p mn)为第一样本中第m个子样本的预测类别和真实类别之间的损失值,c为第一样本中子样本的总数量。
S4、解析用户基于客户端发出的图像分类请求,获取所述图像分类请求携带的待分类 图像,将所述待分类图像输入所述目标分类模型得到图像分类结果。
由上述实施例可知,本申请提出的基于深度学习的图像分类方法,首先,构建第一分类模型,利用第一样本训练第一分类模型得到调整后的第一分类模型,将第一样本输入调整后的第一分类模型得到第一特征数据,将第一特征数据和对第一分类模型压缩处理得到的第二分类模型发送给各个第二服务器,本步骤为第一服务器和第二服务器分别构建了结构不同的分类模型,使得各自的算力可以充分发挥,可使后续的训练效率更高;接着,接收各个第二服务器基于第一特征数据及第二样本训练第二分类模型得到的第二参数,基于第一参数及第二参数确定调整后的第一分类模型的第三参数,得到更新后的第一分类模型,本步骤中各个第二服务器利用其本地数据训练模型得到各自的第二参数并反馈给第一服务器,第一服务器根据各个第二参数更新第一分类模型,因参与训练的数据更为丰富,得到的更新后的第一分类模型的分类准确度更高;最后,利用第一样本训练更新后的第一分类模型得到目标分类模型。因此,本申请提高了模型训练效率、提升了图像分类准确度。
参照图2所示,为本申请另一实施例提供的基于深度学习的图像分类方法的流程示意图。
本实施例中,基于深度学习的图像分类方法,应用于第二服务器,所述第二服务器与第一服务器通信连接,所述方法包括:
S11、接收第一特征数据及第二分类模型,所述第一特征数据包括第二特征图及第一相关系数矩阵;
S12、将第二样本输入所述第二分类模型的特征提取区得到第三特征图,求解所述第二特征图与所述第三特征图的相似度损失值;
所述相似度损失值的计算公式为:
Figure PCTCN2020131988-appb-000004
其中,t k(x,y)为第二分类模型的第k层网络对应的第三特征图第x行第y列像素点的特征值,s k(x,y)为调整后的第一分类模型的第k层网络对应的第二特征图第x行第y列像素点的特征值,|||| 2为求解L2范数,L sim为第二特征图与第三特征图的相似度损失值。
S13、将所述第三特征图输入所述第二分类模型的图像分类区得到所述第二样本的预测类别,基于所述第二样本的标注信息获取所述第二样本的真实类别,求解所述预测类别与真实类别的误差损失值;
Figure PCTCN2020131988-appb-000005
其中,P i为第二样本中第i个子样本的真实类别,Q i为第二样本中第i个子样本的预测类别,m为第二样本中子样本的数量,L task为第二样本的误差损失值。
S14、依照第一网络集及第一组合对的分组方式,对所述第二分类模型的特征提取区进行划分得到多个第二网络集及各个所述第二网络集对应的多个第二组合对,基于所述第三特征图计算每个所述第二组合对中两层网络的各个通道的第二相关系数值,得到各个所述第二组合对对应的第二相关系数矩阵,基于所述第一相关系数矩阵及所述第二相关系数矩阵求解相关系数损失值;
所述相关系数损失值的计算公式为:
Figure PCTCN2020131988-appb-000006
其中,G ij为第二分类模型的第i个第二网络集中第j个第二组合对对应的第二相关系数矩阵,T ij为第一分类模型的第i个第一网络集中第j个第一组合对对应的第一相关系数矩阵,m为第一或第二组合对的数量,n为第一或第二网络的数量,λ j为第j个第一或第 二网络集对应的权重参数,L FSP为相关系数损失值。
因第一分类模型和第二分类模型的网络层数相同,只是通道数不同,而本实施例仅对网络层进行分组,故而分组后得到的第一网络集的数量与第二网络集的数量相同,各个网络集对应的组合对的数量也相同。
S15、通过最小化所述相似度损失值、所述误差损失值及所述相关系数损失值确定所述第二分类模型的第二参数,得到训练后的第二分类模型,并将所述第二参数发送给所述第一服务器。
如图3所示,为本申请一实施例提供的图像分类装置的模块示意图。
本申请所述图像分类装置100安装于第一服务器中。根据实现的功能,所述图像分类装置100可以包括获取模块110、构建模块120、训练模块130及分类模块140。本申请所述模块也可以称之为单元,是指一种能够被第一服务器的处理器所执行,并且能够完成固定功能的一系列计算机程序段,其存储在第一服务器的存储器中。
在本实施例中,关于各模块/单元的功能如下:
获取模块110,用于获取各个所述第二服务器的公用图像数据,将所述公用图像数据作为第一样本,将各个所述第二服务器的私有图像数据作为第二样本。
本实施例中,第一服务器对应大型银行,第二服务器对应小型银行,为实现对用户办理业务时所产生的图像数据进行分类,第一服务器与各个第二服务器联合建模,共同训练得到一个公有图像分类模型。
所述获取各个所述第二服务器的公有图像数据,包括:
A1、接收各个所述第二服务器发送的其本地存储的各个图像标识的哈希值集合;
A2、求解所述哈希值集合的交集,得到公有图像标识的哈希值,将所述公用图像标识的哈希值发送给各个所述第二服务器;
A3、接收各个所述第二服务器基于所述公有图像标识的哈希值反馈的采用RSA密钥对中的私钥加密的公有图像数据密文,采用所述RSA密钥对中的公钥解密所述数据密文得到所述公有图像数据。
本实施例中,所述图像标识对应用户ID,每个用户在办理业务时所产生的图像数据标注有用户ID,所述用户ID可以是用户的手机号码,也可以是用户的身份证号码。确定公有图像数据时,通过对各个图像标识进行哈希运算实现了对图像标识的重新编码,增加了图像标识的安全性。
所述哈希函数的计算公式为:
y ij=ax ij+b
其中,x ij为第i个第二服务器中第j个图像标识的key值,a、b为常数,y ij为第i个第二服务器中第j个图像标识的哈希值。
各个第二服务器将公有图像数据加密后传输给第一服务器,保证了传输安全性。
构建模块120,用于构建第一分类模型,利用所述第一样本对所述第一分类模型进行训练,确定所述第一分类模型的第一参数,得到调整后的第一分类模型,将所述第一样本输入所述调整后的第一分类模型得到第一特征数据;
训练模块130,用于对所述第一分类模型的结构进行压缩处理得到第二分类模型,将所述第一特征数据及所述第二分类模型发送给各个所述第二服务器,接收各个所述第二服务器基于所述第一特征数据及所述第二样本训练所述第二分类模型得到的第二参数,基于所述第一参数及所述第二参数确定所述调整后的第一分类模型的第三参数,得到更新后的第一分类模型,利用所述第一样本训练所述更新后的第一分类模型得到目标分类模型。
本实施例中,所述第一分类模型为重量级的深度神经网络模型,包括特征提取区和图像分类区,特征提取区包括多层网络,每层网络包括多个通道。所述第二分类模型为轻量级的深度神经网络模型。
所述对所述第一分类模型的结构进行压缩处理得到第二分类模型包括:按照第二服务器的数量对所述第一分类模型中每层网络的通道数进行压缩,得到第二分类模型。
第二分类模型中每层网络的通道数为C n
C n=C t/n
其中,C t为第一分类模型中每层网络的通道数,n为第二服务器的数量。
通过为第一服务器配置重量级的深度神经网络模型、对第二服务器配置轻量级的深度神经网络模型,充分考虑到了各个服务器的算力,使得后续的训练更为通畅,训练效率更高。
采用第一样本训练第一分类模型直到模型收敛得到调整后的第一分类模型。
本实施例中,所述将所述第一样本输入所述调整后的第一分类模型得到第一特征数据包括:
B1、将所述第一样本输入所述调整后的第一分类模型的所述特征提取区,得到第一特征图,对所述第一特征图进行降维处理得到第二特征图;
为降低通信开销,本实施例对第一特征图进行降维处理得到第二特征图,本实施例通过1*1的卷积核对第一特征图进行卷积操作实现对第一特征图的降维。
B2、将所述调整后的第一分类模型的所述特征提取区中输出同样尺寸特征图的网络的集合作为第一网络集,将所述第一网络集中的所述网络两两组合,得到多个第一组合对,基于所述第一特征图计算每个所述第一组合对中两层网络的各个通道的第一相关系数值,得到各个所述第一组合对对应的第一相关系数矩阵;
特征图经过卷积核计算后通常是越变越小的,有的网络层未进行卷积计算,这些网络层的输出和输入是同样大小的,本实施例中,将输出相同大小特征图的网络层作为一个网络集,所述网络集中的每两层网络形成一个组合对。
所述相关系数值的计算公式为:
Figure PCTCN2020131988-appb-000007
其中,F ij1(x,y,a)为第一分类模型的第i个第一网络集中第j个第一组合对中第1个网络层对应的第一特征图中第x行第y列像素点的第a个通道的特征值,F ij2(x,y,a)为第一分类模型的第i个第一网络集中第j个第一组合对中第2个网络层对应的第一特征图中第x行第y列像素点的第b个通道的特征值,r(F ij1,F ij2,a,b)为第一分类模型的第i个第一网络集中第j个第一组合对中第1个网络层对应的第一特征图中第x行第y列像素点的第a个通道与第i个第一网络集中第j个第一组合对中第2个网络层对应的第一特征图中第x行第y列像素点的第b个通道的第一相关系数值。
求解每个第一组合对中两层网络的各个通道对应的第一相关系数值,得到每个第一组合对对应的第一相关系数矩阵。
B3、将所述第二特征图及所述第一相关系数矩阵作为第一特征数据。
本实施例中,所述第三参数的计算公式为:
Figure PCTCN2020131988-appb-000008
其中,Z为第三参数,Q为第一参数,a为第二分类模型对应的权重参数,W 1*1为1*1的卷积操作,R i为第i个第二服务器对应的第二参数,n为第二服务器的数量。
本实施例中,所述基于所述第一样本训练所述更新后的第一分类模型得到目标分类模型,包括:
将所述第一样本输入所述更新后的第一分类模型,得到所述第一样本的预测类别,基于所述第一样本的标注信息获取所述第一样本的真实类别,通过最小化所述第一样本的预 测类别与真实类别之间的损失值确定所述第一分类模型的目标参数,得到目标分类模型。
所述第一样本的预测类别与真实类别之间的损失值的计算公式为:
Figure PCTCN2020131988-appb-000009
其中,q mn为第一样本中第m个子样本的预测类别,p mn为第一样本中第m个子样本的真实类别,loss(q mn,p mn)为第一样本中第m个子样本的预测类别和真实类别之间的损失值,c为第一样本中子样本的总数量。
分类模块140,用于解析用户基于客户端发出的图像分类请求,获取所述图像分类请求携带的待分类图像,将所述待分类图像输入所述目标分类模型得到图像分类结果。
如图4所示,为本申请另一实施例提供的图像分类装置的模块示意图。
本申请所述图像分类装置200安装于第二服务器中。根据实现的功能,所述图像分类装置200可以包括接收模块210、第一求解模块220、第二求解模块230、第三求解模块240及确定模块250。本申请所述模块也可以称之为单元,是指一种能够被第一服务器的处理器所执行,并且能够完成固定功能的一系列计算机程序段,其存储在第一服务器的存储器中。
在本实施例中,关于各模块/单元的功能如下:
接收模块210,用于接收第一特征数据及第二分类模型,所述第一特征数据包括第二特征图及第一相关系数矩阵;
第一求解模块220,用于将第二样本输入所述第二分类模型的特征提取区得到第三特征图,求解所述第二特征图与所述第三特征图的相似度损失值;
所述相似度损失值的计算公式为:
Figure PCTCN2020131988-appb-000010
其中,t k(x,y)为第二分类模型的第k层网络对应的第三特征图第x行第y列像素点的特征值,s k(x,y)为调整后的第一分类模型的第k层网络对应的第二特征图第x行第y列像素点的特征值,|||| 2为求解L2范数,L sim为第二特征图与第三特征图的相似度损失值。
第二求解模块230,用于将所述第三特征图输入所述第二分类模型的图像分类区得到所述第二样本的预测类别,基于所述第二样本的标注信息获取所述第二样本的真实类别,求解所述预测类别与真实类别的误差损失值;
Figure PCTCN2020131988-appb-000011
其中,P i为第二样本中第i个子样本的真实类别,Q i为第二样本中第i个子样本的预测类别,m为第二样本中子样本的数量,L task为第二样本的误差损失值。
第三求解模块240,用于依照第一网络集及第一组合对的分组方式,对所述第二分类模型的特征提取区进行划分得到多个第二网络集及各个所述第二网络集对应的多个第二组合对,基于所述第三特征图计算每个所述第二组合对中两层网络的各个通道的第二相关系数值,得到各个所述第二组合对对应的第二相关系数矩阵,基于所述第一相关系数矩阵及所述第二相关系数矩阵求解相关系数损失值;
所述相关系数损失值的计算公式为:
Figure PCTCN2020131988-appb-000012
其中,G ij为第二分类模型的第i个第二网络集中第j个第二组合对对应的第二相关系数矩阵,T ij为第一分类模型的第i个第一网络集中第j个第一组合对对应的第一相关系数矩阵,m为第一或第二组合对的数量,n为第一或第二网络的数量,λ j为第j个第一或第 二网络集对应的权重参数,L FSP为相关系数损失值。
因第一分类模型和第二分类模型的网络层数相同,只是通道数不同,而本实施例仅对网络层进行分组,故而分组后得到的第一网络集的数量与第二网络集的数量相同,各个网络集对应的组合对的数量也相同。
确定模块250,用于通过最小化所述相似度损失值、所述误差损失值及所述相关系数损失值确定所述第二分类模型的第二参数,得到训练后的第二分类模型,并将所述第二参数发送给所述第一服务器。
如图5所示,为本申请一实施例提供的包括第一服务器和第二服务器的图像分类***。本实施例中,第一服务器1与多个第二服务器2通信连接。
第一服务器1和第二服务器2可以是机架式服务器、刀片式服务器、塔式服务器或者机柜式服务器等计算设备,第一服务器1和第二服务器2可以是独立的服务器,也可以是多个服务器所组成的服务器集群。
在本申请的一个实施例中,第一服务器1用于:
获取各个所述第二服务器2的公用图像数据,将所述公用图像数据作为第一样本,将各个所述第二服务器2的私有图像数据作为第二样本;
构建第一分类模型,利用所述第一样本对所述第一分类模型进行训练,确定所述第一分类模型的第一参数,得到调整后的第一分类模型,将所述第一样本输入所述调整后的第一分类模型得到第一特征数据;
对所述第一分类模型的结构进行压缩处理得到第二分类模型,将所述第一特征数据及所述第二分类模型发送给各个所述第二服务器2,接收各个所述第二服务器2基于所述第一特征数据及所述第二样本训练所述第二分类模型得到的第二参数,基于所述第一参数及所述第二参数确定所述调整后的第一分类模型的第三参数,得到更新后的第一分类模型,利用所述第一样本训练所述更新后的第一分类模型得到目标分类模型;
解析用户基于客户端发出的图像分类请求,获取所述图像分类请求携带的待分类图像,将所述待分类图像输入所述目标分类模型得到图像分类结果。
所述第二服务器2用于:
接收第一特征数据及第二分类模型,所述第一特征数据包括第二特征图及第一相关系数矩阵;
将第二样本输入所述第二分类模型的特征提取区得到第三特征图,求解所述第二特征图与所述第三特征图的相似度损失值;
将所述第三特征图输入所述第二分类模型的图像分类区得到所述第二样本的预测类别,基于所述第二样本的标注信息获取所述第二样本的真实类别,求解所述预测类别与真实类别的误差损失值;
依照第一网络集及第一组合对的分组方式,对所述第二分类模型的特征提取区进行划分得到多个第二网络集及各个所述第二网络集对应的多个第二组合对,基于所述第三特征图计算每个所述第二组合对中两层网络的各个通道的第二相关系数值,得到各个所述第二组合对对应的第二相关系数矩阵,基于所述第一相关系数矩阵及所述第二相关系数矩阵求解相关系数损失值;
通过最小化所述相似度损失值、所述误差损失值及所述相关系数损失值确定所述第二分类模型的第二参数,得到训练后的第二分类模型,并将所述第二参数发送给所述第一服务器1。
如图6所示,为本申请一实施例提供的实现基于深度学习的图像分类方法的第一服务器1的结构示意图。
在本实施例中,第一服务器1包括,但不仅限于,可通过***总线相互通信连接的存储器11、处理器12、网络接口13,该存储器11中存储有图像分类程序10,所述图像分类 程序10可被所述处理器12执行。图6仅示出了具有组件11-13以及图像分类程序10的第一服务器1,本领域技术人员可以理解的是,图6示出的结构并不构成对第一服务器1的限定,可以包括比图示更少或者更多的部件,或者组合某些部件,或者不同的部件布置。
其中,存储器11包括内存及至少一种类型的可读存储介质。内存为第一服务器1的运行提供缓存;可读存储介质可为如闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、随机访问存储器(RAM)、静态随机访问存储器(SRAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、可编程只读存储器(PROM)、磁性存储器、磁盘、光盘等的非易失性存储介质。在一些实施例中,可读存储介质可以是第一服务器1的内部存储单元,例如该第一服务器1的硬盘;在另一些实施例中,该非易失性存储介质也可以是第一服务器1的外部存储设备,例如第一服务器1上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。本实施例中,存储器11的可读存储介质通常用于存储安装于第一服务器1的操作***和各类应用软件,例如存储本申请一实施例中的图像分类程序10的代码等。此外,存储器11还可以用于暂时地存储已经输出或者将要输出的各类数据。
处理器12在一些实施例中可以是中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器、或其他数据处理芯片。该处理器12通常用于控制所述第一服务器1的总体操作,例如执行与其他设备进行数据交互或者通信相关的控制和处理等。本实施例中,所述处理器12用于运行所述存储器11中存储的程序代码或者处理数据,例如运行图像分类程序10等。
网络接口13可包括无线网络接口或有线网络接口,该网络接口13用于在所述第一服务器1与客户端(图中未画出)之间建立通信连接。
可选的,所述第一服务器1还可以包括用户接口,用户接口可以包括显示器(Display)、输入单元比如键盘(Keyboard),可选的用户接口还可以包括标准的有线接口、无线接口。可选的,在一些实施例中,显示器可以是LED显示器、液晶显示器、触控式液晶显示器以及OLED(Organic Light-Emitting Diode,有机发光二极管)触摸器等。其中,显示器也可以适当的称为显示屏或显示单元,用于显示在第一服务器1中处理的信息以及用于显示可视化的用户界面。
应该了解,所述实施例仅为说明之用,在专利申请范围上并不受此结构的限制。
所述第一服务器1中的所述存储器11存储的图像分类程序10是多个指令的组合,在所述处理器12中运行时,可以实现:
获取各个所述第二服务器2的公用图像数据,将所述公用图像数据作为第一样本,将各个所述第二服务器2的私有图像数据作为第二样本;
构建第一分类模型,利用所述第一样本对所述第一分类模型进行训练,确定所述第一分类模型的第一参数,得到调整后的第一分类模型,将所述第一样本输入所述调整后的第一分类模型得到第一特征数据;
对所述第一分类模型的结构进行压缩处理得到第二分类模型,将所述第一特征数据及所述第二分类模型发送给各个所述第二服务器2,接收各个所述第二服务器2基于所述第一特征数据及所述第二样本训练所述第二分类模型得到的第二参数,基于所述第一参数及所述第二参数确定所述调整后的第一分类模型的第三参数,得到更新后的第一分类模型,利用所述第一样本训练所述更新后的第一分类模型得到目标分类模型;
解析用户基于客户端发出的图像分类请求,获取所述图像分类请求携带的待分类图像,将所述待分类图像输入所述目标分类模型得到图像分类结果。
具体地,所述处理器12对上述图像分类程序10的具体实现方法可参考图1对应实施例中相关步骤的描述,在此不赘述。需要强调的是,为进一步保证上述待分类图像的私密和安全性,上述待分类图像还可以存储于一区块链的节点中。
如图7所示,为本申请一实施例提供的实现基于深度学习的图像分类方法的第二服务器2的结构示意图。
在本实施例中,第二服务器2包括,但不仅限于,可通过***总线相互通信连接的存储器21、处理器22、网络接口23,该存储器21中存储有图像分类程序20,所述图像分类程序20可被所述处理器22执行。
所述第二服务器2中的所述存储器21存储的图像分类程序20是多个指令的组合,在所述处理器22中运行时,可以实现:
接收第一特征数据及第二分类模型,所述第一特征数据包括第二特征图及第一相关系数矩阵;
将第二样本输入所述第二分类模型的特征提取区得到第三特征图,求解所述第二特征图与所述第三特征图的相似度损失值;
将所述第三特征图输入所述第二分类模型的图像分类区得到所述第二样本的预测类别,基于所述第二样本的标注信息获取所述第二样本的真实类别,求解所述预测类别与真实类别的误差损失值;
依照第一网络集及第一组合对的分组方式,对所述第二分类模型的特征提取区进行划分得到多个第二网络集及各个所述第二网络集对应的多个第二组合对,基于所述第三特征图计算每个所述第二组合对中两层网络的各个通道的第二相关系数值,得到各个所述第二组合对对应的第二相关系数矩阵,基于所述第一相关系数矩阵及所述第二相关系数矩阵求解相关系数损失值;
通过最小化所述相似度损失值、所述误差损失值及所述相关系数损失值确定所述第二分类模型的第二参数,得到训练后的第二分类模型,并将所述第二参数发送给所述第一服务器1。
进一步地,所述第一服务器1和/或第二服务器2集成的模块/单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。所述计算机可读介质可以是非易失性的,也可以是非易失性的。所述计算机可读介质可以包括:能够携带所述计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(ROM,Read-Only Memory)。
所述计算机可读存储介质上存储有图像分类程序10,所述图像分类程序10可被一个或者多个处理器执行,本申请计算机可读存储介质具体实施方式与上述图1所述的基于深度学习的图像分类方法各实施例基本相同。
进一步的,所述计算机可读存储介质上也可以存储图像分类程序20,所述图像分类程序20可被一个或者多个处理器执行,本申请计算机可读存储介质具体实施方式与上述图2所述的基于深度学习的图像分类方法各实施例基本相同,在此不作赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的设备,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式。
所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。
另外,在本申请各个实施例中的各功能模块可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能模块的形式实现。
对于本领域技术人员而言,显然本申请不限于上述示范性实施例的细节,而且在不背离本申请的精神或基本特征的情况下,能够以其他的具体形式实现本申请。
因此,无论从哪一点来看,均应将实施例看作是示范性的,而且是非限制性的,本申 请的范围由所附权利要求而不是上述说明限定,因此旨在将落在权利要求的等同要件的含义和范围内的所有变化涵括在本申请内。不应将权利要求中的任何附关联图标记视为限制所涉及的权利要求。
本申请所指区块链是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。区块链(Blockchain),本质上是一个去中心化的数据库,是一串使用密码学方法相关联产生的数据块,每一个数据块中包含了一批次网络交易的信息,用于验证其信息的有效性(防伪)和生成下一个区块。区块链可以包括区块链底层平台、平台产品服务层以及应用服务层等。
此外,显然“包括”一词不排除其他单元或步骤,单数不排除复数。***权利要求中陈述的多个单元或装置也可以由一个单元或装置通过软件或者硬件来实现。第二等词语用来表示名称,而并不表示任何特定的顺序。
最后应说明的是,以上实施例仅用以说明本申请的技术方案而非限制,尽管参照较佳实施例对本申请进行了详细说明,本领域的普通技术人员应当理解,可以对本申请的技术方案进行修改或等同替换,而不脱离本申请技术方案的精神和范围。

Claims (20)

  1. 一种基于深度学习的图像分类方法,应用于第一服务器,所述第一服务器与多个第二服务器通信连接,其中,所述方法包括:
    获取各个所述第二服务器的公用图像数据,将所述公用图像数据作为第一样本,将各个所述第二服务器的私有图像数据作为第二样本;
    构建第一分类模型,利用所述第一样本对所述第一分类模型进行训练,确定所述第一分类模型的第一参数,得到调整后的第一分类模型,将所述第一样本输入所述调整后的第一分类模型得到第一特征数据;
    对所述第一分类模型的结构进行压缩处理得到第二分类模型,将所述第一特征数据及所述第二分类模型发送给各个所述第二服务器,接收各个所述第二服务器基于所述第一特征数据及所述第二样本训练所述第二分类模型得到的第二参数,基于所述第一参数及所述第二参数确定所述调整后的第一分类模型的第三参数,得到更新后的第一分类模型,利用所述第一样本训练所述更新后的第一分类模型得到目标分类模型;
    解析用户基于客户端发出的图像分类请求,获取所述图像分类请求携带的待分类图像,将所述待分类图像输入所述目标分类模型得到图像分类结果。
  2. 如权利要求1所述的基于深度学习的图像分类方法,其中,所述第一分类模型包括特征提取区和图像分类区,所述特征提取区包括多层网络,每层所述网络包括多个通道,所述对所述第一分类模型的结构进行压缩处理得到第二分类模型包括:
    按照所述第二服务器的数量对所述第一分类模型中每层所述网络的通道数进行压缩,得到所述第二分类模型。
  3. 如权利要求2所述的基于深度学习的图像分类方法,其中,所述将所述第一样本输入所述调整后的第一分类模型得到第一特征数据包括:
    将所述第一样本输入所述调整后的第一分类模型的所述特征提取区,得到第一特征图,对所述第一特征图进行降维处理得到第二特征图;
    将所述调整后的第一分类模型的所述特征提取区中输出同样尺寸特征图的网络的集合作为第一网络集,将所述第一网络集中的所述网络两两组合,得到多个第一组合对,基于所述第一特征图计算每个所述第一组合对中两层网络的各个通道的第一相关系数值,得到各个所述第一组合对对应的第一相关系数矩阵;
    将所述第二特征图及所述第一相关系数矩阵作为第一特征数据。
  4. 如权利要求1所述的基于深度学习的图像分类方法,其中,所述第三参数的计算公式为:
    Figure PCTCN2020131988-appb-100001
    其中,Z为第三参数,Q为第一参数,a为第二分类模型对应的权重参数,W 1*1为1*1的卷积操作,R i为第i个第二服务器对应的第二参数,n为第二服务器的数量。
  5. 如权利要求1所述的基于深度学习的图像分类方法,其中,所述获取各个所述第二服务器的公用图像数据包括:
    接收各个所述第二服务器发送的其本地存储的各个图像标识的哈希值集合;
    求解所述哈希值集合的交集,得到公有图像标识的哈希值,将所述公用图像标识的哈希值发送给各个所述第二服务器;
    接收各个所述第二服务器基于所述公有图像标识的哈希值反馈的采用RSA密钥对中的私钥加密的公有图像数据密文,采用所述RSA密钥对中的公钥解密所述数据密文得到所述公有图像数据。
  6. 一种基于深度学习的图像分类方法,应用于第二服务器,所述第二服务器与第一 服务器通信连接,其中,所述方法包括:
    接收第一特征数据及第二分类模型,所述第一特征数据包括第二特征图及第一相关系数矩阵;
    将第二样本输入所述第二分类模型的特征提取区得到第三特征图,求解所述第二特征图与所述第三特征图的相似度损失值;
    将所述第三特征图输入所述第二分类模型的图像分类区得到所述第二样本的预测类别,基于所述第二样本的标注信息获取所述第二样本的真实类别,求解所述预测类别与真实类别的误差损失值;
    依照第一网络集及第一组合对的分组方式,对所述第二分类模型的特征提取区进行划分得到多个第二网络集及各个所述第二网络集对应的多个第二组合对,基于所述第三特征图计算每个所述第二组合对中两层网络的各个通道的第二相关系数值,得到各个所述第二组合对对应的第二相关系数矩阵,基于所述第一相关系数矩阵及所述第二相关系数矩阵求解相关系数损失值;
    通过最小化所述相似度损失值、所述误差损失值及所述相关系数损失值确定所述第二分类模型的第二参数,得到训练后的第二分类模型,并将所述第二参数发送给所述第一服务器。
  7. 如权利要求6所述的基于深度学习的图像分类方法,其中,所述相似度损失值的计算公式为:
    Figure PCTCN2020131988-appb-100002
    其中,t k(x,y)为第二分类模型的第k层网络对应的第三特征图第x行第y列像素点的特征值,s k(x,y)为调整后的第一分类模型的第k层网络对应的第二特征图第x行第y列像素点的特征值,|||| 2为求解L2范数,L sim为第二特征图与第三特征图的相似度损失值;
    所述预测类别与真实类别的误差损失值的计算公式为:
    Figure PCTCN2020131988-appb-100003
    其中,P i为第二样本中第i个子样本的真实类别,Q i为第二样本中第i个子样本的预测类别,m为第二样本中子样本的数量,L task为第二样本的误差损失值;
    所述相关系数损失值的计算公式为:
    Figure PCTCN2020131988-appb-100004
    其中,G ij为第二分类模型的第i个第二网络集中第j个第二组合对对应的第二相关系数矩阵,T ij为第一分类模型的第i个第一网络集中第j个第一组合对对应的第一相关系数矩阵,m为第一或第二组合对的数量,n为第一或第二网络集的数量,λ j为第j个第一或第二网络集对应的权重参数,L FSP为相关系数损失值。
  8. 一种图像分类装置,其中,所述装置包括:
    获取模块,用于获取各个第二服务器的公用图像数据,将所述公用图像数据作为第一样本,将各个所述第二服务器的私有图像数据作为第二样本;
    构建模块,用于构建第一分类模型,利用所述第一样本对所述第一分类模型进行训练,确定所述第一分类模型的第一参数,得到调整后的第一分类模型,将所述第一样本输入所述调整后的第一分类模型得到第一特征数据;
    训练模块,用于对所述第一分类模型的结构进行压缩处理得到第二分类模型,将所述第一特征数据及所述第二分类模型发送给各个所述第二服务器,接收各个所述第二服务器基于所述第一特征数据及所述第二样本训练所述第二分类模型得到的第二参数,基于所述 第一参数及所述第二参数确定所述调整后的第一分类模型的第三参数,得到更新后的第一分类模型,利用所述第一样本训练所述更新后的第一分类模型得到目标分类模型;
    分类模块,用于解析用户基于客户端发出的图像分类请求,获取所述图像分类请求携带的待分类图像,将所述待分类图像输入所述目标分类模型得到图像分类结果。
  9. 一种第一服务器,其中,所述第一服务器包括:
    至少一个处理器;以及,
    与所述至少一个处理器通信连接的存储器;其中,
    所述存储器存储有可被所述至少一个处理器执行的图像分类程序,所述图像分类程序被所述至少一个处理器执行,以使所述至少一个处理器能够执行如下步骤:
    获取各个第二服务器的公用图像数据,将所述公用图像数据作为第一样本,将各个所述第二服务器的私有图像数据作为第二样本;
    构建第一分类模型,利用所述第一样本对所述第一分类模型进行训练,确定所述第一分类模型的第一参数,得到调整后的第一分类模型,将所述第一样本输入所述调整后的第一分类模型得到第一特征数据;
    对所述第一分类模型的结构进行压缩处理得到第二分类模型,将所述第一特征数据及所述第二分类模型发送给各个所述第二服务器,接收各个所述第二服务器基于所述第一特征数据及所述第二样本训练所述第二分类模型得到的第二参数,基于所述第一参数及所述第二参数确定所述调整后的第一分类模型的第三参数,得到更新后的第一分类模型,利用所述第一样本训练所述更新后的第一分类模型得到目标分类模型;
    解析用户基于客户端发出的图像分类请求,获取所述图像分类请求携带的待分类图像,将所述待分类图像输入所述目标分类模型得到图像分类结果。
  10. 如权利要求9所述的第一服务器,其中,所述第一分类模型包括特征提取区和图像分类区,所述特征提取区包括多层网络,每层所述网络包括多个通道,所述对所述第一分类模型的结构进行压缩处理得到第二分类模型包括:
    按照所述第二服务器的数量对所述第一分类模型中每层所述网络的通道数进行压缩,得到所述第二分类模型。
  11. 如权利要求10所述的第一服务器,其中,所述将所述第一样本输入所述调整后的第一分类模型得到第一特征数据包括:
    将所述第一样本输入所述调整后的第一分类模型的所述特征提取区,得到第一特征图,对所述第一特征图进行降维处理得到第二特征图;
    将所述调整后的第一分类模型的所述特征提取区中输出同样尺寸特征图的网络的集合作为第一网络集,将所述第一网络集中的所述网络两两组合,得到多个第一组合对,基于所述第一特征图计算每个所述第一组合对中两层网络的各个通道的第一相关系数值,得到各个所述第一组合对对应的第一相关系数矩阵;
    将所述第二特征图及所述第一相关系数矩阵作为第一特征数据。
  12. 如权利要求9所述的第一服务器,其中,所述第三参数的计算公式为:
    Figure PCTCN2020131988-appb-100005
    其中,Z为第三参数,Q为第一参数,a为第二分类模型对应的权重参数,W 1*1为1*1的卷积操作,R i为第i个第二服务器对应的第二参数,n为第二服务器的数量。
  13. 如权利要求9所述的第一服务器,其中,所述获取各个所述第二服务器的公用图像数据包括:
    接收各个所述第二服务器发送的其本地存储的各个图像标识的哈希值集合;
    求解所述哈希值集合的交集,得到公有图像标识的哈希值,将所述公用图像标识的哈希值发送给各个所述第二服务器;
    接收各个所述第二服务器基于所述公有图像标识的哈希值反馈的采用RSA密钥对中的私钥加密的公有图像数据密文,采用所述RSA密钥对中的公钥解密所述数据密文得到所述公有图像数据。
  14. 一种第二服务器,所述第二服务器与第一服务器通信连接,所述第二服务器包括:
    至少一个处理器;以及,
    与所述至少一个处理器通信连接的存储器;其中,
    所述存储器存储有可被所述至少一个处理器执行的图像分类程序,所述图像分类程序被所述至少一个处理器执行,以使所述至少一个处理器能够执行如下步骤:
    接收第一特征数据及第二分类模型,所述第一特征数据包括第二特征图及第一相关系数矩阵;
    将第二样本输入所述第二分类模型的特征提取区得到第三特征图,求解所述第二特征图与所述第三特征图的相似度损失值;
    将所述第三特征图输入所述第二分类模型的图像分类区得到所述第二样本的预测类别,基于所述第二样本的标注信息获取所述第二样本的真实类别,求解所述预测类别与真实类别的误差损失值;
    依照第一网络集及第一组合对的分组方式,对所述第二分类模型的特征提取区进行划分得到多个第二网络集及各个所述第二网络集对应的多个第二组合对,基于所述第三特征图计算每个所述第二组合对中两层网络的各个通道的第二相关系数值,得到各个所述第二组合对对应的第二相关系数矩阵,基于所述第一相关系数矩阵及所述第二相关系数矩阵求解相关系数损失值;
    通过最小化所述相似度损失值、所述误差损失值及所述相关系数损失值确定所述第二分类模型的第二参数,得到训练后的第二分类模型,并将所述第二参数发送给所述第一服务器。
  15. 如权利要求14所述的第二服务器,其中,所述相似度损失值的计算公式为:
    Figure PCTCN2020131988-appb-100006
    其中,t k(x,y)为第二分类模型的第k层网络对应的第三特征图第x行第y列像素点的特征值,s k(x,y)为调整后的第一分类模型的第k层网络对应的第二特征图第x行第y列像素点的特征值,|||| 2为求解L2范数,L sim为第二特征图与第三特征图的相似度损失值;
    所述预测类别与真实类别的误差损失值的计算公式为:
    Figure PCTCN2020131988-appb-100007
    其中,P i为第二样本中第i个子样本的真实类别,Q i为第二样本中第i个子样本的预测类别,m为第二样本中子样本的数量,L task为第二样本的误差损失值;
    所述相关系数损失值的计算公式为:
    Figure PCTCN2020131988-appb-100008
    其中,G ij为第二分类模型的第i个第二网络集中第j个第二组合对对应的第二相关系数矩阵,T ij为第一分类模型的第i个第一网络集中第j个第一组合对对应的第一相关系数矩阵,m为第一或第二组合对的数量,n为第一或第二网络集的数量,λ j为第j个第一或第二网络集对应的权重参数,L FSP为相关系数损失值。
  16. 一种计算机可读存储介质,其中,所述计算机可读存储介质上存储有图像分类程序,所述图像分类程序可被一个或者多个处理器执行,以实现如下步骤:
    获取各个第二服务器的公用图像数据,将所述公用图像数据作为第一样本,将各个所 述第二服务器的私有图像数据作为第二样本;
    构建第一分类模型,利用所述第一样本对所述第一分类模型进行训练,确定所述第一分类模型的第一参数,得到调整后的第一分类模型,将所述第一样本输入所述调整后的第一分类模型得到第一特征数据;
    对所述第一分类模型的结构进行压缩处理得到第二分类模型,将所述第一特征数据及所述第二分类模型发送给各个所述第二服务器,接收各个所述第二服务器基于所述第一特征数据及所述第二样本训练所述第二分类模型得到的第二参数,基于所述第一参数及所述第二参数确定所述调整后的第一分类模型的第三参数,得到更新后的第一分类模型,利用所述第一样本训练所述更新后的第一分类模型得到目标分类模型;
    解析用户基于客户端发出的图像分类请求,获取所述图像分类请求携带的待分类图像,将所述待分类图像输入所述目标分类模型得到图像分类结果。
  17. 如权利要求16所述的计算机可读存储介质,其中,所述第一分类模型包括特征提取区和图像分类区,所述特征提取区包括多层网络,每层所述网络包括多个通道,所述对所述第一分类模型的结构进行压缩处理得到第二分类模型包括:
    按照所述第二服务器的数量对所述第一分类模型中每层所述网络的通道数进行压缩,得到所述第二分类模型。
  18. 如权利要求17所述的计算机可读存储介质,其中,所述将所述第一样本输入所述调整后的第一分类模型得到第一特征数据包括:
    将所述第一样本输入所述调整后的第一分类模型的所述特征提取区,得到第一特征图,对所述第一特征图进行降维处理得到第二特征图;
    将所述调整后的第一分类模型的所述特征提取区中输出同样尺寸特征图的网络的集合作为第一网络集,将所述第一网络集中的所述网络两两组合,得到多个第一组合对,基于所述第一特征图计算每个所述第一组合对中两层网络的各个通道的第一相关系数值,得到各个所述第一组合对对应的第一相关系数矩阵;
    将所述第二特征图及所述第一相关系数矩阵作为第一特征数据。
  19. 如权利要求16所述的计算机可读存储介质,其中,所述第三参数的计算公式为:
    Figure PCTCN2020131988-appb-100009
    其中,Z为第三参数,Q为第一参数,a为第二分类模型对应的权重参数,W 1*1为1*1的卷积操作,R i为第i个第二服务器对应的第二参数,n为第二服务器的数量。
  20. 如权利要求16所述的计算机可读存储介质,其中,所述获取各个所述第二服务器的公用图像数据包括:
    接收各个所述第二服务器发送的其本地存储的各个图像标识的哈希值集合;
    求解所述哈希值集合的交集,得到公有图像标识的哈希值,将所述公用图像标识的哈希值发送给各个所述第二服务器;
    接收各个所述第二服务器基于所述公有图像标识的哈希值反馈的采用RSA密钥对中的私钥加密的公有图像数据密文,采用所述RSA密钥对中的公钥解密所述数据密文得到所述公有图像数据。
PCT/CN2020/131988 2020-10-14 2020-11-27 基于深度学习的图像分类方法、装置、服务器及介质 WO2021189908A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011099982.6 2020-10-14
CN202011099982.6A CN112163635B (zh) 2020-10-14 2020-10-14 基于深度学习的图像分类方法、装置、服务器及介质

Publications (1)

Publication Number Publication Date
WO2021189908A1 true WO2021189908A1 (zh) 2021-09-30

Family

ID=73867010

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/131988 WO2021189908A1 (zh) 2020-10-14 2020-11-27 基于深度学习的图像分类方法、装置、服务器及介质

Country Status (2)

Country Link
CN (1) CN112163635B (zh)
WO (1) WO2021189908A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113837488A (zh) * 2021-10-14 2021-12-24 南京国铁电气有限责任公司 能源消耗数据预测方法、***、设备
CN118171309A (zh) * 2024-05-16 2024-06-11 苏州市卫生计生统计信息中心 一种医学图像加密检索方法

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113515999A (zh) * 2021-01-13 2021-10-19 腾讯科技(深圳)有限公司 图像处理模型的训练方法、装置、设备及可读存储介质
CN113220918A (zh) * 2021-03-09 2021-08-06 十堰时风达工贸有限公司 基于区块技术的电商大数据分类方法及***

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170076224A1 (en) * 2015-09-15 2017-03-16 International Business Machines Corporation Learning of classification model
CN110909803A (zh) * 2019-11-26 2020-03-24 腾讯科技(深圳)有限公司 图像识别模型训练方法、装置和计算机可读存储介质
CN110929807A (zh) * 2019-12-06 2020-03-27 腾讯科技(深圳)有限公司 图像分类模型的训练方法、图像分类方法及装置
CN111160448A (zh) * 2019-12-26 2020-05-15 北京达佳互联信息技术有限公司 一种图像分类模型的训练方法及装置
CN111598160A (zh) * 2020-05-14 2020-08-28 腾讯科技(深圳)有限公司 图像分类模型的训练方法、装置、计算机设备及存储介质

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180300653A1 (en) * 2017-04-18 2018-10-18 Distributed Systems, Inc. Distributed Machine Learning System
CN108805160B (zh) * 2018-04-17 2020-03-24 平安科技(深圳)有限公司 迁移学习方法、装置、计算机设备和存储介质
CN110399742B (zh) * 2019-07-29 2020-12-18 深圳前海微众银行股份有限公司 一种联邦迁移学习模型的训练、预测方法及装置
CN111091200B (zh) * 2019-12-20 2021-03-19 深圳前海微众银行股份有限公司 训练模型的更新方法、***、智能设备、服务器及存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170076224A1 (en) * 2015-09-15 2017-03-16 International Business Machines Corporation Learning of classification model
CN110909803A (zh) * 2019-11-26 2020-03-24 腾讯科技(深圳)有限公司 图像识别模型训练方法、装置和计算机可读存储介质
CN110929807A (zh) * 2019-12-06 2020-03-27 腾讯科技(深圳)有限公司 图像分类模型的训练方法、图像分类方法及装置
CN111160448A (zh) * 2019-12-26 2020-05-15 北京达佳互联信息技术有限公司 一种图像分类模型的训练方法及装置
CN111598160A (zh) * 2020-05-14 2020-08-28 腾讯科技(深圳)有限公司 图像分类模型的训练方法、装置、计算机设备及存储介质

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113837488A (zh) * 2021-10-14 2021-12-24 南京国铁电气有限责任公司 能源消耗数据预测方法、***、设备
CN113837488B (zh) * 2021-10-14 2023-12-26 南京国铁电气有限责任公司 能源消耗数据预测方法、***、设备
CN118171309A (zh) * 2024-05-16 2024-06-11 苏州市卫生计生统计信息中心 一种医学图像加密检索方法

Also Published As

Publication number Publication date
CN112163635A (zh) 2021-01-01
CN112163635B (zh) 2024-05-28

Similar Documents

Publication Publication Date Title
US11475143B2 (en) Sensitive data classification
WO2021189908A1 (zh) 基于深度学习的图像分类方法、装置、服务器及介质
WO2021179720A1 (zh) 基于联邦学习的用户数据分类方法、装置、设备及介质
US11341417B2 (en) Method and apparatus for completing a knowledge graph
AU2021218110B2 (en) Learning from distributed data
WO2021174944A1 (zh) 基于目标对象活跃度的消息推送方法及相关设备
US20190340533A1 (en) Systems and methods for preparing data for use by machine learning algorithms
WO2022105115A1 (zh) 问答对匹配方法、装置、电子设备及存储介质
US9576248B2 (en) Record linkage sharing using labeled comparison vectors and a machine learning domain classification trainer
WO2019218475A1 (zh) 异常行为对象的识别方法、装置、终端设备及介质
WO2022116424A1 (zh) 交通流预测模型训练方法、装置、电子设备及存储介质
CN108197532A (zh) 人脸识别的方法、装置及计算机装置
WO2022160442A1 (zh) 答案生成方法、装置、电子设备及可读存储介质
Guo et al. Privacy-preserving image search (PPIS): Secure classification and searching using convolutional neural network over large-scale encrypted medical images
WO2021208695A1 (zh) 目标物推荐方法、装置、电子设备及计算机可读存储介质
WO2019047567A1 (zh) 服务提供方法、装置、存储介质和计算设备
WO2022105496A1 (zh) 智能回访方法、装置、电子设备及可读存储介质
WO2023071105A1 (zh) 一种特征变量的分析方法、装置、计算机设备及存储介质
CN115063589A (zh) 基于知识蒸馏的车辆部件分割方法及相关设备
CN112668482A (zh) 人脸识别训练方法、装置、计算机设备及存储介质
CN111831715A (zh) 一种基于人工智能大数据智慧接访及存证***及方法
CN111475541A (zh) 数据决策方法、装置、电子设备及存储介质
CN111756684A (zh) 传输机密数据的***和方法
CN113157739B (zh) 跨模态检索方法、装置、电子设备及存储介质
CN116150663A (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: 20926413

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20926413

Country of ref document: EP

Kind code of ref document: A1