2
votes

This question has been asked before but with different context. So please dont mark it as duplicate.
I want to feedforward a network step by step. First feedforward upto some layer then get its result change it and then pass it on to the next layer. Here is the code.

forward_kwargs = {'data': blobs['data'].astype(np.float32, copy=False)}
blobs_out = net.forward(end='proposal',**forward_kwargs)
forward_kwargs = {'proposal': blobs_out}
blobs_out = net.forward(start='roi_pool_conv5',**forward_kwargs)

When it run this code, it gives error

Exception: Input blob arguments do not match net inputs.

this error comes from the file pycaffe.py. The line in this file giving error is

 if set(kwargs.keys()) != set(self.inputs):
            raise Exception('Input blob arguments do not match net inputs.')

Because in prototxt file i have mentioned only two inputs data and im_info. But i want to input my network again from roi_pool_conv5 layer and when i send this argument as start layer to network it checks whether this blob is in the inputs or not. Clearly it is not in the inputs. I cannot mention this in input because i am unsure of dimension. Any workaround for this?

1

1 Answers

0
votes

I think your problem is you don't know dimensions of proposal.
If so, you just fill dummy dimensions in prototxt file and reshape it before you forward.
After running your program, batch size is gonna fixed, right?
Then you can reshape your roi_pool_conv5 layer and your network!
I hope this answer is helpful to you :)