完全卷积网络训练图像大小 [英] Fully Convolutional Network Training Image Size

查看:123
本文介绍了完全卷积网络训练图像大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用TensorFlow复制用于语义分割的全卷积网络(FCN)的结果.

I'm trying to replicate the results of Fully Convolutional Network (FCN) for Semantic Segmentation using TensorFlow.

我坚持将训练图像输入到计算图中.全卷积网络使用VOC PASCAL数据集进行训练.但是,数据集中的训练图像大小各异.

I'm stuck on feeding training images into the computation graph. The fully convolutional network used VOC PASCAL dataset for training. However, the training images in the dataset are of varied sizes.

我只想问一下他们是否对训练图像进行了预处理,以使其具有相同的大小,以及它们如何对图像进行了预处理.如果不是,他们是否只是将一批不同大小的图像送入FCN?是否可以在TensorFlow中将一批不同大小的图像馈送到计算图中?可以使用队列输入而不是占位符来做到这一点吗?

I just want to ask if they preprocessed the training images to make them have the same size and how they preprocessed the images. If not, did they just feed batches of images of different sizes into the FCN? Is it possible to feed images of different sizes in one batch into a computation graph in TensorFlow? Is it possible to do that using queue input rather than placeholder?

推荐答案

不可能将不同大小的图像馈入单个输入批处理中.每个批次可以有不确定数量的样本(通常是批次大小,以下用None指出),但是每个样本必须具有相同的尺寸.

It's not possible to feed images of different size into a single input batch. Every batch can have an undefined number of samples (that's the batch size usually, below noted with None) but every sample must have the same dimensions.

训练全卷积网络时,您必须像训练网络一样将其训练为末尾具有完全连接的层. 因此,输入批次中的每个输入图像都必须具有相同的宽度,高度和深度.调整它们的大小.

When you train a fully convolutional network you have to train it like a network with fully connected layers at the end. So, every input image in the input batch must have the same widht, height and depth. Resize them.

唯一的区别是,虽然全连接层为输入批次中的每个样本(形状为[None, num_classes])输出单个输出矢量,但全卷积输出类的概率图.

The only difference is that while fully connected layers output a single output vector for every sample in the input batch (shape [None, num_classes]) the fully convolutional outputs a probability map of classes.

在训练期间,当输入图像尺寸等于网络输入尺寸时,输出将是形状为[None, 1, 1, num_classes]的概率图.

During train, when the input images dimensions are equals to the network input dimensions, the output will be a probability map with shape [None, 1, 1, num_classes].

您可以使用 tf.squeeze ,然后像完全连接网络一样计算损耗和准确性.

You can remove the dimensions of size 1 from the output tensor using tf.squeeze and then calculate the loss and accuracy just like you do with a fully connected network.

在测试时,当您输入尺寸大于输入尺寸的网络图像时,输出将是尺寸为[None, n, n, num_classes]的概率图.

At test time, when you feed the network images with dimensions greater than the input, the output will be a probability map with size [None, n, n, num_classes].

这篇关于完全卷积网络训练图像大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