{'fraction_non_alphanumeric': 0.03654329649769046, 'fraction_numerical': 0.014968134245454014, 'mean_word_length': 4.786197564276049, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Embedding Task Knowledge into 3D Neural Networks via Self-supervised Learning

Deep learning highly relies on the amount of annotated data. However, annotating medical images is extremely laborious and expensive. To this end, self-supervised learning (SSL), as a potential solution for deficient annotated data, attracts increasing attentions from the community. However, SSL approaches often design a proxy task that is not necessarily related to target task. In this paper, we propose a novel SSL approach for 3D medical image classification, namely Task-related Contrastive Prediction Coding (TCPC), which embeds task knowledge into training 3D neural networks. The proposed TCPC first locates the initial candidate lesions via supervoxel estimation using simple linear iterative clustering. Then, we extract features from the sub-volume cropped around potential lesion areas, and construct a calibrated contrastive predictive coding scheme for self-supervised learning. Extensive experiments are conducted on public and private datasets. The experimental results demonstrate the effectiveness of embedding lesion-related prior-knowledge into neural networks for 3D medical image classification.


Introduction
The performance of deep learning networks strongly relies on the amount of annotated data. However, annotating 3D volumetric medical data requires experienced physicians to spend hours or days, which is laborious and expensive. Therefore, the amount of annotated 3D medical data is often insufficient for the training of 3D neural networks. To address the problem, researchers have attempted to loose the requirement of annotated data for neural networks by exploiting the rich information contained in unlabeled data [5].
Self-supervised learning (SSL), as one of the potential solutions, gains increasing attentions from the community. Conventional self-supervised learning approaches start with a formulated proxy task to encourage neural networks to learn informative features from the raw data. Various proxy tasks have been proposed, such as grayscale image colorization [9], images rotation [4] and Jigsaw puzzles [10,13]. However, those proxy tasks primarily focus on the pre-training of 2D neural networks. Compared to 2D networks, 3D neural networks have shown their superiority for 3D volumetric data. Till now, there are few 3D selfsupervised learning approaches. Rubiks cube proposed by Zhuang et al. [14] is one of the earliest attempts in the area. It formulates the volumetric data as a Rubik's cube and enforces 3D neural networks to learn anatomical information by playing a disarrangement-and-restoration game. Those existing 3D-based SSL approaches prefer to learn the feature representation more related to the common prior-knowledge, e.g., anatomical structure of organs. The information often used for clinical diagnosis, such as position and texture of potential lesion areas, is not explicitly embedded during the 3D network pre-training.
Contrastive predictive coding (CPC) [3,7], which learns the feature representation of spatial information, is a recent SSL approach. The underlying principle of CPC is to use a feature set, extracted from patches cropped from part (upper/left) of 2D image, to predict the encoded features of the rest part (lower/right). The spatial information of image content is embedded during the predictive coding. However, due to the gap between 2D natural images and 3D medical volumes, the conventional CPC cannot be directly applied to 3D volumes.
In this paper, we aim to bridge this gap by proposing Task-related CPC (TCPC), which embeds the lesion information into the pre-training process. It initially locates the potential lesion areas using the simple linear iterative clustering (SLIC) [1], and then calibrates CPC to learn 3D feature representation from the sub-volumes containing the candidate lesion areas. To validate the effectiveness of our TCPC, we conduct experiments on public and private datasets. The experimental results demonstrate the benefits generated by embedding the clinical prior-knowledge (e.g., the texture and position of lesion area) to 3D neural networks for some specific tasks, e.g., brain hemorrhage classification.

Task-related Constrastive Predictive Coding
In this section, we introduce the proposed TCPC in details. As shown in Fig. 1, the pipeline of our self-supervised learning framework consists of two steps: 1) pre-train a 3D convolutional neural network (CNN) on our TCPC proxy task using unlabeled datasets; 2) fine-tune the pre-trained network for the specific target task with manual annotations.

Supervoxel generation and subvolume cropping
For a raw 3D medical volume, the voxels are first normalized to [-1, 1] by using the minimum and maximum intensity. Then, the simple linear iterative clustering (SLIC) [1] method is utilized to generate the supervoxels, which are small clusters of pixels that share similar properties, e.g., grayscale intensity. The potential lesion areas can thereby be roughly detected and these areas are more meaningful for our target classification task than say pure background areas. Finally, we crop the sub-volumes centered on the region of each supervoxel for our calibrated CPC to unsupervisedly extract feature representations.

