Python keras CNN的未知错误-2
我一直在用keras训练CNN。今天早些时候,我培训了一个模型微调VGG16,并决定将其与微调VGG19模型进行比较 最初,我得到的是“无法获取卷积算法。这可能是因为cuDNN未能初始化,因此请尝试查看上面是否打印了警告日志消息。” 通过stackoverflow搜索,我发现我的CUDA与我的Python keras CNN的未知错误-2,python,tensorflow,keras,eoserror,Python,Tensorflow,Keras,Eoserror,我一直在用keras训练CNN。今天早些时候,我培训了一个模型微调VGG16,并决定将其与微调VGG19模型进行比较 最初,我得到的是“无法获取卷积算法。这可能是因为cuDNN未能初始化,因此请尝试查看上面是否打印了警告日志消息。” 通过stackoverflow搜索,我发现我的CUDA与我的tensorflow版本不兼容。因此我找到了兼容的版本,并一起工作并安装了它们 我去重新运行我的VGG16模型,以确保一切正常工作…但现在我得到 -----------------------------
tensorflow
版本不兼容。因此我找到了兼容的版本,并一起工作并安装了它们
我去重新运行我的VGG16模型,以确保一切正常工作…但现在我得到
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
<ipython-input-13-4d283cf7c5f9> in <module>
4 validation_data = validation_generator,
5 validation_steps = 700,
----> 6 epochs = 5)
~\Anaconda3\lib\site-packages\keras\legacy\interfaces.py in wrapper(*args, **kwargs)
89 warnings.warn('Update your `' + object_name + '` call to the ' +
90 'Keras 2 API: ' + signature, stacklevel=2)
---> 91 return func(*args, **kwargs)
92 wrapper._original_function = func
93 return wrapper
~\Anaconda3\lib\site-packages\keras\engine\training.py in fit_generator(self, generator, steps_per_epoch, epochs, verbose, callbacks, validation_data, validation_steps, class_weight, max_queue_size, workers, use_multiprocessing, shuffle, initial_epoch)
1416 use_multiprocessing=use_multiprocessing,
1417 shuffle=shuffle,
-> 1418 initial_epoch=initial_epoch)
1419
1420 @interfaces.legacy_generator_methods_support
~\Anaconda3\lib\site-packages\keras\engine\training_generator.py in fit_generator(model, generator, steps_per_epoch, epochs, verbose, callbacks, validation_data, validation_steps, class_weight, max_queue_size, workers, use_multiprocessing, shuffle, initial_epoch)
179 batch_index = 0
180 while steps_done < steps_per_epoch:
--> 181 generator_output = next(output_generator)
182
183 if not hasattr(generator_output, '__len__'):
~\Anaconda3\lib\site-packages\keras\utils\data_utils.py in get(self)
707 "`use_multiprocessing=False, workers > 1`."
708 "For more information see issue #1638.")
--> 709 six.reraise(*sys.exc_info())
~\Anaconda3\lib\site-packages\six.py in reraise(tp, value, tb)
694 if value.__traceback__ is not tb:
695 raise value.with_traceback(tb)
--> 696 raise value
697 finally:
698 value = None
~\Anaconda3\lib\site-packages\keras\utils\data_utils.py in get(self)
683 try:
684 while self.is_running():
--> 685 inputs = self.queue.get(block=True).get()
686 self.queue.task_done()
687 if inputs is not None:
~\Anaconda3\lib\multiprocessing\pool.py in get(self, timeout)
681 return self._value
682 else:
--> 683 raise self._value
684
685 def _set(self, i, obj):
~\Anaconda3\lib\multiprocessing\pool.py in worker(inqueue, outqueue, initializer, initargs, maxtasks, wrap_exception)
119 job, i, func, args, kwds = task
120 try:
--> 121 result = (True, func(*args, **kwds))
122 except Exception as e:
123 if wrap_exception and func is not _helper_reraises_exception:
~\Anaconda3\lib\site-packages\keras\utils\data_utils.py in next_sample(uid)
624 The next value of generator `uid`.
625 """
--> 626 return six.next(_SHARED_SEQUENCES[uid])
627
628
~\Anaconda3\lib\site-packages\keras_preprocessing\image\iterator.py in __next__(self, *args, **kwargs)
102
103 def __next__(self, *args, **kwargs):
--> 104 return self.next(*args, **kwargs)
105
106 def next(self):
~\Anaconda3\lib\site-packages\keras_preprocessing\image\iterator.py in next(self)
114 # The transformation of images is not under thread lock
115 # so it can be done in parallel
--> 116 return self._get_batches_of_transformed_samples(index_array)
117
118 def _get_batches_of_transformed_samples(self, index_array):
~\Anaconda3\lib\site-packages\keras_preprocessing\image\iterator.py in _get_batches_of_transformed_samples(self, index_array)
228 color_mode=self.color_mode,
229 target_size=self.target_size,
--> 230 interpolation=self.interpolation)
231 x = img_to_array(img, data_format=self.data_format)
232 # Pillow images should be closed after `load_img`,
~\Anaconda3\lib\site-packages\keras_preprocessing\image\utils.py in load_img(path, grayscale, color_mode, target_size, interpolation)
130 ", ".join(_PIL_INTERPOLATION_METHODS.keys())))
131 resample = _PIL_INTERPOLATION_METHODS[interpolation]
--> 132 img = img.resize(width_height_tuple, resample)
133 return img
134
~\Anaconda3\lib\site-packages\PIL\Image.py in resize(self, size, resample, box)
1780 return self.convert('RGBa').resize(size, resample, box).convert('RGBA')
1781
-> 1782 self.load()
1783
1784 return self._new(self.im.resize(size, resample, box))
~\Anaconda3\lib\site-packages\PIL\TiffImagePlugin.py in load(self)
1065 def load(self):
1066 if self.use_load_libtiff:
-> 1067 return self._load_libtiff()
1068 return super(TiffImageFile, self).load()
1069
~\Anaconda3\lib\site-packages\PIL\TiffImagePlugin.py in _load_libtiff(self)
1157
1158 if err < 0:
-> 1159 raise IOError(err)
1160
1161 return Image.Image.load(self)
OSError: -2```
Any idea?
---------------------------------------------------------------------------
OSError回溯(最近一次调用上次)
在里面
4验证数据=验证生成器,
5个验证步骤=700,
---->6个时代=5个)
包装中的~\Anaconda3\lib\site packages\keras\legacy\interfaces.py(*args,**kwargs)
89 warnings.warn('Update your`'+object\u name+'`调用+
90'Keras 2 API:'+签名,堆栈级别=2)
--->91返回函数(*args,**kwargs)
92包装器._原始函数=func
93返回包装器
拟合生成器中的~\Anaconda3\lib\site packages\keras\engine\training.py(self、生成器、每个历元的步数、历元、冗余、回调、验证数据、验证步骤、类权重、最大队列大小、工作者、使用多处理、无序、初始历元)
1416使用多处理=使用多处理,
1417洗牌=洗牌,
->1418初始_历元=初始_历元)
1419
1420@interfaces.legacy\u生成器\u方法\u支持
~\Anaconda3\lib\site packages\keras\engine\training\u generator.py-in-fit\u generator(模型、生成器、每个历元的步骤、历元、详细信息、回调、验证数据、验证步骤、类权重、最大队列大小、工人、使用多处理、洗牌、初始历元)
179批次指数=0
180当步骤完成时<每个步骤:
-->181发电机输出=下一个(发电机输出)
182
183如果不是HASTATR(发电机输出,'''.'透镜''.'':
get中的~\Anaconda3\lib\site packages\keras\utils\data\u utils.py(self)
707“`use_multiprocessing=False,workers>1`。”
708“有关更多信息,请参阅第1638期。”)
-->709六.重新播放(*sys.exc_info())
~\Anaconda3\lib\site packages\six.py正在重新播放(tp,value,tb)
694如果值.\uuuu回溯\uuuuu不是tb:
695通过回溯(tb)提升值
-->696提高价值
697最后:
698值=无
get中的~\Anaconda3\lib\site packages\keras\utils\data\u utils.py(self)
683试试:
684当self.u正在运行()时:
-->685 inputs=self.queue.get(block=True).get()
686 self.queue.task_done()
687如果输入不是无:
get中的~\Anaconda3\lib\multiprocessing\pool.py(self,超时)
681返回自身值
682其他:
-->683提高自我价值
684
685 def_装置(自、i、obj):
工作进程中的~\Anaconda3\lib\multiprocessing\pool.py(inqueue、outqueue、初始值设定项、initargs、maxtasks、wrap\u异常)
119作业,i,func,参数,kwds=任务
120尝试:
-->121结果=(真,函数(*args,**kwds))
122例外情况除外,如e:
123如果换行异常和func不是_helper _重新出现_异常:
下一个样本(uid)中的~\Anaconda3\lib\site packages\keras\utils\data\u utils.py
624生成器“uid”的下一个值。
625 """
-->626返回六。下一步(\u共享\u序列[uid])
627
628
~\Anaconda3\lib\site packages\keras\u preprocessing\image\iterator.py in\uuuuuuuu next\uuuuuuuuu(self,*args,**kwargs)
102
103定义下一个定义(self,*args,**kwargs):
-->104返回自下一步(*args,**kwargs)
105
106 def next(自我):
~\Anaconda3\lib\site packages\keras\u preprocessing\image\iterator.py in next(self)
114#图像转换未处于线程锁定状态
115#因此可以并行进行
-->116返回自身。获取转换样本的批次(索引数组)
117
118 def_获取_转换_样本的批次(自、索引_数组):
~\Anaconda3\lib\site packages\keras\u preprocessing\image\iterator.py in\u get\u batches\u of \u transformed\u样本(self,index\u数组)
228颜色_模式=self.color_模式,
229目标大小=自我目标大小,
-->230插值=自插值)
231 x=img\u to\u数组(img,data\u格式=self.data\u格式)
232#枕头图像应在“加载img”后关闭,
加载img中的~\Anaconda3\lib\site packages\keras\u preprocessing\image\utils.py(路径、灰度、颜色模式、目标大小、插值)
130“,”.join(_PIL_INTERPOLATION_METHODS.keys()))
131重采样=插值方法[插值]
-->132 img=img.调整大小(宽度\高度\元组,重采样)
133返回img
134
~\Anaconda3\lib\site packages\PIL\Image.py中的大小调整(self、size、resample、box)
1780返回self.convert('RGBa')。调整大小(大小、重采样、方框)。convert('RGBa'))
1781
->1782自加载()
1783
1784返回self.\u新建(self.im.调整大小(大小、重采样、方框))
加载中的~\Anaconda3\lib\site packages\PIL\TiffImagePlugin.py(self)
1065 def加载(自):
1066如果self.use\u load\u libtiff:
->1067返回自。_加载_libtiff()
1068 return super(TiffImageFile,self).load()
1069
加载libti中的~\Anaconda3\lib\site packages\PIL\TiffImagePlugin.py