Question about porting from caffe to Tensorflow
Closed this issue · 2 comments
jakeoung commented
Thank you very much for your excellent work! I just wonder how we can port a caffe model to Tensorflow (because I want to port another caffe model to Tensorflow)
Did you train FlowNet2 from the scratch, or use the original caffe model and port it?
sampepose commented
Hi!
I rewrote the code in TF. You have to be careful since not all ops are the same between caffe and tf. For instance, deconv is slightly different, which is why I manually crop the resulting feature maps.
I am reusing the caffe weights. I did not retrain (but the code is there if you want to!). Take a look at scripts/caffe to see how I did that.
My advice is to write your tf model incrementally and load your transferred weights incrementally. That way you can ensure each layer is providing expected results. I found it helpful to do a sample forward pass in caffe, noting the min/max/std/mean of each layer output. Compare that with tf to ensure your implementation matches. It likely won’t be the exact same due to round off errors but it’ll be close.
…Sent from my iPhone
On Oct 20, 2017, at 4:11 PM, koo ***@***.***> wrote:
Thank you very much for your excellent work! I just wonder how we can port a caffe model to Tensorflow (because I want to port another caffe model to Tensorflow)
Did you train FlowNet2 from the scratch, or use the original caffe model and port it?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
kindloaf commented
Hi @sampepose
You mentioned that for training with Tensorflow "the code is there", and I saw train.py.
Have you used train.py to train a model with similar performance as the original caffe model?