Caffe: Filter_visualization notebook collapsed?

Created on 10 May 2015  路  4Comments  路  Source: BVLC/caffe

Hi,
in filiter_visualization.ipynb, I got a following error.


OverflowError Traceback (most recent call last)
in ()
----> 1 [(k, v[0].data.shape) for k, v in net.params.items()]

/home/MYNAME/caffe/python/caffe/pycaffe.pyc in _Net_params(self)
37 return OrderedDict([(name, lr.blobs)
38 for name, lr in zip(self._layer_names, self.layers)
---> 39 if len(lr.blobs) > 0])
40
41

OverflowError: long int too large to convert to int

Is this bug?

Most helpful comment

rebuild solves the problem [if not reply again to this thread].
i.e.
make clean;
make;
make pycaffe;

This is also discussed here:
https://groups.google.com/forum/#!topic/caffe-users/PyvaI2LWXRg

All 4 comments

I tried to change pycaffe.py as follow:

@property
def _Net_params(self):
    """
    An OrderedDict (bottom to top, i.e., input to output) of network
    parameters indexed by name; each is a list of multiple blobs (e.g.,
    weights and biases)
    """

    _dict = OrderedDict()
    for name, lr in zip(self._layer_names, self.layers):
        try:
            if len(lr.blobs) > 0:
                _dict[name] = lr.blobs
        except:
            print name, " collapse"
            continue

    return _dict
    # return OrderedDict([(name, lr.blobs)
    #                     for name, lr in zip(self._layer_names, self.layers)
    #                     if len(lr.blobs) > 0
    #                     ])

but I got a Segmentation fault. Do you know why it is?

I tried to use google-protocol-buffer in Python directly, and it is good for my purpse.
I changed the code as follows, then I can get images.

    net = caffe.proto.caffe_pb2.NetParameter()
    net.ParseFromString(open(args.pretrained_model).read())

    for l in net.layers:
        if l.name == args.layer_name:
            _filter = np.array(l.blobs[0].data).reshape((96, 3, 11, 11))

    print _filter.shape
    vis_square(_filter.transpose(0,2,3,1))

rebuild solves the problem [if not reply again to this thread].
i.e.
make clean;
make;
make pycaffe;

This is also discussed here:
https://groups.google.com/forum/#!topic/caffe-users/PyvaI2LWXRg

@rohrbach thanks it worked for me .

Was this page helpful?
0 / 5 - 0 ratings