keras-resnet icon indicating copy to clipboard operation
keras-resnet copied to clipboard

Incorporate into keras models repository

Open ahundt opened this issue 7 years ago • 12 comments

Would you be interested to get this into the keras models repository? https://github.com/fchollet/deep-learning-models

I might be able to help with modifying the class to match the others appropriately.

ahundt avatar Dec 15 '16 21:12 ahundt

Doesn't that require pre-trained weights? I can work on porting over resnet50 weights. Not sure about others. Do you know if Kaiming He has pretrained weights for all resnet configurations? If yes, we could try and port those over.

raghakot avatar Dec 15 '16 22:12 raghakot

there are a bunch of pretrained weights floating around. I'm sure just one set of weights would be enough for them to accept the request for the first version. I mean, your functions let you generate arbitrary sized resnets so one certainly wouldn't be expected to make them all. :-)

ahundt avatar Dec 16 '16 17:12 ahundt

Ok. I'll give it a shot. Do you know of any projects for converting caffe models? I see a bunch of them floating around. Not sure which one to use.

raghakot avatar Dec 16 '16 19:12 raghakot

~~What may be the easiest option is to simply~~ convert the ones from the tensorflow slim models repository. They have a resnet implementation and links to their pre-trained models which they already converted into tensorflow.... nvm that is resnet v1, they don't have resnet v2 up...

pretrained resnet v2 (w/pre activations) weights in torch t7 format Well here are the resnet v2 models torch weights that are trained by a grad student under the supervision of the original author (as you may know he moved from microsoft research to facebook): https://github.com/facebook/fb.resnet.torch/tree/master/pretrained

Actually, it looks pretty simple to move the weights from tensorflow to h5f, and it seems https://github.com/Moodstocks/inception-v3.torch/blob/master/dump_filters.py

Those are in torch format, and I'd bet the deepmind implementation of conversion is very likely to work: https://github.com/deepmind/torch-hdf5

From there I believe keras can load hdf5 by name.

ahundt avatar Dec 16 '16 23:12 ahundt

Cool. I will try to get to this in after december. In the mean time, if any of you guys have time, feel free to take a stab at this. It would be cool to convert all the torch models.

raghakot avatar Dec 17 '16 01:12 raghakot

looks like based on the description some of the weights were already transferred in here: https://github.com/fchollet/deep-learning-models so it might be worth asking if there is code that was used to do the conversion that could be reused

ahundt avatar Dec 18 '16 23:12 ahundt

I have an old script which can convert t7 file to keras model, maybe I can try to get it work again. The problem is there's no easy way to map between the layers created from touchfile and an existing keras model, so some adhoc logic is needed so that we can know which weight is for which layer in the existing model.

Also if I remember correctly I had a hard time reproducing the image preprocessing logic from touch.

jrao1 avatar Dec 21 '16 11:12 jrao1

I believe the most appropriate place for this now might be keras-contrib: https://github.com/farizrahman4u/keras-contrib

ahundt avatar Mar 11 '17 20:03 ahundt

I've taken first steps towards this at https://github.com/farizrahman4u/keras-contrib/pull/148

ahundt avatar Sep 10 '17 19:09 ahundt

Thanks, @ahundt. I have been super busy at work lately.

raghakot avatar Sep 11 '17 19:09 raghakot

@ahundt Did you ever find the pretrained weights for some of the architectures you have for keras-contrib?

CMCDragonkai avatar Sep 12 '18 07:09 CMCDragonkai

no, I haven't been using ResNets directly recently

ahundt avatar Oct 08 '18 18:10 ahundt