Questions on real-time python processing

47 views
Skip to first unread message

Invisible Arts

unread,
Jan 6, 2016, 8:11:02 AM1/6/16
to Caffe Users
I did

net.blobs['input'].data[...] =whatever
net.forward()
out = net.blobs['(last layer)']

and everything seemed to be working fine. But when I repeat that process on the same net the output is always the same with the former one. Is there a way to prevent this, or what's the right way (if I'm not doing things right) to conduct that process?

Aske Rasch Lejbølle

unread,
Jan 8, 2016, 4:56:15 AM1/8/16
to Caffe Users
After running the network you need to copy the output to a new variable. What I do is:

net.blobs['data'].data[...] = whatever

out = net.forward() prob = out['prob'][...].copy() (or whatever layer you want output from)


Hope this helps.

Jan C Peters

unread,
Jan 14, 2016, 8:59:50 AM1/14/16
to Caffe Users
Yes, I too suspect that you are using "out" again without copying the results first. Your last line out = net.blobs['(last layer)'] does not copy anything, it just creates a reference (or "pointer" if you will) called "out" to a blob datastructure. If the blob changes, out also changes, because it points only to the location of the data. Array data is only copied if requested explicitly (with .copy as suggested above) or when slicing the array.

Jan
Reply all
Reply to author
Forward
0 new messages