nnUnet模型训练时报错:RuntimeError: Unable to find a valid cuDNN algorithm to run convolution

跑模型时报错,遂解决记录。这个错误出现原因是模型所需显存过大,GPU显存不足导致的错误,这时需要将batch-size,patch-size改小即可:64-32等。

使用如下代码:

import numpy as np
import pickle as pkl
from batchgenerators.utilities.file_and_folder_operations import *

path = r'/home/all_data/nnUNet/nnUNet_processed/Task11_CTPelvic1K/nnUNetPlans_plans_3D.pkl'

with (open(path, 'rb')) as f:
    s = pkl.load(f)
    print(s['plans_per_stage'][0]['batch_size'])
    print(s['plans_per_stage'][1]['patch_size'])

    plans = load_pickle(path)
    plans['plans_per_stage'][0]['batch_size'] = 2
    plans['plans_per_stage'][0]['patch_size'] = np.array((32, 160, 128))

    plans['plans_per_stage'][1]['batch_size'] = 2
    plans['plans_per_stage'][1]['patch_size'] = np.array((32, 160, 128))

    
    save_pickle(plans, join(r'/home/all_data/nnUNet/nnUNet_processed/Task11_CTPelvic1K/nnUNetPlans_plans_3D.pkl'))

你可能感兴趣的:(python,机器学习,numpy,计算机视觉)