我想在Caffenet的'upscore‘层之外生成(输出class=9,’upscore‘层的大小是9)。但是,在使用argmax(axis=0)之后,upscore层的所有像素都调整为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) 发布于 2018-03-11 15:03:43
似乎'upscore'的第一个维度中的值被标记为maximal w.r.t所有其他值,因此argmax是0:第一个条目是最大的。
顺便说一句,bilinear上采样不应该也有group参数吗?
https://stackoverflow.com/questions/49215719
复制相似问题