Giter Site home page Giter Site logo

jcreinhold / tiramisu-brulee Goto Github PK

View Code? Open in Web Editor NEW
5.0 3.0 2.0 1.13 MB

A 2D and 3D PyTorch implementation of the Tiramisu CNN

License: Other

Makefile 1.62% Python 98.38%
segmentation convolutional-neural-network deep-learning mri lesion-segmentation

tiramisu-brulee's Introduction

tiramisù-brûlée

Documentation Status

A 2D and 3D PyTorch implementation of the Tiramisu CNN

This package is primarily used for multiple sclerosis (MS) lesion segmentation; specifically, T2 lesions in the brain.

Install

The easiest way to install the package is with:

pip install tiramisu-brulee

Alternatively, you can download the source and run:

python setup.py install

If you want a CLI to train a lesion segmentation model (or work with anything in the experiment subpackage), install with:

pip install "tiramisu-brulee[lesionseg]"

Basic Usage

Import the 2D or 3D Tiramisu version with:

from tiramisu_brulee.model import Tiramisu2d, Tiramisu3d

If you install tiramisu-brulee with [lesionseg] extras, then you can train a lesion segmentation Tiramisu CNN and predict with:

lesion-train ...
lesion-predict ...
lesion-predict-image ...

Use the --help option to see the arguments. See the documentation for a tutorial on how to use the CLIs.

References

[1] Jégou, Simon, et al. "The one hundred layers tiramisu: Fully convolutional densenets for semantic segmentation." CVPR. 2017.

[2] Zhang, Huahong, et al. "Multiple sclerosis lesion segmentation with Tiramisu and 2.5D stacked slices." International Conference on Medical Image Computing and Computer-Assisted Intervention. Springer, Cham, 2019.

Why the name?

Why is the name tiramisù-brûlée? Well, tiramisù is named after the neural network [1] whose name is inspired by the dessert; however, tiramisu—by itself—was already taken as a package on PyPI. I added brûlée to get around the existence of that package and because this package is written in PyTorch (torch -> burnt). Plus brûlée in English is often associated with the dessert crème brûlée. Why combine an Italian word (tiramisù) with a French word (brûlée)? Because I didn't think about it until after I already deployed the package to PyPI.

tiramisu-brulee's People

Contributors

jcreinhold avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

tiramisu-brulee's Issues

lesion-predict-image error

🐛 Bug

lesion-predict-image shouldn't require the user to specify subject.

Traceback (most recent call last):
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/bin/lesion-predict-image", line 8, in <module>
    sys.exit(predict_image())
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/tiramisu_brulee/experiment/cli/predict.py", line 188, in predict_image
    _predict(args, parser, False)
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/tiramisu_brulee/experiment/cli/predict.py", line 263, in _predict
    _predict_whole_image(args, model_path, model_num)
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/tiramisu_brulee/experiment/cli/predict.py", line 201, in _predict_whole_image
    dm = LesionSegDataModulePredictWhole.from_csv(**dict_args)
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/tiramisu_brulee/experiment/data.py", line 771, in from_csv
    check_dicom=check_dicom,
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/tiramisu_brulee/experiment/data.py", line 1105, in csv_to_subjectlist
    df = pd.read_csv(filename, index_col="subject")
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/pandas/io/parsers.py", line 610, in read_csv
    return _read(filepath_or_buffer, kwds)
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/pandas/io/parsers.py", line 468, in _read
    return parser.read(nrows)
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/pandas/io/parsers.py", line 1057, in read
    index, columns, col_dict = self._engine.read(nrows)
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/pandas/io/parsers.py", line 2101, in read
    values = data.pop(self.index_col[i])
KeyError: 'subject'

DataModule.setup deprecation warning

🐛 Bug

pytorch-lightning's (>=v1.4.4) DataModule functionality will change. Need to update the script to use the new functionality. Current code triggers the following deprecation warning:

LightningDeprecationWarning: DataModule.setup has already been called, so it will not be called again. In v1.6 this behavior will change to always call DataModule.setup.

Make training and prediction framework model agnostic

The current lesionseg framework integrates the Tiramisu model into training and prediction framework. It would be preferable to separate the two so you can import the training/prediction and drop-in your own model.

Improve docs

📚 Documentation

Additional documentation needs to be added—with examples (that always run)—via docstrings to the user-facing functions.

See doctest and the pytest extension.

Support DICOM images as input

🚀 Feature

Support DICOM images as input.

Motivation

