Replies: 2 comments
-
Hi @mandelkow, thanks for your reporting. |
Beta Was this translation helpful? Give feedback.
-
This is still an on going issue. Is there no other work around? |
Beta Was this translation helpful? Give feedback.
-
Describe the bug
When using RandCropByPosNegLabel in conjunction with ImageDataset with both image_files and seg_files (in a segmentation task) one would expect the parameter "label" to default to the seg_file input at runtime. But instead an error is raised: "ValueError: label must be provided." How could this be done?
To Reproduce
Steps to reproduce the behavior:
img_xform = Compose([ EnsureChannelFirst(), RandCropByPosNegLabel( [128]*3, pos=0.9, neg=0.1)])
self.train_ds = ImageDataset(
image_files=[ 'image1.nrrd'],
seg_files= [ 'label1.nrrd' ],
transform=img_xform,
seg_transform=img_xform,
image_only=True, # output image + meta
transform_with_metadata=False, # input image + meta?
)
...
Expected behavior
RandCropByPosNegLabel should use the input "seg_files" from ImageDataset if missing the input "label".
Screenshots
If applicable, add screenshots to help explain your problem.
Environment
Ensuring you use the relevant python executable, please paste the output of:
================================
Printing MONAI config...
MONAI version: 1.2.0
Numpy version: 1.23.4
Pytorch version: 2.0.1
MONAI flags: HAS_EXT = False, USE_COMPILED = False, USE_META_DICT = False
MONAI rev id: c33f1ba
MONAI file: /Users/mandelkow/bin/mambaforge/envs/py310/lib/python3.10/site-packages/monai/init.py
Optional dependencies:
Pytorch Ignite version: NOT INSTALLED or UNKNOWN VERSION.
ITK version: NOT INSTALLED or UNKNOWN VERSION.
Nibabel version: 4.0.2
scikit-image version: NOT INSTALLED or UNKNOWN VERSION.
Pillow version: 9.2.0
Tensorboard version: 2.13.0
gdown version: NOT INSTALLED or UNKNOWN VERSION.
TorchVision version: 0.15.2
tqdm version: 4.65.0
lmdb version: NOT INSTALLED or UNKNOWN VERSION.
psutil version: 5.9.4
pandas version: 1.5.1
einops version: 0.6.1
transformers version: NOT INSTALLED or UNKNOWN VERSION.
mlflow version: NOT INSTALLED or UNKNOWN VERSION.
pynrrd version: 0.4.2
For details about installing the optional dependencies, please visit:
https://docs.monai.io/en/latest/installation.html#installing-the-recommended-dependencies
Additional context
According to the docs this is not a problem with dictionary-based datasets.
Beta Was this translation helpful? Give feedback.
All reactions