1

My team has spent several months training a Caffe model but now we're looking at converting to Tensorflow and we don't want to spend several months retraining.

How can I convert our caffemodel weight files to TensorFlow weight files?

I've tried caffe-tensorflow but it won't work for Caffe models that have layers with more than one top.

empty
  • 5,194
  • 3
  • 32
  • 58

2 Answers2

1

I am not familiar with , but you can use this python code to "dump" the trained caffe weights to python-readable numpy arrays. I would expect TF to have a functionality to init its weights from numpy arrays - this method might not be automatic or trivial, but you only need to do it once.

Shai
  • 111,146
  • 38
  • 238
  • 371
0

What is the error you get from caffe-tensorflow? If this is just a validation check, you can disable it. You can also try to enforce the tool to load the weights through load_using_pb function. (transformers.py / DataInjector / load function)

rkellerm
  • 5,362
  • 8
  • 58
  • 95
  • Hi @rkellerm , If you're still out there, please reply to this. I highly need your help! – Aditya Nikhil Dec 02 '20 at 08:05
  • @AdityaNikhil - still here, hope I can help (But my focus has changed so not sure that I have the relevant knowledge) – rkellerm Dec 02 '20 at 08:48
  • Am glad that you replied. So am using caffe-tensorflow to convert a pose estimation caffe model to tensorflow pb model. Every layer has been converted succesfully except the final layer(Output layer). It's saying that,** AssertionError: Mconv7_stage6 is not in graph.** – Aditya Nikhil Dec 02 '20 at 14:12
  • @AdityaNikhil I'm not familiar with this error, but if I understood correctly you try to convert CMU's OpenPose -- it has already a working TF version: https://github.com/infocom-tpo/tf-openpose. Didn't dig into the code, but they succeeded to convert the original Caffe weights. Hope that helps. – rkellerm Dec 03 '20 at 10:21
  • Hey @rkellerm, thanks for the link but i need a hand pose model to estimate hand poses. Se there's only one caffe model out there to do this, https://www.kaggle.com/changethetuneman/openpose-model. Please let me know if you can find a tensorflow version of this... – Aditya Nikhil Dec 04 '20 at 11:50