torchio supports DICOM images, so tiramisu-brulee should work with DICOM images as well.

Pitch

Allow DICOM image folders to be used as entries in the train/validation/prediction CSVs.

Alternatives

Only support NIfTI images and expect the user to convert all images to NIfTI before using the package.

Additional context

Support multi-class segmentation

The current version of lesionseg assumes a binary segmentation task. Extend the framework to support multi-class segmentation.

Update pytest configuration

Change pytest configuration in setup.cfg to something like:

[tool:pytest]
addopts = --doctest-modules --ignore=setup.py
doctest_optionflags = NORMALIZE_WHITESPACE IGNORE_EXCEPTION_DETAIL NUMBER
testpaths =
	tests

Patch-based prediction

Description

Enable patch-based prediction for memory-constrained machines. Current version only allows whole-image prediction (based on an estimate of the foreground).

Improve contributing information

📚 Documentation

The contributing information is out-of-date and generally lacking. It needs to be updated so it's easier to contribute to this project.

lesion-predict - input not on gpu

lesion-predict --config predict_config_noAC.yaml 
Global seed set to 0
2021-11-16 19:56:36,770 - py.warnings - WARNING - /home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/tiramisu_brulee/experiment/data.py:1071: UserWarning: pet not in known ('ct', 'flair', 'pd', 't1', 't1c', 't2', 'label', 'weight', 'div', 'out'). Assuming pet is a non-label image.
  f"{name} not in known {RECOGNIZED_NAMES}. "

