alexgkendall / SegNet-Tutorial

Files for a tutorial to train SegNet for road scenes using the CamVid dataset
http://mi.eng.cam.ac.uk/projects/segnet/tutorial.html
851 stars 518 forks source link

Scripts/test_bayesian_segnet.py #23

Closed tsingjinyun closed 8 years ago

tsingjinyun commented 8 years ago

when run test_bayesian_segnet.py follow the tutour,make following error Traceback (most recent call last): File "Scripts/test_bayesian_segnet.py", line 57, in out = net.forward_all(data=input_image) File "/home/caffe/dl/segment/caffe-segnet/python/caffe/pycaffe.py", line 168, in _Net_forward_all outs = self.forward(blobs=blobs, **batch) File "/home/caffe/dl/segment/caffe-segnet/python/caffe/pycaffe.py", line 87, in _Net_forward raise Exception('Input blob arguments do not match net inputs.') Exception: Input blob arguments do not match net inputs.

someone else run the same problem?

alexgkendall commented 8 years ago

What have you set the batch size (sample size) to in your model? Also, just checking you are using the inference model?

tsingjinyun commented 8 years ago

The batch size is the same as your tutour, and run the other sample is ok,but the bayesian segment throw out exception as mentioned. $ ./caffe-segnet/build/tools/caffe train -solver Models/bayesian_segnet_basic_solver.prototxt $ python Scripts/compute_bn_statistics.py Models/bayesian_segnet_basic_train.prototxt Models/Training/bayesian_segnet_basic_iter_10.caffemodel Models/Inference/ $ python Scripts/test_bayesian_segnet.py --model Models/bayesian_segnet_basic_inference.prototxt --weights Models/Inference/test_weights.caffemodel --colours Scripts/camvid11.png --data CamVid/test.txt

and I debug the test_bayesian_segnet.py,and find that print kwargs.keys() ['data'] print net.inputs []

and i debug the webcam_demo.py ,and print kwargs.keys() ['data'] print net.inputs ['data']

so the caffemodel may have the problem. Then i download the SegNet Model Zoo' bayesian_segnet_basic_camvid.caffemodel ,and it also have the same problem. so ,i need to keep fix it,@alexgkendall,thanks for your advice

alexgkendall commented 8 years ago

When using the test_bayesian_segnet.py the script loads the data for you, so you can't use the DenseImageDataLayer. Your model should begin with something like these lines: input: "data" input_dim: 8 # Set this to your sample size input_dim: 3 input_dim: 360 input_dim: 480

As an example: https://github.com/alexgkendall/SegNet-Tutorial/blob/master/Example_Models/bayesian_segnet_basic_camvid.prototxt

The webcam demo doesn't support bayesian segnet at this time.

Cheers, Alex