完全卷积网络的每像素softmax [英] Per pixel softmax for fully convolutional network

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

问题描述

我正在尝试实现类似完全卷积的网络,其中最后一个卷积层使用大小为1x1的过滤器并输出一个得分"张量.得分张量的形状为[Batch,height,width,num_classes].

I'm trying to implement something like a fully convolutional network, where the last convolution layer uses filter size 1x1 and outputs a 'score' tensor. The score tensor has shape [Batch, height, width, num_classes].

我的问题是,张量流中的哪个函数可以对每个像素应用softmax操作,而与其他像素无关. tf.nn.softmax操作似乎并非出于此目的.

My question is, what function in tensorflow can apply softmax operation for each pixel, independent of other pixels. The tf.nn.softmax ops seems not for such purpose.

如果没有这样的操作,我想我必须自己写一个.

If there is no such ops available, I guess I have to write one myself.

谢谢!

更新:如果我必须自己实现,我想我可能需要将输入张量重塑为[N,num_claees],其中N =批处理x宽度x高度,并应用tf.nn.softmax,然后将其重塑.有道理吗?

UPDATE: if I do have to implement myself, I think I may need to reshape the input tensor to [N, num_claees] where N = Batch x width x height, and apply tf.nn.softmax, then reshape it back. Does it make sense?

推荐答案

将其重塑为2d,然后像您猜想的那样将其重塑为正确的方法.

Reshaping it to 2d and then reshaping it back, like you guessed, is the right approach.

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

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