When I tried to use the training example of Patch-based pipelines in the help document, the following error occurred
See original GitHub issue🐛Bug
To reproduce
import torch
import torchio as tio
from torch.utils.data import DataLoader
patch_size = 96
queue_length = 300
samples_per_volume = 10
sampler = tio.data.UniformSampler(patch_size)
subject = tio.datasets.Colin27()
subjects_dataset = tio.SubjectsDataset(10 * [subject])
patches_queue = tio.Queue(
subjects_dataset,
queue_length,
samples_per_volume,
sampler,
num_workers=0,
)
patches_loader = DataLoader(patches_queue, batch_size=16)
num_epochs = 2
model = torch.nn.Identity()
for epoch_index in range(num_epochs):
for patches_batch in patches_loader:
inputs = patches_batch['t1'][tio.DATA] # key 't1' is in subject
targets = patches_batch['brain'][tio.DATA] # key 'brain' is in subject
logits = model(inputs) # model being an instance of torch.nn.Module
Expected behavior
It should be an iterable object
Actual behavior
TypeError: randint(): argument 'high' (position 1) must be int, not numpy.int32
System info
Output of
TypeError: randint(): argument 'high' (position 1) must be int, not numpy.int32
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Patch-based pipelines - TorchIO - Read the Docs
Patch-based pipelines #. The number of pixels in 2D images used in deep learning is rarely larger than one million. For example, the...
Read more >Debugging the training pipeline - Hugging Face Course
The error is then often very easy to solve. To demonstrate this, we will use the following script that (tries to) fine-tune a...
Read more >Training Pipeline failed for the TPOTAutoMLRegression ML ...
I have a small data set of training data and testing data but the training pipeline keeps failing with the following error message:...
Read more >Patch‐based generative adversarial neural network models ...
Purpose To evaluate pix2pix and CycleGAN and to assess the effects of multiple combination strategies on accuracy for patch-based synthetic ...
Read more >Combining Regions and Patches for Object Class Localization
framework, where only image-level object occurrence la- bels are available for the training ... There have been a limited number of attempts to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This occurs because you have an older version of Numpy. Please update to the latest version. Also make sure you update PyTorch to at least version 1.6.0
Thanks, @rayryeng. @Key-lei, feel free to reopen if that solution does not help.