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

时间:2018-03-11 01:23:56

标签: computer-vision deep-learning caffe image-segmentation argmax

我希望产生“上升”的感觉。 Caffenet层(输出类= 9,大小为' upscore'层为9)。但是,在使用argmax(轴= 0)后,所有高分图层像素都调整为0。任何想法请求?
(upscore是反卷积层)

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
  }
}

$

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

1 个答案:

答案 0 :(得分:0)

似乎'upscore'的第一维中的值与所有其他值的最大值相同,因此argmax为0:第一个条目是最大值。

BTW,不应该bilinear上采样也有group参数吗?