RuntimeError: Unable to find a valid cuDNN algorithm to run convolution

Hello!

I am training a unet based on resnet34 on google colab. When I try to optimize the learning rate like

lrs= learn.lr_find()

I got an error (which actually iterates over different errors all related to cuDNN, like:

RuntimeError: Unable to find a valid cuDNN algorithm to run convolution

or

RuntimeError: cuDNN error: CUDNN_STATUS_MAPPING_ERROR

Any help appreciated!

Thank you!

P.S.
more code from before the error

def label_func(x):
  return path/'labels'/f'{x.stem}_P{x.suffix}'

# https://docs.fast.ai/vision.data.html#SegmentationDataLoaders
#set_seed(42)
dls = SegmentationDataLoaders.from_label_func(
    path, 
    bs=1, 
    fnames = get_image_files(path/"images"),
    label_func = label_func,
    codes = ["Background","Roof"]
    #codes = np.loadtxt(path/'codes.txt', dtype=str)
)
``

Please read Binary Segmentation | walkwithfastai, it discusses some of what is going on here :slight_smile:

2 Likes

Thank you!

I finally figured out what is the problem. For anyone who is running into problems like this, the following could be helpful:

  • I have a binary segmentation mask. The labeling was done in LabelMe.
  • The output of LabelMe are are images and the corresponding labels both in RGB-Values.
  • I converted the RGB Values of the label into greyscale.
  • The resulting greyscale image MUST include only values between [0 … (num_classes -1)]. For a binary problem one has to convert the (arbitrary) color-numbers into 0s and 1s (0: background, 1: class of interest). This solved the issue for me.
1 Like

Hi Zachary,

i tried to run your code from the link you gave. It gives me an error in the following line:

dls = binary.dataloaders(path/'images_data_crop', bs=8)

Error:

---------------------------------------------------------------------------

AttributeError                            Traceback (most recent call last)

<ipython-input-27-8c118b7d67ab> in <module>
----> 1 dls = binary.dataloaders(path/'images_data_crop', bs=8)

14 frames

/usr/local/lib/python3.9/dist-packages/PIL/Image.py in __getattr__(self, name)
    544             )
    545             return self._category
--> 546         raise AttributeError(name)
    547 
    548     @property

AttributeError: read