Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.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
Tensorflow 从ImageDataGenerator选择imagenet_utils.preprocess_输入模式的可能性_Tensorflow_Image Processing_Keras_Conv Neural Network - Fatal编程技术网

Tensorflow 从ImageDataGenerator选择imagenet_utils.preprocess_输入模式的可能性

Tensorflow 从ImageDataGenerator选择imagenet_utils.preprocess_输入模式的可能性,tensorflow,image-processing,keras,conv-neural-network,Tensorflow,Image Processing,Keras,Conv Neural Network,有一种预处理技术,我们可以使用以下方法针对ImageNet数据集预处理图像: from keras.applications import imagenet_utils imagenet_utils.preprocess_input(image, mode='caffe') 你看,我选择了mode='caffe'。事实上,Keras.applicationsAPI解释了三种模式: mode: One of "caffe", "tf" or "t

有一种预处理技术,我们可以使用以下方法针对ImageNet数据集预处理图像:

from keras.applications import imagenet_utils
imagenet_utils.preprocess_input(image, mode='caffe')
你看,我选择了
mode='caffe'
。事实上,
Keras.applications
API解释了三种模式:

mode: One of "caffe", "tf" or "torch".
  - caffe: will convert the images from RGB to BGR,
      then will zero-center each color channel with
      respect to the ImageNet dataset,
      without scaling.
  - tf: will scale pixels between -1 and 1,
      sample-wise.
  - torch: will scale pixels between 0 and 1 and then
      will normalize each channel with respect to the
      ImageNet dataset.
由于我在代码中使用了
keras.preprocessing.image
中的
ImageDataGenerator
,是否有一种变通方法,允许从
ImageDataGenerator
中设置此类模式,因为这三种模式适用于ImageNet数据集


谢谢

ImageDataGenerator有一个
预处理函数
参数,您可以在其中传递一个要应用于图像的函数。要调整模式,可以执行以下操作:

from keras.applications import imagenet_utils
imagenet_utils.preprocess_input(image, mode='caffe')
从functools导入部分
从keras.applications导入imagenet_utils
imagenet\u caffe\u preprocessing\u函数=部分(imagenet\u utils.preprocess\u输入,mode=“caffe”)
数据\u生成器=图像数据生成器(预处理\u函数=图像网络\u caffe\u预处理\u函数,…)