Closed DanielsJusts closed 5 years ago
In the error log i just read something from "flatten". But in your model file I coud not find any flatten layer.. Did you removed it?
We run into some truble with this type of layer during a conversion from tensorflow to caffe and finaly to chaidnn. In our case it tourned out, that we do not need any flatten layer at all in caffe...
Another thing I remember, that we had some truble with the last layer. In our case
layer { name: "linear22" type: "ReLU" bottom: "conv22" top: "conv22" relu_param { negative_slope: 1 } }
While experimenting we manual edit according to the VGG protex file from the ModelZoo (https://github.com/Xilinx/CHaiDNN/blob/master/docs/MODELZOO.md) to
layer { name: "linear22" type: "ReLU" bottom: "conv22" top: "linear22" relu_param { negative_slope: 1 } }
Thats just the things I remenber we did while experimenting with the tools. I do not have any deeper infomation about the XportDNN tool, therefore I do not know if this is something which could fix your problem as well.
Hello, @bennihoffmann! Thank you for your reply.
I do not have a "flatten" layer anywhere in the network, although I do have a "reshape" layer, but the error occurs before it reaches the "reshape" layer.
Thank you for sharing your experience about the problem you had with the last layer. Will keep this in mind in further work.
Kind of an off-topic question - I am working on TF to Caffe model conversion as well, this model is actually converted as well. How did you go about converting the model?
I think the problem here is that your input file to the XportDNN, it accepts in the format given in the quantization guide which is {} format rather then [ ] format. You can try using the solution which i used for it .https://github.com/Xilinx/CHaiDNN/issues/90#issuecomment-433443329 let me know if that worked
Hello, @adu81020799! Thank you for your reply.
If I understood you correctly, then you think that I should change from this syntax:
layer {
name: "conv1"
type: "Convolution"
bottom: "data"
top: "conv1"
convolution_param {
num_output: 32
kernel_size: 3
pad: 1
bias_term: true
}
}
to this:
layer [
name: "conv1"
type: "Convolution"
bottom: "data"
top: "conv1"
convolution_param [
num_output: 32
kernel_size: 3
pad: 1
bias_term: true
]
]
Did I understand you correctly? This doesn't work, XportDNN tool throws an error:
Traceback (most recent call last):
File "XportDNN.py", line 400, in <module>
File "XportDNN.py", line 355, in main
File "/home/edi/Workspaces/SDx/CHaiDNN_repo/tools/chaidnn_tools_ENV/local/lib/python2.7/site-packages/google/protobuf/text_format.py", line 536, in Merge
descriptor_pool=descriptor_pool)
File "/home/edi/Workspaces/SDx/CHaiDNN_repo/tools/chaidnn_tools_ENV/local/lib/python2.7/site-packages/google/protobuf/text_format.py", line 590, in MergeLines
return parser.MergeLines(lines, message)
File "/home/edi/Workspaces/SDx/CHaiDNN_repo/tools/chaidnn_tools_ENV/local/lib/python2.7/site-packages/google/protobuf/text_format.py", line 623, in MergeLines
self._ParseOrMerge(lines, message)
File "/home/edi/Workspaces/SDx/CHaiDNN_repo/tools/chaidnn_tools_ENV/local/lib/python2.7/site-packages/google/protobuf/text_format.py", line 638, in _ParseOrMerge
self._MergeField(tokenizer, message)
File "/home/edi/Workspaces/SDx/CHaiDNN_repo/tools/chaidnn_tools_ENV/local/lib/python2.7/site-packages/google/protobuf/text_format.py", line 757, in _MergeField
merger(tokenizer, message, field)
File "/home/edi/Workspaces/SDx/CHaiDNN_repo/tools/chaidnn_tools_ENV/local/lib/python2.7/site-packages/google/protobuf/text_format.py", line 805, in _MergeMessageField
tokenizer.Consume('{')
File "/home/edi/Workspaces/SDx/CHaiDNN_repo/tools/chaidnn_tools_ENV/local/lib/python2.7/site-packages/google/protobuf/text_format.py", line 1101, in Consume
raise self.ParseError('Expected "%s".' % token)
google.protobuf.text_format.ParseError: 3:2 : Expected "{".
Also, I cannot import the model with this syntax in PyCaffe as well.
You can try using the solution which i used for it .#90 (comment)
It seems that you had to convert a Darknet model to Caffe, but I have a TensorFlow checkpoint file, which I converted to Caffe, so I cannot use the method you used (to my knowledge).
Hello, i think its other way round quoting from the Chai DNN repo:
XportDNN expects the input/ data to be defined as a layer.
layer {
name: "data"
type: "Input"
top: "data"
input_param {
shape { #As required
dim: 1
dim: 3
dim: 224
dim: 224
}
}
}
I remember that my darknet model file was in the [] format, and I was getting the similar error. But When I converted into {} syntax then it the tool worked for me. I might be wrong (as I am a newbie to the Deep learning field).
Regards
Adarsh
@adu81020799, I think you are talking about neural network model descriptions in different frameworks. Is this the "[]" format you were talking about (for example):
[convolutional]
batch_normalize=1
filters=32
size=3
stride=1
pad=1
activation=leaky
[maxpool]
size=2
stride=2
This is an example of my networks first layer in Darknet model format. XportDNN tool expects models in format, which is used in Caffe (the one you showed or in "{}" format as you call it). I hope this clarifies this for you :)
Ya. Chai Expects it in the caffe model. But If you would give Chai with the darknet model it would throw errors.
@adu81020799 and I have the model in the Caffe format and XportDNN tool is having issues with my model.
Hi @DanielsJusts,
The model you are using seems to have batch norm and scale layers. Currently, XportDNN does not support batchnorm and scale layers individually. You can fuse batchnorm and scale layers to convolution and create protoxt and caffe model. Then, run XportDNN with fused prototxt and fused caffemodel. CHaiDNN does not have support for ReLU with negative slope (Leaky ReLU). You could retrain your model with regular relu and try use it on CHaiDNN.
Hello!
I'm having trouble using XportDNN tool when using "Xilinx" quantization method. I also posted on Xilinx Forums, but I had no response there, so I thought I might try to get help here.
Here is a link to my Google Drive folder, where you can access the .prototxt and .caffemodel files of my model, if anyone needs them.
The Python script throws an error:
I have no clue as to where to look for the issue. Only "weird" thing I noticed is that the threshold values for the layer tend to grow bigger from layer to layer, so that lead me to believe that the issue might come from there, but I don't know how to debug that. An example:
And right before the error:
Does anyone have any ideas as to what to do now and how to diagnose this issue? Thanks in advance!