Skip to content

ValueError: y_pred and y should have same shapes #596

Answered by yiheng-wang-nv
HripsimeS asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @HripsimeS , sorry for late reply. I checked your code, Where you used Spacingd(keys=["image", "mask"], pixdim=(1.0, 1.0, 1.0), mode=("bilinear", "nearest")):

val_org_transforms = Compose(
    [
        LoadImaged(keys=["image", "mask"]),
        EnsureChannelFirstd(keys=["image", "mask"]),
        Orientationd(keys=["image"], axcodes="RAS"),
        Spacingd(keys=["image", "mask"], pixdim=(1.0, 1.0, 1.0), mode=("bilinear", "nearest")),
        ScaleIntensityRanged(keys=["image"], a_min=-120, a_max=360,b_min=0.0, b_max=1.0, clip=True,),
        CropForegroundd(keys=["image"], source_key="image"),
        
        EnsureTyped(keys=["image", "mask"]),
    ]
)

Can you please change it i…

Replies: 3 comments 6 replies

Comment options

You must be logged in to vote
4 replies
@HripsimeS
Comment options

@ashiwalv
Comment options

@Nic-Ma
Comment options

@ashiwalv
Comment options

Answer selected by yiheng-wang-nv
Comment options

You must be logged in to vote
1 reply
@yiheng-wang-nv
Comment options

Comment options

You must be logged in to vote
1 reply
@KumoLiu
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
6 participants