{"action":"created","issue":{"url":"https://api.github.com/repos/ry/tensorflow-resnet/issues/43","repository_url":"https://api.github.com/repos/ry/tensorflow-resnet","labels_url":"https://api.github.com/repos/ry/tensorflow-resnet/issues/43/labels{/name}","comments_url":"https://api.github.com/repos/ry/tensorflow-resnet/issues/43/comments","events_url":"https://api.github.com/repos/ry/tensorflow-resnet/issues/43/events","html_url":"https://github.com/ry/tensorflow-resnet/issues/43","id":293562449,"number":43,"title":"is there anyone have successfully load the pretrained model in code?","user":{"login":"Yiman-GO","id":32350242,"avatar_url":"https://avatars2.githubusercontent.com/u/32350242?v=4","gravatar_id":"","url":"https://api.github.com/users/Yiman-GO","html_url":"https://github.com/Yiman-GO","followers_url":"https://api.github.com/users/Yiman-GO/followers","following_url":"https://api.github.com/users/Yiman-GO/following{/other_user}","gists_url":"https://api.github.com/users/Yiman-GO/gists{/gist_id}","starred_url":"https://api.github.com/users/Yiman-GO/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Yiman-GO/subscriptions","organizations_url":"https://api.github.com/users/Yiman-GO/orgs","repos_url":"https://api.github.com/users/Yiman-GO/repos","events_url":"https://api.github.com/users/Yiman-GO/events{/privacy}","received_events_url":"https://api.github.com/users/Yiman-GO/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-02-01T15:02:35Z","updated_at":"2018-03-25T08:54:42Z","closed_at":null,"author_association":"NONE","body":"is there anyone have successfully load the pretrained model in code?\r\nI have no idea about it. \r\nI have tried :\r\nsaver1 = tf.train.import_meta_graph(pretrained_meta)\r\nsaver1.restore(sess, pretrained_ckpt)\r\nbut it tells me that \"At least two variables have the same name\"\r\nif you have loaded successfully, please tell me your method. I will appreciate it."},"comment":{"url":"https://api.github.com/repos/ry/tensorflow-resnet/issues/comments/375955147","html_url":"https://github.com/ry/tensorflow-resnet/issues/43#issuecomment-375955147","issue_url":"https://api.github.com/repos/ry/tensorflow-resnet/issues/43","id":375955147,"user":{"login":"cardwing","id":23656119,"avatar_url":"https://avatars1.githubusercontent.com/u/23656119?v=4","gravatar_id":"","url":"https://api.github.com/users/cardwing","html_url":"https://github.com/cardwing","followers_url":"https://api.github.com/users/cardwing/followers","following_url":"https://api.github.com/users/cardwing/following{/other_user}","gists_url":"https://api.github.com/users/cardwing/gists{/gist_id}","starred_url":"https://api.github.com/users/cardwing/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cardwing/subscriptions","organizations_url":"https://api.github.com/users/cardwing/orgs","repos_url":"https://api.github.com/users/cardwing/repos","events_url":"https://api.github.com/users/cardwing/events{/privacy}","received_events_url":"https://api.github.com/users/cardwing/received_events","type":"User","site_admin":false},"created_at":"2018-03-25T08:54:42Z","updated_at":"2018-03-25T08:54:42Z","author_association":"NONE","body":"The following code works for me where I load the weight of 2D ResNet-50 model into 3D ResNet-50 model: \r\nwith tf.Session() as sess:\r\n    # build 3D ResNet-50\r\n    saver = tf.train.import_meta_graph('/DATA/houyn/pre-trained-models/models/ResNet-L50.meta')\r\n    saver.restore(sess, '/DATA/houyn/pre-trained-models/models/ResNet-L50.ckpt')\r\n    var_list = saver._var_list\r\n    value=[]\r\n    for i in range(265):\r\n        tmp = sess.run(var_list[i], feed_dict={})\r\n        if tmp.shape[0] < 10:\r\n            tmp = [tmp / 1.0 / tmp.shape[0] for _ in range(tmp.shape[0])]\r\n            tmp = np.stack(tmp, axis=0)\r\n        value.append(tmp)\r\nYou can use PyCharm to view the variable values and its names in the debug mode."}}
{"actor":{"display_login":"cardwing"}}