TensorFlow,Keras:测试图像大于训练图像

时间:2018-09-23 09:17:40

标签: image tensorflow keras

我训练了一个网络来检测14x14像素灰度图像中的“气泡”。我用包含气泡的图像和不含气泡的图像训练了网络。网络运作良好。

现在,我有一个带有大量气泡的大图像(我从该大图像生成了训练数据)1

我希望网络使用14x14内核扫描大图像以检测气泡的位置。我该怎么办?

下面是我的网络:

model = keras.Sequential([
    keras.layers.Flatten(input_shape=(14, 14)),
    keras.layers.Dense(128, activation=tf.nn.relu),
    keras.layers.Dense(64, activation=tf.nn.relu),
    keras.layers.Dense(32, activation=tf.nn.relu),
    keras.layers.Dense(16, activation=tf.nn.relu),
    keras.layers.Dense(8, activation=tf.nn.relu),
    keras.layers.Dense(2, activation=tf.nn.softmax)
])
model.compile(optimizer=tf.train.AdamOptimizer(), 
              loss='sparse_categorical_crossentropy',
              metrics=['accuracy'])

1 个答案:

答案 0 :(得分:0)

我认为您无法使用所使用的体系结构检测气泡的位置。您将需要根据YOLO这样的算法调整案例:https://medium.com/@jonathan_hui/real-time-object-detection-with-yolo-yolov2-28b1b93e2088。然后,您的输出将包含一个指示特定区域中是否存在气泡的单位,以及一组定义气泡坐标的单位。