Calibrated 3D contrastive predictive coding
Those sub-volumes cropped from supervoxels of potential lesion areas still contain heterogeneous texture and rich contextual information, from which it is probable to learn effective feature representation for the target task of disease classification. In this study, we further propose a calibrated CPC scheme on the sub-volumes to embed the rich contextual information into 3D neural networks.
Proxy task. As shown in Fig. 1, the sub-volume is divided into 3 × 3 cubes as predictive units. Different from the typical CPC, which constitutes the support features along a straight path ( Fig. 2(a) and (b)), we propose a 'U' shape path for the construction of support set; this way more contextual information of surrounding tissues can be included to better characterize the lesions. The difference between 2D CPC, 3D CPC (a simple extension of CPC from 2D to 3D) and our TCPC is illustrated in Fig. 2, where the orange cubes are used as support set and the green one is for predictive coding.
Assuming the feature extracted by a backbone network from the cube i as z i , the support set contained N features can be represented as Z = {z i , i = 1, ..., N } and the ground-truth for the predictive coding is z N +1 . A recurrent neural network (RNN) ψ is adopted to predict the feature vector (z N +1 ) of cube Fig. 2. The sequence path for support generation adopted by our proposed method and conventional contrastive predictive coding methods. a) The path proposed in [7]. b) The extension of [7]. (c) The 'U' shape path adopted in our TCPC. The cube sizes in a) and b) are relatively small, which contain limited information. The content of medical images has fewer variations (e.g, texture, grayscale), compared to natural images; hence, a relative larger cube size is more appropriate.
N + 1 based on the support features, which can be formulated as: Feature extractor. A feature extractor is utilized to encode the features for support set and yields the corresponding ground-truth for the predictive coding. A sub-volume can be divided into 3 × 3 cubes x i,j (i, j = 1, 2, 3) with a 50% overlap. The backbone network of feature extractor can be any 3D CNNs (e.g., 3D ResNet). Given the network function of feature extractor f (.) and input cubes x, the features (z) of cubes can be generated via: Contrastive loss. The purpose of the proxy task is to recognize the target z N +1 from other representations z i , i ∈ {1, ..., N }. Hence, a contrastive loss is adopted in our proxy task for network optimization, which can be defined as: The {z i |z i = z N +1 } denotes negative representations in the mini-batch. This loss is inspired by InfoNCE [3] and proved to have the ability to maximize the mutual information.

Adapting pre-trained network for target task
Our TCPC proxy task can not only enforce 3D neural networks to exploit a robust feature representation from raw data, but also embed the clinical prior-knowledges, e.g., lesion position, into the neural networks. The pre-trained weights can be directly transferred to the target task, e.g., brain hemorrhage classification, with a small amount of annotated data.

Dataset
Brain hemorrhage dataset. The dataset contains 1,486 brain CT volumes, which are collected from a collaborative hospital. The CT volumes are used to diagnose the pathological cause of cerebral hemorrhage, which can be categorized into four classes: aneurysm, arteriovenous malformation, moyamoya disease and hypertension. The CT volumes are of a uniform size (270 × 230 × 30 voxels). The sub-volumes of 30 × 150 × 150 voxels are cropped from the CT and partitioned to 3 × 3 30 × 75 × 75 cubes with 50% overlapping for our TCPC proxy task. The network pre-trained on TCPC proxy task is then transferred to the target task (i.e., cerebral hemorrhage classification).
Lung cancer dataset. LUNA16 dataset is a subset of LIDC-IDRI [2], which is the largest publicly available dataset for pulmonary nodules detection. The dataset contains 888 low-dose lung CT volumes. The CT scans with a slice thickness greater than 2.5 mm are excluded. The potential lung nodules are already given and labeled by four experienced radiologists as benign (negative) or malignant (positive). The CT volumes have a uniform resolution (512 × 512) with different slice number. The sub-volumes of 48 × 48 × 48 voxels are cropped for the proxy task. Our goal here is to automatically classify these potential nodules into the benign and the malignant.

