I am not sure what I am doing wrong. I am trying to run ResNet152 on Jupyter Notebooks within a Conda Environment. Here’s my code:
from tensorflow.keras.applications import ResNet50, ResNet101, ResNet152, InceptionResNetV2, DenseNet121
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Dense, GlobalAveragePooling2D, Activation, BatchNormalization
from tensorflow.keras import mixed_precision, layers, models
import tensorflow as tf
from tensorflow.keras.optimizers.schedules import ExponentialDecay
from tensorflow.keras.optimizers import Adam, RMSprop
mixed_precision.set_global_policy('mixed_float16')
base_model = ResNet152(weights='imagenet', include_top=False, input_shape=(256, 256, 3))
for layer in base_model.layers:
layer.trainable = True
pooling_layer = layers.GlobalAveragePooling2D()(base_model.output) # GlobalAveragePooling2D layer
output_layer = layers.Dense(1, activation='sigmoid', name='output_layer')(pooling_layer)
model = Model(inputs=base_model.input, outputs=output_layer)
initial_learning_rate = 0.001
lr_schedule = ExponentialDecay(
initial_learning_rate,
decay_steps=50, # Adjust the decay steps as needed
decay_rate=0.9, # Adjust the decay rate as needed
staircase=False)
optimizer = Adam(learning_rate=lr_schedule)
model.compile(
optimizer=optimizer,
loss='binary_crossentropy',
metrics=['accuracy', tf.keras.metrics.Precision(), tf.keras.metrics.Recall(), tf.keras.metrics.AUC(name='auc')]
)
model.summary()
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
history = model.fit(dataset_batched_withoutnames, epochs=5)
I get the following error:
DNN library is not found.
[[{{node model/conv1_conv/Conv2D}}]] [Op:__inference_train_function_55822]
(there’s a long box but didn’t copy and paste it all)
I went back and downgraded my Tensorflow, CUDA, and cuDNN. I am on CUDA 11.2, cuDNN 8.1.0 and Tensorflow 2.10.0
I went back to my paths and have cleaned it all up and I added all the following to path
I am not sure why this isn’t working. Anybody have any ideas?