<tfoot id='Jjkvh'></tfoot>
  1. <small id='Jjkvh'></small><noframes id='Jjkvh'>

      • <bdo id='Jjkvh'></bdo><ul id='Jjkvh'></ul>
      <legend id='Jjkvh'><style id='Jjkvh'><dir id='Jjkvh'><q id='Jjkvh'></q></dir></style></legend>
    1. <i id='Jjkvh'><tr id='Jjkvh'><dt id='Jjkvh'><q id='Jjkvh'><span id='Jjkvh'><b id='Jjkvh'><form id='Jjkvh'><ins id='Jjkvh'></ins><ul id='Jjkvh'></ul><sub id='Jjkvh'></sub></form><legend id='Jjkvh'></legend><bdo id='Jjkvh'><pre id='Jjkvh'><center id='Jjkvh'></center></pre></bdo></b><th id='Jjkvh'></th></span></q></dt></tr></i><div id='Jjkvh'><tfoot id='Jjkvh'></tfoot><dl id='Jjkvh'><fieldset id='Jjkvh'></fieldset></dl></div>

    2. 未知错误:无法获取卷积算法

      时间:2024-08-22
            <tbody id='eFoWv'></tbody>

            <legend id='eFoWv'><style id='eFoWv'><dir id='eFoWv'><q id='eFoWv'></q></dir></style></legend>

            <small id='eFoWv'></small><noframes id='eFoWv'>

            <tfoot id='eFoWv'></tfoot>

              <bdo id='eFoWv'></bdo><ul id='eFoWv'></ul>
            • <i id='eFoWv'><tr id='eFoWv'><dt id='eFoWv'><q id='eFoWv'><span id='eFoWv'><b id='eFoWv'><form id='eFoWv'><ins id='eFoWv'></ins><ul id='eFoWv'></ul><sub id='eFoWv'></sub></form><legend id='eFoWv'></legend><bdo id='eFoWv'><pre id='eFoWv'><center id='eFoWv'></center></pre></bdo></b><th id='eFoWv'></th></span></q></dt></tr></i><div id='eFoWv'><tfoot id='eFoWv'></tfoot><dl id='eFoWv'><fieldset id='eFoWv'></fieldset></dl></div>

                本文介绍了未知错误:无法获取卷积算法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                完全错误:

                未知错误:无法获取卷积算法。这可能是 因为cuDNN初始化失败,所以请尝试查看是否有警告 上面打印了日志消息。[OP:Conv2D]

                软件包安装命令:

                conda install -c anaconda keras-gpu
                

                它已安装:

                • 张力板2.0.0 pyhb38c66f_1
                • TensorFlow 2.0.0 GPU_py37h57d29ca_0
                • TensorFlow-BASE 2.0.0 GPU_py37h390e234_0
                • TensorFlow-Estiator 2.0.0 pyh2649769_0
                • TensorFlow-GPU 2.0.0 h0d30ee6_0蟒蛇
                • cudatoolkit 10.0.130 0
                • cudnn 7.6.5 cuda10.0_0
                • Keras-Applications 1.0.8 py_0
                • keras-base 2.2.4py37_0
                • Keras-GPU 2.2.4 0蟒蛇
                • keras-预处理1.1.0py_1

                我已尝试从NVIDIA网站安装CUDA-TOOLKIT,但没有解决问题,因此建议与CONDA命令相关。

                一些博客建议安装Visual Studio,但是如果我有Spyder IDE,有什么需要吗?

                编码:

                from tensorflow.keras.models import Sequential
                from tensorflow.keras.layers import Convolution2D
                from tensorflow.keras.layers import MaxPooling2D
                from tensorflow.keras.layers import Flatten
                from tensorflow.keras.layers import Dense
                
                classifier = Sequential()
                
                classifier.add(Convolution2D(32, 3, 3, input_shape = (64, 64, 3), activation = 'relu'))
                
                classifier.add(MaxPooling2D(pool_size = (2, 2)))
                
                classifier.add(Convolution2D(32, 3, 3, activation = 'relu'))
                classifier.add(MaxPooling2D(pool_size = (2, 2)))
                
                classifier.add(Flatten())
                
                classifier.add(Dense(units = 128, activation = 'relu'))
                classifier.add(Dense(units = 1, activation = 'sigmoid'))
                
                classifier.compile(optimizer = 'adam', loss = 'binary_crossentropy', metrics = ['accuracy'])
                
                from tensorflow.keras.preprocessing.image import ImageDataGenerator
                
                train_datagen = ImageDataGenerator(rescale = 1./255,
                                                   shear_range = 0.2,
                                                   zoom_range = 0.2,
                                                   horizontal_flip = True)
                
                test_datagen = ImageDataGenerator(rescale = 1./255)
                
                training_set = train_datagen.flow_from_directory('dataset/training_set',
                                                                 target_size = (64, 64),
                                                                 batch_size = 4,
                                                                 class_mode = 'binary')
                
                test_set = test_datagen.flow_from_directory('dataset/test_set',
                                                            target_size = (64, 64),
                                                            batch_size = 4,
                                                            class_mode = 'binary')
                
                classifier.fit_generator(training_set,
                                         steps_per_epoch = 8000,
                                         epochs = 25,
                                         validation_data = test_set,
                                         validation_steps = 2000)
                

                执行下面的代码后,我收到错误:

                classifier.fit_generator(training_set,
                                             steps_per_epoch = 8000,
                                             epochs = 25,
                                             validation_data = test_set,
                                             validation_steps = 2000)
                

                编辑1:回溯

                Traceback (most recent call last):
                
                  File "D:Machine LearningMachine Learning A-Z Template FolderPart 8 - Deep LearningSection 40 - Convolutional Neural Networks (CNN)cnn.py", line 70, in <module>
                    validation_steps = 2000)
                
                  File "C:AnacondaenvsMLlibsite-packages	ensorflow_corepythonkerasengine	raining.py", line 1297, in fit_generator
                    steps_name='steps_per_epoch')
                
                  File "C:AnacondaenvsMLlibsite-packages	ensorflow_corepythonkerasengine	raining_generator.py", line 265, in model_iteration
                    batch_outs = batch_function(*batch_data)
                
                  File "C:AnacondaenvsMLlibsite-packages	ensorflow_corepythonkerasengine	raining.py", line 973, in train_on_batch
                    class_weight=class_weight, reset_metrics=reset_metrics)
                
                  File "C:AnacondaenvsMLlibsite-packages	ensorflow_corepythonkerasengine	raining_v2_utils.py", line 264, in train_on_batch
                    output_loss_metrics=model._output_loss_metrics)
                
                  File "C:AnacondaenvsMLlibsite-packages	ensorflow_corepythonkerasengine	raining_eager.py", line 311, in train_on_batch
                    output_loss_metrics=output_loss_metrics))
                
                  File "C:AnacondaenvsMLlibsite-packages	ensorflow_corepythonkerasengine	raining_eager.py", line 252, in _process_single_batch
                    training=training))
                
                  File "C:AnacondaenvsMLlibsite-packages	ensorflow_corepythonkerasengine	raining_eager.py", line 127, in _model_loss
                    outs = model(inputs, **kwargs)
                
                  File "C:AnacondaenvsMLlibsite-packages	ensorflow_corepythonkerasenginease_layer.py", line 891, in __call__
                    outputs = self.call(cast_inputs, *args, **kwargs)
                
                  File "C:AnacondaenvsMLlibsite-packages	ensorflow_corepythonkerasenginesequential.py", line 256, in call
                    return super(Sequential, self).call(inputs, training=training, mask=mask)
                
                  File "C:AnacondaenvsMLlibsite-packages	ensorflow_corepythonkerasengine
                etwork.py", line 708, in call
                    convert_kwargs_to_constants=base_layer_utils.call_context().saving)
                
                  File "C:AnacondaenvsMLlibsite-packages	ensorflow_corepythonkerasengine
                etwork.py", line 860, in _run_internal_graph
                    output_tensors = layer(computed_tensors, **kwargs)
                
                  File "C:AnacondaenvsMLlibsite-packages	ensorflow_corepythonkerasenginease_layer.py", line 891, in __call__
                    outputs = self.call(cast_inputs, *args, **kwargs)
                
                  File "C:AnacondaenvsMLlibsite-packages	ensorflow_corepythonkeraslayersconvolutional.py", line 197, in call
                    outputs = self._convolution_op(inputs, self.kernel)
                
                  File "C:AnacondaenvsMLlibsite-packages	ensorflow_corepythonops
                n_ops.py", line 1134, in __call__
                    return self.conv_op(inp, filter)
                
                  File "C:AnacondaenvsMLlibsite-packages	ensorflow_corepythonops
                n_ops.py", line 639, in __call__
                    return self.call(inp, filter)
                
                  File "C:AnacondaenvsMLlibsite-packages	ensorflow_corepythonops
                n_ops.py", line 238, in __call__
                    name=self.name)
                
                  File "C:AnacondaenvsMLlibsite-packages	ensorflow_corepythonops
                n_ops.py", line 2010, in conv2d
                    name=name)
                
                  File "C:AnacondaenvsMLlibsite-packages	ensorflow_corepythonopsgen_nn_ops.py", line 1031, in conv2d
                    data_format=data_format, dilations=dilations, name=name, ctx=_ctx)
                
                  File "C:AnacondaenvsMLlibsite-packages	ensorflow_corepythonopsgen_nn_ops.py", line 1130, in conv2d_eager_fallback
                    ctx=_ctx, name=name)
                
                  File "C:AnacondaenvsMLlibsite-packages	ensorflow_corepythoneagerexecute.py", line 67, in quick_execute
                    six.raise_from(core._status_to_exception(e.code, message), None)
                
                  File "<string>", line 3, in raise_from
                
                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. [Op:Conv2D]
                

                推荐答案

                以下代码解决了该问题:

                import tensorflow as tf
                gpus = tf.config.experimental.list_physical_devices('GPU')
                if gpus:
                    try:
                        for gpu in gpus:
                            tf.config.experimental.set_memory_growth(gpu, True)
                
                    except RuntimeError as e:
                        print(e)
                

                这篇关于未知错误:无法获取卷积算法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:如何在TensorFlow中使用相同的权重进行初始化? 下一篇:为什么有时候CNN的模型只预测了所有其他班级中的一个呢?

                相关文章

                1. <small id='MKcdF'></small><noframes id='MKcdF'>

                  • <bdo id='MKcdF'></bdo><ul id='MKcdF'></ul>
                  1. <i id='MKcdF'><tr id='MKcdF'><dt id='MKcdF'><q id='MKcdF'><span id='MKcdF'><b id='MKcdF'><form id='MKcdF'><ins id='MKcdF'></ins><ul id='MKcdF'></ul><sub id='MKcdF'></sub></form><legend id='MKcdF'></legend><bdo id='MKcdF'><pre id='MKcdF'><center id='MKcdF'></center></pre></bdo></b><th id='MKcdF'></th></span></q></dt></tr></i><div id='MKcdF'><tfoot id='MKcdF'></tfoot><dl id='MKcdF'><fieldset id='MKcdF'></fieldset></dl></div>

                    <tfoot id='MKcdF'></tfoot>
                    <legend id='MKcdF'><style id='MKcdF'><dir id='MKcdF'><q id='MKcdF'></q></dir></style></legend>