torrvision / crfasrnn

This repository contains the source code for the semantic image segmentation method described in the ICCV 2015 paper: Conditional Random Fields as Recurrent Neural Networks. http://crfasrnn.torr.vision/
Other
1.34k stars 462 forks source link

Message type "caffe.LayerParameter" has no field named "multi_stage_meanfield_param". #94

Closed SharifAmit closed 7 years ago

SharifAmit commented 7 years ago

I am using this version of crfasrnn this. Error parsing text-format caffe.NetParameter: 758:31: Message type "caffe.LayerParameter" has no field named "multi_stage_meanfield_param".

My solve.py file:

import caffe import surgery, score

import numpy as np import os

import setproctitle setproctitle.setproctitle(os.path.basename(os.getcwd())) weights = 'voc-experiment8CRF/snapshot/vocSBDall_iter_400000.caffemodel' caffe.set_device(0) caffe.set_mode_gpu()

solver = caffe.SGDSolver('voc-experiment8CRF/solver.prototxt') solver.net.copy_from(weights)

interp_layers = [k for k in solver.net.params.keys() if 'up' in k] surgery.interp(solver.net, interp_layers)

val = np.loadtxt('../seg12val.txt', dtype=str)

for _ in range(1): solver.step(1) score.seg_tests(solver, False, val, layer='score')

MutliStageMeanField Layer in train.prototxt

layer { name: "inference1"#if you set name "inference1", code will load parameters from caffemodel. type: "MultiStageMeanfield" bottom: "unary" bottom: "Q0" bottom: "data" top: "pred" param { lr_mult: 10000#learning rate for W_G } param { lr_mult: 10000#learning rate for W_B } param { lr_mult: 1000 #learning rate for compatiblity transform matrix } multi_stage_meanfield_param { num_iterations: 10 #Number of iterations for CRF-RNN compatibility_mode: POTTS#Initialize the compatilibity transform matrix with a matrix whose diagonal is -1. threshold: 2 theta_alpha: 160 theta_beta: 3 theta_gamma: 3 spatial_filter_weight: 3 bilateral_filter_weight: 5 } }