Medical auxiliary diagnosis method based on quantum federal learning and electronic equipment
By adopting a quantum federated learning method based on quantum federated learning model in medical-assisted diagnosis, we solve data privacy and sensitivity problems, improve the accuracy and efficiency of medical-assisted diagnosis, and achieve higher diagnostic accuracy and security sex.
Patent Information
- Application Number
- CN202411430722.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-14
- Publication Date
- 2025-02-14
AI Technical Summary
In medical-assisted diagnosis, due to data privacy and sensitivity issues, it is difficult to improve the accuracy and efficiency of the model without leaking data.
Using a quantum federated learning method, a quantum federated learning model including local client and central server side is constructed. Through interactive training between local client and central server, until the global model loss function is reached is lower than the predetermined threshold, ensuring client data. Privacy and leverage quantum advantages to improve diagnostic accuracy and efficiency.
On the premise of ensuring client data privacy, the accuracy and efficiency of medical-assisted diagnosis are improved, the entanglement and expressibility of quantum circuits are optimized, and the accuracy is higher than the average aggregation of parameters, and suitable for actual medical care. Application scenario.
Smart Images

Figure CN119446482A_ABST
Abstract
Description
[0001] The present invention relates to the field of smart medical technology, and in particular to a medical auxiliary diagnosis method and electronic equipment based on quantum federated learning. Background Art
[0002] With the improvement of material living standards, people's expectations for their own health and quality of life continue to increase. In order to meet people's expectations for healthy life, the medical industry continues to seek to use emerging information technologies and equipment to improve the quality and efficiency of services. The emergence of the Internet of Things has further promoted the rapid development of the medical industry. In recent years, with the rapid development of the Internet of Things, artificial intelligence and big data, artificial intelligence technologies related to machine learning have been widely used in the medical field. Among them, intelligent diagnosis can provide effective intelligent diagnostic decision support for clinicians, and has gradually developed into an important research branch of smart medicine.
[0003] In the existing classic machine learning paradigm, model training usually relies on centralizing scattered data to a core node in order to build and optimize the model. This method is particularly limited in scenarios where the data accumulation of a single medical institution is insufficient to build an efficient model, and often requires data cooperation between multiple medical institutions. However, given the high sensitivity and privacy of medical data, medical institutions and patients are reserved about data sharing, especially at a time when data protection laws are becoming increasingly stringent, data leakage may lead to serious consequences. How to improve the accuracy and efficiency of the model's medical-assisted diagnosis while avoiding data leakage is a technical problem that needs to be solved urgently. Summary of the invention
[0004] The purpose of the present invention is to overcome the shortcomings of the prior art and provide a medical-assisted diagnosis method and electronic device based on quantum federated learning, which can utilize quantum advantages to improve the accuracy and efficiency of medical-assisted diagnosis while ensuring client data privacy.
[0005] To achieve the above object, the present invention is implemented by adopting the following technical solutions: In a first aspect, the present invention provides a medical auxiliary diagnosis method based on quantum federated learning, comprising: Acquire target medical data and perform preprocessing to generate target samples; Inputting the target sample into a pre-trained quantum federated learning model to obtain the disease category of the target medical data; The acquisition process of the pre-trained quantum federated learning model includes: Acquire a real medical data set and perform preprocessing to generate a sample set, and divide the sample set into a training sample set and a test sample set according to a preset ratio; Constructing a quantum federated learning model, wherein the quantum federated learning model includes a local client and a central server, wherein the local client includes a variational quantum neural network; Repeat the following steps until the preset training cycle is reached to complete the training of the quantum federated learning model: In a current training cycle, the local client is trained according to the training sample set, and the accuracy of the local client after each training cycle is calculated according to the test sample set; The local client sends its accuracy and final model gradient to the central server after the current training cycle; The central server updates the global model parameters according to the accuracy and the model gradient, and returns the updated global model parameters to the local client; The local client updates the local model parameters according to the global model parameters and enters the next training cycle.
[0006] Optionally, the preprocessing includes: Using a Gaussian filtering method to perform denoising on the real medical data in the real medical data set; The real medical data after denoising is normalized to .
[0007] Optionally, the variational quantum neural network includes a parameterized quantum circuit and a classical optimizer; The parameterized quantum circuit includes a quantum coding layer, a variational quantum layer and a quantum measurement layer; The quantum coding layer is used to perform amplitude coding on the input sample to obtain quantum state data on the corresponding quantum state; The variational quantum layer is used to evolve the quantum state data through a variational quantum circuit to obtain final state data; The quantum measurement layer is used to measure the final state data and use the measurement result as the predicted disease category label of the input sample; Calculating a loss function based on the predicted disease category label of the input sample and its true disease category label; The classical optimizer optimizes the line parameters of the variational quantum circuit according to the loss function; the line parameters are local model parameters; Substituting the optimized line parameters into the variational component quantum layer to implement iterative training of the local client.
[0008] Optionally, the variational quantum circuit includes four quantum bits; each of the quantum bits uses a single quantum bit X gate, Y gate, and Z gate; the expression is: ; ; ; In the formula, is the quantum rotation operator of X-gate, Y-gate and Z-gate, are the rotation angles around the x, y, and z axes respectively, is an imaginary unit, is the identity matrix, are Pauli-X matrix, Pauli-Y matrix and Pauli-Z matrix; A CNOT gate is set between every two quantum bits in sequence, and a ring connection is adopted. The previous quantum bit is used as the control bit of the next quantum bit to realize entanglement between the quantum bits.
[0009] Optionally, the loss function is: ; In the formula, is the total number of input samples, For the The true disease category labels of the input samples, For the The input sample is Predicted value on disease categories; Class break hyperparameters; According to the loss function, the line parameters are optimized using the classical optimizer by adopting the stochastic gradient descent method: ; ; In the formula, To optimize the line parameters before and after, is the learning rate 1, is the disturbance parameter, It means that the error term is about the disturbance parameter The second-order infinitesimal quantity of For The loss function value under the condition.
[0010] Optionally, updating the global model parameters according to the accuracy and the model gradient includes: Calculate the weight of the local client according to the accuracy : ; In the formula, For the The accuracy of local clients after this training cycle, is the total number of local clients; Generate a global model gradient based on the weights and model gradient aggregation : ; In the formula, For the The final model gradient of each local client after this training cycle; Update the global model parameters according to the global model gradient: ; In the formula, For the and The global model parameters after training cycles, is the learning rate 2.
[0011] Optionally, there are multiple local clients, and the training sample set is divided into multiple training sample subsets according to independent synchronous distribution, non-independent identical distribution or long-tail distribution, and each training sample subset is used to train one local client.
[0012] In a second aspect, the present invention provides an electronic device, including a processor and a storage medium; The storage medium is used to store instructions; The processor is used to operate according to the instructions to execute the steps according to the above method.
[0013] In a third aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of the above method when executed by a processor.
[0014] In a fourth aspect, the present invention provides a computer program product, comprising a computer program / instruction, which implements the steps of the above method when executed by a processor.
[0015] Compared with the prior art, the present invention has the following beneficial effects: The present invention provides a medical-assisted diagnosis method and electronic device based on quantum federated learning, which constructs a quantum federated learning model including a local client and a central server, and performs interactive training between the local client and the central server until the global model loss function is lower than a predetermined threshold; the trained quantum federated learning model can utilize quantum advantages to improve the accuracy and efficiency of medical-assisted diagnosis while ensuring the privacy of client data.
[0016] Furthermore, each local client provides a trainable variational quantum neural network for intelligent diagnosis and detection, which effectively protects the privacy of data in the collaborative training process; at the same time, the corresponding quantum circuits are optimized, and the entanglement and expressibility of the quantum circuits are improved. In view of the problem that the heterogeneity of medical data between local clients leads to a decrease in the accuracy of the global model, the present invention designs a dynamic weighted federated aggregation algorithm. The negative impact of data deviations between local clients on the global model is reduced, providing a higher accuracy than parameter average aggregation. Three different data distributions, namely independent and identically distributed, non-independent and identically distributed, and long-tail distribution, are set up to be more suitable for actual medical application scenarios, with better performance in terms of accuracy and convergence, as well as higher security and robustness. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 is a flowchart of the construction and training process of the quantum federated learning model provided by an embodiment of the present invention; Figure 2 It is a block diagram of the construction and training process of the quantum federated learning model provided by an embodiment of the present invention; Figure 3 is a schematic diagram of the structure of a local client provided by an embodiment of the present invention; Figure 4 is a schematic diagram of the structure of a variational quantum circuit provided by an embodiment of the present invention; Figure 5 It is a flow chart of the central server provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0018] The present invention will be further described below in conjunction with the accompanying drawings. The following embodiments are only used to more clearly illustrate the technical solution of the present invention, and cannot be used to limit the protection scope of the present invention.
[0019] Embodiment 1:
[0020] The embodiment of the present invention provides a medical auxiliary diagnosis method based on quantum federated learning. Medical auxiliary diagnosis relies on the quantum federated learning model, such as Figure 1 and 2 As shown in the figure, the construction and training process of the quantum federated learning model includes the following steps: Step S1, obtaining a real medical data set and preprocessing it to generate a sample set, and dividing the sample set into a training sample set and a test sample set according to a preset ratio; Specifically, in this embodiment, the real medical data set used is the Breast Cancer Wisconsin (Diagnostic) data set, which is a medical data resource widely used in the field of breast cancer diagnosis and identification. The data set contains a total of 569 sample records, and each sample provides 30 feature parameters, which mainly cover multiple aspects such as cell nuclear size, morphology, and structural texture. The Breast Cancer Wisconsin (Diagnostic) data set can be obtained by accessing the UCI machine learning library.
[0021] Specifically in this embodiment, the preprocessing includes: The Gaussian filtering method is used to denoise the real medical data in the real medical data set; The real medical data after denoising is normalized to .
[0022] Preprocessing ensures data quality and consistency, while facilitating subsequent loading into the quantum state.
[0023] Step S2: construct a quantum federated learning model, which includes a local client and a central server, and the local client includes a variational quantum neural network.
[0024] like Figure 3 As shown, the variational quantum neural network includes a parameterized quantum circuit and a classical optimizer; The parameterized quantum circuit includes a quantum coding layer, a variational quantum layer, and a quantum measurement layer; The quantum coding layer is used to perform amplitude encoding on the input sample to obtain the quantum state data on the corresponding quantum state; The variational quantum layer is used to evolve the quantum state data through the variational quantum circuit to obtain the final state data; The quantum measurement layer is used to measure the final state data and use the measurement results as the predicted disease category label of the input sample; Calculate the loss function based on the predicted disease category label of the input sample and its true disease category label; The classical optimizer optimizes the line parameters of the variational quantum line according to the loss function; the line parameters are local model parameters; Substitute the optimized line parameters into the variational quantum layer to implement iterative training of the local client.
[0025] The above variational quantum circuit is as follows Figure 4 As shown, it includes four quantum bits; each quantum bit uses a single quantum bit X gate, Y gate and Z gate; its expression is: ; ; ; In the formula, is the quantum rotation operator of X-gate, Y-gate and Z-gate, are the rotation angles around the x, y, and z axes respectively, is an imaginary unit, is the identity matrix, are Pauli-X matrix, Pauli-Y matrix and Pauli-Z matrix; Take a single qubit as an example: Initial state After a The parameters of the gate are , the state becomes This operation changes the angle of the quantum state about the x-axis on the Bloch sphere.
[0026] Then, after another The parameters of the gate are , the state becomes , this operation further changes the position of the quantum state on the Bloch sphere, now rotating around both the y-axis and the x-axis.
[0027] Finally, after a The parameters of the gate are , the state becomes This operation ultimately determines the position of the quantum state on the Bloch sphere by adjusting the parameters of the three rotating gates. , , , the initial state can be evolve to different final states.
[0028] Variational quantum circuit for: ; CNOT gates are set between every two quantum bits in sequence, using a ring connection. The previous quantum bit serves as the control bit of the next quantum bit to achieve entanglement between quantum bits.
[0029] The above loss function is: ; In the formula, is the total number of input samples, For the The true disease category labels of the input samples, For the The input sample is Predicted value on disease categories; Class break hyperparameters; According to the loss function, the stochastic gradient descent method is used to optimize the line parameters using the classic optimizer: ; ; In the formula, To optimize the line parameters before and after, is the learning rate 1, is the disturbance parameter, It means that the error term is about the disturbance parameter The second-order infinitesimal quantity of For The loss function value under the condition.
[0030] Step S3: Repeat the following steps until the preset training cycle is reached to complete the training of the quantum federated learning model: Step S3.1: In the current training cycle, the local client is trained according to the training sample set, and the accuracy of the local client after each training cycle is calculated according to the test sample set; There are multiple local clients, and each local client goes through multiple rounds of iterations in one training cycle.
[0031] The training sample set is divided into multiple training sample subsets according to independent synchronous distribution, non-independent identical distribution or long-tail distribution, and each training sample subset is used to train a local client.
[0032] Independent synchronous distribution is: dividing the training sample set into multiple training sample subsets with the same data volume.
[0033] Non-IID means: the training sample set is divided into multiple training sample subsets according to different feature types. The heterogeneity level of feature types between local clients is divided into high, medium and low levels. In the setting of high heterogeneity level, each local client is ensured to have a relatively small feature subset to maximize the heterogeneity between local clients. In the setting of medium heterogeneity level, each local client is ensured to have some unique feature combinations and also contain some features that overlap with other local clients. In the setting of low heterogeneity level, the feature sets between local clients are highly overlapping, with only a few features being different.
[0034] The specific method for obtaining the high-level heterogeneity is to delete the features that each local client has in common with other local clients, making the remaining features as different as possible from other local clients. The specific method for obtaining the intermediate-level heterogeneity is to retain a part of the features that are the same as other local clients and delete a part of the same features. The specific method for obtaining the low-level heterogeneity is to retain most of the features that are the same as other local clients and delete a small part of the same features.
[0035] The long-tail distribution is: divide the training sample set into multiple training sample subsets according to the frequency of disease categories; the specific division method is to first count the frequency of each category in the training sample set. Calculate the number of samples in each category and its proportion in the training sample set. Then set the proportion of samples in a certain category to be much lower than that of other categories. In each training sample subset, 90% of the data belongs to the most common one or two categories, and the remaining 10% is evenly distributed to the remaining rarer categories. This constitutes the long-tail data.
[0036] Step S3.2: The local client sends its accuracy and final model gradient to the central server after the current training cycle; The central server updates the global model parameters according to the accuracy and model gradient, and returns the updated global model parameters to the local client; like Figure 5 As shown, updating the global model parameters according to the accuracy and model gradient includes: Calculate the weight of the local client based on accuracy : ; In the formula, For the The accuracy of local clients after this training cycle, is the total number of local clients; Generate global model gradients based on weights and model gradient aggregation : ; In the formula, For the The final model gradient of each local client after this training cycle; Update the global model parameters according to the global model gradient: ; In the formula, For the and The global model parameters after training cycles, is the learning rate 2.
[0037] Step S3.3: The local client updates the local model parameters according to the global model parameters and enters the next training cycle.
[0038] After the quantum federated learning model is built and trained, it can be deployed and used: Step S11, obtaining target medical data and performing preprocessing to generate target samples; Step S12: input the target sample into the pre-trained quantum federated learning model to obtain the disease category of the target medical data; The disease categories of the target medical data obtained can provide effective intelligent diagnostic decision support for clinicians.
[0039] Embodiment 2: Based on the above embodiment 1, an embodiment of the present invention provides an electronic device, including a processor and a storage medium; The storage medium is used to store instructions; The processor is used to operate according to the instructions to execute the steps according to the above method.
[0040] Embodiment three: Based on the above-mentioned embodiment 1, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the steps of the above-mentioned method are implemented.
[0041] Embodiment 4: Based on the above-mentioned embodiment 1, an embodiment of the present invention provides a computer program product, including a computer program / instruction, which implements the steps of the above-mentioned method when executed by a processor.
[0042] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Furthermore, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0043] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0044] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0045] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0046] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A medical auxiliary diagnosis method based on quantum federated learning, characterized in that: include: Acquire target medical data and perform preprocessing to generate target samples; Inputting the target sample into a pre-trained quantum federated learning model to obtain the disease category of the target medical data; The acquisition process of the pre-trained quantum federated learning model includes: Acquire a real medical data set and perform preprocessing to generate a sample set, and divide the sample set into a training sample set and a test sample set according to a preset ratio; Constructing a quantum federated learning model, wherein the quantum federated learning model includes a local client and a central server, wherein the local client includes a variational quantum neural network; Repeat the following steps until the preset training cycle is reached to complete the training of the quantum federated learning model: In a current training cycle, the local client is trained according to the training sample set, and the accuracy of the local client after each training cycle is calculated according to the test sample set; The local client sends its accuracy and final model gradient to the central server after the current training cycle; The central server updates the global model parameters according to the accuracy and the model gradient, and returns the updated global model parameters to the local client; The local client updates the local model parameters according to the global model parameters and enters the next training cycle.
2. The medical auxiliary diagnosis method based on quantum federated learning according to claim 1 is characterized in that: The pre-processing comprises: Using a Gaussian filtering method to perform denoising on the real medical data in the real medical data set; The real medical data after denoising is normalized to .
3. The medical auxiliary diagnosis method based on quantum federated learning according to claim 1 is characterized in that: The variational quantum neural network includes a parameterized quantum circuit and a classical optimizer; The parameterized quantum circuit includes a quantum coding layer, a variational quantum layer and a quantum measurement layer; The quantum coding layer is used to perform amplitude coding on the input sample to obtain quantum state data on the corresponding quantum state; The variational quantum layer is used to evolve the quantum state data through a variational quantum circuit to obtain final state data; The quantum measurement layer is used to measure the final state data and use the measurement result as the predicted disease category label of the input sample; Calculating a loss function based on the predicted disease category label of the input sample and its true disease category label; The classical optimizer optimizes the line parameters of the variational quantum circuit according to the loss function; the line parameters are local model parameters; Substituting the optimized line parameters into the variational component quantum layer to implement iterative training of the local client.
4. The medical auxiliary diagnosis method based on quantum federated learning according to claim 3 is characterized in that: The variational quantum circuit includes four quantum bits; each of the quantum bits uses a single quantum bit X gate, Y gate and Z gate; its expression is: ; ; ; In the formula, is the quantum rotation operator of X-gate, Y-gate and Z-gate, are the rotation angles around the x, y, and z axes respectively, is an imaginary unit, is the identity matrix, are Pauli-X matrix, Pauli-Y matrix and Pauli-Z matrix; A CNOT gate is set between every two quantum bits in sequence, and a ring connection is adopted. The previous quantum bit is used as the control bit of the next quantum bit to realize entanglement between the quantum bits.
5. The medical auxiliary diagnosis method based on quantum federated learning according to claim 3 is characterized in that: The loss function is: ; In the formula, is the total number of input samples, For the The true disease category labels of the input samples, For the The input sample is Predicted value on disease categories; Class break hyperparameters; According to the loss function, the line parameters are optimized using the classical optimizer by adopting the stochastic gradient descent method: ; ; In the formula, To optimize the line parameters before and after, is the learning rate 1, is the disturbance parameter, It means that the error term is about the disturbance parameter The second-order infinitesimal quantity of For The loss function value under the condition.
6. The medical auxiliary diagnosis method based on quantum federated learning according to claim 1 is characterized in that: The updating of the global model parameters according to the accuracy and the model gradient comprises: Calculate the weight of the local client according to the accuracy : ; In the formula, For the The accuracy of local clients after this training cycle, is the total number of local clients; Generate a global model gradient based on the weights and model gradient aggregation : ; In the formula, For the The final model gradient of each local client after this training cycle; Update the global model parameters according to the global model gradient: ; In the formula, For the and The global model parameters after training cycles, is the learning rate 2.
7. The medical auxiliary diagnosis method based on quantum federated learning according to claim 1 is characterized in that: There are multiple local clients, and the training sample set is divided into multiple training sample subsets according to independent synchronous distribution, non-independent identical distribution or long-tail distribution, and each training sample subset is used to train one local client.
8. An electronic device, characterized in that: including processor and storage medium; The storage medium is used to store instructions; The processor is configured to operate according to the instructions to execute the steps of the method according to any one of claims 1-7.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Cognitive function evaluation method and system based on data fusion
CN120236721A
A cognitive function evaluation method and system based on data fusion
CN120236721B
Federal learning method, system and device for model isomerism, medium and product
CN120409745A