The Medical Detection Toolkit contains 2D + 3D implementations of prevalent object detectors such as Mask R-CNN, Retina Net, Retina U-Net, as well as a training and inference framework focused on dealing with medical images.

Overview


Copyright © German Cancer Research Center (DKFZ), Division of Medical Image Computing (MIC). Please make sure that your usage of this code is in compliance with the code license.

Overview

This is a comprehensive framework for object detection featuring:

  • 2D + 3D implementations of prevalent object detectors: e.g. Mask R-CNN [1], Retina Net [2], Retina U-Net [3].
  • Modular and light-weight structure ensuring sharing of all processing steps (incl. backbone architecture) for comparability of models.
  • training with bounding box and/or pixel-wise annotations.
  • dynamic patching and tiling of 2D + 3D images (for training and inference).
  • weighted consolidation of box predictions across patch-overlaps, ensembles, and dimensions [3].
  • monitoring + evaluation simultaneously on object and patient level.
  • 2D + 3D output visualizations.
  • integration of COCO mean average precision metric [5].
  • integration of MIC-DKFZ batch generators for extensive data augmentation [6].
  • easy modification to evaluation of instance segmentation and/or semantic segmentation.

[1] He, Kaiming, et al. "Mask R-CNN" ICCV, 2017
[2] Lin, Tsung-Yi, et al. "Focal Loss for Dense Object Detection" TPAMI, 2018.
[3] Jaeger, Paul et al. "Retina U-Net: Embarrassingly Simple Exploitation of Segmentation Supervision for Medical Object Detection" , 2018

[5] https://github.com/cocodataset/cocoapi/blob/master/PythonAPI/pycocotools/cocoeval.py
[6] https://github.com/MIC-DKFZ/batchgenerators

How to cite this code

Please cite the original publication [3].

Installation

Setup package in a virtual environment:

git clone https://github.com/pfjaeger/medicaldetectiontoolkit.git .
cd medicaldetectiontoolkit
virtualenv -p python3.6 venv
source venv/bin/activate
pip3 install -e .

We use two cuda functions: Non-Maximum Suppression (taken from pytorch-faster-rcnn and added adaption for 3D) and RoiAlign (taken from RoiAlign, fixed according to this bug report, and added adaption for 3D). In this framework, they come pre-compile for TitanX. If you have a different GPU you need to re-compile these functions:

GPU arch
TitanX sm_52
GTX 960M sm_50
GTX 1070 sm_61
GTX 1080 (Ti) sm_61
cd cuda_functions/nms_xD/src/cuda/
nvcc -c -o nms_kernel.cu.o nms_kernel.cu -x cu -Xcompiler -fPIC -arch=[arch]
cd ../../
python build.py
cd ../

cd cuda_functions/roi_align_xD/roi_align/src/cuda/
nvcc -c -o crop_and_resize_kernel.cu.o crop_and_resize_kernel.cu -x cu -Xcompiler -fPIC -arch=[arch]
cd ../../
python build.py
cd ../../

Prepare the Data

This framework is meant for you to be able to train models on your own data sets. Two example data loaders are provided in medicaldetectiontoolkit/experiments including thorough documentation to ensure a quick start for your own project. The way I load Data is to have a preprocessing script, which after preprocessing saves the Data of whatever data type into numpy arrays (this is just run once). During training / testing, the data loader then loads these numpy arrays dynamically. (Please note the Data Input side is meant to be customized by you according to your own needs and the provided Data loaders are merely examples: LIDC has a powerful Dataloader that handles 2D/3D inputs and is optimized for patch-based training and inference. Toy-Experiments have a lightweight Dataloader, only handling 2D without patching. The latter makes sense if you want to get familiar with the framework.).

Execute

  1. Set I/O paths, model and training specifics in the configs file: medicaldetectiontoolkit/experiments/your_experiment/configs.py

  2. Train the model:

    python exec.py --mode train --exp_source experiments/my_experiment --exp_dir path/to/experiment/directory       
    

    This copies snapshots 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:

    python exec.py --folds 0 1 2 .... # specify any combination of folds [0-4]
    
  3. Run inference:

    python exec.py --mode test --exp_dir path/to/experiment/directory 
    

    This runs the prediction pipeline and saves all results to exp_dir.

Models

This framework features all models explored in [3] (implemented in 2D + 3D): The proposed Retina U-Net, a simple but effective Architecture fusing state-of-the-art semantic segmentation with object detection,


also implementations of prevalent object detectors, such as Mask R-CNN, Faster R-CNN+ (Faster R-CNN w\ RoIAlign), Retina Net, U-Faster R-CNN+ (the two stage counterpart of Retina U-Net: Faster R-CNN with auxiliary semantic segmentation), DetU-Net (a U-Net like segmentation architecture with heuristics for object detection.)



Training annotations

This framework features training with pixelwise and/or bounding box annotations. To overcome the issue of box coordinates in data augmentation, we feed the annotation masks through data augmentation (create a pseudo mask, if only bounding box annotations provided) and draw the boxes afterwards.


The framework further handles two types of pixel-wise annotations:

  1. A label map with individual ROIs identified by increasing label values, accompanied by a vector containing in each position the class target for the lesion with the corresponding label (for this mode set get_rois_from_seg_flag = False when calling ConvertSegToBoundingBoxCoordinates in your Data Loader).
  2. A binary label map. There is only one foreground class and single lesions are not identified. All lesions have the same class target (foreground). In this case the Dataloader runs a Connected Component Labelling algorithm to create processable lesion - class target pairs on the fly (for this mode set get_rois_from_seg_flag = True when calling ConvertSegToBoundingBoxCoordinates in your Data Loader).

Prediction pipeline

This framework provides an inference module, which automatically handles patching of inputs, and tiling, ensembling, and weighted consolidation of output predictions:




Consolidation of predictions (Weighted Box Clustering)

Multiple predictions of the same image (from test time augmentations, tested epochs and overlapping patches), result in a high amount of boxes (or cubes), which need to be consolidated. In semantic segmentation, the final output would typically be obtained by averaging every pixel over all predictions. As described in [3], weighted box clustering (WBC) does this for box predictions:





Visualization / Monitoring

By default, loss functions and performance metrics are monitored:




Histograms of matched output predictions for training/validation/testing are plotted per foreground class:



Input images + ground truth annotations + output predictions of a sampled validation abtch are plotted after each epoch (here 2D sampled slice with +-3 neighbouring context slices in channels):



Zoomed into the last two lines of the plot:


License

This framework is published under the Apache License Version 2.0.

