【发布时间】:2020-01-20 22:29:45
【问题描述】:
我刚刚使用 tensorflow 对象检测 api 使用 fast-rcnn 进行了一些迁移学习。我在tensorflow 1.14,骨干网是faster_rcnn_resnet101_coco。冻结网络在进行预测时是否会调整提供给它们的图像的大小?
我问是因为当我为模型提供比我训练的图像大得多的图像时,它无法识别任何物体。当我将图像裁剪为 1200x1200 时,对象都是相同的,但效果很好。
模型是否包含图像大小限制?我是否应该使用与配置文件中相似的尺寸进行预测,即使对象在 3000x3000 图像中的大小相同?
在用于训练的配置文件中,我对输入图像进行了约束:
image_resizer {
keep_aspect_ratio_resizer {
min_dimension: 200
max_dimension: 1200
}
}
这是否意味着在我现在使用的经过训练的模型中,如果我给它提供大于 1200x1200 的图像,它会缩小它吗?以下是我如何在加载的冻结模型中进行预测:
with model.as_default():
with tf.Session(graph=model) as sess:
imageTensor = model.get_tensor_by_name("image_tensor:0")
boxesTensor = model.get_tensor_by_name("detection_boxes:0")
scoresTensor = model.get_tensor_by_name("detection_scores:0")
classesTensor = model.get_tensor_by_name("detection_classes:0")
numDetections = model.get_tensor_by_name("num_detections:0")
# Make prediction
(boxes, scores, labels, N) = sess.run([boxesTensor, scoresTensor, classesTensor, numDetections],
feed_dict = {imageTensor: image})
相关:Training Image Size Faster-RCNN
另外,这篇文章让我觉得它应该处理任何输入大小,但它显然不能处理它们,所以我很困惑:Faster RCNN + inception v2 input size
【问题讨论】:
标签: python tensorflow object-detection-api