facebookarchive / caffe2

Caffe2 is a lightweight, modular, and scalable deep learning framework.
https://caffe2.ai
Apache License 2.0
8.42k stars 1.95k forks source link

How to resize the input blob and how to define a new output layer with a pretrained Network? #1787

Open MarviB16 opened 6 years ago

MarviB16 commented 6 years ago

Hi,

i am using this https://github.com/leonardvandriel/caffe2_models pretrained ResNet-Model and i am trying to get it to work with bigger pictures (FullHD), but i couldn't find anyway to resize the input blob like i did in caffe(1): net.blobs['data'].reshape(1,3,width,height)

I already tried #614 and #956 but i couldn't get it to work. I am using the newest version of caffe2 and python (2.7.12). The next thing is i would like to cut the network before the fully connected layers, in caffe i would just remove the layers in the .prototxt, but here i don't know how to do it.

Thanks

sf-wind commented 6 years ago

Is this what you want? https://caffe2.ai/docs/operators-catalogue.html#imageinput

To modify the net, I suppose you can load it to memory and then manipulate it in python.

MarviB16 commented 6 years ago
  1. No i don‘t want to resize he picture, i want to edit the input blob to accept the new picture size. (Not sure if i need that, because it now accepts every picture without an error it just crashes when it reaches the Fully conected layers)
  2. But how would i do that? I am using the workspace class by the way. Still thanks for your answer!
MarviB16 commented 6 years ago

Okay i made it by converting it myself (from the caffe model zoo and removing the non convolutional end). But now it get this error: RuntimeError: [enforce fail at conv_op_cudnn.cc:301] filter.ndim() >= filter.ndim() <=. Error from operator: input: „data“ input: „conv_w“ output: „conv“ type: „Conv“ any idea what went wrong? I tried to convert it twice, but the second one had the same error.

hoL1day commented 6 years ago

@MarviB16 Hi, I'm working on removing layers, can you please tell me how to do thai? Thanks a lot!

Anubhav7 commented 6 years ago

related issue: after changing the input dimensions the model is failing at fc layers How do we remove the fc layers or change dimensions of fc layers?