GPU available: True, used: True
TPU available: False, using: 0 TPU cores
IPU available: False, using: 0 IPUs
LOCAL_RANK: 0 - CUDA_VISIBLE_DEVICES: [0]
2021-11-16 19:56:39,967 - py.warnings - WARNING - /home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/pytorch_lightning/trainer/data_loading.py:111: UserWarning: The dataloader, predict_dataloader 0, does not have many workers which may be a bottleneck. Consider increasing the value of the `num_workers` argument` (try 4 which is the number of cpus on this machine) in the `DataLoader` init to improve performance.
  f"The dataloader, {name}, does not have many workers which may be a bottleneck."

Predicting: 0it [00:00, ?it/s]Traceback (most recent call last):
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/bin/lesion-predict", line 33, in <module>
    sys.exit(load_entry_point('tiramisu-brulee', 'console_scripts', 'lesion-predict')())
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/tiramisu_brulee/experiment/cli/predict.py", line 173, in predict
    _predict(args, parser, True)
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/tiramisu_brulee/experiment/cli/predict.py", line 263, in _predict
    _predict_patch_image(args, model_path, model_num, p3d)
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/tiramisu_brulee/experiment/cli/predict.py", line 236, in _predict_patch_image
    trainer.predict(model, datamodule=dm)
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 987, in predict
    self._predict_impl, model, dataloaders, datamodule, return_predictions, ckpt_path
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 682, in _call_and_handle_interrupt
    return trainer_fn(*args, **kwargs)
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 1030, in _predict_impl
    results = self._run(model, ckpt_path=self.predicted_ckpt_path)
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 1193, in _run
    self._dispatch()
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 1270, in _dispatch
    self.training_type_plugin.start_predicting(self)
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/pytorch_lightning/plugins/training_type/training_type_plugin.py", line 210, in start_predicting
    self._results = trainer.run_stage()
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 1281, in run_stage
    return self._run_predict()
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 1343, in _run_predict
    return self.predict_loop.run()
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/pytorch_lightning/loops/base.py", line 145, in run
    self.advance(*args, **kwargs)
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/pytorch_lightning/loops/dataloader/prediction_loop.py", line 92, in advance
    dataloader_iter, self.current_dataloader_idx, dl_max_batches, self.num_dataloaders, self.return_predictions
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/pytorch_lightning/loops/base.py", line 145, in run
    self.advance(*args, **kwargs)
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/pytorch_lightning/loops/epoch/prediction_epoch_loop.py", line 100, in advance
    self._predict_step(batch, batch_idx, dataloader_idx)
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/pytorch_lightning/loops/epoch/prediction_epoch_loop.py", line 133, in _predict_step
    predictions = self.trainer.accelerator.predict_step(step_kwargs)
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/pytorch_lightning/accelerators/accelerator.py", line 252, in predict_step
    return self.training_type_plugin.predict_step(*step_kwargs.values())
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/pytorch_lightning/plugins/training_type/training_type_plugin.py", line 225, in predict_step
    return self.model.predict_step(*args, **kwargs)
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/tiramisu_brulee/experiment/seg.py", line 268, in predict_step
    return self._predict_patch_image(batch)
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/tiramisu_brulee/experiment/seg.py", line 346, in _predict_patch_image
    pred = self(src)
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/tiramisu_brulee/experiment/seg.py", line 140, in forward
    out: Tensor = self.network(tensor)
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/tiramisu_brulee/model/tiramisu.py", line 167, in forward
    out = self.first_conv(x)
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/torch/nn/modules/container.py", line 119, in forward
    input = module(input)
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/torch/nn/modules/conv.py", line 399, in forward
    return self._conv_forward(input, self.weight, self.bias)
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/torch/nn/modules/conv.py", line 396, in _conv_forward
    self.padding, self.dilation, self.groups)
RuntimeError: Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the same
Exception ignored in: <function tqdm.__del__ at 0x7fd4ea1df0e0>
Traceback (most recent call last):
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/tqdm/std.py", line 1134, in __del__
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/tqdm/std.py", line 1281, in close
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/tqdm/std.py", line 1467, in display
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/tqdm/std.py", line 1137, in __repr__
  File "/home/ec2-user/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/tqdm/std.py", line 1424, in format_dict
TypeError: cannot unpack non-iterable NoneType object

Add union aggregation

🚀 Feature

Add union as a method to aggregate results instead of mean of the predicted probability

Motivation

Union is a useful way to aggregate predictions, especially when predictions are consistently low.

Patch-based (esp. 2.5D) prediction broken

🐛 Bug

Some output predictions are nonsense, likely due to the introduction ToCanonical as a preprocessing step. Especially problematic with 2.5D prediction with all orientations.

Environment

  • tiramisu-brulee version (e.g., 0.1.14): 0.1.17

Dice metric in almost_isbi15_score outputs zero every iteration

🐛 Bug

I was training the model on lesion segmentation data (using the cli tools), and wrote "print(dice)" after line 52 of tiramisu_brulee.experiments.lesion_tools (which is "dice = dice_score(pred.int(), target.int())") and the code printed 0 at every iteration.

To fix this, I used the "dice_loss" function from "tiramisu_brulee.loss" instead of the dice function supplied by torchmetrics, and it seems to works as expected.

To Reproduce

Steps to reproduce the behavior:

  1. Add print(dice) statement
  2. Run code
  3. ???
  4. Profit

Additional context

I encountered this issue when I was training a 3D tiramisu network for supervised binary lesion segmentation using 4 input channels (T1, T2, FLAIR, PD).

Lesion-predict: Deprecated function in seg.py

🐛 Bug

Deprecated function at line #481 of seg.py.

-- This is the error message:

UserWarning: floordiv is deprecated, and its behavior will change in a future version of pytorch. It currently rounds toward 0 (like the 'trunc' function NOT 'floor'). This results in incorrect rounding for negative values. To keep the current behavior, use torch.div(a, b, rounding_mode='trunc'), or for actual floor division, use torch.div(a, b, rounding_mode='floor').
k = (k_fin - k_ini) // 2 + k_ini

lesion-predict-image padding issue

🐛 Bug

When running lesion-predict-image, the code starts predicting and throws the following error :

Global seed set to 0
GPU available: False, used: False
TPU available: False, using: 0 TPU cores
IPU available: False, using: 0 IPUs
2021-12-15 14:09:32,840 - py.warnings - WARNING - /Users/asantilli/.local/share/virtualenvs/AWS_lambda_docker-0zwPIMFV/lib/python3.9/site-packages/torch/utils/data/dataloader.py:478: UserWarning: This DataLoader will create 16 worker processes in total. Our suggested max number of worker in current system is 8 (`cpuset` is not taken into account), which is smaller than what this DataLoader is going to create. Please be aware that excessive worker creation might get DataLoader running slow or even freeze, lower the worker number to avoid potential slowness/freeze if necessary.
  warnings.warn(_create_warning_msg(

Predicting: 0it [00:00, ?it/s]2021-12-15 14:10:06,060 - py.warnings - WARNING - /Users/asantilli/.local/share/virtualenvs/AWS_lambda_docker-0zwPIMFV/lib/python3.9/site-packages/pytorch_lightning/loops/epoch/prediction_epoch_loop.py:172: UserWarning: Lightning couldn't infer the indices fetched for your dataloader.
  warning_cache.warn("Lightning couldn't infer the indices fetched for your dataloader.")

Traceback (most recent call last):
  File "/Users/asantilli/PycharmProjects/AWS_lambda_docker/trial.py", line 22, in <module>
    main("alice")
  File "/Users/asantilli/PycharmProjects/AWS_lambda_docker/trial.py", line 18, in main
    resutls = predict.predict_image(args=args)
  File "/Users/asantilli/PycharmProjects/AWS_lambda_docker/tiramisubrulee/tiramisu_brulee/experiment/cli/predict.py", line 197, in predict_image
    _predict(args, parser, False)
  File "/Users/asantilli/PycharmProjects/AWS_lambda_docker/tiramisubrulee/tiramisu_brulee/experiment/cli/predict.py", line 273, in _predict
    _predict_whole_image(args, model_path, model_num)
  File "/Users/asantilli/PycharmProjects/AWS_lambda_docker/tiramisubrulee/tiramisu_brulee/experiment/cli/predict.py", line 218, in _predict_whole_image
    trainer.predict(model, datamodule=dm)
  File "/Users/asantilli/.local/share/virtualenvs/AWS_lambda_docker-0zwPIMFV/lib/python3.9/site-packages/pytorch_lightning/trainer/trainer.py", line 988, in predict
    return self._call_and_handle_interrupt(
  File "/Users/asantilli/.local/share/virtualenvs/AWS_lambda_docker-0zwPIMFV/lib/python3.9/site-packages/pytorch_lightning/trainer/trainer.py", line 682, in _call_and_handle_interrupt
    return trainer_fn(*args, **kwargs)
  File "/Users/asantilli/.local/share/virtualenvs/AWS_lambda_docker-0zwPIMFV/lib/python3.9/site-packages/pytorch_lightning/trainer/trainer.py", line 1032, in _predict_impl
    results = self._run(model, ckpt_path=self.predicted_ckpt_path)
  File "/Users/asantilli/.local/share/virtualenvs/AWS_lambda_docker-0zwPIMFV/lib/python3.9/site-packages/pytorch_lightning/trainer/trainer.py", line 1195, in _run
    self._dispatch()
  File "/Users/asantilli/.local/share/virtualenvs/AWS_lambda_docker-0zwPIMFV/lib/python3.9/site-packages/pytorch_lightning/trainer/trainer.py", line 1273, in _dispatch
    self.training_type_plugin.start_predicting(self)
  File "/Users/asantilli/.local/share/virtualenvs/AWS_lambda_docker-0zwPIMFV/lib/python3.9/site-packages/pytorch_lightning/plugins/training_type/training_type_plugin.py", line 210, in start_predicting
    self._results = trainer.run_stage()
  File "/Users/asantilli/.local/share/virtualenvs/AWS_lambda_docker-0zwPIMFV/lib/python3.9/site-packages/pytorch_lightning/trainer/trainer.py", line 1284, in run_stage
    return self._run_predict()
  File "/Users/asantilli/.local/share/virtualenvs/AWS_lambda_docker-0zwPIMFV/lib/python3.9/site-packages/pytorch_lightning/trainer/trainer.py", line 1346, in _run_predict
    return self.predict_loop.run()
  File "/Users/asantilli/.local/share/virtualenvs/AWS_lambda_docker-0zwPIMFV/lib/python3.9/site-packages/pytorch_lightning/loops/base.py", line 145, in run
    self.advance(*args, **kwargs)
  File "/Users/asantilli/.local/share/virtualenvs/AWS_lambda_docker-0zwPIMFV/lib/python3.9/site-packages/pytorch_lightning/loops/dataloader/prediction_loop.py", line 88, in advance
    dl_predictions, dl_batch_indices = self.epoch_loop.run(
  File "/Users/asantilli/.local/share/virtualenvs/AWS_lambda_docker-0zwPIMFV/lib/python3.9/site-packages/pytorch_lightning/loops/base.py", line 145, in run
    self.advance(*args, **kwargs)
  File "/Users/asantilli/.local/share/virtualenvs/AWS_lambda_docker-0zwPIMFV/lib/python3.9/site-packages/pytorch_lightning/loops/epoch/prediction_epoch_loop.py", line 105, in advance
    self._predict_step(batch, batch_idx, dataloader_idx)
  File "/Users/asantilli/.local/share/virtualenvs/AWS_lambda_docker-0zwPIMFV/lib/python3.9/site-packages/pytorch_lightning/loops/epoch/prediction_epoch_loop.py", line 135, in _predict_step
    predictions = self.trainer.accelerator.predict_step(step_kwargs)
  File "/Users/asantilli/.local/share/virtualenvs/AWS_lambda_docker-0zwPIMFV/lib/python3.9/site-packages/pytorch_lightning/accelerators/accelerator.py", line 252, in predict_step
    return self.training_type_plugin.predict_step(*step_kwargs.values())
  File "/Users/asantilli/.local/share/virtualenvs/AWS_lambda_docker-0zwPIMFV/lib/python3.9/site-packages/pytorch_lightning/plugins/training_type/training_type_plugin.py", line 225, in predict_step
    return self.model.predict_step(*args, **kwargs)
  File "/Users/asantilli/.local/share/virtualenvs/AWS_lambda_docker-0zwPIMFV/lib/python3.9/site-packages/tiramisu_brulee-0.1.36-py3.9.egg/tiramisu_brulee/experiment/seg.py", line 257, in predict_step
    return self._predict_whole_image(batch)
  File "/Users/asantilli/.local/share/virtualenvs/AWS_lambda_docker-0zwPIMFV/lib/python3.9/site-packages/tiramisu_brulee-0.1.36-py3.9.egg/tiramisu_brulee/experiment/seg.py", line 325, in _predict_whole_image
    pred_seg = self._predict_patch_image(batch)
  File "/Users/asantilli/.local/share/virtualenvs/AWS_lambda_docker-0zwPIMFV/lib/python3.9/site-packages/tiramisu_brulee-0.1.36-py3.9.egg/tiramisu_brulee/experiment/seg.py", line 332, in _predict_patch_image
    pred = self(src)
  File "/Users/asantilli/.local/share/virtualenvs/AWS_lambda_docker-0zwPIMFV/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "/Users/asantilli/.local/share/virtualenvs/AWS_lambda_docker-0zwPIMFV/lib/python3.9/site-packages/tiramisu_brulee-0.1.36-py3.9.egg/tiramisu_brulee/experiment/seg.py", line 140, in forward
    out: Tensor = self.network(tensor)
  File "/Users/asantilli/.local/share/virtualenvs/AWS_lambda_docker-0zwPIMFV/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "/Users/asantilli/.local/share/virtualenvs/AWS_lambda_docker-0zwPIMFV/lib/python3.9/site-packages/tiramisu_brulee-0.1.36-py3.9.egg/tiramisu_brulee/model/tiramisu.py", line 167, in forward
    out = self.first_conv(x)
  File "/Users/asantilli/.local/share/virtualenvs/AWS_lambda_docker-0zwPIMFV/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "/Users/asantilli/.local/share/virtualenvs/AWS_lambda_docker-0zwPIMFV/lib/python3.9/site-packages/torch/nn/modules/container.py", line 141, in forward
    input = module(input)
  File "/Users/asantilli/.local/share/virtualenvs/AWS_lambda_docker-0zwPIMFV/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "/Users/asantilli/.local/share/virtualenvs/AWS_lambda_docker-0zwPIMFV/lib/python3.9/site-packages/torch/nn/modules/padding.py", line 328, in forward
    return F.pad(input, self.padding, 'replicate')
  File "/Users/asantilli/.local/share/virtualenvs/AWS_lambda_docker-0zwPIMFV/lib/python3.9/site-packages/torch/nn/functional.py", line 4207, in _pad
    raise NotImplementedError("Only 2D, 3D, 4D, 5D padding with non-constant padding are supported for now")
NotImplementedError: Only 2D, 3D, 4D, 5D padding with non-constant padding are supported for now
Predicting:   0%|          | 0/1 [00:35<?, ?it/s]

To Reproduce

Ran lesion-predict-image inline using :

input_img = "S0006_PV_5mm.nii.gz"
save_filename = "save_image_test.nii.gz"
model_name = "model_test.ckpt"
args = ["--t1", str(input_img), "--out", str(save_filename), "--model-path", model_name]

results = predict.predict_image(args=args)

Use highdicom to properly format predicted DSO

🚀 Feature

The current DICOM save option doesn't properly format the predicted segmentation as a DSO.

Motivation

Want to be able to import DSOs generated from TB to other applications (e.g., slicer)

Add PyPI package for Python v3.10

🚀 Feature

Add pypi package for Python 3.10

Motivation

Keep up with latest versions of Python


As of 16 Nov 2021, SimpleITK doesn't have a Python 3.10 PyPI package, so I'm delaying adding support until they build it since it's a requirement of this project.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.