1

I want to generate out of 'upsocre' layer of Caffenet(output class=9, there for the size of 'upscore' layer is 9). However, all pixels of upscore layer tuned 0 after using argmax(axis=0). any idea pleas?
(upscore is deconvolution layer )

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

4

1 回答 1

0

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

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

于 2018-03-11T07:03:42.983 回答