Comments
  • Dataloader in lidc_exp

    Dataloader in lidc_exp

    What is the format of the input in lidc_exp? I followed preprocessing.py, and set my dataset folder as :

    path/to/dataset/pp_norm/xxxxxx_img.npy path/to/dataset/pp_norm/xxxxxx_rois.npy ... ... path/to/dataset/pp_norm/info_df.pickle

    However, when I run the training, the program got struck at exec.py: batch = next(batch_gen['train']). There should be some bugs when I prepared my input. Hope to get some help, thanks!

    opened by DevinCheung 16
  • issue with ConvertSegToBoundingBoxCoordinates when multiple ROI per slice or volume

    issue with ConvertSegToBoundingBoxCoordinates when multiple ROI per slice or volume

    Hi,

    it seems that ConvertSegToBoundingBoxCoordinates makes a single bounding box when multiple ROIs are on the same slice (or volume). The same problem occurs whether self.dim = 2 or 3 in configs file.

    Indeed for now I load via np.load 3D arrays using the data_loader of the LIDC dataset.

    • 1 np.float32 for img of dim 128x128x256
    • 1 np.int16 mask of dim 128x128x256 where there may be from 30 to 100 lesions by volume. All lesions are labeled with ones.

    eg for 1 slice from the pred example in plots:

    capture d ecran 2018-12-27 a 10 24 51

    Is there anything that can be done to avoid this ?

    Best regards

    Paul

    opened by paul-bd 10
  • Training stuck on validation

    Training stuck on validation

    Hi,

    I'm trying to train a 3D Mask R-CNN on large CT scans (sizes around 512x512x300)

    In my configs I have self.pre_crop_size_3D = [64, 64, 64] self.patch_size_3D = [64, 64, 64]

    Relevant validation settings are: self.val_mode = 'val_sampling if self.val_mode == 'val_patient': self.max_val_patients = 1 # if 'None' iterates over entire val_set once. if self.val_mode == 'val_sampling': self.num_val_batches = 1

    My training keeps getting stuck on validation... all 32 cores are running but nothing much seems to be happening. I've been waiting an hour or more.. Is it normal for this to take a long time?

    I will continue to debug but thought I'd ask here.

    opened by delton137 9
  • I have problems for 4channel dataset to run mask rcnn

    I have problems for 4channel dataset to run mask rcnn

    Hi, pfjaeger. I'm trying to run mask rcnn with Brats dataset. I created 4channel .npy dataset with brats(t1, t1ce, t2, flair). When I run training, I met some error for like that assert len(crop_size) == len(data_shape) - 2, "If you provide a list/tuple as center crop make sure it has the same dimension as your data (2d/3d)" AssertionError: If you provide a list/tuple as center crop make sure it has the same dimension as your data (2d/3d).

    before training , I modified dataloader.py for read multichannel data. data = np.transpose(np.load(patient['data'], mmap_mode='r'), axes=(0, 1, 2, 3))[np.newaxis] seg = np.transpose(np.load(patient['seg'], mmap_mode='r'), axes=(0, 1, 2, 3))

    Could you comment for this error to resolve the problem? Best, David.

    opened by cammu00 9
  • ROI suppresor on LIDC preprocessing.py

    ROI suppresor on LIDC preprocessing.py

    Hello Sir Paul, thank you for your answer last time, regarding ROI suppresor on LIDC, I have some question If my dataset only contain one final annotation per patients (one final annotation by head radiologist, instead of multiple radiologist annotation), will the ROI suppresed or not?

    I hope my information help you identify the problem:

    1. My private dataset of Body (Thorax) and Lung CT scan with slice thickness 0.5 and 1.0
    2. When preprocessed using modified LIDC-IDRI-Processing almost 80% of data filtered out because incompatible DICOM when loaded with MitkCLDicomtoNRRD. --> I already ask at https://github.com/MIC-DKFZ/LIDC-IDRI-processing/issues/5, but no respond yet, maybe you know where the problem is?
    3. After passing it through, I run lidc_exp/preprocessing.py and almost all (90%) of RoIs are suppresed eventhough the RoI is already confimed to be a single RoI (not multiple RoI).

    Could you give me some hint, how to unsuppress RoI at preprocessing.py line 75-102? Thank you Sir @pfjaeger.

    opened by ivanwilliammd 8
  • Error with Retina U-net training

    Error with Retina U-net training

    Hi,

    First, thanks for your amazing work, it's really helpful ! I trained several models on LIDC dataset without any problem, but I just can't train Retina U-net

    Here the output of the exec.py file :

    Logging to RetinaUNET_400/fold_0/exec.log performing training in 3D over fold 0 on experiment RetinaUNET_400 with model retina_unet feature map shapes: [[32 32 64] [16 16 32] [ 8 8 16] [ 4 4 8]] anchor scales: {'xy': [[8, 10.079368399158986, 12.699208415745595], [16, 20.15873679831797, 25.39841683149119], [32, 40.31747359663594, 50.79683366298238], [64, 80.63494719327188, 101.59366732596476]], 'z': [[2, 2.5198420997897464, 3.1748021039363987], [4, 5.039684199579493, 6.3496042078727974], [8, 10.079368399158986, 12.699208415745595], [16, 20.15873679831797, 25.39841683149119]]} level 0: built anchors (589824, 6) / expected anchors 589824 ||| total build (589824, 6) / total expected 673920 level 1: built anchors (73728, 6) / expected anchors 73728 ||| total build (663552, 6) / total expected 673920 level 2: built anchors (9216, 6) / expected anchors 9216 ||| total build (672768, 6) / total expected 673920 level 3: built anchors (1152, 6) / expected anchors 1152 ||| total build (673920, 6) / total expected 673920

    Traceback (most recent call last): File "exec.py", line 276, in train(logger) File "exec.py", line 91, in train results_dict = net.train_forward(batch) File "/home/damien/medicaldetectiontoolkit/models/tmp_model.py", line 933, in train_forward rpn_class_loss, neg_anchor_ix = compute_rpn_class_loss(rpn_match, rpn_class_logits[b], self.cf.shem_poolsize) File "/home/damien/medicaldetectiontoolkit/models/tmp_model.py", line 200, in compute_rpn_class_loss roi_logits_pos = rpn_class_logits[pos_indices] RuntimeError: index 648427 is out of bounds for dimension 0 with size 224640

    I kept default parameters in the config.py file, however it seems that 'rpn_class_logits' is of size 224640 while it should be of size 673920 ( so 224640*3) Have you any idea of where it comes from ?

    Many thanks,

    opened by damien-blanc 7
  • HELP!

    HELP!

    In mrcnn.py ,I meet a error File "models/mrcnn.py", line 24, in from cuda_functions.nms_2D.pth_nms import nms_gpu as nms_2D File "C:\medicaldetectiontoolkit-master\cuda_functions\nms_2D\pth_nms.py", line 2, in from .ext import nms File "C:\medicaldetectiontoolkit-master\cuda_functions\nms_2D_ext\nms_init.py", line 3, in from ._nms import lib as _lib, ffi as _ffi ModuleNotFoundError: No module named 'cuda_functions.nms_2D._ext.nms._nms', could you help me solve it?

    opened by wgs123 7
  • why retinanet outperforms maskrcnn for lung lesion detection?

    why retinanet outperforms maskrcnn for lung lesion detection?

    Hi, I've read your paper and I'm wondering why RetinaNet works better than MaskRCNN for lung lesion detection with 2D or 2Dc inputs. I think in most cases, a two-stage detector should be better than one-stage with the same backbone. Have you ever investigate this? Or did I miss any details? Thanks

    opened by gathierry 7
  • cuda function crop_and_resize: different signatures for cpu and gpu versions

    cuda function crop_and_resize: different signatures for cpu and gpu versions

    Hi Paul,

    I was trying to get the code to run on cpu only for developing and testing on my local PC before training on a machine equipped with GPU(s).

    Unfortunately, there is an issue with the following lines:

    https://github.com/pfjaeger/medicaldetectiontoolkit/blob/695277d581128e210893fd0be5068868f21c9dfc/cuda_functions/roi_align_3D/roi_align/crop_and_resize.py#L21-L28

    When called, the cpu-only function _backend.crop_and_resize_forward returns an error "crop_and_resize_forward expected 7 arguments, got 8".

    This function is defined in the file ._crop_and_resize.so which is a compiled library so we don't access to the code. Would you have access to the definition/signature of this function and be able to help resolve this issue ?

    Thanks !

    opened by ThomasLecat 7
  • How to find AP score of the best trained model?

    How to find AP score of the best trained model?

    Hi I want to first thank you for posting this toolkit on Github. The whole thing is well-coded!

    I learned from the config file that the model selection criteria is AP score, which is awesome! I have used my own dataset and got multiple models (best check points) in exp_dir. Your code generated a file: epoch_ranking.npy, which contains ranked epoch numbers. I noticed there are multiple precision-recall graphs in plots folder, however, precision-recall graphs don't have AP score on them.

    If you don't mind me asking, how can I find the AP score of each of these epoch numbers ranked in epoch_ranking.npy?

    Thank you very much! -Bo

    opened by catmangoeswild 6
  • list index out of range while testing.

    list index out of range while testing.

    Hi, I met an error like following while testing after training with 4ch dataset. I think I need to change something in testing code, but I don't know exactly. I guess it's due to mismatch between 4ch data dimension and patch size dimension. could you comment for this? my 4ch dataset dim is (4, 240,240,155). Logging to ./brats_tc/fold_0/exec.log starting testing model of fold 0 in exp ./brats_tc feature map shapes: [[32 32 64] [16 16 32] [ 8 8 16] [ 4 4 8]] anchor scales: {'z': [[2], [4], [8], [16]], 'xy': [[8], [16], [32], [64]]} level 0: built anchors (196608, 6) / expected anchors 196608 ||| total build (196608, 6) / total expected 224640 level 1: built anchors (24576, 6) / expected anchors 24576 ||| total build (221184, 6) / total expected 224640 level 2: built anchors (3072, 6) / expected anchors 3072 ||| total build (224256, 6) / total expected 224640 level 3: built anchors (384, 6) / expected anchors 384 ||| total build (224640, 6) / total expected 224640 using default pytorch weight init subset: selected 57 instances from df data set loaded with: 57 test patients tmp ensembling over rank_ix:0 epoch:./brats_tc/fold_0/114_best_params.pth Traceback (most recent call last): File "exec.py", line 190, in test(logger) File "exec.py", line 126, in test test_results_list = test_predictor.predict_test_set(batch_gen, return_results=True) File "/data2/project/keras/medicaldetectiontoolkit/predictor.py", line 149, in predict_test_set batch = next(batch_gen['test']) File "/data2/project/keras/batchgenerators/batchgenerators/dataloading/data_loader.py", line 123, in next return self.generate_train_batch() File "experiments/brats_tc/data_loader.py", line 381, in generate_train_batch patch_crop_coords_list = dutils.get_patch_crop_coords(data, self.patch_size) File "/data2/project/keras/medicaldetectiontoolkit/utils/dataloader_utils.py", line 157, in get_patch_crop_coords n_patches = int(np.ceil(img.shape[dim] / patch_size[dim])) IndexError: list index out of range

    Thank you, David.

    opened by cammu00 6
  • Project dependencies may have API risk issues

    Project dependencies may have API risk issues

    Hi, In medicaldetectiontoolkit, inappropriate dependency versioning constraints can cause risks.

    Below are the dependencies and version constraints that the project is using

    batchgenerators==0.19.3
    cffi==1.11.5
    cycler==0.10.0
    decorator==4.4.1
    future==0.18.2
    imageio==2.6.1
    kiwisolver==1.1.0
    linecache2==1.0.0
    matplotlib==3.1.2
    networkx==2.4
    numpy==1.15.3
    pandas==0.23.4
    Pillow==8.1.1
    pycparser==2.19
    pyparsing==2.4.5
    python-dateutil==2.8.1
    pytz==2019.3
    PyWavelets==1.1.1
    scikit-image==0.16.2
    scikit-learn==0.20.0
    scipy==1.3.3
    six==1.13.0
    sklearn==0.0
    threadpoolctl==1.1.0
    torch==0.4.1
    traceback2==1.4.0
    unittest2==1.1.0
    

    The version constraint == will introduce the risk of dependency conflicts because the scope of dependencies is too strict. The version constraint No Upper Bound and * will introduce the risk of the missing API Error because the latest version of the dependencies may remove some APIs.

    After further analysis, in this project, The version constraint of dependency matplotlib can be changed to >=1.3.0,<=3.0.3. The version constraint of dependency networkx can be changed to >=2.0,<=2.8.4. The version constraint of dependency numpy can be changed to >=1.8.0,<=1.23.0rc3. The version constraint of dependency pandas can be changed to >=0.13.0,<=0.23.4. The version constraint of dependency scikit-learn can be changed to >=0.14,<=0.21.3. The version constraint of dependency scipy can be changed to >=0.12.0,<=1.7.3.

    The above modification suggestions can reduce the dependency conflicts as much as possible, and introduce the latest version as much as possible without calling Error in the projects.

    The invocation of the current project includes all the following methods.

    The calling methods from the matplotlib
    matplotlib.gridspec.GridSpec
    matplotlib.gridspec.GridSpec.update
    matplotlib.use
    
    The calling methods from the networkx
    max
    
    The calling methods from the numpy
    distutils.core.setup
    numpy.testing.assert_almost_equal
    
    The calling methods from the pandas
    pandas.DataFrame.to_csv
    pandas.read_pickle
    pandas.read_csv
    pandas.concat
    
    The calling methods from the scikit-learn
    sklearn.metrics.roc_curve
    sklearn.metrics.precision_recall_curve
    sklearn.metrics.roc_auc_score
    sklearn.metrics.average_precision_score
    
    The calling methods from the scipy
    scipy.ndimage.zoom
    scipy.ndimage.measurements.label
    scipy.ndimage.measurements.center_of_mass
    
    The calling methods from the all methods
    numpy.std
    all_pids_list.len.cf.n_cv_splits.cf.seed.dutils.fold_generator.get_fold_names
    self.C0
    rpn_bbox.view.contiguous
    handle2.write
    self.FPN.super.__init__
    numpy.newaxis.seg_logits.F.softmax.cpu.data.numpy.np.argmax.astype
    distutils.core.setup
    boxes2.repeat.size
    self.cf.dim.scale.np.array.torch.from_numpy.float.cuda
    cl_df.groupby
    fold_df.pred_score.tolist
    C2_layers.append
    os.path.split
    msg_colors.get
    boxes.detach.contiguous
    torch.utils.ffi._wrap_function
    rpn_bbox.view.view
    pyramid_roi_align
    dets.cpu.cpu
    batch_anchors.clone.size
    self.model.self.add_mrcnn_configs.self.add_mrcnn_configs.self.add_mrcnn_configs.self.add_mrcnn_configs.self.add_det_unet_configs
    numpy.linspace
    predictor.Predictor.predict_patient
    cf.bbox_std_dev.torch.from_numpy.float
    cf.mask_shape.negative_count.torch.zeros.cuda
    img_arr.np.std.astype.astype
    torch.LongTensor.cuda
    compute_roi_ap
    self.rpn_rois_batch_info.split
    data.seg_preds.segs.data.np.concatenate.astype
    numpy.median
    fg_probs.shape.keep_ix.unsqueeze
    BatchGenerator
    C6_layers.append
    nrrd.read
    self.P2_conv2
    self.Classifier
    subprocess.call
    negative_count.rand_idx.cuda
    configs.configs
    batch_targets.append
    boxix.ix.chunk_dict.copy
    numpy.argsort
    self.conv2
    fold_df.class_label.tolist
    utils.dataloader_utils.pad_nd_image
    img.np.flip.copy
    torch.nn.Conv2d
    aucs.append
    torch.cuda.is_available
    self.figure_list.ax1.set_ylim
    matplotlib.pyplot.plot
    numpy.clip
    matplotlib.pyplot.subplot
    b_keep.class_scores.sort
    numpy.savez_compressed
    keep.class_ids.unsqueeze
    self.C6
    numpy.max
    PatientBatchIterator
    self._data.items
    self.new_fold
    torch.nn.Sequential
    torch.nn.Linear
    utils.exp_utils.load_checkpoint
    numpy.testing.assert_almost_equal
    torch.nn.init.kaiming_uniform_
    seg.torch.FloatTensor.cuda
    mask.unsqueeze.repeat.unsqueeze
    net.load_state_dict
    torch.nn.init.xavier_normal_
    batch_coords.append
    numpy.minimum
    SimpleITK.GetImageFromArray.SetSpacing
    self.conv_3
    torch.nn.init.xavier_uniform_
    locals
    matplotlib.pyplot.savefig
    numpy.sqrt
    utils.model_utils.bbox_overlaps_2D
    numpy.delete
    cf.bbox_std_dev.torch.from_numpy.float.cuda
    torch.from_numpy
    type
    utils.exp_utils.ModelSelector.run_model_selection
    roi_masks.unsqueeze
    Classifier
    _AnsiColorizer
    utils.dataloader_utils.get_patch_crop_coords
    self.figure_list.ax1.set_xlim
    copy.deepcopy
    weighted_box_clustering
    plotting.plot_stat_curves
    RPN
    numpy.sum
    logging.getLogger.addHandler
    epoch.monitor_metrics.append
    rpn_scores.shape.n_pad_boxes.torch.zeros.cuda
    rpn_match.torch.nonzero.size
    numpy.stack
    __all__.append
    full_masks.append
    default_configs.DefaultConfigs.__init__
    boxes.detach.contiguous.detach
    box_depths.box_widths.box_heights.np.stack.reshape
    numpy.unique
    argparse.ArgumentParser.parse_args
    self.conv_shared
    utils.model_utils.initialize_weights
    self.sigmoid.size
    numpy.split
    torch.mean
    generate_experiment
    plotting.plot_prediction_hist
    pool_size.pool_size.ra2D
    self.preprocess_patient
    Mask
    rpn_pred_deltas.size
    class_ids.size.torch.arange.long
    torch.nn.ReLU
    sample_proposals.self.cf.window.mutils.clip_to_window.cpu
    torch.ByteTensor
    self.conv_4.size
    torch.utils.ffi.create_extension.build
    chunk_dicts.keys
    CropAndResizeFunction
    fg_probs.view.sort
    scales.flatten.flatten
    batch_segs.append
    torch.nn.functional.cross_entropy
    converter.update
    torch.nn.ConvTranspose3d
    line.strip
    torch.nn.functional.interpolate
    self.stream.write
    torch.IntTensor.cuda.cpu
    positive_ix.target_masks.detach
    batch_rpn_rois.shape.batch_rpn_rois.shape.np.arange.np.repeat.torch.from_numpy.float.cuda
    pandas.DataFrame.to_pickle
    val_results_list.append
    numpy.save
    matplotlib.pyplot.figure.savefig
    zip
    numpy.sum.append
    pre_nms_scores.size.torch.arange.long
    numpy.random.randint
    utils.exp_utils.prepare_monitoring
    matplotlib.pyplot.ylabel
    numpy.prod
    anchor_matches.torch.nonzero.size
    df.fold.unique
    self.build
    numpy.delete.squeeze
    self.P2_conv1
    get_case_identifiers
    numpy.std.GetSpacing
    refine_detections.cpu
    anchor_target_deltas.torch.from_numpy.float
    self.P6_conv2
    resample_array
    new_seg_batch.append
    sample_masks.append
    roi_rater_list.append
    get_results
    neg_ix.shape.torch.LongTensor.cuda
    collectPaths.append
    os.path.isfile
    _ext.nms.cpu_nms
    Exception
    self.deconv
    seg_logits.F.softmax.argmax
    self.conv_1
    torch.cat.permute
    generate_anchors_3D
    os.listdir
    positive_roi_ix.mrcnn_target_deltas.detach
    self.conv3
    preprocessing.get_z_crops
    batch_data.append
    self.linear_class
    self.P0_conv1
    numpy.transpose.items
    importlib.util.spec_from_file_location
    matplotlib.pyplot.legend
    utils.model_utils.shem.cpu
    torch.sort
    bix.max_scores.append
    utils.exp_utils.import_module.get_train_generators
    torch.FloatTensor.cuda.size
    self.downsample
    targets_pos.long
    numpy.delete.size
    argparse.ArgumentParser
    tensor.sort.sort
    batchgenerators.transforms.crop_and_pad_transforms.CenterCropTransform
    cf.dim.negative_count.torch.zeros.cuda
    dets.cpu.size
    keep.pre_nms_class_ids.unsqueeze.float
    utils.model_utils.batch_dice
    path.split
    numpy.sign
    self.RPN.super.__init__
    utils.model_utils.get_one_hot_encoding
    torch.split
    b.box_results_list.append
    metric_classes.extend
    str
    rpn_target_deltas.torch.from_numpy.float
    class_logits.shape.class_logits.shape.torch.arange.unsqueeze.repeat.view
    self.np_anchors.torch.from_numpy.float.cuda
    self.final_conv
    ratios.flatten.flatten
    compute_mrcnn_class_loss
    os.path.join
    numpy.where
    positive_roi_bool.torch.nonzero.squeeze
    os.path.exists
    torch.nn.functional.smooth_l1_loss
    keep.class_ids.unsqueeze.float
    pandas.read_pickle.to_pickle
    ValueError
    torch.LongTensor
    target_class_ids.cpu.data.numpy.list.count
    self.conv_2
    SimpleITK.GetImageFromArray.SetOrigin
    torch.nn.InstanceNorm3d
    sklearn.metrics.precision_recall_curve
    numpy.floor
    utils.model_utils.unmold_mask_3D
    cf.rpn_bbox_std_dev.torch.from_numpy.float
    torch.log
    torch.IntTensor.cuda
    torch.nn.InstanceNorm2d
    torch.tensor.long.cuda
    torch.IntTensor.cuda.long
    predictor.Predictor
    multiprocessing.Pool.close
    converter
    bix.out_patient_results_list.extend
    max
    numpy.mean
    numpy.meshgrid
    w.h.w.h.np.array.torch.from_numpy.float.cuda
    numpy.std.GetSize
    self.BBRegressor
    seg_logits.F.softmax.argmax.cpu
    self.conv1
    self.P3_conv2
    y.shape.y.shape.n_classes.y.shape.np.zeros.astype
    bb_logits.view.contiguous
    keep.pre_nms_batch_ixs.unsqueeze
    torch.cat.contiguous
    seg.torch.FloatTensor.cuda.long
    net.train_forward.backward
    self.cf.num_seg_classes.seg.mutils.get_one_hot_encoding.torch.FloatTensor.cuda
    numpy.copy
    anchors.repeat.repeat
    utils.model_utils.apply_box_deltas_2D
    self.cf.wce_weights.torch.tensor.float
    torch.FloatTensor.cuda.item
    load_dataset.items
    scores.argsort
    self.cf.class_dict.keys
    ratios_meshed.flatten.flatten
    self.conv4
    pos_indices.squeeze.size
    spec_df.pred_score.tolist
    any
    p_df.pid.isin.tolist
    sorted
    self.conv_final
    get_one_hot_encoding
    torch.autograd.Variable
    self.cf.exp_dir.split
    load_dataset
    self.C5
    os.walk
    torch.optim.Adam.step
    torch.cat.append
    batch_rpn_rois.shape.batch_rpn_rois.shape.np.arange.np.repeat.torch.from_numpy.float
    self.Fpn
    evaluator.Evaluator.evaluate_predictions
    skimage.segmentation.clear_border
    sklearn.metrics.average_precision_score
    torch.IntTensor
    self.extrapolation_value.self.crop_zdepth.self.crop_width.self.crop_height.CropAndResizeFunction
    self.fpn
    numpy.random.rand
    self.P0_conv2
    class_logits.shape.torch.arange.unsqueeze
    load_dataset.keys
    batchgenerators.transforms.spatial_transforms.SpatialTransform
    SimpleITK.ReadImage.GetSpacing
    self.save_for_backward
    self.net.eval
    p_df.pid.isin
    numpy.argmin
    img.np.flip.np.flip.copy
    batch_components.append
    torch.nn.Conv3d
    ax1.set_title
    matplotlib.pyplot.text
    mrcnn_bbox.view.size
    numpy.std.GetDirection
    self.rpn
    numpy.reshape
    ii.min_pix.count.np.argwhere.ii.ii.np.array.astype
    self.spatial_tiling_forward
    pid_df.det_type.pid_df.det_type.pid_df.sort_values
    order.dets.contiguous
    w.h.torch.sqrt.mutils.log2.round.int.clamp
    box_widths.box_heights.np.stack.reshape
    numpy.concatenate.clamp
    numpy.zeros_like
    img.torch.from_numpy.float
    numpy.log
    box_ind.detach.detach
    get_mirrored_patch_crops
    torch.nn.MaxPool3d
    SimpleITK.ResampleImageFilter.SetReferenceImage
    utils.model_utils.box_refinement
    compute_rpn_bbox_loss
    pandas.read_pickle
    multiprocessing.Pool.join
    utils.model_utils.clip_boxes_2D
    numpy.load
    logger.warning
    os.mkdir
    utils.model_utils.bbox_overlaps_3D
    r.int.box_results_list.append
    torch.nn.functional.binary_cross_entropy
    matplotlib.pyplot.xlabel
    numpy.take
    self.loss_samples_forward
    self.P5_conv1
    torch.nn.functional.cross_entropy.item
    utils.model_utils.batch_dice.item
    SimpleITK.GetArrayFromImage
    sample_negative_indices.append
    self.P1_conv1
    logging.FileHandler
    SimpleITK.Image.SetDirection
    self.P4_conv1
    class_ids.size.torch.arange.long.cuda
    self.P2_upsample
    time.time
    sample_proposals.self.cf.window.mutils.clip_to_window.cpu.data.numpy.repeat
    scales_xy.flatten.flatten
    _ext.crop_and_resize.crop_and_resize_gpu_forward
    crop_and_resize.CropAndResizeFunction
    numpy.load.astype
    self.forward
    callable
    ax1.set_position
    b.batch_gt_class_ids.torch.from_numpy.int
    self.net.train_forward
    numpy.ceil
    grad_outputs.torch.zeros_like.resize_
    matplotlib.pyplot.yscale
    out_max_scores.append
    apply_wbc_to_patient
    matplotlib.gridspec.GridSpec.update
    _ext.nms.gpu_nms
    predictor.Predictor.load_saved_predictions
    self.BatchGenerator.super.__init__
    self.net.test_forward
    self.sigmoid.view
    numpy.arange
    multiprocessing.Pool.map
    numpy.array.astype
    matplotlib.pyplot.hist
    roi_probs_neg.max.sort
    ii.split
    torch.FloatTensor
    num_out.keep.cuda.order.contiguous
    numpy.delete.sort
    cf.mask_shape.cf.mask_shape.cf.mask_shape.ra3D
    torch.nn.init.normal_
    self.data_aug_forward
    SimpleITK.ReadImage
    dir
    collectPaths
    z.z.w.h.w.h.np.array.torch.from_numpy.float
    ax1.get_position
    cuda_functions.roi_align_2D.roi_align.crop_and_resize.CropAndResizeFunction
    C3_layers.append
    zoom_factor.mask.scipy.ndimage.zoom.astype
    torch.nonzero
    configs.configs.configs
    b.batch_proposals.torch.nonzero.squeeze
    utils.exp_utils.import_module.FPN
    aggregate_meta_info
    image.size
    negative_roi_bool.torch.nonzero.squeeze
    batch.torch.LongTensor.cuda
    class_logits.shape.torch.arange.unsqueeze.repeat
    get_one_hot_encoding.size
    enumerate
    rpn_bbox.view.permute
    anchors.append
    b.batch_gt_masks.torch.from_numpy.float.cuda
    self.classifier
    batchgenerators.transforms.abstract_transforms.Compose
    batchgenerators.transforms.utility_transforms.ConvertSegToBoundingBoxCoordinates
    utils.model_utils.gt_anchor_matching
    numpy.delete.unsqueeze
    rpn_class_logits.view.permute
    batch_2D.update
    utils.model_utils.generate_pyramid_anchors
    seg_logits.F.softmax.detach
    positive_roi_bool.torch.nonzero.size
    numpy.newaxis.seg_preds.np.array.np.round.astype
    rpn_scores.boxes.torch.cat.cpu.data.numpy
    stream.isatty
    out_coords.append
    self.Interpolate.super.__init__
    boxes1_repeat.boxes1.repeat.view.chunk
    self.model.self.add_mrcnn_configs.self.add_mrcnn_configs.self.add_mrcnn_configs.self.add_mrcnn_configs.self.add_mrcnn_configs.self.add_mrcnn_configs.self.add_det_unet_configs
    numpy.std.GetPixelIDValue
    keep_bool.torch.nonzero.size
    list
    train_results_list.append
    self.P3_conv1
    out_box_coords.append
    torch.round
    m.bias.data.zero_
    torch.exp
    logger.cf.model.net.cuda.eval
    self.P6_conv1
    detection_monitoring_plot
    print
    _import_symbols
    torch.nn.init.kaiming_normal_
    keep.batch_ixs.unsqueeze
    torch.nn.MaxPool2d
    matplotlib.pyplot.close
    import_module.configs
    logger.info
    spec.loader.exec_module
    batchgenerators.transforms.spatial_transforms.MirrorTransform
    self.net.super.__init__
    numpy.random.choice
    rpn_target_deltas.torch.from_numpy.float.cuda
    pos_indices.squeeze.squeeze
    self.ResBlock.super.__init__
    min
    df.pid.unique
    batch_rpn_rois.view
    self.sigmoid
    self.mask
    torch.tensor.long
    slice
    pandas.read_csv
    chunk_dict.np.flip.np.flip.copy
    s.int.roi_results.append
    generate_anchors
    file_path.split
    iou_df.det_type.iou_df.det_type.iou_df.sort_values
    numpy.newaxis.seg_logits.F.softmax.argmax.cpu.data.numpy.astype
    SimpleITK.Image
    ix_scores.unsqueeze
    torch.load
    self.RoIAlign.super.__init__
    float
    get_train_generators
    cf.mask_shape.cf.mask_shape.ra2D
    int.extend
    batch_pids.append
    logger.cf.model.net.cuda
    tensor.sort.size
    sklearn.metrics.roc_auc_score
    get_coords
    utils.exp_utils.import_module.net
    proposals.shape.np.array.torch.from_numpy.cuda
    self.P1_upsample
    logging.getLogger
    torch.save
    roi_masks.size.torch.arange.int.cuda
    ix_scores.sort
    utils.dataloader_utils.unpack_dataset
    keep.pre_nms_batch_ixs.unsqueeze.float
    b.batch_gt_boxes.torch.from_numpy.float.cuda
    next.keys
    self.init_indices
    join
    proposal_layer
    keep.pre_nms_class_ids.unsqueeze
    coords_mesh_grid.append
    utils.model_utils.shem
    b.batch_gt_masks.torch.from_numpy.float
    net.state_dict
    SimpleITK.Image.SetOrigin
    pc.results_dict.append
    torch.max
    sklearn.metrics.roc_curve
    ii.split.lstrip
    batchgenerators.dataloading.multi_threaded_augmenter.MultiThreadedAugmenter
    self.logger.info
    numpy.random.RandomState
    self.conv5
    order.size.negative_count.int.ohem_poolsize.torch.tensor.min
    numpy.array.append
    bboxes_list.append
    self.test_df.to_pickle
    bb_logits.view.view
    numpy.pad
    spec_df.det_type.tolist
    roi.sitk.GetArrayFromImage.astype
    seg_logits.F.softmax.cpu
    os.path.dirname
    neg_indices.squeeze.size
    self.cf.dim.scale.np.array.torch.from_numpy.float
    self.extrapolation_value.self.crop_width.self.crop_height.CropAndResizeFunction
    fold_df.class_label.any
    q.tolist.tolist
    keep.pre_nms_scores.unsqueeze
    cf.scale.torch.from_numpy.float.cuda
    train
    deltas.repeat.repeat
    pre_nms_scores.size.torch.arange.long.cuda
    spec_df.class_label.unique
    neg_indices.squeeze.squeeze
    get_mirrored_patch_crops.append
    boxes2.repeat.repeat
    torch.nn.init._calculate_fan_in_and_fan_out
    int
    box_centers_x.box_centers_y.np.stack.reshape
    roi_rater_list.extend
    torch.FloatTensor.cuda
    src_imgs.astype
    BBRegressor
    compute_iou_3D
    torch.sqrt
    super
    importlib.util.module_from_spec
    metrics.keys
    utils.model_utils.compute_overlaps
    matplotlib.pyplot.subplot.axis
    torch.IntTensor.cuda.size
    create_data_gen_pipeline
    rpn_match.torch.nonzero.squeeze
    numpy.all
    sample_proposals.size
    plotting.plot_batch_prediction
    cf.dim.cf.rpn_bbox_std_dev.np.reshape.torch.from_numpy.float
    mrcnn_bbox.view.view
    parse_requirements
    target_shape.img.resize.astype
    cuda_functions.nms_3D.pth_nms.nms_gpu
    cf.dim.cf.rpn_bbox_std_dev.np.reshape.torch.from_numpy.float.cuda
    numpy.full
    SimpleITK.ResampleImageFilter
    rpn_scores.boxes.torch.cat.cpu
    b.proposal_boxes.argsort
    Interpolate
    b.batch_gt_class_ids.torch.from_numpy.int.cuda
    _ext.crop_and_resize.crop_and_resize_forward
    numpy.tile
    predictor.Predictor.predict_test_set
    range.append
    positive_samples.rand_idx.cuda
    boxes1_repeat.boxes1.repeat.view.size
    numpy.zeros
    rpn_class_logits.view.contiguous
    cand.class_targets.count
    class_logits.shape.class_logits.shape.torch.arange.unsqueeze.repeat.view.cuda
    compute_mrcnn_bbox_loss
    self.batch_tiling_forward
    keep_scores.append
    positive_roi_ix.target_class_ids.long
    positive_roi_bool.torch.nonzero.squeeze.size
    import_module
    next
    utils.exp_utils.import_module.configs
    self.conv_class
    SimpleITK.Resample
    self.figure_list.ax1.set_xlabel
    setuptools.find_packages
    AssertionError
    getattr
    fold_df.class_label.unique
    len
    pickle.load
    neg_ix.cpu.data.numpy
    argparse.ArgumentParser.add_argument
    anchor_matches.torch.nonzero.squeeze
    hdlr.close
    curses.tigetnum
    out_list.append
    order.size
    evaluator.Evaluator.score_test_df
    self.cf.wce_weights.torch.tensor.float.cuda
    logger.cf.model.net.cuda.train
    sys.path.append
    batch_ixs.append
    divmod
    logging.getLogger.setLevel
    utils.dataloader_utils.fold_generator
    nms_2to3D
    cf.rpn_bbox_std_dev.torch.from_numpy.float.cuda
    roi_probs_neg.max
    b.batch_gt_boxes.torch.from_numpy.float
    utils.exp_utils.import_module.get_test_generator
    collections.OrderedDict.items
    spec_df.class_label.tolist
    numpy.array.items
    self.net.load_state_dict
    matplotlib.use
    refine_detections
    test
    ColorHandler
    matplotlib.pyplot.title
    pre_nms_scores.size
    torch.optim.Adam.zero_grad
    mask.unsqueeze.repeat
    pool_size.pool_size.pool_size.ra3D
    utils.model_utils.unmold_mask_2D
    keep_coords.append
    sample_positive_indices.append
    final_slices.append
    torch.nn.BatchNorm3d
    compute_bbox_loss
    w.h.w.h.np.array.torch.from_numpy.float
    utils.model_utils.NDConvGenerator
    cuda_functions.nms_2D.pth_nms.nms_gpu
    self.np_anchors.torch.from_numpy.float
    batch_segs.np.array.astype
    anchor_class_match.torch.from_numpy.cuda
    self.interp
    torch.tensor
    sample_deltas.append
    self.C4
    i.endswith
    header.keys
    Warning
    utils.exp_utils.ModelSelector
    scipy.ndimage.zoom
    numpy.cumsum
    coords_mesh_grid.np.array.astype
    featuremap.size
    self.P4_conv2
    keep_z.append
    seg_preds.append
    pickle.dump
    torch.no_grad
    numpy.concatenate
    numpy.searchsorted
    os.path.join.split
    numpy.min
    img.torch.FloatTensor.cuda
    numpy.argmax
    keep_max.append
    RuntimeError
    utils.model_utils.clip_boxes_3D
    boxes1_repeat.boxes1.repeat.view.repeat
    compute_mrcnn_class_loss.item
    p_df.pid.tolist
    probs.contiguous.view
    numpy.maximum
    separate_values_dict.values
    torch.optim.Adam
    seg_logits.F.softmax.detach.cpu.data.numpy
    torch.arange
    detection_masks.permute.cpu.data.numpy
    os.remove
    detection_masks.permute.cpu
    first_element.cuda.cuda
    line.startswith
    pos_indices.cpu.data.numpy
    torch.min
    scipy.ndimage.measurements.center_of_mass
    order.size.negative_count.int.ohem_poolsize.torch.tensor.min.int
    k.header.split
    utils.model_utils.apply_box_deltas_3D
    self.figure_list.ax1.grid
    torch.nn.LeakyReLU
    numpy.random.RandomState.shuffle
    pool_indices.size
    format
    TrainingPlot.update_and_save
    batch_anchors.clone
    pos_indices.squeeze.cpu
    copy_and_unpack_data
    _ext.crop_and_resize.crop_and_resize_backward
    matplotlib.pyplot.figure
    names_list.append
    skimage.transform.resize
    pandas.concat
    positive_ix.target_class_ids.long
    compute_mrcnn_bbox_loss.item
    seg_logits.F.softmax.argmax.cpu.data.numpy
    sum_tensor
    y.shape.y.shape.y.shape.n_classes.y.shape.np.zeros.astype
    get_z_crops
    evaluator.Evaluator
    img_arr.np.std.astype
    batch_rpn_rois.shape.batch_rpn_rois.shape.np.arange.np.repeat.torch.from_numpy.float.cuda.unsqueeze
    torch.max.size
    torch.stack
    collections.OrderedDict
    abs
    utils.model_utils.clip_to_window
    self.ColorHandler.super.__init__
    self.relu
    dict
    cf.dim.ix.detections.astype
    torch.nn.init.uniform_
    p.x.np.concatenate.astype
    self.mask.permute
    bb_logits.view.permute
    smax.np.copy.argmax
    batch_data.np.array.astype
    pr.tolist.tolist
    utils.dataloader_utils.get_class_balanced_patients
    keep.class_scores.unsqueeze
    compute_rpn_class_loss
    self.C2
    seg_logits.F.softmax.detach.cpu
    box_centers_z.box_centers_x.box_centers_y.np.stack.reshape
    batch.dict_of_patient_results.append
    cf.scale.torch.from_numpy.float
    self.figure_list.append
    input.sum.sum
    self.PatientBatchIterator.super.__init__
    C4_layers.append
    bix.results_dict.append
    seg_logits.F.softmax.cpu.data.numpy
    compute_iou_2D
    scipy.ndimage.measurements.label
    detection_target_layer
    utils.model_utils.clip_boxes_numpy
    spec_df.class_label.any
    isinstance
    net.modules
    torch.nn.Sigmoid
    optimizer.load_state_dict
    utils.model_utils.unique1d
    roi_masks.size
    ln2.cuda.cuda
    self.figure_list.ax1.set_ylabel
    anchor_target_deltas.torch.from_numpy.float.cuda
    numpy.std.GetOrigin
    self.C3
    boxes_list.append
    merge_2D_to_3D_preds_per_patient
    torch.nonzero.any
    utils.exp_utils.get_logger.info
    optimizer.state_dict
    seg.astype.astype
    conv.cf.backbone.FPN.cuda
    z.z.w.h.w.h.np.array.torch.from_numpy.float.cuda
    self.conv_4
    ii.split.split
    SimpleITK.ResampleImageFilter.Execute
    class_dict.keys
    self.predict_patient
    pool.map.append
    boxes2.repeat.chunk
    boxes.shape.n_pad_boxes.torch.zeros.cuda
    self.CropAndResize.super.__init__
    pred_deltas.size
    exp_path.split
    layer_outputs.append
    bb_reg_layer_outputs.append
    bix.out_patient_results_list.append
    boxes1_repeat.boxes1.repeat.view
    roi_masks.size.torch.arange.int
    logger.cf.model.net.cuda.train_forward
    self.cf.num_seg_classes.batch.mutils.get_one_hot_encoding.torch.FloatTensor.cuda
    multiprocessing.Pool
    numpy.delete.chunk
    utils.exp_utils.prep_exp
    cl_df.groupby.agg
    compute_class_loss
    ix.box_results_list.append
    num_out.keep.cuda
    all_stats.append
    cf.class_dict.items
    numpy.any
    self.Mask.super.__init__
    numpy.flip
    img.torch.from_numpy.float.cuda
    class_layer_outputs.append
    matplotlib.pyplot.imshow
    torch.cat
    negative_count.torch.zeros.int.cuda
    w.h.torch.sqrt.mutils.log2.round.int
    _ext.crop_and_resize.crop_and_resize_gpu_backward
    numpy.diagonal
    numpy.zeros.astype
    class_logits_list.append
    ax1.get_position.keys
    ax1.legend
    binary_mask.astype.astype
    utils.model_utils.shem.size
    curses.setupterm
    self.Classifier.super.__init__
    logging.getLogger.info
    rpn_class_logits.view.view
    matplotlib.gridspec.GridSpec
    torch.zeros
    self.linear_bbox
    numpy.argwhere
    numpy.round
    probs.repeat.repeat
    open
    aux.sort.sort
    SimpleITK.Image.SetSpacing
    os.path.realpath
    self.P5_conv2
    normalized_boxes.unsqueeze
    sc.monitor_metrics.count
    keep.append
    score_level_name.monitor_metrics.append
    utils.exp_utils.import_module
    rpn_match.torch.from_numpy.cuda
    torch.randperm
    ax1.plot
    b.results_dict.append
    plotting.TrainingPlot_2Panel
    batch_rpn_rois.shape.batch_rpn_rois.shape.np.arange.np.repeat.torch.from_numpy.float.cuda.repeat
    compute_overlaps
    torch.nn.functional.softmax
    self.return_metrics
    sample_proposals.self.cf.window.mutils.clip_to_window.cpu.data.numpy
    target_class_ids.cpu.data.numpy
    utils.model_utils.log2
    scipy.stats.norm.pdf
    probs.contiguous
    crop_coords.append
    new_img_batch.append
    negative_roi_bool.torch.nonzero.size
    target_class_ids.torch.nonzero.size
    class_ids.np.array.torch.from_numpy.cuda
    cuda_functions.roi_align_3D.roi_align.crop_and_resize.CropAndResizeFunction
    torch.zeros_like
    w.h.torch.sqrt.mutils.log2.round
    iou.view
    numpy.repeat
    tuple
    level_boxes.detach.detach
    sample_class_ids.append
    set
    torch.nn.ConvTranspose2d
    negative_count.torch.zeros.int
    grad_outputs.contiguous.contiguous
    logger.cf.model.net.cuda.parameters
    scores.sort
    range
    compute_mrcnn_mask_loss
    my_transforms.append
    conv
    get_roi_ap_from_df
    numpy.transpose
    torch.utils.ffi.create_extension
    self.net.test_forward.append
    torch.cat.view
    SimpleITK.GetImageFromArray
    numpy.array
    ix.batch_ixs.int
    torch.nn.BatchNorm2d
    utils.exp_utils.create_csv_output
    type_list.count
    df.match_iou.unique
    self.spatial_tiling_forward.append
    b_keep.pre_nms_scores.sort
    C5_layers.append
    detections.cpu.data.numpy
    self.C1
    pandas.DataFrame
    self.block
    pos_indices.shape.torch.LongTensor.cuda
    self.conv_bbox
    numpy.load.items
    handle.write
    utils.exp_utils.get_logger
    pandas.DataFrame.to_csv
    zeros.cuda.cuda
    os.makedirs
    self.BBRegressor.super.__init__
    

    @developer Could please help me check this issue? May I pull a request to fix it? Thank you very much.

    opened by PyDeps 0
  • digital-copyright

    digital-copyright

    Hi MIC-DKFZ!đź‘‹, I added this optional feature to digitally sign you source-code and track it on a blockchain node should you ever be audited or experience a software supply-chain attack. Simply compare the byte encrypted signature on your .git binary with the hash written to your immutable blockchain node. If they ever differ you should escalate. See the MIC-DKFZ-digital-copyright for complete instructions on accessing your hash.. Feel free to contact me directly to review any questions before accepting. ~~Best: [email protected]

    opened by JudeSafo 1
  • How to write U-Net Deep Learning code dealing with

    How to write U-Net Deep Learning code dealing with ".tiff" images?

    Hi, I have read the supervised machine learning on the page of "https://rasterframes.io/supervised-learning.html", now I would like to implement U-Net (Semantic Segmentation) Deep Learning which is integrated with RasterFrames. However, I am so confused about how to write U-Net Deep Learning code dealing with ".tiff" images? So, would you pls help to give me some suggestions? Many Thanks!

    opened by JenniferYingyiWu2020 0
  • only a single thread working in

    only a single thread working in "MultiThreadedAugmenter " !

    when I run lidc_exp, I found only a single thread is working while loading data

    image

    here is my code:

    def create_data_gen_pipeline(patient_data, cf, is_training=True):
        """
        create mutli-threaded train/val/test batch generation and augmentation pipeline.
        :param patient_data: dictionary containing one dictionary per patient in the train/test subset.
        :param is_training: (optional) whether to perform data augmentation (training) or not (validation/testing)
        :return: multithreaded_generator
        """
    
        # create instance of batch generator as first element in pipeline.
        data_gen = BatchGenerator(patient_data, batch_size=cf.batch_size, cf=cf)
    
        # add transformations to pipeline.
        my_transforms = []
        if is_training:
            mirror_transform = MirrorTransform(axes=np.arange(cf.dim))
            my_transforms.append(mirror_transform)
            spatial_transform = SpatialTransform(patch_size=cf.patch_size[:cf.dim],
                                                 patch_center_dist_from_border=cf.da_kwargs['rand_crop_dist'],
                                                 do_elastic_deform=cf.da_kwargs['do_elastic_deform'],
                                                 alpha=cf.da_kwargs['alpha'], sigma=cf.da_kwargs['sigma'],
                                                 do_rotation=cf.da_kwargs['do_rotation'], angle_x=cf.da_kwargs['angle_x'],
                                                 angle_y=cf.da_kwargs['angle_y'], angle_z=cf.da_kwargs['angle_z'],
                                                 do_scale=cf.da_kwargs['do_scale'], scale=cf.da_kwargs['scale'],
                                                 order_data=cf.da_kwargs['order_data'],
                                                 random_crop=cf.da_kwargs['random_crop'])
    
            my_transforms.append(spatial_transform)
        else:
            my_transforms.append(CenterCropTransform(crop_size=cf.patch_size[:cf.dim]))
    
        my_transforms.append(ConvertSegToBoundingBoxCoordinates(cf.dim, get_rois_from_seg_flag=False, class_specific_seg_flag=cf.class_specific_seg_flag))
        all_transforms = Compose(my_transforms)
        # multithreaded_generator = SingleThreadedAugmenter(data_gen, all_transforms)
        if is_training:
            print (f"is_training: {is_training}, num_processes: {cf.n_workers}")
            # multithreaded_generator = MultiThreadedAugmenter(data_gen, all_transforms, num_processes = cf.n_workers, 
            #                          num_cached_per_queue=3, seeds=range(cf.n_workers), pin_memory=True)
            multithreaded_generator = MultiThreadedAugmenter(data_gen, all_transforms, num_processes = cf.n_workers, 
            num_cached_per_queue=3, seeds=range(cf.n_workers), pin_memory=True, wait_time=0.01, timeout=5)
        else:
            print (f"is_training: {is_training}, num_processes: {max(1, cf.n_workers // 2)}")
            # multithreaded_generator = MultiThreadedAugmenter(data_gen, all_transforms, num_processes = max(1, cf.n_workers // 2),
            #                          num_cached_per_queue=1, seeds=None, pin_memory=True)
            multithreaded_generator = MultiThreadedAugmenter(data_gen, all_transforms, num_processes = max(1, cf.n_workers // 2), 
            num_cached_per_queue=1, seeds=None, pin_memory=True, wait_time=0.01, timeout=5)
        return multithreaded_generator
    

    here is my config:

    class configs(DefaultConfigs):
    
        def __init__(self, server_env=False):
    
            #########################
            #    Preprocessing      #
            #########################
    
            # self.root_dir = '/home/gregor/networkdrives/E130-Personal/Goetz/Datenkollektive/Lungendaten/Nodules_LIDC_IDRI'
            # self.raw_data_dir = '{}/new_nrrd'.format(self.root_dir)
            self.pp_dir = '/root/workspace/medicaldetectiontoolkit/datasets/lidc_mdt'
            self.target_spacing = (0.7, 0.7, 1.25)
    
            #########################
            #         I/O           #
            #########################
    
            # one out of [2, 3]. dimension the model operates in.
            self.dim = 3
    
            # one out of ['mrcnn', 'retina_net', 'retina_unet', 'detection_unet', 'ufrcnn'].
            self.model = 'retina_unet'
    
            DefaultConfigs.__init__(self, self.model, server_env, self.dim)
    
    
            #########################
            #         I/O           #
            ######################### 
            self.test_aug = False
            self.n_workers = 4
    

    what's wrong? really thanks for your reply

    opened by wanghan0501 0
  • When using batch_generator, where should I put

    When using batch_generator, where should I put "boxes_coords" in?

    I have a custom datasets in 3D, labeled with segmentation and I did ConvertSegToBoundingBoxCoordinates already, so I have a annotation file (.json), contains each image's path, segmentation path and b-boxes.

    Now I am confusing when re-writing preprocessing.py script, as showed in README, I should have a dict contains: "data": preprocessed image (.npy format) "seg": preprocessed segmentation image (.npy format) "pid": patient id "class_target": a list of each ROI's class, for example, [1, 2] (means this image have 2 rois, first is class_1 and second is class_2)

    So, where the bounding boxes coordinates should be put ??

    opened by fmo-voxelcloud 0
Owner
MIC-DKFZ
Division of Medical Image Computing, German Cancer Research Center (DKFZ)
MIC-DKFZ
Mask R-CNN for object detection and instance segmentation on Keras and TensorFlow

Mask R-CNN for Object Detection and Segmentation This is an implementation of Mask R-CNN on Python 3, Keras, and TensorFlow. The model generates bound

Matterport, Inc 22.5k Jan 4, 2023
FAIR's research platform for object detection research, implementing popular algorithms like Mask R-CNN and RetinaNet.

Detectron is deprecated. Please see detectron2, a ground-up rewrite of Detectron in PyTorch. Detectron Detectron is Facebook AI Research's software sy

Facebook Research 25.5k Jan 7, 2023
Nicely is a real-time Feedback and Intervention Program Depression is a prevalent issue across all age groups, socioeconomic classes, and cultural identities.

Nicely is a real-time Feedback and Intervention Program Depression is a prevalent issue across all age groups, socioeconomic classes, and cultural identities.

null 1 Jan 16, 2022
An implementation of the research paper "Retina Blood Vessel Segmentation Using A U-Net Based Convolutional Neural Network"

Retina Blood Vessels Segmentation This is an implementation of the research paper "Retina Blood Vessel Segmentation Using A U-Net Based Convolutional

Srijarko Roy 23 Aug 20, 2022
Face Mask Detection is a project to determine whether someone is wearing mask or not, using deep neural network.

face-mask-detection Face Mask Detection is a project to determine whether someone is wearing mask or not, using deep neural network. It contains 3 scr

amirsalar 13 Jan 18, 2022
BMW TechOffice MUNICH 148 Dec 21, 2022
DCT-Mask: Discrete Cosine Transform Mask Representation for Instance Segmentation

DCT-Mask: Discrete Cosine Transform Mask Representation for Instance Segmentation This project hosts the code for implementing the DCT-MASK algorithms

Alibaba Cloud 57 Nov 27, 2022
The Face Mask recognition system uses AI technology to detect the person with or without a mask.

Face Mask Detection Face Mask Detection system built with OpenCV, Keras/TensorFlow using Deep Learning and Computer Vision concepts in order to detect

Rohan Kasabe 4 Apr 5, 2022
A light weight data augmentation tool for training CNNs and Viola Jones detectors

hey-daug A light weight data augmentation tool for training CNNs and Viola Jones detectors (Haar Cascades). This tool inflates your data by up to six

Jaiyam Sharma 2 Nov 23, 2019
PyTorch-LIT is the Lite Inference Toolkit (LIT) for PyTorch which focuses on easy and fast inference of large models on end-devices.

PyTorch-LIT PyTorch-LIT is the Lite Inference Toolkit (LIT) for PyTorch which focuses on easy and fast inference of large models on end-devices. With

Amin Rezaei 157 Dec 11, 2022
《Train in Germany, Test in The USA: Making 3D Object Detectors Generalize》(CVPR 2020)

Train in Germany, Test in The USA: Making 3D Object Detectors Generalize This paper has been accpeted by Conference on Computer Vision and Pattern Rec

Xiangyu Chen 101 Jan 2, 2023
Deep Structured Instance Graph for Distilling Object Detectors (ICCV 2021)

DSIG Deep Structured Instance Graph for Distilling Object Detectors Authors: Yixin Chen, Pengguang Chen, Shu Liu, Liwei Wang, Jiaya Jia. [pdf] [slide]

DV Lab 31 Nov 17, 2022
Project code for weakly supervised 3D object detectors using wide-baseline multi-view traffic camera data: WIBAM.

WIBAM (Work in progress) Weakly Supervised Training of Monocular 3D Object Detectors Using Wide Baseline Multi-view Traffic Camera Data 3D object dete

Matthew Howe 10 Aug 24, 2022
This is a Keras implementation of a CNN for estimating age, gender and mask from a camera.

face-detector-age-gender This is a Keras implementation of a CNN for estimating age, gender and mask from a camera. Before run face detector app, expr

Devdreamsolution 2 Dec 4, 2021
Boundary-preserving Mask R-CNN (ECCV 2020)

BMaskR-CNN This code is developed on Detectron2 Boundary-preserving Mask R-CNN ECCV 2020 Tianheng Cheng, Xinggang Wang, Lichao Huang, Wenyu Liu Video

Hust Visual Learning Team 178 Nov 28, 2022
[CVPR 2021] MiVOS - Mask Propagation module. Reproduced STM (and better) with training code :star2:. Semi-supervised video object segmentation evaluation.

MiVOS (CVPR 2021) - Mask Propagation Ho Kei Cheng, Yu-Wing Tai, Chi-Keung Tang [arXiv] [Paper PDF] [Project Page] [Papers with Code] This repo impleme

Rex Cheng 106 Jan 3, 2023
[NeurIPS 2021] A weak-shot object detection approach by transferring semantic similarity and mask prior.

[NeurIPS 2021] A weak-shot object detection approach by transferring semantic similarity and mask prior.

BCMI 49 Jul 27, 2022
This is an example of object detection on Micro bacterium tuberculosis using Mask-RCNN

Mask-RCNN on Mycobacterium tuberculosis This is an example of object detection on Mycobacterium Tuberculosis using Mask RCNN. Implement of Mask R-CNN

Jun-En Ding 1 Sep 16, 2021