{
  "id": 22043,
  "title": "help in converting pretrained models to different format",
  "url": "/competitions/state-farm-distracted-driver-detection/discussion/22043",
  "author_name": "",
  "post_date": "2016-07-05T01:00:07.153Z",
  "votes": 1,
  "comment_count": 1,
  "views": 1617,
  "content": "<p>Hi, I am using native c/c++ code warped around cudnn. I dump caffe  model files into binary files to be read by my code (using fwrite(float *weights, size_t size, ...). But for other format (like tensorflow, torch, etc) i cannot use their models. It would quite a hassle for me to setup these framework. If anyone can provide binary dump of the following models, it would be useful for me. In exchange, i can give you the binary dump of my models too.</p>\n\n<p>Alternatively, some scripts (e.g. python, matlab, c) and instruction to dump the models is also fine for me. binary dump of the weights is good enough for me as i am familiar with the network structure which i can setup in the c/c++ code later.</p>\n\n<ul>\n<li>looking for : inceptionv3 (tensorflow,torch,lasagne), resNet18/34/152/200 (torch), inception-BN(aka inception v2) (mnxet)</li>\n<li>i current have the binary dump of: googlenet-v1, resnet50/100,vgg16/19, googlenet-CAM,vgg16-CAM</li>\n</ul>\n\n<p>I will also post my c/c++ code for dumping caffe model here.</p>",
  "messages": [
    {
      "id": "125956",
      "postDate": "07/05/2016 01:00:07",
      "content": "<p>Hi, I am using native c/c++ code warped around cudnn. I dump caffe  model files into binary files to be read by my code (using fwrite(float *weights, size_t size, ...). But for other format (like tensorflow, torch, etc) i cannot use their models. It would quite a hassle for me to setup these framework. If anyone can provide binary dump of the following models, it would be useful for me. In exchange, i can give you the binary dump of my models too.</p>\n\n<p>Alternatively, some scripts (e.g. python, matlab, c) and instruction to dump the models is also fine for me. binary dump of the weights is good enough for me as i am familiar with the network structure which i can setup in the c/c++ code later.</p>\n\n<ul>\n<li>looking for : inceptionv3 (tensorflow,torch,lasagne), resNet18/34/152/200 (torch), inception-BN(aka inception v2) (mnxet)</li>\n<li>i current have the binary dump of: googlenet-v1, resnet50/100,vgg16/19, googlenet-CAM,vgg16-CAM</li>\n</ul>\n\n<p>I will also post my c/c++ code for dumping caffe model here.</p>",
      "rawMarkdown": "Hi, I am using native c/c++ code warped around cudnn. I dump caffe  model files into binary files to be read by my code (using fwrite(float *weights, size_t size, ...). But for other format (like tensorflow, torch, etc) i cannot use their models. It would quite a hassle for me to setup these framework. If anyone can provide binary dump of the following models, it would be useful for me. In exchange, i can give you the binary dump of my models too.\r\n\r\nAlternatively, some scripts (e.g. python, matlab, c) and instruction to dump the models is also fine for me. binary dump of the weights is good enough for me as i am familiar with the network structure which i can setup in the c/c++ code later.\r\n\r\n - looking for : inceptionv3 (tensorflow,torch,lasagne), resNet18/34/152/200 (torch), inception-BN(aka inception v2) (mnxet)\r\n - i current have the binary dump of: googlenet-v1, resnet50/100,vgg16/19, googlenet-CAM,vgg16-CAM\r\n\r\nI will also post my c/c++ code for dumping caffe model here.",
      "votes": null
    },
    {
      "id": "125959",
      "postDate": "07/05/2016 01:30:19",
      "content": "<p>Hi, Heng CherKeng</p>\n\n<p>Dumping caffe model by using its python interface is quite straight forward. </p>\n\n<p>For example, below code is to get weights and bais from net. They are stored in numpy array and can be saved by using np.savez() function.</p>\n\n<pre><code>    #weights\n    weights = net.params['fc6'][0].data\n    #bias\n    bais    = net.params['fc6'][1].data\n</code></pre>\n\n<p>You can take a look at my github which try to compress caffe model and find the full source code as your reference.\n<a href=\"https://github.com/yuanyuanli85/CaffeModelCompression\">https://github.com/yuanyuanli85/CaffeModelCompression</a></p>",
      "rawMarkdown": "Hi, Heng CherKeng\r\n\r\nDumping caffe model by using its python interface is quite straight forward. \r\n\r\nFor example, below code is to get weights and bais from net. They are stored in numpy array and can be saved by using np.savez() function.\r\n\r\n\t\t#weights\r\n\t\tweights = net.params['fc6'][0].data\r\n\t\t#bias\r\n\t\tbais    = net.params['fc6'][1].data\r\n\r\nYou can take a look at my github which try to compress caffe model and find the full source code as your reference.\r\nhttps://github.com/yuanyuanli85/CaffeModelCompression",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 125959,
      "author_name": "victorli",
      "author_url": "",
      "post_date": "07/05/2016 01:30:19",
      "content": "<p>Hi, Heng CherKeng</p>\n\n<p>Dumping caffe model by using its python interface is quite straight forward. </p>\n\n<p>For example, below code is to get weights and bais from net. They are stored in numpy array and can be saved by using np.savez() function.</p>\n\n<pre><code>    #weights\n    weights = net.params['fc6'][0].data\n    #bias\n    bais    = net.params['fc6'][1].data\n</code></pre>\n\n<p>You can take a look at my github which try to compress caffe model and find the full source code as your reference.\n<a href=\"https://github.com/yuanyuanli85/CaffeModelCompression\">https://github.com/yuanyuanli85/CaffeModelCompression</a></p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "125956": "Hi, I am using native c/c++ code warped around cudnn. I dump caffe  model files into binary files to be read by my code (using fwrite(float *weights, size_t size, ...). But for other format (like tensorflow, torch, etc) i cannot use their models. It would quite a hassle for me to setup these framework. If anyone can provide binary dump of the following models, it would be useful for me. In exchange, i can give you the binary dump of my models too.\r\n\r\nAlternatively, some scripts (e.g. python, matlab, c) and instruction to dump the models is also fine for me. binary dump of the weights is good enough for me as i am familiar with the network structure which i can setup in the c/c++ code later.\r\n\r\n - looking for : inceptionv3 (tensorflow,torch,lasagne), resNet18/34/152/200 (torch), inception-BN(aka inception v2) (mnxet)\r\n - i current have the binary dump of: googlenet-v1, resnet50/100,vgg16/19, googlenet-CAM,vgg16-CAM\r\n\r\nI will also post my c/c++ code for dumping caffe model here.",
    "125959": "Hi, Heng CherKeng\r\n\r\nDumping caffe model by using its python interface is quite straight forward. \r\n\r\nFor example, below code is to get weights and bais from net. They are stored in numpy array and can be saved by using np.savez() function.\r\n\r\n\t\t#weights\r\n\t\tweights = net.params['fc6'][0].data\r\n\t\t#bias\r\n\t\tbais    = net.params['fc6'][1].data\r\n\r\nYou can take a look at my github which try to compress caffe model and find the full source code as your reference.\r\nhttps://github.com/yuanyuanli85/CaffeModelCompression"
  },
  "source": "meta"
}