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'])
解决方案
I don't think you can detect the position of bubbles with the architecture you are using. You would have to adapt your case to an algorithm like YOLO: https://medium.com/@jonathan_hui/real-time-object-detection-with-yolo-yolov2-28b1b93e2088. Your output would then contain a unit indicating the presence or absence of a bubble in a particular region, and a set of units defining the coordinates of the bubbles.
推荐阅读
- php - 在 Laravel 中获取最新的关系
- google-cloud-platform - 无法使用自定义容器 GCP 进行部署
- java - 空手道框架:如何重用一个场景中使用的变量以在另一个场景中调用而不将其声明为全局变量
- python - 训练 YOLO 模型时,Google Colab Notebook 完全冻结
- python - 我在 CentOS 的 Pycharm Community 2020.2 中找不到个人资料按钮
- apache-flink - `stream.addSink(new PrintSinkFunction<>())` 和 `stream.print()` 在 Flink 中是否相同
- python - 有没有办法将 9,12 或 15 列从单个 df 组合成 3?
- logging - 如何将自定义数据传递给 Rust 中的 log crate 宏?
- excel - Excel 宏,用于根据工作表名称将多个工作表合并到主工作表
- r - 如何使用寓言(r)将预测加在一起?