Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/363.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python tensorflow再培训最后一层如何处理不同的图像大小?_Python_Tensorflow_Deep Learning - Fatal编程技术网

Python tensorflow再培训最后一层如何处理不同的图像大小?

Python tensorflow再培训最后一层如何处理不同的图像大小?,python,tensorflow,deep-learning,Python,Tensorflow,Deep Learning,我正在运行,但我无法理解为什么重新训练的图像可以与模型最初训练的图像大小不同。我查看了将图像提供给模型的脚本,但是代码没有进行任何类型的图像大小调整,而是直接且立即地 有人知道在进行最后一层训练时如何使用不同大小的图像吗?从技术上讲,Inception模型可以直接应用于各种大小的图像。这是可能的,因为密集层之前的最后一个平均池是全局平均池(而不是3x3或2x2): 发件人: 这将池的窗口指定为整个映像 换句话说,该池层将空间维度上的特征平均化,因此无论H和W如何,H x W x 2048都将变为

我正在运行,但我无法理解为什么重新训练的图像可以与模型最初训练的图像大小不同。我查看了将图像提供给模型的脚本,但是代码没有进行任何类型的图像大小调整,而是直接且立即地


有人知道在进行最后一层训练时如何使用不同大小的图像吗?

从技术上讲,Inception模型可以直接应用于各种大小的图像。这是可能的,因为密集层之前的最后一个平均池是全局平均池(而不是3x3或2x2):

发件人:

这将池的窗口指定为整个映像

换句话说,该池层将空间维度上的特征平均化,因此无论
H
W
如何,
H x W x 2048
都将变为
1 x 2048



也就是说,根据我的经验,在与训练方式非常不同的尺度上应用NNs可能会导致精度下降(但网络应该工作)

技术上,初始模型可以直接应用于各种图像大小。这是可能的,因为密集层之前的最后一个平均池是全局平均池(而不是3x3或2x2):

发件人:

这将池的窗口指定为整个映像

换句话说,该池层将空间维度上的特征平均化,因此无论
H
W
如何,
H x W x 2048
都将变为
1 x 2048



也就是说,根据我的经验,将NNs应用于不同于其训练方式的刻度可能会导致精度下降(但网络应该可以工作)

@anthonybell您是对的代码没有进行任何图像调整。但是,如果您检查预训练网络,则有一个图像调整层

<tf.Tensor 'DecodeJpeg/contents:0' shape=() dtype=string>,
<tf.Tensor 'DecodeJpeg:0' shape=(?, ?, 3) dtype=uint8>,
<tf.Tensor 'Cast:0' shape=(?, ?, 3) dtype=float32>,
<tf.Tensor 'ExpandDims/dim:0' shape=(1,) dtype=int32>,
<tf.Tensor 'ExpandDims:0' shape=(1, ?, ?, 3) dtype=float32>,
<tf.Tensor 'ResizeBilinear/size:0' shape=(2,) dtype=int32>,
<tf.Tensor 'ResizeBilinear:0' shape=(1, 299, 299, 3) dtype=float32>,
<tf.Tensor 'Sub/y:0' shape=() dtype=float32>,
<tf.Tensor 'Sub:0' shape=(1, 299, 299, 3) dtype=float32>,
<tf.Tensor 'Mul/y:0' shape=() dtype=float32>,
<tf.Tensor 'Mul:0' shape=(1, 299, 299, 3) dtype=float32>,
,
,
,
,
,
,
,
,
,
,
,

网络将接受任何分辨率的图像,并在内部将其大小调整为299x299

@anthonybell您是对的,代码没有进行任何图像大小调整。但是,如果您检查预训练网络,则有一个图像调整层

<tf.Tensor 'DecodeJpeg/contents:0' shape=() dtype=string>,
<tf.Tensor 'DecodeJpeg:0' shape=(?, ?, 3) dtype=uint8>,
<tf.Tensor 'Cast:0' shape=(?, ?, 3) dtype=float32>,
<tf.Tensor 'ExpandDims/dim:0' shape=(1,) dtype=int32>,
<tf.Tensor 'ExpandDims:0' shape=(1, ?, ?, 3) dtype=float32>,
<tf.Tensor 'ResizeBilinear/size:0' shape=(2,) dtype=int32>,
<tf.Tensor 'ResizeBilinear:0' shape=(1, 299, 299, 3) dtype=float32>,
<tf.Tensor 'Sub/y:0' shape=() dtype=float32>,
<tf.Tensor 'Sub:0' shape=(1, 299, 299, 3) dtype=float32>,
<tf.Tensor 'Mul/y:0' shape=() dtype=float32>,
<tf.Tensor 'Mul:0' shape=(1, 299, 299, 3) dtype=float32>,
,
,
,
,
,
,
,
,
,
,
,

网络将接受任何分辨率的图像,并在内部将其大小调整为299x299

它可能正在动态调整图像大小?你是什么意思?您是否建议模型可以接受可变大小的图像?不是模型,而是代码可以在发送到模型之前执行图像预处理,以调整图像大小或子集。这只是一个猜测,来自create_inception_graph()的jpeg_data_tensor、resized_input_tensor和resized_tensor之间有什么区别?此外,如果您要求任何失真,裁剪/调整大小都在这里完成:它可能在动态调整图像大小?您的意思是什么?您是否建议模型可以接受可变大小的图像?不是模型,而是代码可以在发送到模型之前执行图像预处理,以调整图像大小或子集。这只是一个猜测,来自create_inception_graph()的jpeg_data_tensor、resized_input_tensor和resized_input_tensor之间有什么区别?此外,如果你要求任何失真,裁剪/调整大小都在这里进行:看起来他们必须进行某种调整大小的工作,因为当你查看卷积时,每一层的图像都会越来越小。。如果我的图像一开始是8x8,那么当它达到1x1时它会做什么呢?这是因为在卷积层之间夹有池层。如果您的输入大小为8x8,调整图层大小会将图像调整为299x299。似乎他们必须进行某种调整,因为当您查看卷积时,每个图层上的图像都会越来越小。。如果我的图像一开始是8x8,那么当它达到1x1时它会做什么呢?这是因为在卷积层之间夹有池层。如果您的输入大小为8x8,调整图层大小将把图像大小调整为299x299。