首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >argmax(axis=0):所有输出值均为0

argmax(axis=0):所有输出值均为0
EN

Stack Overflow用户
提问于 2018-03-11 09:23:56
回答 1查看 208关注 0票数 1

我想在Caffenet的'upscore‘层之外生成(输出class=9,’upscore‘层的大小是9)。但是,在使用argmax(axis=0)之后,upscore层的所有像素都调整为0。有什么建议吗?

(upscore为反卷积层)

代码语言:javascript
复制
layer {
  name: "upscore"
  type: "Deconvolution"
  bottom: "score_fr"
  top: "upscore"
  param {
    lr_mult: 0.0
  }
  convolution_param {
    num_output: 9
    weight_filler: { type: "bilinear" }
    bias_term: false
    kernel_size: 25
    stride: 1
  }
}

$

代码语言:javascript
复制
in_ = mh.hypermat('../data/pavia/PaviaU.mat','../data/pavia/PaviaU_gt.mat').load_image()
in_ = in_[:,:,::-1]
in_ = in_.transpose((2,0,1))
print(in_.shape) # 103, 610, 340

# init
caffe.set_device(0)
caffe.set_mode_gpu()

# load net
net = caffe.Net('deploy.prototxt', 'snapshot/train_iter_5000.caffemodel', caffe.TEST)
net.blobs['data'].reshape(1, 103, 610, 340)

#net.blobs['data'].data[...] = in_

# run net and take argmax for prediction

output = net.forward(data=np.asarray([in_]))
output_prob1 = output['upscore'][0]
output_prob2 = output['upscore'][0].squeeze().argmax(axis=0)

print(output_prob1.shape) 
print(output_prob1) 

print(output_prob2.shape) 
print(output_prob2) 

output_prob1

output_prob2

EN

回答 1

Stack Overflow用户

发布于 2018-03-11 15:03:43

似乎'upscore'的第一个维度中的值被标记为maximal w.r.t所有其他值,因此argmax是0:第一个条目是最大的。

顺便说一句,bilinear上采样不应该也有group参数吗?

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

https://stackoverflow.com/questions/49215719

复制
相关文章

相似问题

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