首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在Tensorflow对象检测API的配置文件中,“keep_aspect_ratio_resizer{”的功能是什么?

在Tensorflow对象检测API的配置文件中,“keep_aspect_ratio_resizer{”的功能是什么?
EN

Stack Overflow用户
提问于 2021-01-25 00:53:57
回答 1查看 1.2K关注 0票数 1

我使用Tensorflow对象检测API来创建一个AI以加快速度-RCNN。GitHub:Tensorflow/模型

配置文件中的"keep_aspect_ratio_resizer {“具有什么样的大小调整功能?

我准备了1920年x 1080像素的图像,并将"min维度:“和"max维度:”分别设置在配置文件中的"keep_aspect_ratio_resizer {“之后分别设置为768。

在这种情况下,1920x1080像素图像将被调整为768x768像素并输入CNN。此时,会否维持原来的影像比例(16: 9)?也就是说,当图像被调整到768x768像素时,图像的长边会被转换成768像素,并在图像的边缘添加黑条吗?

还是图像比从16: 9变为1: 1,并在这种情况下变得扭曲?

如果有人知道这件事,请告诉我。

谢谢!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-01-25 09:26:00

配置文件的不同字段的定义如下所示:探测/原型

keep_aspect_ratio_resizer字段位于image_resizer.proto中,并声明如下:

代码语言:javascript
运行
复制
// Configuration proto for image resizer that keeps aspect ratio.
message KeepAspectRatioResizer {
  // Desired size of the smaller image dimension in pixels.
  optional int32 min_dimension = 1 [default = 600];

  // Desired size of the larger image dimension in pixels.
  optional int32 max_dimension = 2 [default = 1024];

  // Desired method when resizing image.
  optional ResizeType resize_method = 3 [default = BILINEAR];

  // Whether to pad the image with zeros so the output spatial size is
  // [max_dimension, max_dimension]. Note that the zeros are padded to the
  // bottom and the right of the resized image.
  optional bool pad_to_max_dimension = 4 [default = false];

  // Whether to also resize the image channels from 3 to 1 (RGB to grayscale).
  optional bool convert_to_grayscale = 5 [default = false];

  // Per-channel pad value. This is only used when pad_to_max_dimension is True.
  // If unspecified, a default pad value of 0 is applied to all channels.
  repeated float per_channel_pad_value = 6;
}

因此,您可以通过在配置文件中添加pad_to_max_dimension: true来添加填充(黑条)。否则,应保持高宽比。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65877638

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档