-
Hello, I am having a very similar issue as #1616, i.e. I can use Error:
Potentially useful info:
Furthermore, if I do use
...
Am stumped. Any advice / direction would be greatly appreciated, thank you! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Do you think you could create a minimum example that demonstrates your problem? You can use one of the freely available datasets, something like this: from glob import glob
import os
from monai.apps import download_and_extract
from monai.transforms import <transforms>
from monai.data import CacheDataset, DataLoader, Dataset
# get data
directory = os.environ.get("MONAI_DATA_DIRECTORY")
root_dir = tempfile.mkdtemp() if directory is None else os.path.expanduser(directory)
print(root_dir)
task = "Task09_Spleen"
resource = "https://msd-for-monai.s3-us-west-2.amazonaws.com/" + task + ".tar"
compressed_file = os.path.join(root_dir, task + ".tar")
data_dir = os.path.join(root_dir, task)
download_and_extract(resource, compressed_file, root_dir)
# get images
images = sorted(glob(os.path.join(data_dir, "imagesTr", "*.nii.gz")))
labels = sorted(glob(os.path.join(data_dir, "labelsTr", "*.nii.gz")))
data_dicts = [{"image": image, "label": label}
for image, label in zip(images, labels)]
# transforms
transform = Compose([
<transforms>
])
ds = CacheDataset(data=data_dicts, transform=transforms, ...) # any other args
dl = DataLoader(ds, batch_size=?, shuffle=?, num_workers=?)
for _ in dl:
pass |
Beta Was this translation helpful? Give feedback.
Do you think you could create a minimum example that demonstrates your problem? You can use one of the freely available datasets, something like this: