How to start simple example in Windows

65 views
Skip to first unread message

Eras Rasmuson

unread,
Feb 2, 2017, 3:03:43 PM2/2/17
to Caffe Users

Hi

I have installed prebuilded Windows version (Visual Studio 2015, CPU only, Python 3.5) from page: https://github.com/BVLC/caffe/tree/windows
I don't find examples how to start to using Caffe with some simple example.

How can i use commands that are in prebuilded zip-packet ?

What command i should start and what parameters ?

Best Regards
Eras R

Filip K

unread,
Feb 2, 2017, 7:33:46 PM2/2/17
to Caffe Users
Hi.
I started straight away with FCNs (https://github.com/shelhamer/fcn.berkeleyvision.org). The only thing you need to do in this case, is look for instance at the "infer.py". This launches testing for VOC8s network ,which perform semantic segmentation. You have to download the model, which is specified in command  caffe.Net (https://github.com/shelhamer/fcn.berkeleyvision.org/blob/master/infer.py) - in the case of this example it is: 'voc-fcn8s/fcn8s-heavy-pascal.caffemodel', and input image of your preference at the top.

Then you can just run: python infer.py and your network should run. In addition, you can add this to the end of the "infer.py" to display the image ( this is the first thing that I have tested):
classes = []

print out.shape

colors
= [[255,0,0], [255,208,191], [204,163,0], [0,140,0], [0,255,204], [0,34,51], [34,0,255], [179,89,173],
                 
[89,67,76], [229,0,0], [242,133,61], [153,150,115], [0,64,0], [191,255,251], [0,116,217], [137,121,242],
                 
[102,51,99], [191,0,51], [217,0,0], [140,98,70], [97,102,26], [61,242,61], [0,83,89], [64,98,128], [34,19,77],
                 
[229,0,122], [191,96,121], [102,14,0], [229,176,115], [238,242,182], [67,89,70], [115,150,153], [0,37,140], [143,0,179], [51,0,27], [191,108,96],
                 
[64,48,16], [195,230,57], [38,153,115], [0,204,255], [182,182,242], [255,64,242], [255,191,225]]
data
= np.zeros( (out.shape[0],out.shape[1],3), dtype=np.uint8 )


for x in range(0,out.shape[0]):
       
for y in range(0,out.shape[1]):
               
if  out[x][y] not in classes:
                        classes
.append(out[x][y])
                data
[x,y] = colors[classes.index(out[x][y])]


print classes

img
= smp.toimage( data )       # Create a PIL image
img
.show()                      # View in default viewer



In addition, you can use caffe.exe, which should be in build/tools/Release and then use command:

caffe.exe MODE(train/test/etc) --solver SOLVER.txt --weights WEIGHTSMODEL
Reply all
Reply to author
Forward
0 new messages