当我使用Colab时不会出现此问题。 当我运行fit语句时,以下问题会出现在不同的地方 系统 1.在colab中没有错误,但是这太慢了,因为它只是一个 我项目的一部分 2.在Nvidia Titanx 12 Gb GPU中,我遇到资源耗尽错误 3.在33Gb GPU工作站中,我遇到了另一个错误 与这个问题有关的错误陈述。同样只有此代码在此系统中显示问题。
input_sh=Input(shape=(256,256,1))
x=Conv2D(128,(3,3),strides=1,activation='relu',padding='same')(input_sh)
x=Conv2D(64,(3,3),activation='relu',padding='same')(x)
x=Conv2D(64,(3,3),activation='relu',strides=1,padding='same')(x)
mapp=Conv2D(32,(3,3),activation='relu',padding='same')(x)
x=MaxPooling2D((2,2))(mapp)
x=Conv2D(10,(3,3),activation='relu',padding='same',name='sal')(x)
encod=MaxPooling2D((2,2),name='ecod')(x)
x=UpSampling2D((2,2))(encod)
x=Conv2D(10,(3,3),activation='relu',padding='same')(x)
x=UpSampling2D((2,2))(x)
x=Conv2D(32,(3,3),activation='relu',strides=1,padding='same')(x)
x=UpSampling2D((2,2))(x)
x=Conv2D(64,(3,3),activation='relu',strides=1,padding='same')(x)
x=Conv2D(16,(3,3),activation='relu',strides=1,padding='same')(x)
x=Conv2D(16,(3,3),activation='relu',strides=1,padding='same')(x)
x=Conv2D(16,(3,3),activation='relu',strides=1,padding='same')(x)
x=Conv2D(16,(3,3),activation='relu',strides=2,padding='same')(x)
decod=Conv2D(1,(3,3),activation='sigmoid',padding='same')(x)
saliency=Model(input_sh,decod)
saliency.summary()
from skimage.color import rgb2lab, lab2rgb, rgb2gray
folder=r"F:\INTERN\Subset16k"
onlyfiles = [f for f in os.listdir(folder) if
os.path.isfile(os.path.join(folder, f))]
xdataset=np.ndarray(shape=(800,256,256,1),dtype=np.float32)
ydataset=np.ndarray(shape=(800,256,256,2),dtype=np.float32)
vxdataset=np.ndarray(shape=(200,256,256,1),dtype=np.float32)
vydataset=np.ndarray(shape=(200,256,256,2),dtype=np.float32)
xtestset=np.ndarray(shape=(50,256,256,1),dtype=np.float32)
ytestset=np.ndarray(shape=(50,256,256,2),dtype=np.float32)
for i in range(0,1050):
if(i==1):
print('pass')
ft=folder + "/" + onlyfiles[i]
im=load_img(ft)
x=img_to_array(im)
lab_image = rgb2lab(1.0/255*x)
x= (lab_image + [0, 128, 128]) / [100, 255, 255]
if(i<800):
xdataset[i]=x[:,:,0].reshape(256,256,1)
ydataset[i]=x[:,:,1:]
elif(i<1000):
vxdataset[i-800]=x[:,:,0].reshape(256,256,1)
vydataset[i-800]=x[:,:,1:]
else:
xtestset[i-1000]=x[:,:,0].reshape(256,256,1)
ytestset[i-1000]=x[:,:,1:]
saliency.compile(optimizer='adam',loss='mse')
saliency.fit(xdataset,xdataset,epochs=10,verbose=1)
UnknownError Traceback (most recent call
last)
<ipython-input-16-a5e8d074b015> in <module>
----> 1 saliency.fit(tx,tx,epochs=5,verbose=1)
~\Anaconda3\envs\Suvidha\lib\site-packages\keras\engine\training.py in
fit(self, x, y, batch_size, epochs, verbose, callbacks, validation_split,
validation_data, shuffle, class_weight, sample_weight, initial_epoch,
steps_per_epoch, validation_steps, **kwargs)
1037 initial_epoch=initial_epoch,
1038
steps_per_epoch=steps_per_epoch,
-> 1039
validation_steps=validation_steps)
1040
1041 def evaluate(self, x=None, y=None,
~\Anaconda3\envs\Suvidha\lib\site-
packages\keras\engine\training_arrays.py in fit_loop(model, f, ins,
out_labels, batch_size, epochs, verbose, callbacks, val_f, val_ins,
shuffle, callback_metrics, initial_epoch, steps_per_epoch,
validation_steps)
197 ins_batch[i] = ins_batch[i].toarray()
198
--> 199 outs = f(ins_batch)
200 outs = to_list(outs)
201 for l, o in zip(out_labels, outs):
~\Anaconda3\envs\Suvidha\lib\site-
packages\keras\backend\tensorflow_backend.py in __call__(self, inputs)
2713 return self._legacy_call(inputs)
2714
-> 2715 return self._call(inputs)
2716 else:
2717 if py_any(is_tensor(x) for x in inputs):
~\Anaconda3\envs\Suvidha\lib\site-
packages\keras\backend\tensorflow_backend.py in _call(self, inputs)
2673 fetched = self._callable_fn(*array_vals,
run_metadata=self.run_metadata)
2674 else:
-> 2675 fetched = self._callable_fn(*array_vals)
2676 return fetched[:len(self.outputs)]
2677
~\Anaconda3\envs\Suvidha\lib\site-
packages\tensorflow\python\client\session.py in __call__(self, *args,
**kwargs)
1437 ret = tf_session.TF_SessionRunCallable(
1438 self._session._session, self._handle, args, status,
-> 1439 run_metadata_ptr)
1440 if run_metadata:
1441 proto_data = tf_session.TF_GetBuffer(run_metadata_ptr)
~\Anaconda3\envs\Suvidha\lib\site-
packages\tensorflow\python\framework\errors_impl.py in __exit__(self,
type_arg, value_arg, traceback_arg)
526 None, None,
527 compat.as_text(c_api.TF_Message(self.status.status)),
--> 528 c_api.TF_GetCode(self.status.status))
529 # Delete the underlying status object from memory otherwise it
stays alive
530 # as there is a reference to status from this from the traceback
due to
UnknownError: Failed to get convolution algorithm. This is probably
because cuDNN failed to initialize, so try looking to see if a warning
log message was printed above.
[[{{node conv2d_1/convolution}}]]
[[{{node loss/mul}}]]