JanMarcelKezmann / TensorFlow-Advanced-Segmentation-Models

A Python Library for High-Level Semantic Segmentation Models based on TensorFlow and Keras with pretrained backbones.
Other
151 stars 48 forks source link

DNN library is not found. [Op:Conv2D] #9

Closed caioefalcao closed 2 years ago

caioefalcao commented 2 years ago

Hi @JanMarcelKezmann congratulation awesome project! When running TASM_Example2.ipynb on GPU I got the following error: DNN library is not found. [Op:Conv2D]_. Can you help me?

JanMarcelKezmann commented 2 years ago

Hi @caioefalcao thank you. Have you run the code in colab? And could you please provide a little more details, i.e., where exactly did the error occur and could you provide the whole error message? Further did you change anything from the example code, if yes what specifically. And what kind of GPU did you use?

caioefalcao commented 2 years ago

Hi @JanMarcelKezmann Thank you in advance for your feedback.

I'm running the example without any modification in Colab Pro. The error below happens both when I run the def show_predictions(dataset=None, num=1): and model.fit function.

Some information used: Dataset: CamVid

BATCH_SIZE = 4 N_CLASSES = len(MODEL_CLASSES) HEIGHT = 320 WIDTH = 320 BACKBONE_NAME = "efficientnetb3" WEIGHTS = "imagenet" WWO_AUG = True # train data with and without augmentation

`--------------------------------------------------------------------------
UnimplementedError                        Traceback (most recent call last)
<ipython-input-20-4b1619d54a16> in <module>()
     34     display([sample_image, tf.argmax(sample_mask, axis=-1)[..., tf.newaxis], output_mask]) # K.one_hot(K.squeeze(output_mask, axis=-1), 3)])
     35 
---> 36 show_predictions()

2 frames
<ipython-input-20-4b1619d54a16> in show_predictions(dataset, num)
     18 
     19 def show_predictions(dataset=None, num=1):
---> 20     output_model = model(sample_image[tf.newaxis, ...])
     21     # print(output_model.numpy())
     22 

/usr/local/lib/python3.7/dist-packages/keras/utils/traceback_utils.py in error_handler(*args, **kwargs)
     65     except Exception as e:  # pylint: disable=broad-except
     66       filtered_tb = _process_traceback_frames(e.__traceback__)
---> 67       raise e.with_traceback(filtered_tb) from None
     68     finally:
     69       del filtered_tb

/content/TensorFlow-Advanced-Segmentation-Models/tensorflow_advanced_segmentation_models/models/DANet.py in call(self, inputs, training, mask)
     63             training = True
     64 
---> 65         x = self.backbone(inputs, training=training)[-1]
     66 
     67         x_pam = self.conv3x3_bn_relu_1(x, training=training)

UnimplementedError: Exception encountered when calling layer "stem_conv" (type Conv2D).

DNN library is not found. [Op:Conv2D]

Call arguments received:
  • inputs=tf.Tensor(shape=(1, 321, 321, 3), dtype=float32)
JanMarcelKezmann commented 2 years ago

Okay thank you @caioefalcao . Unfortunately I cannot reproduce the error... What I do not understand is the shape of the input? It should be (4, 320, 320, 3) and not (1, 321, 321, 3). Have you run the whole code including the DataGenerators? If not please take a look.

Further, my guess above probably should not solve the error message, because it is related to a CuDNN problem as far as I am familiar with it. Therefore check again that the GPU in colab is enabled and please check the TensorFlow Version.

caioefalcao commented 2 years ago

The error was exactly in the shape of the input. I managed to resolve it by observing your tip. Thanks for the attention and again congratulations on the library.