-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problems for convert #53
Comments
I'm also seeing this issue when trying to convert some models and haven't figured out the problem, yet. |
I think in the case of SqueezeNet (where I also got that error), the problem is in the global average pooling layer here: https://gist.github.com/bmount/62089f03e998dc945d9fdb76d8cf82cd#file-squeeze_1-1-prototxt-L652 Does TensorFlow have a generic global pool op? Otherwise, for the converter, the pool kernel dimensions could be set by the output of the previous layer, ie enough to cover the whole input exactly once. |
TensorFlow has a Global Average Pooling layer |
So did anyone succed in converting squeeze net? |
@Arsakes yeah, you can just change the last pooling parameter from global to a fixed kernel with size equal to the width/height of the previous layer (iirc it's 14 or 7). I started to make a patch that computes this but got sidetracked, sounds like tf will support it natively so maybe it will be fairly straightforward per the note from @tmatas . But quick fix is to just make that small adjustment to the Caffe model spec. |
@bmount Yeah, I made exactly the same to convert squeezenet |
This is how I converted the SqueezeNet model: I changed LayerAdapter class in layers.py to be:
Note:
The only thing I needed to change in the caffe model spec for squeezenet was for conv10, the kernel size was set to 1 and pad to 1 as well. I removed the pad from that layer since that's not needed. |
could you post the squeezenet model for tensorflow? |
Trying to convert squeezenet1.1 :
EDIT:
|
@Arsakes Check failed: target_blobs.size() == source_layer.blovs_size() (2 vs. 0) Incompatible number of blobs for layer pool10. Could you share you're deployment prototxt? EDIT: |
@gruenebohne deploy.txt |
Hi @Arsakes, using your deploy.txt, I run this command: I got the following error: |
For anyone still interested in this issue, note the right explicit window size and stride are:
(at least, for working correctly with NVIDIA's TensorRT 1.0.0). |
In response to @shrutisharmavsco great answer, make the following change in def get_strided_kernel_output_shape(node, round_func):
assert node.layer is not None
input_shape = node.get_only_parent().output_shape
node.layer.set_input_shape(input_shape)
o_h, o_w = get_filter_output_shape(input_shape.height, input_shape.width,
node.layer.kernel_parameters, round_func)
params = node.layer.parameters
has_c_o = hasattr(params, 'num_output')
c = params.num_output if has_c_o else input_shape.channels
return TensorShape(input_shape.batch_size, c, o_h, o_w) |
Maybe, there is something wrong in @shrutisharmavsco code.
should be
|
Thanks all.... this worked for me. I've collected the above comments into a PR at #123 |
Hi,
I tried to convert the SqueezeNet weights trained to tensorflow.
But i get some errors:
ValueError: Unable to determine kernel parameter!
How to fix that?
Thank you very much!
The text was updated successfully, but these errors were encountered: