{"id":13717027,"url":"https://github.com/longcw/pytorch2caffe","last_synced_at":"2025-04-05T15:08:40.076Z","repository":{"id":88264897,"uuid":"101606360","full_name":"longcw/pytorch2caffe","owner":"longcw","description":"Convert PyTorch model to Caffemodel","archived":false,"fork":false,"pushed_at":"2019-05-28T02:29:19.000Z","size":1682,"stargazers_count":541,"open_issues_count":25,"forks_count":151,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-03-29T14:11:21.761Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/longcw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-08-28T05:17:06.000Z","updated_at":"2024-08-24T12:45:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"7e79372a-bfdb-419c-8540-a998730bff78","html_url":"https://github.com/longcw/pytorch2caffe","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/longcw%2Fpytorch2caffe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/longcw%2Fpytorch2caffe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/longcw%2Fpytorch2caffe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/longcw%2Fpytorch2caffe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/longcw","download_url":"https://codeload.github.com/longcw/pytorch2caffe/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247353746,"owners_count":20925329,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T00:01:17.034Z","updated_at":"2025-04-05T15:08:40.034Z","avatar_url":"https://github.com/longcw.png","language":"Python","readme":"## PyTorch2Caffe\n\n**Require Pytorch \u003c 0.4**\n\nPorted from [pytorch-caffe-darknet-convert](https://github.com/marvis/pytorch-caffe-darknet-convert). \n\nAdd support for \n+ Dilated Convolution Layer\n+ Concat Layer\n+ Upsampling (converted to Deconvolution with bilinear initialization)\n+ Eltwise Product\n+ Sigmoid Layer\n\n```python\n# We can obtain almost the same output from caffe except Upsampling\n# for inception_v3: \n# diff between pytorch and caffe: min: 0.0, max: 1.76429748535e-05, mean: 2.14079022953e-06\n# see more in demo.py\n\nimport torch\nfrom torch.autograd import Variable\nimport torchvision\n\nimport os\nfrom pytorch2caffe import pytorch2caffe, plot_graph\n\nm = torchvision.models.inception_v3(pretrained=True, transform_input=False)\nm.eval()\nprint(m)\n\ninput_var = Variable(torch.rand(1, 3, 299, 299))\noutput_var = m(input_var)\n\noutput_dir = 'demo'\n# plot graph to png\nplot_graph(output_var, os.path.join(output_dir, 'inception_v3.dot'))\n\npytorch2caffe(input_var, output_var, \n              os.path.join(output_dir, 'inception_v3-pytorch2caffe.prototxt'),\n              os.path.join(output_dir, 'inception_v3-pytorch2caffe.caffemodel'))\n\n```\n\n","funding_links":[],"categories":["Pytorch \u0026 related libraries｜Pytorch \u0026 相关库","Pytorch \u0026 related libraries"],"sub_categories":["Other libraries｜其他库:","Other libraries:"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flongcw%2Fpytorch2caffe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flongcw%2Fpytorch2caffe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flongcw%2Fpytorch2caffe/lists"}