【发布时间】:2019-05-02 01:58:54
【问题描述】:
我正在设计一个深度学习分割模型的原型,该模型需要六个输入通道(两个在不同光照条件下对齐的 448x448 RGB 图像)。我希望将几个预训练模型的性能与我从头开始训练的当前模型的性能进行比较。我可以将tf.keras.applications 中的预训练模型用于超过 3 个通道的输入图像吗?
我尝试先应用卷积将通道维度减少到 3,然后将该输出传递给 tf.keras.applications.DenseNet121(),但收到以下错误:
import tensorflow as tf
dense_input = tf.keras.layers.Input(shape=(448, 448, 6))
dense_filter = tf.keras.layers.Conv2D(3, 3, padding='same')(dense_input)
dense_stem = tf.keras.applications.DenseNet121(include_top=False, weights='imagenet', input_tensor=dense_filter)
*** ValueError: You are trying to load a weight file containing 241 layers into a model with 242 layers.
有没有更好的方法在 keras 中对具有不同输入通道数量的数据使用预训练模型?当输入通道的数量不同时,预训练是否会有所帮助?
【问题讨论】:
标签: python tensorflow keras deep-learning