Anyone have success porting from caffe to tensorflow?

I’m interested in using the places365 dataset ( for a hackathon project involving transfer learning and image similarity as it’s a good fit for my problem space, and they have pretrained weights available for most of the major models but they provide them in caffe which I’ve never used and don’t have time to learn in the context of the hackathon.

I tried using which is supposed to map from one to the other but wasn’t able to get it working on the vgg16 model.

Has anyone had any luck with this? I’ve googled around for solutions to my issue but nothing seems to solve the problem. I honestly only need the weights for vgg pretrained on places365 but I’m likely going to have to just go with imagenet weights and hope it works okay.

Thanks in advance.

Yes, I had successfully converted them (both vgg16_hybrid1365 and vgg16_places365) into tf format using caffe-tensorflow. But I did not completely follow steps from “”. You can try steps listed here

Thanks for the reference. That’s super relevant.

Was that on windows Anaconda? I’m running into an issue with docker parsing the command

docker run -v $(pwd):/workspace -ti docker build -q .

I’d love to get a keras compatible version of the places365 weights, ideally in .h5. I’m hoping that they can add it to keras eventually as one of the weights options.

I test it in Ubuntu. I’m not sure windows can work or not.
BTW, the conversion results are .npy for weights and .py for network structure. It needs further conversion to h5 format. Here is my conversion output.

1 Like

Thanks so much for sharing and for helping me out with this. Are there any special arguements for loading these? I tried:

data = np.load(‘vgg16_places365.npy’)

And it give me a

UnicodeDecodeError: ‘ascii’ codec can’t decode byte error

suggested that I set the encoding to something else. Seems like it’s a common issue porting from python 2 to 3, but the suggested fix doesn’t seem to work. If I can’t figure it out it looks like I’m going to have to train the model myself, which isn’t a bad thing.

You should try it as :
weights_data = np.load(’./vgg16_places365.npy’, encoding=‘latin1’).item()

Haha. This is now available as a CoreML model. Apple did the conversion for you, so if you’re up for updating your phone to iOS11 beta, getting Xcode 9 beta you could use the CoreML model for this.