Python TypeError with caffe.io.Transformer instantiation

26 views
Skip to first unread message

Jesse Connell

unread,
Jun 29, 2016, 4:17:59 PM6/29/16
to Caffe Users
I'm following along with the Caffe/Python example from http://nbviewer.jupyter.org/github/BVLC/caffe/blob/master/examples/00-classification.ipynb

Everything runs fine until I get to this line in step 2:


transformer = caffe.io.Transformer({'data': net.blobs['data'].data.shape})

... which throws an Exception:

Traceback (most recent call last):
 
File "caffe_python.py", line 43, in <module>
    transformer
= caffe.io.Transformer({'data': net.blobs['data'].data.shape})
 
File "/ad/eng/opt/64/caffe-rc3/python/caffe/pycaffe.py", line 28, in _Net_blobs
   
return OrderedDict(zip(self._blob_names, self._blobs))
TypeError: No to_python (by-value) converter found for C++ type: boost::shared_ptr<caffe::Blob<float> >

Any ideas?  Looking at earlier threads I see a few different possible problems but nothing definitive.  I thought it was possible something wrong with my Boost.Python install, but I built and tested some examples with no trouble.  The caffe python module itself imports just fine, and other calls in that tutorial work OK; it's not until that specific line that there's a problem.

I'm using:

CentOS 6.8
Caffe rc3
Boost 1.60.0
Anaconda Python 2.7

Thanks for any thoughts!

Jesse Connell

unread,
Jun 29, 2016, 4:25:06 PM6/29/16
to Caffe Users
Actually, maybe one of those old threads has the answer after all.  This said in March that the problem "apparently was fixed recently":

https://groups.google.com/d/topic/caffe-users/8Xcla3_9_Nw/discussion

But rc3 was released in January.  Was this actually a bug still present in rc3, and I should I be building from something newer, like straight from the master branch?

Jesse Connell

unread,
Jun 30, 2016, 4:04:25 PM6/30/16
to Caffe Users
Found it.

https://github.com/BVLC/caffe/pull/3575

The fix was merged into the master branch in March, so I should just rebuild from that if I want it to work with Boost 1.60.  Will try that next.  As a fallback, downgrading Boost looks like it would also do the trick:

https://github.com/BVLC/caffe/issues/3645

Jesse Connell

unread,
Jul 7, 2016, 11:10:24 AM7/7/16
to Caffe Users
Rebuilding from the master branch fixed it.  My Caffe install can now classify a tabby cat in Python :)
Reply all
Reply to author
Forward
0 new messages