Diabetic retinopathy diagnosis and treatment system based on federated learning
By introducing differential privacy encryption, asymmetric communication, and the FocalLoss loss function into the federated learning system, the problems of low segmentation accuracy and insufficient privacy protection in diabetic retinopathy are solved, achieving image segmentation with high security and high accuracy.
Patent Information
- Application Number
- CN202310660211.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-06
- Publication Date
- 2026-01-06
- Estimated Expiration
- 2043-06-06
AI Technical Summary
Existing technologies using federated learning for grading diabetic retinopathy have significant room for improvement in segmentation accuracy and lack effective privacy protection measures.
A federated learning-based diagnostic system is adopted, which uses differential privacy for model encryption and asymmetric encryption for communication. In addition, the FocalLoss loss function is used to adjust the sample difficulty and inter-class weights, and the weighted federated averaging algorithm is combined to optimize model training.
This approach improves the segmentation accuracy of diabetic retinopathy images while protecting privacy, ensuring the security of client data and the effectiveness of the model.
Smart Images

Figure CN116630353B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of big data processing and deep learning, specifically to a diagnostic and treatment system for diabetic retinopathy based on federated learning. Background Technology
[0002] Federated learning is an emerging distributed machine learning architecture. In today's context of increasing emphasis on privacy protection and the difficulty of directly collecting and centrally exchanging data, the conflict between the need for massive training data and compliance with privacy protection has become increasingly prominent. Federated learning tasks are solved by a loosely distributed federation of participating devices (clients), coordinated by a central server. It builds machine learning models based on datasets distributed across multiple devices, while preventing data leakage. As a new framework and distributed machine learning technology, it achieves collaborative modeling, improves model performance, and ultimately addresses data silos while ensuring data privacy, security, and legal compliance.
[0003] Diabetic retinopathy (DR) is an eye disease caused by high blood sugar and high blood pressure that damages the blood vessels in the retina at the back of the eye and can lead to diabetic retinopathy. Nearly one-third of people with diabetes have some degree of diabetic retinopathy, and all people with diabetes are at risk of developing the disease. Ophthalmologists need to spend a significant amount of time accurately classifying diabetic retinopathy, which is a huge challenge for beginners.
[0004] Most existing research focuses on image-level classification tasks for DR, which is not convincing to patients. However, applying DR lesion segmentation and recognition algorithms, which are the basis for evaluating DR grading, to relevant diagnostic systems will provide interpretability for the diagnostic systems and further promote the application of deep learning methods in the clinical application of DR.
[0005] Existing technologies for classifying DR using federated learning still have many shortcomings, such as significant room for improvement in segmentation accuracy. Summary of the Invention
[0006] This invention was made to solve the above-mentioned problems, and its purpose is to provide a diagnostic and treatment system for diabetic retinopathy based on federated learning.
[0007] This invention provides a federated learning-based diagnostic and treatment system for diabetic retinopathy, comprising a server and multiple clients. Each client contains multiple diabetic retinopathy image data as local data and a federated model for segmenting the diabetic retinopathy image data to be segmented according to lesion type to obtain a predicted segmented image. The federated model is obtained using the following method: Step S1, initializing the server and each client; Step S2, each client establishes a communication connection with the server until the number of clients connected to the server exceeds a threshold; Step S3, each client connected to the server performs data processing on its local data. According to the preprocessing, preprocessed data is obtained; in step S4, the server constructs a federated global model based on its own configuration data, and then sends the federated global model to each client connected to the server; in step S5, each client iteratively trains the federated global model based on the preprocessed data, and after training is completed, sends the obtained learning data to the server; in step S6, the server aggregates all learning data according to the weighted federated average, updates the federated global model according to the aggregation result, and then sends the updated federated global model to each client; in step S7, steps S5 to S6 are repeated until the training completion condition is met, and the trained federated global model is the federated model.
[0008] The diabetic retinopathy diagnosis and treatment system based on federated learning provided by this invention may also have the following features: Step S3 includes the following sub-steps: Step S3-1, performing fast contour segmentation on the diabetic retinopathy image data according to the segmentation threshold to obtain multiple contours, each contour containing multiple contour inflection points; Step S3-2, selecting the contour with the most contour inflection points as the final contour of the diabetic retinopathy image data; Step S3-3, determining the top, bottom, left, and right vertices of the final contour, and then performing center cropping on the diabetic retinopathy image data according to the top, bottom, left, and right vertices to obtain an image without black borders; Step S3-4, scaling the image without black borders according to a uniform size to obtain scaled data, and using the scaled data corresponding to all diabetic retinopathy image data in the local data as preprocessed data.
[0009] The federated learning-based diagnostic and treatment system for diabetic retinopathy provided by this invention may also have the following feature: wherein, in step S6, the expression for the weighted federated average is: In the formula, FedAvg_weights is the weighted federated average, n is the total number of clients connected to the server, and a i Let D be the contribution value of the i-th client, where D is the influence factor of the corresponding client on the federated global model. i This refers to the learning data sent to the server by the i-th client.
[0010] The diabetic retinopathy diagnosis and treatment system based on federated learning provided by this invention may also have the following features: the contribution value of the client is calculated in the following ways: based on the annotation quality of the client's local data; or based on the total number of iterations trained by the client in this iteration of training the federated global model; or based on the segmentation accuracy of the federated global model obtained by the client through this iteration of training; or based on the amount of local data of the client.
[0011] The diabetes retinopathy diagnosis and treatment system based on federated learning provided by this invention may also have the following features: wherein, in step S5, the learning data includes federated learning state synchronization information, model weights, and model evaluation data; the federated learning state synchronization information includes the global round and local round during the current iteration training; the model weights include the parameters of the federated global model after iterative training as weight parameters; and the model evaluation data includes the accuracy obtained by evaluating the segmentation accuracy of the federated global model after iterative training.
[0012] The federated learning-based diabetic retinopathy diagnosis and treatment system provided by this invention may also have the following features: Asymmetric encryption is used for communication encryption of the transmitted learning data, and differential privacy is used for model encryption of the model weights. Differential privacy includes adding noise to the weight parameters and using a differential privacy stochastic gradient descent algorithm for gradient noise reduction and clipping. The expression for adding noise to the weight parameters is as follows: w' = w + randen(mean, std), where w' is the weight parameter after noise addition, w is the weight parameter before noise addition, randn() is a Gaussian noise function, mean is the set mean, and std is the set standard deviation. The expression for using a differential privacy stochastic gradient descent algorithm for gradient noise reduction and clipping is as follows: param.grad = stack(clip(batch_ The formula is: batch_sample_param.grad)), param' = param - lr * param.grad, param” = param' + Normal(mean = 0, std = std.sample(param.shape), where batch_sample_param.grad is the gradient of the batch sampled data, clip() is the clipping function, stack() is the concatenation function, lr is the learning rate, param is the weight parameters before model encryption, Normal(mean = 0, std = std.sample(param.shape) is the normal distribution method, mean is the set mean, std is the set standard deviation, and param” is the weight parameters after model encryption.
[0013] The federated learning-based diabetic retinopathy diagnosis and treatment system provided by this invention may also have the following features: the loss function used when training the federated global model includes the FocalLoss loss function; a diabetic retinopathy image is selected from the preprocessed data as a sample, and the FocalLoss loss function is used to calculate the Loss result on the sample. Focal The calculation result is Loss Focal The expression is: In the formula, C represents the total number of lesion types, and α i Let y be the class weight of the i-th category. i Let i be the unique hot code of the label of the i-th category of this sample. γ is the predicted output probability of the label of the i-th class of this sample, and γ is a modulation parameter greater than or equal to 0.
[0014] The role and effect of invention
[0015] The federated learning-based diabetic retinopathy diagnosis and treatment system of the present invention achieves better security and protects the privacy of each client by using differential privacy for model encryption and asymmetric encryption for communication encryption. Furthermore, by adjusting the influence of easy and difficult samples and inter-class weights on the federated model through the FocalLoss loss function, the trained federated model achieves better segmentation accuracy. Therefore, the federated learning-based diabetic retinopathy diagnosis and treatment system of the present invention can obtain accurate segmentation results for diabetic retinopathy image data requiring privacy protection. Attached Figure Description
[0016] Figure 1 This is a schematic diagram of the framework of the diagnostic and treatment system for diabetic retinopathy in an embodiment of the present invention;
[0017] Figure 2 This is a schematic diagram of the process for obtaining the federated model in an embodiment of the present invention;
[0018] Figure 3 This is a schematic diagram illustrating the preprocessing of local data in an embodiment of the present invention;
[0019] Figure 4 A schematic diagram of asymmetric encryption for communication in an embodiment of the present invention;
[0020] Figure 5 This is a visual diagram illustrating the client and server during the training process in an embodiment of the present invention;
[0021] Figure 6 This is a schematic diagram illustrating the communication interaction between the client and the server in an embodiment of the present invention;
[0022] Figure 7 This is a schematic diagram of diabetic retinopathy image data and corresponding label images in an embodiment of the present invention;
[0023] Figure 8 This is a schematic diagram illustrating the segmentation results of diabetic retinopathy image data using three federated models in an embodiment of the present invention. Detailed Implementation
[0024] To make the technical means, creative features, objectives and effects of this invention easy to understand, the following embodiments, in conjunction with the accompanying drawings, specifically illustrate the Diabetic Retinopathy Diagnosis and Treatment System based on Federated Learning of this invention.
[0025] Figure 1 This is a schematic diagram of the framework of the diagnostic and treatment system for diabetic retinopathy in an embodiment of the present invention.
[0026] like Figure 1 As shown, the diabetic retinopathy diagnosis and treatment system 100 includes a server 10 and multiple clients 20. Each client 20 contains multiple diabetic retinopathy image data as local data and a federated model that segments the diabetic retinopathy image data to be segmented according to the lesion type to obtain a predicted segmented image.
[0027] Figure 2 This is a schematic diagram of the process for obtaining the federation model in an embodiment of the present invention.
[0028] like Figure 2 As shown, the federated model is obtained using the following method:
[0029] Step S1: Initialize the server 10 and each client 20.
[0030] In this embodiment, the specific process of initializing the server 10 is as follows: loading server configuration, initializing flask-app, initializing log module, initializing privacy module, initializing global model algorithm module, registering listening events, initialization completed, and starting the server 20.
[0031] In this embodiment, the specific initialization process of client 20 is as follows: loading client configuration, establishing a websocket connection, initializing the log module, initializing the privacy module, initializing the local model algorithm module, registering listening events, initialization complete, client 10 wakes up and sends the client_wakeup event, and blocks the current thread until disconnecting from server 10 using socketio.wait().
[0032] In step S2, each client 20 establishes a communication connection with the server 10 until the number of clients 20 connected to the server 10 exceeds a threshold.
[0033] In step S3, each client 20 connected to the server 10 performs data preprocessing on its local data to obtain preprocessed data.
[0034] Step S3 includes the following sub-steps:
[0035] Step S3-1: Perform fast contour segmentation on the diabetic retinopathy image data according to the segmentation threshold to obtain multiple contours. Each contour contains multiple contour inflection points. In this embodiment, the findContours function of OpenCV is used for fast contour segmentation. The segmentation threshold is set to 20, and only the external contours are detected and only the contour inflection point information is saved.
[0036] Step S3-2: Select the contour with the most contour inflection points as the final contour of the diabetic retinopathy image data.
[0037] Step S3-3: Determine the top, bottom, left, and right vertices of the final contour, and then perform center cropping on the diabetic retinopathy image data based on the top, bottom, left, and right vertices to obtain an image without black borders.
[0038] Steps S3-4: Scale the image without black borders according to a uniform size to obtain scaled data. Use the scaled data corresponding to all diabetic retinopathy image data in the local data as preprocessing data. In this embodiment, the preprocessing data includes cropped and scaled diabetic retinopathy image data and corresponding cropped and scaled label images. The label images are cropped by centering according to the final outline of the diabetic retinopathy image data, and the scaled and adjusted size is a uniform size.
[0039] Figure 3 This is a schematic diagram illustrating the preprocessing of local data in an embodiment of the present invention.
[0040] like Figure 3 As shown, (a) is the image data of diabetic retinopathy before data preprocessing, (b) the white circle is the final contour obtained by fast contour segmentation, (c) is the scaled data after center cropping based on the final contour and then scaling, (d) is the label image corresponding to the image data of diabetic retinopathy, and the white dots in the figure are label points, (e) the white circle is the final contour of the image data of diabetic retinopathy corresponding to the label image, and (f) is the label image after center cropping based on the final contour and then scaling.
[0041] In step S4, the server 10 constructs a federated global model based on its own configuration data, and then sends the federated global model to each client 20 connected to the server 10.
[0042] In step S5, each client 20 iteratively trains the federated global model based on the preprocessed data, and after training, sends the obtained learning data to the server 10.
[0043] The learning data includes federated learning state synchronization information, model weights, and model evaluation data. The federated learning state synchronization information includes the global round and local round during the current iteration of training. The model weights include the parameters of the federated global model after iterative training as weight parameters. The model evaluation data includes the accuracy obtained by evaluating the segmentation accuracy of the federated global model after iterative training. In this embodiment, the server 10 sends the federated global model to each client 20 and updates the federated global model according to the feedback learning data for one global round. The local round is the number of rounds in which the client 20 trains the federated global model using the training set in the preprocessed data in one global round. Each local round uses all the training data in the training set. The segmentation accuracy evaluation uses the test set in the preprocessed data, and the accuracy is calculated based on the difference between the model's predicted value and the true value.
[0044] The loss function used in training the federated global model includes FocalLoss. A diabetic retinopathy image is selected as a sample from the preprocessed data, and the FocalLoss loss function is used to calculate the loss result. Focal The calculation result is Loss Focal The expression is:
[0045]
[0046] In the formula, C represents the total number of lesion types, and α i Let y be the class weight of the i-th category. i Let i be the unique hot code of the label of the i-th category of this sample. γ is the predicted output probability of the label of the i-th class of this sample, and γ is a modulation parameter greater than or equal to 0.
[0047] In this embodiment, the FocalLoss loss function is used to improve the training situation of imbalanced data with both easy and difficult samples. The modulation term is used to adjust the easy and difficult samples. The easy and difficult samples include easy samples and difficult samples. Easy samples often have a higher prediction output probability than difficult samples. The corresponding modulation term makes the contribution of easy samples to the loss less than the contribution of difficult samples to the loss, thereby achieving simultaneous adjustment of inter-class weights and easy and difficult samples.
[0048] In this embodiment, data augmentation was also used when training the federated global model, and sliding window inference was used during the inference process.
[0049] In this embodiment, communication encryption is performed using asymmetric encryption on the transmitted learning data, and differential privacy is used to encrypt the model weights. Differential privacy includes adding noise to the weight parameters and using the differential privacy stochastic gradient descent algorithm to add noise and prune the gradients. In this embodiment, only the method of adding noise to the weight parameters is used for model encryption.
[0050] The expression for adding noise to the weight parameters is as follows:
[0051] w' = w + randn(mean, std, ...
[0052] In the formula, w' is the weight parameter after adding noise, w is the weight parameter before adding noise, randn() is the Gaussian noise function, mean is the set mean, and std is the set standard deviation.
[0053] The expression for gradient clipping with noise using the differential privacy stochastic gradient descent algorithm is as follows:
[0054] param.grad=stack(clip(batch_sample_param.grad,param'=param-lr*param.grad,
[0055] param”=param'+Normal(mean=0,std=std.sample(param.shape),
[0056] In the formula, batch_sample_param.grad is the gradient of the batch sampled data, clip() is the clipping function, stack() is the concatenation function, lr is the learning rate, param is the weight parameters of the model before encryption, Normal(mean=0, std=std.sample(param.shape) is the normal distribution method, mean is the set mean, std is the set standard deviation, and param” is the weight parameters of the model after encryption.
[0057] Figure 4 A schematic diagram of asymmetric encryption for communication in an embodiment of the present invention.
[0058] like Figure 4As shown, the specific process of asymmetric encryption in communication is as follows: When the server 10 initializes, it sends its server public key (server public-key) to the initialized client 20. When the client 20 initializes, it sends its client public key (client public-key) to the initialized server 10. The server 10 uses the client public key to encrypt the data to be sent to the client 20, obtaining encrypted data (encoded-data). The client 20 uses its client private key (client private-key) to decrypt the received encrypted data, thereby achieving asymmetric encrypted communication between the server 10 and the client 20.
[0059] In step S6, the server 10 aggregates all learning data based on the weighted federated average, updates the federated global model based on the aggregation results, and then sends the updated federated global model to each client 20.
[0060] The weighted federal average is expressed as follows:
[0061]
[0062] In the formula, FedAvg_weights is the weighted federated average, n is the total number of clients 20 connected to server 10, and a i Let D be the contribution value of the i-th client 20, where D is the influence factor of the corresponding client 20 on the federated global model. i In this embodiment, D represents the learning data sent by the i-th client 20 to the server 10. i For loss, accuracy, or model parameter data.
[0063] The contribution value of client 20 is calculated in the following ways: based on the labeling quality of the local data of client 20; or based on the total number of iterations of training of the federated global model in this iteration; or based on the segmentation accuracy of the federated global model obtained by client 20 through this iteration; or based on the amount of local data of client 20. In this embodiment, the contribution value is based on the amount of local data of client 20, that is, client 20 with more local training data has a greater impact on the federated model.
[0064] Step S7: Repeat steps S5 to S6 until the training completion condition is met. The completed federated global model is the federated model. In this embodiment, the training completion condition is a pre-set server training round. Each client 20 also has its own corresponding local training round for training the federated global model in the current server training round.
[0065] Figure 5 This is a visual diagram illustrating the client and server during the training process in an embodiment of the present invention.
[0066] like Figure 5 As shown, server 10 is connected to multiple clients 20, including client-1, client-2, and client-3. Server 10 has completed federated computation of evaluation data and training data in round 3633. Clients-1, client-2, and client-3 have all completed model evaluation in round 3633 and are currently training the model in round 3634, with progress rates of 11.1%, 9.9%, and 12.7%, respectively. In this embodiment, resource checking refers to whether the current client 20 has sufficient computing resources to participate in federated learning, or whether its status meets the requirements for participation, such as during idle periods like charging or at night.
[0067] Figure 6 This is a schematic diagram illustrating the communication and interaction between the client and the server in an embodiment of the present invention.
[0068] like Figure 5 As shown, after server initialization, server 10 is started. Server 10 starts listening for multiple events, including client connection, client disconnection, client reconnection, server public key request, client public key acquisition, client wake-up, client ready, client resource completion, client local update completion of training data federated computation, client global evaluation completion of evaluation data federated computation, and client training completion. After client initialization, client 20 is started. Client 20 starts listening for multiple events, including connecting to the server, disconnecting from the server, reconnecting to the server, client public key request, server public key acquisition, client ending federated learning, client global evaluation, client local update, client resource check, and client initialization.
[0069] Listening: Client public key request and Listening: Client public key retrieval, as well as Listening: Server public key request and Listening: Server public key retrieval, are all interconnected and used for sending and receiving server public keys and client public keys between server 10 and client 20.
[0070] Listening: Client connection and listening: connection to server, listening: client disconnection and listening: server disconnection, and listening: client reconnection and listening: server reconnection are all corresponding to each other and are used for connection, disconnection and reconnection between server 10 and client 20.
[0071] The communication and interaction process during the training of the federated global model is as follows:
[0072] After client 20 starts, server 10 listens for the following: Client Wake-up: Upon receiving the wake-up signal, server 10 processes it and sends an initialization signal. Client 20 listens for the following: Upon receiving the Client Initialization signal, server 10 initializes the local model of the algorithm module. Server 10 listens for the following: Upon receiving the signal indicating the client is ready, server 10 sends a signal requesting a check of client resources. If training is not finished (fin = False), client 20 listens for the following: Upon receiving the signal indicating the client resource check is complete, server 10 requests to start the next round of training. If client resources do not meet the conditions, server 10 requests another check of client resources. If client resources meet the conditions, server 10 sends the federated global model to client 20. Client 20 listens for the following: Upon receiving the signal indicating the client is locally updated... Local updates involve training the model using the training set until the server 10 receives a signal indicating that the client's local update of training data is complete and the federated computation is finished. The client 20's federated global model then completes its current training round. The server 10 sends a global evaluation signal, which the client 20 receives. The client 20 then performs a global evaluation, testing the trained model using the test set to obtain evaluation data. The server 10 receives a signal indicating that the client's global evaluation is complete and the federated computation of evaluation data is finished. Based on all trained models and evaluation data, the server performs federated computation, updates the federated global model, and sends a signal requesting the server to check client resources, thus initiating the next round of federated computation. When training ends (fin = True), the client 20 receives a signal indicating that the federated learning has ended. The client 20 then obtains the trained federated global model as its federated model.
[0073] In this embodiment, federated global model training is performed on different clients 20 based on UNet, ResUNet, and ResUNet (imagenet) networks, and connected to the server 10, respectively, to obtain the corresponding trained federated models, namely the federated model based on UNet, the federated model based on ResUNet, and the federated model based on ResUNet (imagenet).
[0074] Figure 7 This is a schematic diagram of diabetic retinopathy image data and corresponding label images in an embodiment of the present invention.
[0075] like Figure 7 As shown, (a) is the original fundus image of diabetic retinopathy used to test three federated models, (b) is the labeled image of the diabetic retinopathy image data, and (c) from left to right are the lesion labels of the four lesions in the labeled image, namely EX, HE, MA and SE.
[0076] Figure 8 This is a schematic diagram illustrating the segmentation results of diabetic retinopathy image data using three federated models in an embodiment of the present invention.
[0077] like Figure 8 As shown, (a) shows the prediction results (i.e., segmentation results) of the four lesion types EX, HE, MA, and SE in the original fundus image by the federated model based on the UNet network from left to right; (b) shows the prediction results (i.e., segmentation results) of the four lesions EX, HE, MA, and SE in the original fundus image by the federated model based on the ResUNet network from left to right; and (c) shows the prediction results (i.e., segmentation results) of the four lesions EX, HE, MA, and SE in the original fundus image by the federated model based on the ResUNet (ImageNet) network from left to right. It can be seen that the segmentation results of the three federated models trained have a high degree of consistency with the lesion labels. Therefore, the diabetic retinopathy diagnosis and treatment system based on federated learning of the present invention can achieve good segmentation results for the image data of diabetic retinopathy to be segmented.
[0078] The role and effect of the embodiments
[0079] According to the federated learning-based diabetic retinopathy diagnosis and treatment system involved in this embodiment, on the one hand, differential privacy is used for model encryption, and asymmetric encryption is used for communication encryption, which makes the entire federated learning process more secure and protects the privacy of each client. On the other hand, the FocalLoss loss function is used to adjust the influence of easy and difficult samples and inter-class weights on the federated model, so that the trained federated model has better segmentation accuracy. In summary, this method can obtain accurate segmentation results for diabetic retinopathy image data that requires privacy protection.
[0080] The above embodiments are preferred embodiments of the present invention and are not intended to limit the scope of protection of the present invention.
Claims
1. A diabetic retinopathy diagnosis and treatment system based on federated learning, comprising a server and a plurality of clients, each client comprising a plurality of diabetic retinopathy image data as local data and a federated model for segmenting diabetic retinopathy image data to be segmented according to lesion type to obtain a predicted segmentation image, characterized in that, The federal model is obtained by the following method: Step S1, initializing the service end and each client; Step S2, each client is connected to the service end until the number of clients connected to the service end is greater than a threshold value; Step S3, each client connected to the service end respectively preprocesses the local data to obtain preprocessed data; Step S4, the service end constructs a federal global model according to its own configuration data, and sends the federal global model to each client connected to the service end; Step S5, each client respectively iteratively trains the federal global model according to the preprocessed data, and then sends the obtained learning data to the service end after training is completed; Step S6, the service end aggregates all the learning data according to the weighted federal average, and updates the federal global model according to the aggregation result, and then sends the updated federal global model to each client; Step S7, repeat the steps S5 to S6 until the training is completed, and the federal global model trained is the federal model, In step S6, the expression of the weighted federal average is: , In the formula The weighted federal average. The total number of clients connected to the server. For the first The contribution value of each client, wherein the contribution value is the influence factor of the corresponding client on the federated global model. For the first The learning data sent by the client to the server.
2. The diabetic retinopathy diagnosis and treatment system based on federal learning according to claim 1, characterized in that: wherein The step S3 includes the following sub-steps: Step S3-1, performing fast contour segmentation on the diabetic retinopathy image data according to a segmentation threshold to obtain a plurality of contours, the contours containing a plurality of contour inflection points; Step S3-2, selecting the contour with the most number of contour inflection points as the final contour of the diabetic retinopathy image data; Step S3-3, determining the upper, lower, left and right vertices of the final contour, and then performing center cropping on the diabetic retinopathy image data according to the upper, lower, left and right vertices to obtain a black border-free image; Step S3-4, performing size scaling on the black border-free image according to a uniform size to obtain scaling data, and taking the scaling data corresponding to all the diabetic retinopathy image data in the local data as the preprocessed data.
3. The federated learning based diabetic retinopathy diagnosis and treatment system of claim 1, Characterized in that: Wherein, The calculation method of the contribution value corresponding to the client includes: According to the annotation quality of the local data of the client; or According to the total number of iteration training times of the client in this iteration training of the federal global model; or According to the segmentation accuracy of the federal global model obtained by the client through this iteration training; or According to the data quantity of the local data of the client.
4. The diabetic retinopathy diagnosis and treatment system based on federal learning according to claim 1, characterized in that: wherein In step S5, the learning data includes federal learning state synchronization information, model weight and model evaluation data, The federal learning state synchronization information includes the global round and the local round at the current iteration training, The model weight includes the parameters of the federal global model after iteration training as weight parameters, The model evaluation data includes an accuracy rate obtained by performing segmentation accuracy evaluation on the federated global model after iterative training.
5. The diabetic retinopathy diagnosis and treatment system based on federated learning according to claim 4, characterized in that: wherein, The learning data is encrypted using an asymmetric encryption method for communication encryption, and the model weight is encrypted using differential privacy, including weight parameter noise addition and gradient noise addition and clipping using a differential privacy stochastic gradient descent algorithm, The expression of the weight parameter noise addition is as follows: , wherein is the weight parameter after adding noise, is the weight parameter before adding noise, () is a Gaussian noise function, is the set mean value, is the set standard deviation, The expression of the gradient noise addition and clipping using the differential privacy stochastic gradient descent algorithm is as follows: , , , wherein is the gradient of the batch sampling data, is a clipping function, is a concatenation function, is the learning rate, is the weight parameter before model encryption, is a normal distribution method, is the set mean, is the set standard deviation, is the weight parameter after model encryption.
6. The diabetic retinopathy diagnosis and treatment system based on federated learning according to claim 1, characterized in that: wherein The loss function used when training the federated global model includes a loss function FocalLoss, Select one of the diabetic retinopathy image data as a sample from the preprocessed data, and calculate the sample by using the loss function FocalLoss to obtain a calculation result The expression of the calculation result is , In the formula is the total number of classes of the lesion type, is the class weight of the th class, is the one-hot code of the label of the th class of the sample, is the predicted output probability of the label of the th class of the sample, is a modulation parameter greater than or equal to 0.