首页 文章

为什么Keras不处理图像的Theano和TF表示之间的区别?

提问于
浏览
0

为什么Keras不能处理带有通道的图像的Theano和Tensorflow表示之间的区别?例如,如果您使用Theano作为后端,它们的图像是(samples,color_depth,width,height)形式,如果使用TF,则图像采用(samples,width,height,color_depth)格式 . 看起来像Keras可以只使用其中一个,然后重新格式化幕后的形状 .

1 回答

  • 1

    Keras只使用一种表示法 .

    按标准,它使用 channels_last . 如果用户可以将其更改为 channels_first .

    您可以创建一个keras模型,并将其与tensorflow或theano一起使用,而无需更改模型的任何内容 .

    文件 keras.json 包含标准定义:

    {
        "floatx": "float32",
        "image_data_format": "channels_last",
        "epsilon": 1e-07,
        "backend": "tensorflow"
    }
    

    该文件可在 <user>\.keras\keras.json 中找到

    您还可以通过为每个图层定义参数 data_format 来覆盖标准设置 . (见here) .

    它必须是's a good thing to avoid then using tensorflow or theano functions directly. For cases where it',尝试Keras backend函数 .

相关问题