{"action":"created","issue":{"url":"https://api.github.com/repos/fchollet/keras/issues/3266","repository_url":"https://api.github.com/repos/fchollet/keras","labels_url":"https://api.github.com/repos/fchollet/keras/issues/3266/labels{/name}","comments_url":"https://api.github.com/repos/fchollet/keras/issues/3266/comments","events_url":"https://api.github.com/repos/fchollet/keras/issues/3266/events","html_url":"https://github.com/fchollet/keras/pull/3266","id":166516252,"number":3266,"title":"add resnet50 example","user":{"login":"MoyanZitto","id":10725096,"avatar_url":"https://avatars.githubusercontent.com/u/10725096?v=3","gravatar_id":"","url":"https://api.github.com/users/MoyanZitto","html_url":"https://github.com/MoyanZitto","followers_url":"https://api.github.com/users/MoyanZitto/followers","following_url":"https://api.github.com/users/MoyanZitto/following{/other_user}","gists_url":"https://api.github.com/users/MoyanZitto/gists{/gist_id}","starred_url":"https://api.github.com/users/MoyanZitto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MoyanZitto/subscriptions","organizations_url":"https://api.github.com/users/MoyanZitto/orgs","repos_url":"https://api.github.com/users/MoyanZitto/repos","events_url":"https://api.github.com/users/MoyanZitto/events{/privacy}","received_events_url":"https://api.github.com/users/MoyanZitto/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2016-07-20T07:38:40Z","updated_at":"2016-07-22T11:20:27Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/fchollet/keras/pulls/3266","html_url":"https://github.com/fchollet/keras/pull/3266","diff_url":"https://github.com/fchollet/keras/pull/3266.diff","patch_url":"https://github.com/fchollet/keras/pull/3266.patch"},"body":"This is a Keras implmentation of Kaiming He's residual network (50 layers).\r\nThe layers have been properly named so that it would be easy if anyone want to load the pretrained weights converted from Kaiming he's caffemodel file.\r\n"},"comment":{"url":"https://api.github.com/repos/fchollet/keras/issues/comments/234519524","html_url":"https://github.com/fchollet/keras/pull/3266#issuecomment-234519524","issue_url":"https://api.github.com/repos/fchollet/keras/issues/3266","id":234519524,"user":{"login":"MoyanZitto","id":10725096,"avatar_url":"https://avatars.githubusercontent.com/u/10725096?v=3","gravatar_id":"","url":"https://api.github.com/users/MoyanZitto","html_url":"https://github.com/MoyanZitto","followers_url":"https://api.github.com/users/MoyanZitto/followers","following_url":"https://api.github.com/users/MoyanZitto/following{/other_user}","gists_url":"https://api.github.com/users/MoyanZitto/gists{/gist_id}","starred_url":"https://api.github.com/users/MoyanZitto/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MoyanZitto/subscriptions","organizations_url":"https://api.github.com/users/MoyanZitto/orgs","repos_url":"https://api.github.com/users/MoyanZitto/repos","events_url":"https://api.github.com/users/MoyanZitto/events{/privacy}","received_events_url":"https://api.github.com/users/MoyanZitto/received_events","type":"User","site_admin":false},"created_at":"2016-07-22T11:20:26Z","updated_at":"2016-07-22T11:20:26Z","body":"Hi @fchollet , a good news and a bad one.\r\nThe good news is I use model.save_weights() to resave the pretrained weights, now we can just use 'model.load_weights()' to load the weights.\r\n\r\nThe bad news is that I use the code in https://github.com/fchollet/keras/wiki/Converting-convolution-kernels-from-Theano-to-TensorFlow-and-vice-versa , and then use save_weights like this:\r\n```python\r\nfrom keras import backend as K\r\nfrom keras.utils.np_utils import convert_kernel\r\nimport res_net50\r\nimport h5py\r\n\r\nmodel = res_net50.get_resnet50()\r\nmodel.load_weights('tf_resnet50.h5')\r\nfor layer in model.layers:\r\n   if layer.__class__.__name__ in ['Convolution1D', 'Convolution2D']:\r\n      original_w = K.get_value(layer.W)\r\n      converted_w = convert_kernel(original_w)\r\n      K.set_value(layer.W, converted_w)\r\nmodel.save_weights('th_resnet50.h5')\r\n```\r\nThis is the easiest solution I can figure out, but after run this script, switch backend to theano and load 'th_resnet50.h5' we just generated, the test result is still not correct. \\('n02443485 black-footed ferret, ferret, musterla nigrips' for both test images\\)\r\n\r\nPerhaps the difference between th and tf is bigger than we expected. And I think this difference would be the souce of many unexpected bugs.\r\n\r\nI've updated the links. Now you can download the weights from Google drive. \r\n \r\n"}}
{"actor":{"display_login":"MoyanZitto"}}