Experimental settings
The separation ratio of training and validation for brain hemorrhage classification and lung nodule classification are set to 80:20 and 90:10, respectively. The average classification accuracy (ACC) and area under curve (AUC) are employed as metric for performance evaluation. For comparison, several baseline models are evaluated, including SSL approaches (3D Jigsaw puzzles [10] and Rubik's cube [14]) and transfer learning (TL) method (fine-tuning the model pre-trained using UCF101 with label annotations [12]).
Implementation details. We first adopt supervoxel to center potential lesion areas, which is generated by clustering voxels with similar intensity. We use SLIC for voxel clustering, where the segment number, the maximum number of k-means iterations, and the Gaussian smoothing parameter are set to 10 ∼ 20, 10, and 10, respectively. The widely used 3D VGG [11] and 3D ResNet-18 [6] are adopted as backbone networks in the experiments, which are consistent with the settings of existing self-supervised learning approaches [10,14]. Due to the different input sizes of pre-training and fine-tuning, we use an adaptive average pooling layer by the end of backbone network to unify the output shape. The proposed TCPC is implemented using PyTorch. The network is trained with a mini-batch size of 2. The initial learning rate for the proxy task and target task are set to 2e −5 and 15e −6 , respectively. The Adam solver [8] is used as the optimizer for network training. The baseline approaches involved in our study adopt the same training protocol for fair comparison.

Performance of proxy task
For better evaluating the performance of our proxy task, the feature maps yield by the deep layers of 3D ResNet are presented in Fig. 3. The results show that the pre-trained model (i.e., TCPC) captures the contextual information and task-related information. In particular, as shown in Fig. 3, the lesion area of the input image is the brighter area on the right. The neural network is observed to pay attention to the brain boundary and lesion areas (the second row of Fig. 3) after TCPC pre-training. In contrast, the features yield by a randomly initialized network contain less semantic information. Furthermore, the fine-tuned network generates the feature maps (the third row of Fig. 3) with similar activation patterns to the one learned from TCPC proxy task, which demonstrates the benefit provided by our TCPC to the target task.

Fine-tuning network on target tasks
Brain hemorrhage. We fine-tune the pre-trained networks on the task of cerebral hemorrhage classification. The average classification accuracy (ACC) and area under curve (AUC) of different backbone networks trained with TCPC and other baseline approaches are presented in Table 1. It can be observed that our TCPC can significantly boost the classification accuracy of backbone models. The TCPC pre-trained 3D VGG and ResNet-18 achieve ACCs of 78.38% Table 1. The results of cerebral hemorrhage classification by using 100% labeled data in fine-tuning and lung nodule classification using 1% labeled data in fine-tuning. The performances of TCPC and other different approaches are evaluated by the average classification accuracy (ACC%) and the area under curve (AUC).

Dataset
Brain and 88.17%, respectively, which are 6.08% and 7.09% higher than the trainfrom-scratch model. Similar improvements are observed in terms of AUC-the highest AUCs of 0.921 and 0.955 are obtained by our TCPC pre-trained 3D VGG and ResNet-18, respectively. The approaches that learn structural information of organs, e.g., 3D CPC, 3D Jigsaw puzzles, and Rubik's cube, yield lower improvements to classification accuracy, compared to our TCPC.
Lung cancer. To further demonstrate the effectiveness of our proxy task, we fine-tune the TCPC pre-trained networks on the lung cancer dataset. Since the original dataset is large, which neutralizes the improvement generated by pretraining, we constitute a subset (1%) from the LUNA 16 as the fine-tuning training set for this experiment. The backbone is pre-trained on the whole training data without annotations and fine-tuned on the 1% labeled data. The experimental results are shown in Table 1. Our TCPC pre-trained 3D VGG and 3D ResNet-18 achieve ACCs of 95.86% and 98.88%, respectively, which outperform the listed baselines. The 3D Jigsaw and Rubik's cube are observed to yield relatively small improvements to backbone on this dataset. The underlying reason may be the small cube size of lung nodule, which leads to limited information contained in their partitioned tiles and cubes.
UCF101 + TCPC. It can be observed from Table 1 that the UCF pre-trained model yields good performance, especially on lung nodule dataset. This suggests that though there exists gap between medical and natural images, transfer learning from a large natural image dataset is beneficial too. To further narrow down the gap and boost classification accuracy, we conduct an experiment that combines TL and SSL into a cascade. The 3D network is first initialized using the weights of the network trained for the UCF101 task, then pre-trained on the TCPC proxy task, and finally fine-tuned on the target task. The proposed UCF101 + TCPC yields an average 1% improvement. Specifically, the proposed UCF101 + TCPC increases the ACCs of 3D VGG and ResNet-18 to 97.85% and 99.40% on lung nodule dataset, respectively. To the best of our knowledge, this marks the first attempt in the literature to explore the integration of TL and SSL methods for medical image analysis. In the future, we plan to explore further along this line in order to better address the deficient annotation issue. Performance of small training samples. In this section, we evaluate the performance of our TCPC with small training sets. Different amounts of original training set are extracted for pre-training and fine-tuning. The line chart of average classification accuracy (ACC) and area under curve (AUC) of TCPC pretrained models with different amounts of fine-tuning data are presented in Fig. 4. The train-from-scratch model is also presented for comparison. The curves illustrate that our TCPC can consistently improve the ACC and AUC of backbone model, compared to train-from-scratch, especially when the training dataset is extremely small.
Evaluation of different parameters. The TCPC proxy task has two hyperparameters, i.e., overlap ratio of cubes and cube size. The TCPC with different settings of these two hyper-parameters is evaluated in Fig. 4. Our TCPC is observed to be insensitive to the hyper-parameters. The larger cube size, which means that more contextual information is used for predictive coding, can increase the performance of our TCPC.

Conclusion
In this paper, we develop a novel task-related self-supervised learning method for 3D medical images. By adopting a novel proxy task based on SLIC and CPC, the unsupervised learning features are intensive and more related to target task. We evaluate our proposed method on private and public 3D medical image datasets for classification tasks, and the results demonstrate efficiency and powerfulness for performance boost. Experiments empirically prove that task-related SSL approaches are effective tools in medical image analysis.