SegNet-Tutorial icon indicating copy to clipboard operation
SegNet-Tutorial copied to clipboard

What arguments are required for webdemo.py

Open Maxfashko opened this issue 9 years ago • 3 comments

Hi, how to start webdemo.py ? I'm trying to run webdemo.py follows: python 'webcam_demo.py' --model SegNet-Tutorial/Models/segnet_inference.prototxt --weights SegNet-Tutorial/Models/Inference/test_weights.caffemodel --colours SegNet-Tutorial/Scripts/test/0_image.png I get the following error: File "webcam_demo.py", line 32, in <module> output_shape = net.blobs['argmax'].data.shape KeyError: 'argmax' What image should be submitted to the argument --colours ?

Maxfashko avatar Jul 31 '16 12:07 Maxfashko

Hi,

I think your --colours arg is correct, it is a png image containing colored pixel of each class of the dataset.

However yout error suggest that you are not using the right inference model. You shold look at the end of this file segnet_inference.prototxt and you should see that the final layer is named prob.

Therefore you have to change the webcam_demo script like that :

output_shape = net.blobs['prob'].data.shape

You will also have to change it again further in the code and be carefull, the output of the network will be the probabily of each class and not the class. You can easily find it with np.argmax(prob,axis=0)

Hope that will help

Simon-Prevoteaux avatar Aug 15 '16 20:08 Simon-Prevoteaux

@Simon-Prevoteaux how do I know which --colour arg is correct for my model?

energabos avatar May 30 '17 13:05 energabos

Hi, I have to admit I haven't worked on Segnet for a long time, however if i remember well, you --colours arg should point to an image containing vertically aligned pixels. Each pixel colour will be used for one class. So for example, the first pixel will be for class 1, the second pixel for class 2 etc... For debug, you can use the images in the /script folder and load it with opencv, and try to reproduce it to fit your own model.

Simon-Prevoteaux avatar May 30 '17 13:05 Simon-Prevoteaux