Chromosome polarity identification method and system based on deep learning
1. A chromosome polarity identification method based on deep learning is characterized by comprising the following steps:
(1) collecting a data set: collecting single chromosomes segmented from the metaphase images of the cells by a chromosome segmentation method, rotating the collected chromosomes to be in a vertical state, extracting polarity characteristics of the chromosomes, and labeling the polarities with the short arm upwards or the short arm downwards;
(2) constructing a training set and a testing set: dividing the data set obtained in the step (1) into a training set and a testing set, and carrying out pretreatment and data amplification on the data set;
(3) inputting the chromosome images in the training set obtained in the step (2) into a chromosome polarity recognition model taking a classification network structure as a backbone network, and learning and training the chromosome polarity recognition model, wherein a Softmax function is used for normalizing output 2-dimensional vectors, then a cross entropy loss function is used for measuring the distance between a prediction result and a real result, and then a random gradient descent algorithm is used for learning network parameters;
(4) and inputting the test set into the chromosome polarity recognition model for testing, and outputting a polarity result of the chromosome to be predicted.
2. The method according to claim 1, wherein the angle required for rotating the collected chromosomes to be in a vertical state in step (1) is calculated as shown in formula (I):
(I)
wherein the projection distanceThe horizontal distance between two projection points is defined as the projection point of the leftmost end point of the chromosome region on the horizontal plane under the current rotation angleThe rightmost end of the chromosomal regionThe projected point on the horizontal plane isThe chromosome image is processed according to the rotation angleAnd the counterclockwise rotation is performed to the vertical state.
3. The method of claim 1, wherein the training set and the test set are partitioned at 7:3 in step (2), and wherein the preprocessing comprises image normalization of the training set and the test set using formula (II):
(II)
wherein the content of the first and second substances,represents the original picture and has been normalized to the range of 0.0 to 1.0,represents the mean of the training set data on each channel, δ represents the variance of the training set data on each channel, InRepresenting image data after image normalization.
4. The method of claim 1, wherein the classification network structure of step (3) is ResNet 101.
5. The method of claim 4, wherein the cross-entropy loss function of step (3) is represented by formula (IV):
(IV)
wherein the content of the first and second substances,represents the cross-entropy loss of the prediction class of the sample and its true class,a 2-dimensional vector representing the last fully-connected layer output,representing the real category of the sample, and recording the down class as 0 and the up class as 1, then,The number of the representative categories is,the index of the representative category is,representing the value of the output vector at the true class position,represents the firstThe value at the class position, e is a natural base number.
6. A system for identifying chromosome polarity based on deep learning, which is characterized by comprising the following modules:
(1) the data collection module is used for collecting single chromosomes segmented from the metaphase images by a chromosome segmentation method, rotating the collected chromosomes to be in a vertical state, extracting polarity characteristics of the chromosomes, and labeling the polarities with the short arms facing upwards or the short arms facing downwards;
(2) the training set and test set building module is used for dividing the data set provided by the data collection module into a training set and a test set, and carrying out preprocessing and data amplification on the data set;
(3) the system comprises a training module, a test set construction module and a data processing module, wherein the training module is used for inputting chromosome images in a training set provided by the training set construction module into a chromosome polarity recognition model taking a classification network structure as a main network and learning and training the chromosome polarity recognition model, a Softmax function normalizes an output 2-dimensional vector, then measures the distance between a prediction result and a real result by using a cross entropy loss function, and then learns network parameters by using a random gradient descent algorithm;
(4) a test module: and the test module inputs the test set into the chromosome polarity identification model for testing and outputs a polarity result of the chromosome to be predicted.
7. The system of claim 6, wherein the angle required for rotating the collected chromosomes to be vertical is calculated by the data collection module according to formula (I):
(I)
wherein the projection distanceThe horizontal distance between two projection points is defined as the projection point of the leftmost end point of the chromosome region on the horizontal plane under the current rotation angleWith the rightmost end of the chromosomal region lying in a horizontal planeThe projection point isThe chromosome image is processed according to the rotation angleAnd the counterclockwise rotation is performed to the vertical state.
8. The system of claim 6, wherein the training set and test set construction module partitions the training set and test set by 7:3 and image normalizes the training set and test set using equation (II):
(II)
wherein the content of the first and second substances,represents the original picture and has been normalized to the range of 0.0 to 1.0,represents the mean of the training set data on each channel, δ represents the variance of the training set data on each channel, InRepresenting image data after image normalization.
9. The system of claim 6, wherein the training set and test set construction module classifies the network structure as ResNet 101.
10. The system of claim 9, wherein the cross-entropy loss function of the training module is expressed by equation (IV):
(IV)
wherein the content of the first and second substances,represents the cross-entropy loss of the prediction class of the sample and its true class,a 2-dimensional vector representing the last fully-connected layer output,representing the real category of the sample, and recording the down class as 0 and the up class as 1, thenThe number of the representative categories is,the index of the representative category is,representing the value of the output vector at the true class position,represents the firstThe value at the class position, e is a natural base number.
Background
The chromosome karyotype analysis is an important means for discovering chromosomal disorders, and the chromosome number or structural abnormality can be discovered by the chromosome karyotype analysis technology. In order to provide corresponding diagnosis results according to the morphological structure of the chromosome, a clinician can conveniently give out the corresponding diagnosis results, all the divided chromosomes are arranged in sequence, and meanwhile, the chromosome is ensured to be in a vertical state, the short arm of the chromosome is upward, the long arm of the chromosome is downward, namely, the polarity of the chromosome is adjusted, and finally, an accurate and clear chromosome karyotype chart is formed.
At present, chromosome analysis systems generally rely heavily on manual adjustment of chromosome polarity, and doctors need to adjust the polarity by clicking or dragging, which is time-consuming and labor-consuming. The existing technical method can simultaneously realize the chromosome type identification and the chromosome polarity identification. The methods simultaneously utilize a computer graphics method and a deep convolutional neural network model to extract features related to chromosome type identification and polarity identification, and then utilize two simple classifiers to respectively judge the category and polarity of the chromosome. The methods have the advantages that the chromosome type identification and the polarity identification can be completed simultaneously, so that the operation time and the resources required by the operation are saved; the disadvantage is that the chromosome type identification should be independent of the polarity of the chromosome, i.e. the judgment of the chromosome type should not be influenced by the polarity of the chromosome. In addition, the current methods do not explain how to obtain the chromosome in a vertical state, which is a prerequisite step for polarity inversion of the subsequent chromosomes.
At present, the polarity of the chromosome is adjusted manually, a current chromosome analysis system provides a click dragging function, so that a clinician can conveniently adjust the observed polarity abnormality of the chromosome, namely, the chromosome with the polarity abnormality is turned upside down, the states that the short arm is upward and the long arm is downward are ensured, the labor is consumed, the efficiency is low, and particularly, the long arm and the short arm of the chromosome are difficult to identify, so that the diagnosis is difficult.
The chromosome recognition method based on deep learning fully utilizes the strong feature extraction capability of the deep learning technology, meanwhile, the features extracted by computer graphics are supplemented, and finally, the two independent classifiers are utilized to respectively complete chromosome type recognition and dyeing polarity recognition, but the main purpose is to complete chromosome type recognition, so that the chromosome type recognition is required to be ensured to be irrelevant to chromosome polarity at first, namely whether the short arm of a chromosome is upward or not is required to accurately judge the chromosome type by a model, certain conflict exists before the two tasks, and the learned features cannot enable the two tasks to simultaneously achieve the optimal effect. In addition, the method defaults that the input chromosome is in a vertical state, and the condition that a single chromosome segmented from the metaphase image is not necessarily in a vertical state is not considered, so that the method is a relatively important technical defect.
The manual adjustment of the polarity of the chromosome is inefficient, and the defect of the chromosome identification method based on deep learning is that the characteristics required by the chromosome type identification and the chromosome polarity identification are in conflict and it is difficult to clarify how to obtain the chromosome in a vertical state from the divided chromosome in an arbitrary angle state so as to judge and adjust the polarity of the chromosome by a chromosome polarity identification model. The invention aims to solve the problems of low manual efficiency in the chromosome polarity identification process, chromosome identification algorithm task conflict based on deep learning and lack of a chromosome rotation key step technical scheme, and provides a chromosome polarity identification method and a chromosome polarity identification system.
Disclosure of Invention
Based on the above purpose, the present invention intends to solve the problems of the prior art by calculating the projection distance of the chromosome on the horizontal plane and the deep convolutional neural network dedicated to the chromosome polarity recognition task. The invention firstly provides a chromosome polarity identification method based on deep learning, which comprises the following steps:
(1) collecting a data set: collecting single chromosomes segmented from the metaphase images of the cells by a chromosome segmentation method, rotating the collected chromosomes to be in a vertical state, extracting polarity characteristics of the chromosomes, and labeling the polarities with the short arm upwards or the short arm downwards;
(2) constructing a training set and a testing set: dividing the data set obtained in the step (1) into a training set and a test set, and constructing a chromosome polarity recognition model with a classification network structure as a backbone network;
(3) performing learning training on the chromosome polarity recognition model based on a training set, wherein a Softmax function normalizes an output 2-dimensional vector, then measuring the distance between a prediction result and a real result by using a cross entropy loss function, and then learning network parameters by a random gradient descent algorithm;
(4) and inputting the test set into the chromosome polarity recognition model for testing, and outputting a polarity result of the chromosome to be predicted.
The present invention requires the collection of single chromosomes that are segmented from metaphase images by chromosome segmentation methods, wherein the axis still maintains its angle in the metaphase images. Therefore, in order to make each chromosome in a vertical state, the invention rotates the chromosome along the counterclockwise direction and calculates the projection distance of the chromosome in the horizontal direction in real time until the projection distance is shortest.
In a preferred embodiment, the angle required to rotate the collected chromosomes in the vertical state in step (1) is calculated as shown in formula (I):
(I)
wherein the projection distanceThe horizontal distance between two projection points is defined, and the projection point of the leftmost end point of the chromosome region on the horizontal plane under the current rotation angle isThe projection point of the rightmost end point of the chromosome region on the horizontal plane isAnd rotating the chromosome image anticlockwise to a vertical state according to the rotation angle theta.
And carrying out polarity labeling on the chromosome which is in a vertical state after rotation, wherein if the short arm faces downwards, the chromosome is labeled as down, and if the short arm faces upwards, the chromosome is labeled as up. The method fully utilizes the excellent feature extraction capability of the convolutional neural network, utilizes classification models including but not limited to VGGnet, ResNet, DenseNet and the like to extract features related to the polarity of the chromosome, and finally carries out polarity two classification to obtain a chromosome polarity identification model.
In a preferred embodiment, the classification network structure of step (2) is ResNet 101.
More preferably, the training set and the test set are partitioned at 7:3 and image normalized using equation (II):
(II)
wherein IoRepresents the original picture and hasNormalized to the range of 0.0 to 1.0, m represents the mean of the training set data on each channel, δ represents the variance of the training set data on each channel, InRepresenting image data after image normalization.
In a preferred embodiment, the cross entropy loss function of step (3) is represented by formula (IV):
(IV)
wherein, L (z, y) refers to the cross entropy loss between the prediction class and the real class of the sample, z represents the 2-dimensional vector output by the last full-link layer, y represents the real class of the sample, and for simplicity, it is written that "down" class is 0, and "up" class is 1, then,NclsRepresenting the number of classes, i representing the index of the class, ZyRepresenting the value of the output vector at the true class position, ziRepresents the value at the i-th class position, and e is a natural base number.
Secondly, the invention also provides a chromosome polarity recognition system based on deep learning, which comprises the following modules:
(1) the data collection module is used for collecting single chromosomes segmented from the metaphase images by a chromosome segmentation method, rotating the collected chromosomes to be in a vertical state, extracting polarity characteristics of the chromosomes, and labeling the polarities with the short arms facing upwards or the short arms facing downwards;
(2) the training set and test set building module is used for dividing the data set provided by the data collection module into a training set and a test set, and carrying out preprocessing and data amplification on the data set;
(3) the system comprises a training module, a test set construction module and a data processing module, wherein the training module is used for inputting chromosome images in a training set provided by the training set construction module into a chromosome polarity recognition model taking a classification network structure as a main network and learning and training the chromosome polarity recognition model, a Softmax function normalizes an output 2-dimensional vector, then measures the distance between a prediction result and a real result by using a cross entropy loss function, and then learns network parameters by using a random gradient descent algorithm;
(4) a test module: and the test module inputs the test set into the chromosome polarity identification model for testing and outputs a polarity result of the chromosome to be predicted.
In a preferred embodiment, the angle required for rotating the collected chromosomes to be in a vertical state is calculated by formula (I):
(I)
wherein the projection distanceThe horizontal distance between two projection points is defined as the projection point of the leftmost end point of the chromosome region on the horizontal plane under the current rotation angleThe projection point of the rightmost end point of the chromosome region on the horizontal plane isAnd rotating the chromosome image anticlockwise to a vertical state according to the rotation angle theta.
In another preferred embodiment, the training set and test set builder module constructs the classification network structure as ResNet 101.
More preferably, the training set and the test set are partitioned at 7:3 and image normalized using equation (II):
(II)
wherein, IoRepresenting the original picture and being normalizedTo a range of 0.0 to 1.0, m represents the mean of the training set data on each channel, δ represents the variance of the training set data on each channel, InRepresenting image data after image normalization.
In a preferred embodiment, the cross-entropy loss function of the training module is represented by formula (IV):
(IV)
wherein, L (z, y) refers to the cross entropy loss between the prediction class and the real class of the sample, z represents the 2-dimensional vector output by the last full-link layer, y represents the real class of the sample, and for simplicity, it is written that "down" class is 0, and "up" class is 1, then,NclsRepresents the number of categories and i represents the category index. ZyRepresenting the value of the output vector at the true class position, ziRepresents the value at the i-th class position, and e is a natural base number.
The invention provides a chromosome identification method after rotary segmentation for the first time, a chromosome polarity identification model judges the polarity of a chromosome, and finally the polarity inversion of the chromosome is completed through a polarity result to obtain a vertical chromosome with a short arm facing upwards and a long arm facing downwards. The invention has the following technical effects:
1. the data source is simple, and because the invention comprises the chromosome rotating method based on the projection distance, the acquired data is a single chromosome obtained by dividing the image in the metaphase of cell division, and the chromosome in a vertical state can be obtained without manually adjusting the axis direction, so that the automation degree of chromosome analysis is higher, the process is simpler, and the chromosome rotating method can be widely popularized and applied.
2. The model design is based on a deep learning classification algorithm, the polarity type of the current chromosome can be accurately judged, and the polarity adjustment of the chromosome is completed according to the polarity type, so that the chromosomes are kept in a state that the short arms are upward. The inventors trained the model with 4490 labeled independent chromosome maps, with a 7:3 ratio of training set to test set. Statistics show that 2289 cases of 'up' chromosome-like maps and 2201 cases of 'down' chromosome-like maps are divided into 3143 cases of training sets and 1347 cases of testing sets, and the final testing result is as follows: true Positive (TP, True Positive) = 686; false Positive (FP, False Positive) = 17; true Negative (TN, True Negative) = 612; false Negative (FN, False Negative) = 32; accuracy (Accuracy) = 96.36%.
Drawings
FIG. 1 is a schematic flow chart of a chromosome polarity identification method based on deep learning;
FIG. 2 is a schematic diagram of a single chromosome after segmentation;
FIG. 3 is a schematic diagram of a principle of a chromosome rotation method based on projection distance;
fig. 4 is a schematic diagram of a network structure of the ResNet 101.
Detailed Description
The invention will be further described with reference to specific embodiments, and the advantages and features of the invention will become apparent as the description proceeds. These examples are only illustrative and do not limit the scope of protection defined by the claims of the present invention.
The invention discloses a chromosome polarity identification method based on deep learning, and mainly aims to solve the problems of chromosome rotation and polarity identification after segmentation. The invention is based on a deep learning ResNet model, and the inventor carries out chromosome rotation based on the projection distance on the collected and divided chromosomes to obtain the chromosomes in a vertical state. After labeling the chromosomes in the vertical state, a training set and a test set are constructed. After the model training is finished, the polarity result of the given chromosome can be directly predicted, and therefore the polarity inversion of the chromosome is finished.
The present invention will be described in further detail with reference to the accompanying drawings and examples.
Examples
The process flow of the invention is shown in figure 1 and mainly comprises the following four steps:
1. collecting a data set: collecting single chromosomes segmented from the metaphase images of the cells by a chromosome segmentation method, rotating the collected chromosomes to be in a vertical state, extracting polarity characteristics of the chromosomes, and labeling the polarities with the short arm upwards or the short arm downwards;
1.1 Collection of chromosomes
The collection of cell chromosome true image samples in mitosis metaphase under high resolution microscope field recorded by Leica CytoVision Autocytogenetics platform totaled 4490 cases. An example of a single chromosome image obtained by the collection of the segmentation is shown in fig. 2, where a is an image before the segmentation and B is an image after the segmentation. The divided chromosome image is a rectangular image, the edges of the rectangle closely surround the chromosome, and the angle of the axis is consistent with the angle of the original image.
1.2 rotating the chromosome (the operation can be developed by using Python language and is supported by an OpenCV open source computer vision library and a Numpy open source scientific calculation library), constructing a chromosome rotating method based on the projection distance, and rotating the chromosome according to the minimum projection distance.
The present invention finds that a single chromosome is segmented from the metaphase image, wherein the axis still maintains the angle in the metaphase image, so that in the first step, it is necessary to find a proper rotation angle so that the rotated chromosome is in a vertical state. And then, training a chromosome polarity recognition model by using a large amount of artificially labeled chromosome polarity data, wherein the model is an image binary classification model and is only used for judging whether the short arm of the chromosome faces upwards or downwards. And finally, determining whether the chromosome needs to be turned upside down according to the judgment result of the chromosome polarity identification model.
The angle required for the rotating chromosome to be in a vertical state in this step is calculated as shown in formula (I):
(I)
wherein the projection distanceRefers to the horizontal distance between two projection points, the leftmost end of the chromosome region under the current rotation angleThe projection point of the point on the horizontal plane isThe projection point of the rightmost end point of the chromosome region on the horizontal plane isAnd rotating the chromosome image anticlockwise to a vertical state according to the rotation angle theta.
The method measures whether the chromosome is in a vertical state or not by measuring the projection distance of the leftmost end point to the rightmost end point of the chromosome region on the horizontal plane. And for the chromosome obtained by arbitrary segmentation, taking the geometric center of the image as an origin, taking an angle of 1 degree as a step length, taking an angle of 180 degrees as an upper limit, rotating the image counterclockwise, synchronously calculating the projection distance of the leftmost end point and the rightmost end point of the chromosome region in the horizontal direction, recording the rotating angle when the projection distance reaches the minimum, and rotating the chromosome according to the angle to obtain the chromosome in the vertical state. Specifically, as shown in FIG. 3, a schematic diagram of a chromosome rotation method based on projection distance is shown, and the rotation angle of the chromosome is recorded asThe leftmost end of the chromosomal region at the current rotation angle is recorded asThe projection of which on the horizontal plane isThe rightmost end of the chromosomal region is designatedThe projection of which on the horizontal plane isThus, the projection distanceIs the horizontal distance between the two proxels. By minimizing the projection distanceFinding the angle of rotationAs the angle required for the chromosome to rotate to the vertical state. And finally, the chromosome image is rotated anticlockwise according to the rotation angle theta, and the blank areas are filled (255, 255 and 255), and finally the chromosome with a white background and in a vertical state is obtained.
1.3 Annotation of chromosomes
The rotated chromosomes are subjected to data annotation, wherein the short arm is marked as a down type in 2201 cases in a downward mode, and the short arm is marked as an up type in an upward mode in 2289 cases in a total mode.
2. Partitioning training and test sets
2.1 partitioning data sets
The invention divides the training set and the test set according to the ratio of 7:3 to obtain 3143 cases of the training set and 1347 cases of the test set.
2.2 data preprocessing and data amplification (the operation can be written by using Python language and PyTorch open source machine learning library). Both the training and test set images were scaled to 224 x 224 and then image normalized using equation (II):
(II)
wherein, IoRepresents the original picture and is normalized to the range of 0.0 to 1.0, m represents the mean value of the training set data on each channel, and the mean value of each channel in this embodiment is [0.772, 0.772]And delta represents the variance of the training set data on each channel, and the variance of each channel is [0.245, 0.245 in the embodiment], InRepresenting the normalized image data. The normalized data set makes the input pixels uniformly distributed and normalizedThen, the pixel values of the data set are in accordance with the Gaussian distribution with the mean value of 0 and the standard deviation of 1, and the model training is easier to converge. Before the model is trained, data amplification operation is performed on training set data, and in this embodiment, in-situ horizontal flipping is performed on the image with a probability of 0.5, so that the true type of the image is not affected (in-situ horizontal flipping with a probability of 0.5 does not affect the final data amount during each iteration).
3. Inputting the chromosome image in the training set obtained in the step (2) into a chromosome polarity recognition model taking a classification network structure as a backbone network, and learning and training the chromosome polarity recognition model, wherein the output 2-dimensional vector is normalized by using a Softmax function, then the distance between a prediction result and a real result is measured by using a cross entropy loss function, and then network parameters are learned through a random gradient descent algorithm
3.1 constructing a classification network-based chromosome polarity recognition model (the operation can be written in Python language and is supported by PyTorch open source machine learning library).
The chromosome polarity recognition model can adopt a classical classification network structure such as VGGNet, ResNet, DenseNet and the like as a main structure, and in the embodiment, ResNet101 (a neural network with a depth of 101 layers in a ResNet series network) is used as a main network (a structural schematic diagram of ResNet101 is shown in fig. 4 in the embodiment). The ResNet is used as an important representative of the residual error network for the classification task of the invention, effectively solves the problem of network degradation caused by continuous deepening of the neural network, can train a deeper network, and enhances the expression capability of the network. Residual network means that the output h of each layer of the network consists of the sum of the original input x and the convolution and nonlinear activation function mapping output f (x), i.e., h = f (x) + x; besides ResNet, residual error networks such as ResNext and DenseNet can be applied to the technical scheme of the invention.
In this embodiment, a 101-layer ResNet network is selected as a basic network, the 101-layer structure includes 100 convolutional layers and one fully-connected layer, and the output dimension of the last fully-connected layer is modified (the original ResNet101 has a final fully-connected layer weight dimension of 2048 × 1000, modified to 2048 x 2 in order to accommodate the present task). The residual error network is constructed based on the bottleeck modules, each bottleeck module is composed of three convolutional layers, namely two '1 × 1' convolutional layers and one '3 × 3' convolutional layer, wherein the two '1 × 1' convolutional layers are responsible for reducing and increasing channel dimensions, and the amount of calculation can be reduced through the bottleeck modules, so that the training time is reduced, and the calculation and storage consumption is reduced. In order to form a residual structure, a bypass connection (short) is also arranged in parallel with the three convolutional layers, if the channel dimensions of the front and rear bottleeck modules are consistent, an identity mapping is adopted to add the input channel dimension and the output of the three convolutional layers one by one, and if the channel dimensions of the front and rear bottleeck modules are inconsistent, an additional 1 x 1 convolutional layer is adopted to add the input channel dimension and the output of the three convolutional layers one by one. The ResNet101 network adopted by the backbone network of this embodiment can be divided into 5 different stages according to the scale of the output characteristic diagram, which are "Conv 1", "Conv 2", "Conv 3", "Conv 4" and "Conv 5", respectively. The "Conv 1" stage consists of a 7 × 7 convolution kernel with a step size of 2, and outputs a feature mapWhere C represents the feature map channel dimension, H and W represent the feature map height and width, respectively, and H and W together make up the spatial scale. The "Conv 2" phase first performs pooling operations with step size 2 by a maximum pooling layer of 3 × 3 size, further reduces the spatial scale, and then consists of several bottleeck modules. The remaining "Conv 3", "Conv 4" and "Conv 5" are likewise composed of several bottleeck modules, where only the first 1 × 1 convolution kernel step size of the first bottleeck at each stage is 2, thereby continuously reducing the feature space scale. Specifically, the configuration of the bottleeck module is different from stage to stage. The "Conv 2" stage consists of 3 bottleeck modules with three convolutional layer channel dimensions (64, 256). The "Conv 3" stage consists of 4 bottleeck modules with three convolutional layer channel dimensions (128,128,512). The "Conv 4" stage consists of 23 bottleeck modules with three convolutional layer channel dimensions (256, 1024). The "Conv 5" stage consists of 3 bottleeck modules with three convolutional layer channel dimensions (512,512,2048). The "Conv 5" stage is followed by a Global Average Pooling layer (Global Average Pooling), which is averaged along the H and W dimensions to give a feature vector of 1X 2048. The last Layer (see fig. 4) of the chromosome polarity recognition model is a 2048 × 2 Fully Connected Layer (full Connected Layer), which is used as a polarity classifier, can form an end-to-end network with the backbone network, and can perform joint training, so that features extracted by the backbone network are more suitable for chromosome polarity recognition.
3.2 setting a normalization parameter, a loss function and a hyper-parameter (the hyper-parameter comprises the learning rate, the batch size and the like), and training the model.
3.2.12 dimensional vector normalization (this operation can use Python language and is supported by PyTorch open source machine learning library)
The chromosome polarity identification task can be regarded as a binary task ("up" and "down"), and thus the output 2-dimensional vector is first normalized using a Softmax function, which is also called a normalization exponential function, which, in this embodiment, can compress one 2-dimensional vector z containing arbitrary real numbers into another 2-dimensional vector σ (z) such that each element ranges between (0,1), and the sum of all elements is 1. The Softmax function is shown in equation (III):
(III)
wherein z represents the 2-dimensional vector output by the last fully-connected layer, y represents the real class of the sample, and for simplicity, the down class is 0 and the up class is 1, then。 ,NclsRepresenting the number of classes, 2 in this example, a 2-dimensional vector is output, and i represents the class index. ZyRepresenting the value of the output vector at the true class position, ziRepresents class iThe value at the location. The output 2-dimensional vector is normalized. The 2-dimensional vector is a vector with two components, is the output of network prediction and respectively represents an up class and a down class, and e is a natural base number. Normalization refers to scaling the output by the Softmax function so that the sum of the two components of the vector is 1, and the result of normalization conforms to the probability definition, so that the two components can be used as the probability of the class predicted by the network.
3.2.2 Cross entropy loss function measures the distance between the predicted and true results (this operation can be implemented using Python language and supported by PyTorch open source machine learning library)
The distance between the predicted result and the real result is measured by using a Cross Entropy Loss function (Cross Entropy Loss) commonly used by classification tasks, and specifically, the Cross Entropy Loss function is in the form shown in formula (IV):
(IV)
wherein z represents the 2-dimensional vector output by the last fully-connected layer, y represents the real class of the sample, and for simplicity, the down class is 0 and the up class is 1, then。NclsRepresents the number of categories, 2 in this embodiment, and i represents the category index. ZyRepresenting the value of the output vector at the true class position, ziRepresenting the value at the location of the ith class. The function first normalizes the 2-dimensional vector of outputs using Softmax so that the sum of the outputs of all classes equals 1, and then measures the difference by a cross-entropy loss function. For example, when the true type of a sample is "down", the prediction result of the network isThen, the difference is:
the cross entropy loss is:。
in this embodiment, the difference between the predicted result and the actual result is measured by the cross entropy loss function: the results show that the loss at the beginning of the training set is 0.448, which is a dynamic descent process that can be reduced to 0.001 when training is over.
3.3 random gradient descent series Algorithm to learn network parameters
The network parameters are learned by a Stochastic Gradient Descent (Stochastic Gradient decision) series algorithm. The network parameters refer to neurons containing parameters of ResNet101, and are mainly convolutional layer parameters: the parameters do not need to be specifically set, and the ResNet101 parameters obtained by training on an ImageNet data set (Krizhevsky A, Sutskeeper I, Hinton G E. Imagenet classification with default connected neural network [ J ]. Advances in neural information processing systems, 2012, 25: 1097 and 1105.) are used as the initialization parameters of the ResNet101 in the embodiment, and then the parameters are updated according to the gradient of the loss function relative parameters through a momentum-based random gradient descent algorithm. The operation can be written in Python language and supported by PyTorch open source machine learning library.
In this example, a momentum-based random gradient descent algorithm (Sutskeeper, Ilya, et al. "On the observation of initiation and momentum in deep learning." International conference On machine learning. 2013.) was selected as shown in (V):
(V)
wherein ε represents a learning rate, f (θ) represents a loss function,representing loss function relative thetatV denotes the update rate, t denotes the number of iterations, the momentum factor momentum (μ) is set to 0.9, the weight decay factor is set to 5 × 10-4The learning rate was initialized to 0.01, the batch size was 32, and a total of 100 epochs were trained, with the 60 th and 90 th epoch learning rates dropping to 1/10. The network parameters are learned through a random gradient descent series algorithm, and finally the average loss of the model on the training set is reduced from 0.448 to 0.001.
The above algorithms including the image normalization function, the network structure such as ResNet101, the Softmax function, the cross entropy loss function, and the momentum-based random gradient descent algorithm can all be supported by PyTorch open source machine learning library.
4. And inputting the test set into the chromosome polarity recognition model for testing, and outputting a polarity result of the chromosome to be predicted.
After the model training is finished, the test set is subjected to the same data preprocessing, the output vector of each sample is obtained when the test set is input into the model, and the category corresponding to the index with the largest value is selected as the polarity result of the chromosome prediction. If the class 0, that is, "down" is predicted, the representative chromosome polarity recognition model predicts that the short arm of the chromosome is oriented downward, and therefore, the short arm of the chromosome is oriented upward by being turned upside down. If the type 1 is predicted, namely the type "up", the representative chromosome polarity recognition model predicts that the short arm of the chromosome is upward, so that the up-down flipping operation is not needed.
The model design of the invention is based on a deep learning classification algorithm, and can automatically and accurately identify the polarity of the chromosome. The inventors trained the model with 4490 labeled independent chromosome maps, with a 7:3 ratio of training set to test set.
Statistics show that 2289 cases of 'up' chromosome-like maps and 2201 cases of 'down' chromosome-like maps are divided into 3143 cases of training sets and 1347 cases of testing sets, and the final testing result is True Positive (TP) = 686; false Positive (FP, False Positive) = 17; true Negative (TN, True Negative) = 612; false Negative (FN, False Negative) = 32; accuracy (Accuracy) = 96.36%.
- 上一篇:石墨接头机器人自动装卡簧、装栓机
- 下一篇:一种静止卫星全天时云检测方法及装置