Shoud I调整了Mask RCNN的图像大小



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

,如果是这样,我应该使用哪种方法来调整它们?

我也想我必须调整大小,然后标记图像正确?

您不一定要提前调整它。

您可以在模型配置文件中使用此选项来设置培训的尺寸限制。

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

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

在MatterPlot的Mask RCNN中,您可以在配置文件中找到文档:

# 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 = 800
IMAGE_MAX_DIM = 1024

我如何理解。当您训练或预测此配置时,将不必手动调整它。当然,如果您的大小和图像的比率不同,这可能是一个问题。

  • 512x512:比率= 1,所以这将高档至1024x1024
  • 2054x2456:比率= 0.836 ...因此,这将降至1024x1024保持比率为0.836 ...但是使用zeropadding 获得正方形的形状。

与不同的图像尺寸相比,对象的尺寸相对较小或更大,这可能会导致拉伸或压缩的对象。在这种情况下,您应该手动进行预处理,以便最终您的对象具有相同的大小和形状,因为蒙版RCNN功能已将其模制成正确的形状。

Matter Protot功能在" utils.py"中找到。被称为" resize_image"。在"型号"中这是在数据加载和推理(检测(重塑给定的numpy-array时使用的过程中使用的。

最新更新