Crystal diffraction image screening model training method and crystal diffraction image screening method
Through collaborative training and preprocessing methods between the training group and the central server, the screening model of diffraction images is optimized, and the problems of low recognition accuracy and slow speed are solved, and efficient and safe crystal diffraction images are achieved.
Patent Information
- Application Number
- CN202210354459.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-06
- Publication Date
- 2025-08-12
- Estimated Expiration
- 2042-04-06
AI Technical Summary
The existing diffraction image screening methods have low recognition accuracy and are too slow to recognize. The existing deep learning methods have low processing efficiency in light source scenarios with high data traffic and low latency requirements, and cannot meet the needs of high-speed data transmission and storage.
Each training group is used to train the local model based on the local data set, the central server aggregates the model parameters and updates the global model. The global model is optimized through improved KL divergence and data volume weights, and combined with grayscale processing and random cropping preprocessing methods to achieve privacy protection and efficient screening of private data.
It improves the recognition accuracy of crystal diffraction images, enhances the security and confidentiality of private data, reduces the input size of image data, and improves the screening speed.
Smart Images

Figure CN114842290B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a crystal diffraction image screening model training method and a crystal diffraction image screening method. Background Art
[0002] Synchrotron radiation sources, with their high intensity, high brightness, and high collimation, are suitable for conducting cutting-edge basic research across multiple disciplines. For example, using hard X-rays to perform crystal diffraction analysis of macromolecules such as proteins is a common experimental method. However, the average data bandwidth of hard X-ray free electron lasers is 2 to 20 GB / s, with a peak of 100 GB / s. This high-speed data flow places enormous pressure on data storage and transmission, and the high dimensionality of the diffraction images poses significant challenges for subsequent data processing. To alleviate this pressure on subsequent data transmission and storage, deep learning methods can be used to filter and discard invalid image data.
[0003] Training neural network models requires a large amount of image data, which comes from different research groups. Since this data contains opportunities for major scientific discoveries and has high scientific research value, and there are difficulties in protecting data copyright, in order to avoid scientific research losses caused by data leakage, it is necessary to provide a deep learning method based on data privacy protection. One existing deep learning method is the federated learning method. Its principle is to select one of the multiple clients as a central server to aggregate the global model based on the scheduling information of multiple clients, thereby achieving the purpose of protecting client data privacy. Another existing learning method is the semi-supervised federated learning method based on non-LLD data. In this method, the central server randomly selects a certain proportion of clients to participate in the update of the global model, which solves the problem of lack of labeled data in the federated learning method. However, the above learning method is relatively complex, has a large time overhead, and is relatively inefficient in processing high-speed data. It is not suitable for light source scenarios with high data flow and low latency requirements. It also leads to problems such as low accuracy and slow recognition speed of existing diffraction image recognition methods. Summary of the Invention
[0004] The technical problem to be solved by the present invention is that the existing diffraction image screening method has low diffraction image recognition accuracy and too slow recognition speed.
[0005] In order to solve the above technical problems, the present invention provides a crystal diffraction image screening model training method, comprising:
[0006] Each of the training groups trains a corresponding local diffraction image screening model based on its corresponding local training data set to obtain a trained diffraction image screening model corresponding to each of the training groups;
[0007] All the training groups respectively send the model parameters of their corresponding trained diffraction image screening models to the central server;
[0008] The central server aggregates all the model parameters based on a preset aggregation method to obtain a global gradient parameter group, and updates the diffraction image screening global model based on the global gradient parameter group;
[0009] Each of the training groups respectively determines whether the trained diffraction image screening model obtained in its preset training round group meets the preset recognition accuracy condition to obtain a judgment result, and sends the judgment result to the central server;
[0010] The central server determines, based on all the judgment results, whether all the training groups have met the requirement that the recognition rate no longer decreases; if so, the current diffraction image screening global model is used as the trained diffraction image screening global model; otherwise, the current global gradient parameter group is sent to all the training groups respectively, and each training group aligns the corresponding local diffraction image screening model based on the global gradient parameter group to update it, and re-trains the corresponding local diffraction image screening model based on the corresponding local training data set to achieve a new round of training;
[0011] The initial local diffraction image screening model of each training group is sent by the central server, and the initial local diffraction image models of all the training groups are the same. All the training groups have their corresponding local training data sets, and the image data in different local training data sets belong to the crystal diffraction images of different protein molecules.
[0012] Preferably, the model parameters of the trained diffraction image screening model include the gradient parameter group of the trained diffraction image screening model, the preset KL divergence index corresponding to the local training data set, and the number of image data in the local training data set.
[0013] Preferably, the preset KL divergence indicator calculation formula of the local training data set is:
[0014] W=1-D KL (P||q)
[0015] =1-θlog 2 θ-(1-θ)log 2 (1-θ)-1
[0016] = -θlog 2 θ-(1-θ)log 2 (1-θ)
[0017] Wherein, W represents a preset KL divergence indicator, and θ represents the probability of positive image data in the local training dataset.
[0018] Preferably, the central server aggregates all the model parameters based on a preset aggregation method to obtain a global gradient parameter group including:
[0019] Calculating a preset KL divergence index weight and an image data number weight in each of the model parameters, and taking the sum of the preset KL divergence index weight and the image data number weight of each of the model parameters as the comprehensive weight of the corresponding model parameter;
[0020] Based on the comprehensive weight of each of the model parameters, all the gradient parameters in all the gradient parameter groups are weighted and summed up respectively, and a global gradient parameter is obtained based on all the weighted and summed gradient parameters.
[0021] Preferably, the preset training round group is obtained by taking the current training round as a starting point and sequentially obtaining a preset number of training rounds to form the preset training round group.
[0022] Preferably, determining whether the trained diffraction image screening model obtained within a preset training round group of a single training group meets a preset recognition accuracy condition includes:
[0023] The trained diffraction image screening models obtained in the preset training rounds of the training group are all used as recognition models to obtain a recognition model group;
[0024] The accuracy value in each recognition model acquisition process is used as a training accuracy value to obtain a training accuracy value group, and two adjacent training accuracy values in the training accuracy value group are sequentially subtracted based on the round order to obtain an accuracy error group;
[0025] Determine whether all the accuracy errors in the accuracy error group are less than a preset threshold. If so, determine that the training group has completed the recognition rate requirement and no longer needs to be reduced. Otherwise, determine that the training group has not completed the recognition rate requirement and no longer needs to be reduced.
[0026] Preferably, all image data in the local training data set are acquired through the synchrotron radiation device.
[0027] Preferably, all image data in the local training data set are sequentially grayscale processed and randomly cropped.
[0028] Preferably, the grayscale processing method is: converting the image data from a grayscale image of a first bit depth to a grayscale image of a second bit depth; the first bit depth is greater than the second bit depth.
[0029] In order to solve the above technical problems, the present invention also provides a crystal diffraction image screening method, comprising:
[0030] Obtain image data to be filtered;
[0031] Based on the trained diffraction image screening global model, crystal diffraction image screening is performed on the image data to be screened to obtain crystal diffraction image data in the image data to be screened.
[0032] Compared with the prior art, one or more embodiments of the above solutions may have the following advantages or beneficial effects:
[0033] The crystal diffraction image screening model training method provided by the embodiment of the present invention supports the separation of neural network model training data and the global model, realizes the privacy protection of private data, and greatly enhances the security and confidentiality of private data; updates the global model based on the improved KL divergence and data volume weight, greatly improves the recognition accuracy of crystal diffraction images; adopts preprocessing methods such as grayscale processing and random cropping, greatly reduces the input size of image data input, enhances the characteristics of image data, and accelerates the screening speed of crystal diffraction images.
[0034] Other features and advantages of the present invention will be described in the following description, and in part will become apparent from the description, or will be understood by practicing the present invention. The purposes and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] The accompanying drawings are used to provide a further understanding of the present invention and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention and do not constitute a limitation of the present invention. In the accompanying drawings:
[0036] Figure 1 A schematic diagram showing a flow chart of a method for training a crystal diffraction image screening model according to a first embodiment of the present invention is shown;
[0037] Figure 2 A schematic diagram showing the process of the crystal diffraction image screening model training method in Example 1 of the present invention is shown;
[0038] Figure 3 An example diagram showing the original image data and the grayscale processed image data in the first embodiment of the present invention is shown. DETAILED DESCRIPTION
[0039] The following describes the embodiments of the present invention in detail with reference to the accompanying drawings and examples, so that the present invention can fully understand how to apply technical means to solve technical problems and achieve technical effects, and thus implement the invention accordingly. It should be noted that, as long as no conflict exists, the various embodiments of the present invention and the various features of the embodiments can be combined with each other, and the resulting technical solutions are all within the scope of protection of the present invention.
[0040] Training neural network models requires massive amounts of image data, sourced from diverse research groups. This data holds significant scientific value, potentially leading to significant discoveries. However, data copyright protection presents challenges. To prevent research losses from data leaks, deep learning methods that protect data privacy are essential. One existing deep learning method is federated learning, which uses scheduling information from multiple clients to select a central server to aggregate the global model, thereby protecting client data privacy.
[0041] Example 1
[0042] In order to solve the technical problems existing in the prior art, an embodiment of the present invention provides a crystal diffraction image screening model training method.
[0043] Figure 1 A schematic diagram showing a flow chart of a method for training a crystal diffraction image screening model according to a first embodiment of the present invention is shown; Figure 2 FIG1 shows a process diagram of the crystal diffraction image screening model training method in Example 1 of the present invention; ... Figure 1 and Figure 2 As shown, the crystal diffraction image screening model training method according to an embodiment of the present invention includes the following steps.
[0044] In step S101 , the central server sends the initial diffraction image screening model to all training groups.
[0045] Specifically, the central server obtains an initial diffraction image screening model based on the initial gradient parameter set and then sends it to all training groups. This ensures that each training group's initial local diffraction image screening model is sent by the central server, and that all training groups have the same initial local diffraction image model.
[0046] The training groups are research groups conducting hard X-ray crystal diffraction studies of macromolecules such as proteins. Each training group has its own local training dataset, and it should be noted that the image data in different local training datasets represent crystal diffraction images of different protein molecules. All training groups are considered to be all research groups that can participate in and implement the training of the preliminary diffraction image screening model based on their local datasets. It should be noted that the image data in the local training datasets of all training groups is acquired using a synchrotron radiation facility, which produces diffraction images with an average data bandwidth of 2 to 20 GB / s and a peak of 100 GB / s. Furthermore, the image data in all local training datasets undergoes grayscale processing and random cropping. Specifically, grayscale conversion enhances the features of the model input data, while random cropping reduces the size of the model input data. Furthermore, the grayscale processing method specifically converts the image data from grayscale images of a first bit depth to grayscale images of a second bit depth, with the first bit depth being greater than the second bit depth. Preferably, the first bit depth is 16 bits and the second bit depth is 8 bits. Figure 3 This figure shows the original image data and the grayscale processed image data in Example 1 of the present invention. The random cropping method locates the center of the grayscale processed image data, determines the size of the cropped image, and then moves a certain number of pixels around the center before cropping to reduce the size of the model input data.
[0047] In step S102 , each training group trains a corresponding local diffraction image screening model based on its corresponding local training data set to obtain a trained diffraction image screening model corresponding to each training group.
[0048] Specifically, after obtaining the local diffraction image screening model, each training group needs to train its corresponding local diffraction image screening model through its local local training data set to obtain the trained diffraction image screening model corresponding to each training group. It should be noted that each trained diffraction image screening model has its corresponding model parameters. Preferably, the model parameters of the trained diffraction image screening model include the gradient parameter group of the trained diffraction image screening model, the preset KL divergence index of the corresponding local training data set, and the number of image data in the corresponding local training data set. Furthermore, the preset KL divergence index of the local training data set is calculated based on the binary standard distribution 0-1 distribution, and the calculation formula of the preset KL divergence index of the local training data set is:
[0049] W=1-D KL (p||q)
[0050] =1-θlog 2 θ-(1-θ)log2 (1-θ)-1
[0051] = -θlog 2 θ-(1-θ)log 2 (1-θ)
[0052] Where W represents the preset KL divergence metric, and θ represents the probability of positive image data in the local training dataset. The preset KL divergence metric of the local training dataset in each training group is obtained using the above formula.
[0053] It should be noted that the gradient parameter group includes all necessary parameters in the corresponding model, that is, the gradient parameter group does not represent a single parameter, but represents a series of necessary parameters in the corresponding model. Therefore, the gradient parameter group of the trained diffraction image screening model includes all necessary parameters in the trained diffraction image screening model.
[0054] In step S103 , all training groups send the model parameters of their corresponding trained diffraction image screening models to the central server.
[0055] In step S104 , the central server aggregates all model parameters based on a preset aggregation method to obtain a global gradient parameter group, and updates the diffraction image screening global model based on the global gradient parameter group.
[0056] Specifically, after the central server receives the model parameter parameters sent by all training groups, it needs to aggregate all model parameters to obtain the global gradient parameter group. The aggregation method adopted by the central server is as follows: First, the preset KL divergence indicator weight and the image data number weight in each model parameter need to be calculated. The calculation formula for the preset KL divergence indicator weight of each model parameter is:
[0057]
[0058] Among them, i represents the i-th training group among all training groups, ω i represents the preset KL divergence indicator weight of the i-th training group, W i represents the preset KL divergence index of the i-th training group, and A represents the training set formed by all training groups.
[0059] The weight calculation formula for the number of image data for each model parameter is:
[0060]
[0061] Among them, i represents the i-th training group among all training groups, p i Represents the weight of the number of image data of the i-th training group, n irepresents the number of image data of the i-th training group, and A represents the sum of the training sets formed by all training groups.
[0062] Then, based on the preset KL divergence index weights and image data number weights of all model parameters, the sum of the preset KL divergence index weights and image data number weights corresponding to each model parameter is obtained respectively, and the sum of the preset KL divergence index weights and image data number weights corresponding to each model parameter is used as the comprehensive weight of the corresponding model parameter.
[0063] Finally, the global gradient parameter group is calculated based on the comprehensive weight of all model parameters. Furthermore, based on the comprehensive weight of each model parameter, all gradient parameters in all gradient parameter groups are weighted and summed, and the global gradient parameter is obtained based on all the weighted summed gradient parameters. The specific calculation formula for the global gradient parameter group is:
[0064]
[0065] Among them, i represents the i-th training group among all training groups, g s Represents the global gradient parameter group, g i represents the gradient parameter group of the i-th training group, ω i represents the preset KL divergence indicator weight of the i-th training group, p i represents the weight of the number of image data of the i-th training group, and A represents the sum of the training sets formed by all training groups.
[0066] It should be noted that the initial model of the diffraction image screening global model is the initial diffraction image screening model.
[0067] In step S105 , all training groups respectively determine whether the trained diffraction image screening models obtained in their preset training round groups meet the preset recognition accuracy conditions to obtain a determination result, and send the determination result to the central server.
[0068] Specifically, each training group obtains a preset training round group by starting with the current training round and sequentially obtaining a preset number of training rounds to form a preset training round group. Preferably, the preset number is no less than 20. During the training process of the entire global diffraction image screening model, each training group must perform multiple rounds of training on the corresponding local diffraction image screening model. However, after each round of training for all training groups is completed, the central server must aggregate all model parameters using a preset aggregation method. Therefore, in the process of obtaining the preset training round group, it is necessary to start with the current training round and sequentially count a preset number of training rounds to form the preset training group.
[0069] After obtaining the preset training round group, the preset recognition accuracy condition judgment of all training groups can be realized. The process of further judging whether the training completed diffraction image screening model obtained in the preset training round group of a single training group meets the preset recognition accuracy condition includes: taking all the training completed diffraction image screening models obtained in the preset training round group of the training group as recognition models, and then obtaining a preset number of recognition models, and then forming the preset number of recognition models into a recognition model group; obtaining the accuracy values of all recognition models in the recognition model group during the training process, and taking all accuracy values as training accuracy values, and then obtaining a training accuracy value group, and the training accuracy values in the training accuracy value group are sorted according to the training round; and then based on the order All adjacent accuracy values within the training accuracy value group are subtracted pairwise to obtain multiple accuracy errors, and all accuracy errors form an accuracy error group. Finally, a determination is made as to whether all accuracy errors within the accuracy error group are less than a preset threshold. If so, it is determined that the trained diffraction image screening model obtained within the preset training round group of the training group meets the preset recognition accuracy condition, and further, it is determined that the training group has met the recognition rate no longer reduced requirement. Otherwise, it is determined that the trained diffraction image screening model obtained within the preset training round of the training group does not meet the preset recognition accuracy condition, and further, it is determined that the training group has not met the recognition rate no longer reduced requirement. That is, the determination result includes information that the training group has met the recognition rate no longer reduced requirement and information that the training group has not met the recognition rate no longer reduced requirement.
[0070] In step S106, the central server determines whether all training groups have met the recognition rate requirement based on all judgment results. If so, the process goes to step S107. Otherwise, the current global gradient parameter group is sent to all training groups respectively. Each training group updates its corresponding local diffraction image screening model based on the global gradient parameter group, and the process goes to step S102 to implement a new round of training.
[0071] Specifically, after the central server receives the judgment results sent by all training groups, it determines whether all training groups have completed the recognition rate requirement and no longer needs to be reduced based on all judgment groups. If so, it goes to step S107. Otherwise, the central server needs to send the current global gradient parameter group to all training groups respectively. Each training group then updates its corresponding local diffraction image screening model based on the global gradient parameter group, and goes to step S102 to realize a new round of training.
[0072] In other words, only when all the judgment results received by the central server are the information that the recognition rate no longer decreases, it means that the currently acquired diffraction image screening global model has met the training requirements. Once at least one training group has not reached the requirement that the recognition accuracy rate no longer decreases, all training groups need to proceed to the next round of training.
[0073] In step S107 , the central server uses the current diffraction image screening global model as the trained diffraction image screening global model.
[0074] The crystal diffraction image screening model training method provided by the embodiment of the present invention supports the separation of neural network model training data and the global model, realizes the privacy protection of private data, and greatly enhances the security and confidentiality of private data; updates the global model based on the improved KL divergence and data volume weight, greatly improving the recognition accuracy of crystal diffraction images; adopts preprocessing methods such as grayscale processing and random cropping, greatly reduces the input size of image data input, enhances the characteristics of image data, and accelerates the screening speed of crystal diffraction images.
[0075] Example 2
[0076] To solve the technical problems existing in the prior art, an embodiment of the present invention provides a method for screening crystal diffraction images. The method for screening crystal diffraction images in an embodiment of the present invention includes the following steps.
[0077] Step S201: Obtain image data to be filtered.
[0078] Specifically, the image data to be screened is acquired via a synchrotron radiation device. The average data bandwidth of the diffraction images generated by this device is 2 to 20 GB / s, with a peak of 100 GB / s. Furthermore, the image data to be screened also needs to undergo grayscale processing and random cropping. That is, grayscale transformation of the image data can enhance the features of the model input data, while random cropping of the image data can reduce the size of the model input data. Furthermore, the grayscale processing method specifically converts the image data from a grayscale image of a first bit depth to a grayscale image of a second bit depth; and the first bit depth is greater than the second bit depth. Preferably, the first bit depth is 16 bits and the second bit depth is 8 bits. The random cropping method performs center positioning on the grayscale-processed image data, determines the size of the cropped image, and then moves a number of pixels from the center to the surrounding areas before cropping to reduce the size of the model input data.
[0079] Step S202 : performing crystal diffraction image screening on the image data to be screened based on the trained diffraction image screening global model obtained in Example 1 to obtain crystal diffraction image data in the image data to be screened.
[0080] The crystal diffraction image screening method provided by an embodiment of the present invention uses a global model for training diffraction image screening to support the separation of neural network model training data and the global model, thereby realizing privacy protection of private data and greatly enhancing the security and confidentiality of private data.
[0081] Although the embodiments disclosed herein are as described above, the contents described herein are merely embodiments for facilitating understanding of the present invention and are not intended to limit the present invention. Any person skilled in the art may make any modifications and variations in the form and details of the embodiments without departing from the spirit and scope of the present invention. However, the scope of protection of the present invention shall remain subject to the scope defined by the appended claims.
Claims
1. A crystal diffraction image screening model training method, comprising: Each training group trains a corresponding local diffraction image screening model based on its corresponding local training data set to obtain a trained diffraction image screening model corresponding to each training group; model parameters of the trained diffraction image screening model include a gradient parameter group of the trained diffraction image screening model, a preset KL divergence index corresponding to the local training data set, and the number of image data in the local training data set; All the training groups send the model parameters of their corresponding trained diffraction image screening models to the central server respectively; The central server aggregates all the model parameters based on a preset aggregation method to obtain a global gradient parameter group, and updates the diffraction image screening global model based on the global gradient parameter group; Each of the training groups respectively determines whether the trained diffraction image screening model obtained in its preset training round group meets the preset recognition accuracy condition to obtain a judgment result, and sends the judgment result to the central server; The central server determines, based on all the judgment results, whether all the training groups have met the requirement that the recognition rate no longer decreases; if so, the current diffraction image screening global model is used as the trained diffraction image screening global model; otherwise, the current global gradient parameter group is sent to all the training groups respectively, and each training group updates its corresponding local diffraction image screening model based on the global gradient parameter group, and re-trains the corresponding local diffraction image screening model based on its corresponding local training data set to achieve a new round of training; The initial local diffraction image screening model of each training group is sent by the central server, and the initial local diffraction image models of all the training groups are the same, all the training groups have their corresponding local training data sets, and the image data in different local training data sets belong to crystal diffraction images of different protein molecules; The central server aggregates all the model parameters based on a preset aggregation method to obtain a global gradient parameter group including: Calculating a preset KL divergence index weight and an image data number weight in each of the model parameters, and taking the sum of the preset KL divergence index weight and the image data number weight of each of the model parameters as the comprehensive weight of the corresponding model parameter; performing weighted summation processing on all gradient parameters in all of the gradient parameter groups based on the comprehensive weight of each of the model parameters, and obtaining a global gradient parameter based on all the weighted summed gradient parameters; The preset KL divergence index of the local training data set is: W=1-D KL (P||q) =1-θlog 2 θ-(1-θ)log 2 (1-θ)-1 =-θlog 2 θ-(1-θ)log 2 (1-θ) Wherein, W represents a preset KL divergence indicator, and θ represents the probability of positive image data in the local training dataset.
2. The training method according to claim 1, characterized in that The preset training round group is obtained by taking the current training round as the starting point and sequentially obtaining a preset number of training rounds to form the preset training round group.
3. The training method according to claim 2, characterized in that Determining whether the trained diffraction image screening model obtained within a preset training round group of a single training group meets the preset recognition accuracy condition includes: All the trained diffraction image screening models obtained in the preset training round group of the training group are used as recognition models to obtain a recognition model group; The accuracy value in each recognition model acquisition process is used as a training accuracy value to obtain a training accuracy value group, and two adjacent training accuracy values in the training accuracy value group are sequentially subtracted based on the round order to obtain an accuracy error group; Determine whether all the accuracy errors in the accuracy error group are less than a preset threshold. If so, determine that the training group has completed the recognition rate requirement and no longer needs to be reduced. Otherwise, determine that the training group has not completed the recognition rate requirement and no longer needs to be reduced.
4. The training method according to claim 1, characterized in that All image data in the local training data set are acquired through a synchrotron radiation device.
5. The training method according to claim 1, wherein: All image data in the local training dataset are sequentially grayscale processed and randomly cropped.
6. The training method according to claim 5, characterized in that The grayscale processing method is: converting the image data from a grayscale image of a first bit depth to a grayscale image of a second bit depth; the first bit depth is greater than the second bit depth.
7. A crystal diffraction pattern screening method comprising: Obtain image data to be filtered; The diffraction image screening global model trained based on the crystal diffraction image screening model training method described in any one of claims 1 to 6 performs crystal diffraction image screening on the image data to be screened to obtain crystal diffraction image data in the image data to be screened.