我应该为遮罩RCNN调整图片大小吗?

时间:2019-08-04 11:43:59

标签: image computer-vision

我正在通过使用遮罩RCNN训练自定义对象检测。我有不同大小的自定义图像,所以我想知道是否需要调整图像的大小,以使它们都具有相同的大小?

如果是,我应该使用哪种方法来调整它们的大小?

我还想在标记图像之前必须重新调整大小吗?

2 个答案:

答案 0 :(得分:0)

# Input image resizing
# Generally, use the "square" resizing mode for training and predicting
# and it should work well in most cases. In this mode, images are scaled
# up such that the small side is = IMAGE_MIN_DIM, but ensuring that the
# scaling doesn't make the long side > IMAGE_MAX_DIM. Then the image is
# padded with zeros to make it a square so multiple images can be put
# in one batch.
# Available resizing modes:
# none:   No resizing or padding. Return the image unchanged.
# square: Resize and pad with zeros to get a square image
#         of size [max_dim, max_dim].
# pad64:  Pads width and height with zeros to make them multiples of 64.
#         If IMAGE_MIN_DIM or IMAGE_MIN_SCALE are not None, then it scales
#         up before padding. IMAGE_MAX_DIM is ignored in this mode.
#         The multiple of 64 is needed to ensure smooth scaling of feature
#         maps up and down the 6 levels of the FPN pyramid (2**6=64).
# crop:   Picks random crops from the image. First, scales the image based
#         on IMAGE_MIN_DIM and IMAGE_MIN_SCALE, then picks a random crop of
#         size IMAGE_MIN_DIM x IMAGE_MIN_DIM. Can be used in training only.
#         IMAGE_MAX_DIM is not used in this mode.
IMAGE_RESIZE_MODE = "square" 
IMAGE_MIN_DIM = 720
IMAGE_MAX_DIM = 1280

Config.py 中的这个设置了图像的大小调整。

不能 100% 确定这是否会调整蒙版的大小,但如果这样做会更有意义。

答案 1 :(得分:-1)

您不必事先调整大小。

您可以在模型配置文件中使用此选项来设置训练的大小限制。

 image_resizer {
  keep_aspect_ratio_resizer {
    min_dimension: 600
    max_dimension: 1024
  }
}

请确保所有边界框都在图像尺寸的范围内。即在图片的宽度和高度范围内。然后,将根据此处设置的参数自动调整框和图像的大小。