Closed ouyuxuanbridge closed 2 years ago
@Ouyuxuan623 The error is caused by having a large ROI crop which cannot cover the entire input image volume. It is not related to network architecture but dataloader. More information can be found here.
I am new to UNETR, but I think img_size and spatial_size need to be equal in your example. They both indicate the size of the block that goes into the model. The error may be caused by these not being the same.
I don't think you want to use (80, 80, 80) anywhere in this code - regardless of your input image size, the train_transforms will be cropping it to (48, 48, 48). Please correct me if I'm wrong.
Hi scientists,
I encounter a problem regarding random crop when I'm implementing your tutorial of UNETR.
My image size is(80,80,80), and roi size is (48,48,48)
but it raises a error
raise ValueError("The size of the proposed random crop ROI is larger than the image size.") ValueError: The size of the proposed random crop ROI is larger than the image size.
I am confused because it is actually smaller.
Could you please help me ?
Thanks!
The changes I have done:
model = UNETR( in_channels=1, out_channels=5, img_size=(80, 80, 80), feature_size=16, hidden_size=768, mlp_dim=3072, num_heads=12, pos_embed="perceptron", norm_name="instance", res_block=True, dropout_rate=0.0, ).to(device)
RandCropByPosNegLabeld( keys=["image", "label"], label_key="label", spatial_size=(48, 48, 48), pos=1, neg=1, num_samples=4, image_key="image", image_threshold=0, ),