{"id":20062924,"url":"https://github.com/ivanwilliammd/i3dr-net-transfer-learning","last_synced_at":"2025-05-05T17:31:52.996Z","repository":{"id":40965102,"uuid":"254100314","full_name":"ivanwilliammd/I3DR-Net-Transfer-Learning","owner":"ivanwilliammd","description":"Implementation code for \"Lung Nodule Detection and Classification from Thorax CT-Scan Using RetinaNet with Transfer Learning\" (2020)","archived":false,"fork":false,"pushed_at":"2025-03-21T22:53:55.000Z","size":46299,"stargazers_count":32,"open_issues_count":1,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-09T01:41:47.382Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://doi.org/10.1016/j.jksuci.2020.03.013","language":"Python","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ivanwilliammd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-08T13:46:27.000Z","updated_at":"2025-03-30T11:42:54.000Z","dependencies_parsed_at":"2024-11-13T13:54:04.797Z","dependency_job_id":null,"html_url":"https://github.com/ivanwilliammd/I3DR-Net-Transfer-Learning","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanwilliammd%2FI3DR-Net-Transfer-Learning","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanwilliammd%2FI3DR-Net-Transfer-Learning/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanwilliammd%2FI3DR-Net-Transfer-Learning/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ivanwilliammd%2FI3DR-Net-Transfer-Learning/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ivanwilliammd","download_url":"https://codeload.github.com/ivanwilliammd/I3DR-Net-Transfer-Learning/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252542254,"owners_count":21764934,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T13:39:32.676Z","updated_at":"2025-05-05T17:31:47.987Z","avatar_url":"https://github.com/ivanwilliammd.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# I3DR-Net Transfer Learning\n*Official implementation code for \"Lung Nodule Detection and Classification from Thorax CT-Scan Using RetinaNet with Transfer Learning\" and \"Lung Nodule Texture Detection and Classification Using 3D CNN.\"*\n\n[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/lung-nodule-detection-and-classification-from/lung-nodule-classification-on-lidc-idri)](https://paperswithcode.com/sota/lung-nodule-classification-on-lidc-idri?p=lung-nodule-detection-and-classification-from)\n[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/lung-nodule-detection-and-classification-from/lung-nodule-detection-on-lidc-idri)](https://paperswithcode.com/sota/lung-nodule-detection-on-lidc-idri?p=lung-nodule-detection-and-classification-from)\n[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/lung-nodule-detection-and-classification-from/lung-nodule-3d-classification-on-lidc-idri)](https://paperswithcode.com/sota/lung-nodule-3d-classification-on-lidc-idri?p=lung-nodule-detection-and-classification-from)\n[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/lung-nodule-detection-and-classification-from/lung-nodule-3d-detection-on-lidc-idri)](https://paperswithcode.com/sota/lung-nodule-3d-detection-on-lidc-idri?p=lung-nodule-detection-and-classification-from)\n\nContributor:\n[@ivanwilliammd](https://github.com/ivanwilliammd), [@wawancenggoro](https://github.com/wawancenggoro), [@sliawatimena](https://github.com/sliawatimena)\n\n## Related publication:\n\n1. [Ivan William Harsono, Suryadiputra Liawatimena, Tjeng Wawan Cenggoro. \"Lung Nodule Detection and Classification from Thorax CT-Scan Using RetinaNet with Transfer Learning\". Journal of King Saud University - Computer and Information Sciences. 2020.](https://doi.org/10.1016/j.jksuci.2020.03.013) \n2. [Ivan William Harsono, Suryadiputra Liawatimena, Tjeng Wawan Cenggoro. \"Lung Nodule Texture Detection and Classification Using 3D CNN.\" CommIT Journal 13.2, 2019.](https://journal.binus.ac.id/index.php/commit/article/view/5995)\n3. [Lin, Tsung-Yi, et al. \"Focal Loss for Dense Object Detection\" TPAMI, 2018.](https://arxiv.org/abs/1708.02002)\n4. [Carreira, Joao, and Andrew Zisserman. \"Quo vadis, action recognition? a new model and the kinetics dataset.\" proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. 2017.](https://arxiv.org/abs/1705.07750)\n5. [Jaeger, Paul et al. \"Retina U-Net: Embarrassingly Simple Exploitation of Segmentation Supervision for Medical Object Detection\" , 2018](https://arxiv.org/abs/1811.08661)\n6. [Paper with Code](https://paperswithcode.com/paper/lung-nodule-detection-and-classification-from)\n\n## How to cite this code\n*Please cite our paper [1] \u0026 [2]*\n\n## Adaptation\nThis codes are adapted from medicaldetectiontoolkit from pfjaeger for [Jaeger et al, Medical Detection Toolkit](https://github.com/pfjaeger/medicaldetectiontoolkit) [3, 5] and [Kinetics I3D](https://github.com/hassony2/kinetics_i3d_pytorch) (I3D Backbone) [4] for malignancy (malignant for score\u003e3, benign otherwise), texture classification (groundglass, subsolid, and solid), and nodule detection (Unsupressed RoI will be scored as 1 (foreground), while supressed RoI will be scored as 0 (background))\n\nThe LIDC needs to be preprocessed using [DICOM preprocessing scripts](https://github.com/ivanwilliammd/DICOM-data-preprocessing-script) and [Batch generators](https://github.com/ivanwilliammd/batchgenerators) for training\n\n\n## This repository support experiments (experiments/ folder):\n1. lidc_exp_malignancy: preprocessing and data loader for LIDC malignancy clasification (2 class + 1 bg class)\n2. lidc_exp_texture: modified preprocessing and data loader for LIDC texture clasification (3 class + 1 bg class)\n3. moscow_exp_texture: modified preprocessing and data loader for private dataset texture clasification  (3 class + 1 bg class)\n4. moscow_exp_subtlety: modified preprocessing and data loader for private dataset subtlety clasification  (2 class + 1 bg class) --\u003e 2 fg class : obvious (solid); subtle (subsolid, groundglass)\n5. lidc_exp_nodule: modified preprocessing and data loader for LIDC nodule clasification (1 fg+ 1 bg class)\n6. moscow_exp_nodule: modified preprocessing and data loader for Moscow nodule clasification (1 fg+ 1 bg class)\n\n\n## Install package and dependency\n\n\u003e Setup package in virtual environment\n```\ngit clone https://github.com/ivanwilliammd/I3DR-Net-Transfer-Learning\ncd I3DR-Net-Transfer-Learning\npip3 install -e .\n```\n\n\u003e Install MIC-DKFZ batch-generators \n```\ngit clone https://github.com/ivanwilliammd/batchgenerators\ncd batchgenerators\npip3 install -e .\n```\n\n## Install NMS, RoI, Align for CUDA 9.x and pytorch 0.4.1 (Pre-compiled for Tesla P100.)\n\nNon-Maximum Suppression \n*taken from [pytorch-faster-rcnn](https://github.com/ruotianluo/pytorch-faster-rcnn) and added adaption for 3D*\n```\ncd cuda_functions/nms_2D/src/cuda/\nnvcc -c -o nms_kernel.cu.o nms_kernel.cu -x cu -Xcompiler -fPIC -arch=sm_60\ncd ../../\npython build.py\ncd ../../\n\ncd cuda_functions/nms_3D/src/cuda/\nnvcc -c -o nms_kernel.cu.o nms_kernel.cu -x cu -Xcompiler -fPIC -arch=sm_60\ncd ../../\npython build.py\ncd ../../\n```\nRoiAlign \n*taken from [RoiAlign](https://github.com/longcw/RoIAlign.pytorch), fixed according to [this bug report](https://hackernoon.com/how-tensorflows-tf-image-resize-stole-60-days-of-my-life-aba5eb093f35), and added adaption for 3D*\n\n```\ncd cuda_functions/roi_align_2D/roi_align/src/cuda/\nnvcc -c -o crop_and_resize_kernel.cu.o crop_and_resize_kernel.cu -x cu -Xcompiler -fPIC -arch=sm_60\ncd ../../\npython build.py\ncd ../../../\n\ncd cuda_functions/roi_align_3D/roi_align/src/cuda/\nnvcc -c -o crop_and_resize_kernel.cu.o crop_and_resize_kernel.cu -x cu -Xcompiler -fPIC -arch=sm_60\ncd ../../\npython build.py\ncd ../../../\n```\n\n| GPU | arch |\n| --- | --- |\n| TitanX | sm_52 |\n| GTX 960M | sm_50 |\n| Tesla P100 | sm_60 |\n| Tesla P4 | sm_61 |\n| GTX 10XX series | sm_61 |\n| GTX 1080 (Ti) | sm_61 |\n| Tesla V100 | sm_70 |\n\n*for more compute capability information, please see: (https://en.wikipedia.org/wiki/CUDA )*\n\n## Execute\n1. Set I/O paths, model and training specifics in the configs file: i3dr-net/experiments/your_experiment/configs.py\n2. Train the model: \n\n\t```\n\tpython exec.py --mode train --exp_source experiments/my_experiment --exp_dir path/to/experiment/directory       \n\t```\n\n\tThis copies snapshots and monitoring diagram of configs and model to the specified exp_dir, where all outputs will be saved. By default, the data is split into 60% training and 20% validation and 20% testing data to perform a 5-fold cross validation (can be changed to hold-out test set in configs) and all folds will be trained iteratively. In order to train a single fold, specify it using the folds arg: \n\n\t```\n\tpython exec.py --folds 0 1 2 .... # specify any combination of folds [0-4]\n\t```\n\n3. Run inference:\n\t\n\t```\n\tpython exec.py --mode test --exp_dir path/to/experiment/directory \n\t```\n\t\n\tThis runs the prediction pipeline and saves all results to exp_dir.\n\n4. Add pretrained ImageNet I3D RGB Weights:\n\t\n\t```\n\tpython exec.py --mode train --exp_source experiments/my_experiment --exp_dir path/to/experiment/directory --rgb_weights_path weight/model_rgb.pth     \n\t``` \n\t\n\tThis runs the prediction pipeline and saves all results to exp_dir.\n\t\n\n## Example of Execution Code\n```\npython exec.py --mode train_test --folds 0 --exp_source experiments/lidc_exp_subtlety/ --exp_dir ~/I3DR-Models/LIDC-Solidity_TransferI3D --rgb_weights_path weight/model_rgb.pth\n```\n```\npython exec.py --mode train_test --folds 0 --exp_source experiments/moscow_exp_subtlety/ --exp_dir ~/I3DR-Models/Moscow-Solidity_TransferI3D --rgb_weights_path weight/model_rgb.pth\n```\n\n*Last updated July 2nd 2019*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivanwilliammd%2Fi3dr-net-transfer-learning","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fivanwilliammd%2Fi3dr-net-transfer-learning","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fivanwilliammd%2Fi3dr-net-transfer-learning/lists"}