将Chainer模型转换为ONNX
项目描述
ONNX-Chainer
ONNX-Chainer的所有代码和功能已合并到Chainer v7rc1,此存储库只支持错误修复。
这是一个由Chainer提供的ONNX支持的附加包。
测试环境
请参阅测试环境
安装
pip install onnx-chainer
运行测试
1. 安装测试模块
$ pip install onnx-chainer[test-cpu]
或者在GPU环境下
$ pip install cupy # or cupy-cudaXX is useful
$ pip install onnx-chainer[test-gpu]
2. 运行测试
$ pytest -m "not gpu"
或者在GPU环境下
$ pytest
快速开始
首先,安装ChainerCV以获取预训练模型。
import numpy as np
import chainer
import chainercv.links as C
import onnx_chainer
model = C.VGG16(pretrained_model='imagenet')
# Pseudo input
x = np.zeros((1, 3, 224, 224), dtype=np.float32)
onnx_chainer.export(model, x, filename='vgg16.onnx')
支持的功能
请参阅支持的功能
贡献
欢迎为ONNX-Chainer做出任何贡献!
- Python代码遵循Chainer编码规范
项目详情
关闭
onnx-chainer-1.6.0.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 22036cd5b17ae6bae918468bee32aa739cc4191dc4611a6094b4661504b3bc7a |
|
MD5 | 448a36ee0b612f9898f54ec534cddfe7 |
|
BLAKE2b-256 | 8625dd050fc9b316f9270be63660a3dc951ac688ee3fd56cf65e099db5d9e01d |