All Projects → PaddlePaddle → X2paddle

PaddlePaddle / X2paddle

Licence: apache-2.0
Deep learning model converter for PaddlePaddle. (『飞桨』深度学习模型转换工具)

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to X2paddle

Pinto model zoo
A repository that shares tuning results of trained models generated by TensorFlow / Keras. Post-training quantization (Weight Quantization, Integer Quantization, Full Integer Quantization, Float16 Quantization), Quantization-aware training. TensorFlow Lite. OpenVINO. CoreML. TensorFlow.js. TF-TRT. MediaPipe. ONNX. [.tflite,.h5,.pb,saved_model,tfjs,tftrt,mlmodel,.xml/.bin, .onnx]
Stars: ✭ 634 (+101.27%)
Mutual labels:  caffe, onnx
Ncnn
ncnn is a high-performance neural network inference framework optimized for the mobile platform
Stars: ✭ 13,376 (+4146.35%)
Mutual labels:  caffe, onnx
Deepo
Setup and customize deep learning environment in seconds.
Stars: ✭ 6,145 (+1850.79%)
Mutual labels:  caffe, onnx
Centerx
This repo is implemented based on detectron2 and centernet
Stars: ✭ 403 (+27.94%)
Mutual labels:  caffe, onnx
onnx2caffe
pytorch to caffe by onnx
Stars: ✭ 341 (+8.25%)
Mutual labels:  caffe, onnx
Mmdnn
MMdnn is a set of tools to help users inter-operate among different deep learning frameworks. E.g. model conversion and visualization. Convert models between Caffe, Keras, MXNet, Tensorflow, CNTK, PyTorch Onnx and CoreML.
Stars: ✭ 5,472 (+1637.14%)
Mutual labels:  caffe, onnx
Keras Oneclassanomalydetection
[5 FPS - 150 FPS] Learning Deep Features for One-Class Classification (AnomalyDetection). Corresponds RaspberryPi3. Convert to Tensorflow, ONNX, Caffe, PyTorch. Implementation by Python + OpenVINO/Tensorflow Lite.
Stars: ✭ 102 (-67.62%)
Mutual labels:  caffe, onnx
Visualdl
Deep Learning Visualization Toolkit(『飞桨』深度学习可视化工具 )
Stars: ✭ 4,258 (+1251.75%)
Mutual labels:  caffe, onnx
arcface retinaface mxnet2onnx
arcface and retinaface model convert mxnet to onnx.
Stars: ✭ 53 (-83.17%)
Mutual labels:  caffe, onnx
Netron
Visualizer for neural network, deep learning, and machine learning models
Stars: ✭ 17,193 (+5358.1%)
Mutual labels:  caffe, onnx
Php Opencv Examples
Tutorial for computer vision and machine learning in PHP 7/8 by opencv (installation + examples + documentation)
Stars: ✭ 333 (+5.71%)
Mutual labels:  caffe, onnx
ppq
PPL Quantization Tool (PPQ) is a powerful offline neural network quantization tool.
Stars: ✭ 281 (-10.79%)
Mutual labels:  caffe, onnx
Onnx Chainer
Add-on package for ONNX format support in Chainer
Stars: ✭ 83 (-73.65%)
Mutual labels:  caffe, onnx
Php Opencv
php wrapper for opencv
Stars: ✭ 194 (-38.41%)
Mutual labels:  caffe, onnx
yolov5 onnx2caffe
yolov5 onnx caffe
Stars: ✭ 73 (-76.83%)
Mutual labels:  caffe, onnx
Onnx2caffe
pytorch to caffe by onnx
Stars: ✭ 282 (-10.48%)
Mutual labels:  caffe, onnx
Facedetection
C++ project to implement MTCNN, a perfect face detect algorithm, on different DL frameworks. The most popular frameworks: caffe/mxnet/tensorflow, are all suppported now
Stars: ✭ 255 (-19.05%)
Mutual labels:  caffe
Keras Onnx
Convert tf.keras/Keras models to ONNX
Stars: ✭ 278 (-11.75%)
Mutual labels:  onnx
Caffe Android Demo
An android caffe demo app exploiting caffe pre-trained ImageNet model for image classification
Stars: ✭ 254 (-19.37%)
Mutual labels:  caffe
GSOC
Repository for Google Summer of Code 2019 https://summerofcode.withgoogle.com/projects/#4662790671826944
Stars: ✭ 61 (-80.63%)
Mutual labels:  onnx

X2Paddle

License Version
X2Paddle支持将其余深度学习框架训练得到的模型,转换至PaddlePaddle模型。
X2Paddle is a toolkit for converting trained model to PaddlePaddle from other deep learning frameworks.

转换模型库

X2Paddle在多个主流的CV模型上,测试过TensorFlow/Caffe/ONNX/PyTorch模型的转换,可以在X2Paddle-Model-Zoo查看我们的模型测试列表,可以在OP-LIST中查看目前X2Paddle支持的OP列表。如果你在新的模型上进行了测试转换,也欢迎继续补充该列表;如若无法转换,可通过ISSUE反馈给我们,我们会尽快跟进。

环境依赖

python >= 3.5
paddlepaddle 2.0.0-rc1 或者 develop

按需安装以下依赖
tensorflow : tensorflow == 1.14.0
caffe : 无
onnx : onnx >= 1.6.0 pytorch:torch >=1.5.0 (script方式暂不支持1.7.0)

安装

安装方式一(推荐)

git clone https://github.com/PaddlePaddle/X2Paddle.git
cd X2Paddle
git checkout develop
python setup.py install

安装方式二

我们会定期更新pip源上的x2paddle版本

pip install x2paddle==1.0.0rc0 --index https://pypi.Python.org/simple/

使用方法

TensorFlow

x2paddle --framework=tensorflow --model=tf_model.pb --save_dir=pd_model --paddle_type dygraph

Caffe

x2paddle --framework=caffe --prototxt=deploy.prototxt --weight=deploy.caffemodel --save_dir=pd_model --paddle_type dygraph

ONNX

x2paddle --framework=onnx --model=onnx_model.onnx --save_dir=pd_model --paddle_type dygraph

PyTorch

PyTorch不支持命令行使用方式,详见PyTorch2Paddle

Paddle2ONNX

Paddle2ONNX功能已迁移至新的github: https://github.com/PaddlePaddle/paddle2onnx, 欢迎大家去新的代码仓库查看详细介绍以及新功能。

参数选项

参数
--framework 源模型类型 (tensorflow、caffe、onnx)
--prototxt 当framework为caffe时,该参数指定caffe模型的proto文件路径
--weight 当framework为caffe时,该参数指定caffe模型的参数文件路径
--save_dir 指定转换后的模型保存目录路径
--model 当framework为tensorflow/onnx时,该参数指定tensorflow的pb模型文件或onnx模型路径
--caffe_proto [可选] 由caffe.proto编译成caffe_pb2.py文件的存放路径,当存在自定义Layer时使用,默认为None
--define_input_shape [可选] For TensorFlow, 当指定该参数时,强制用户输入每个Placeholder的shape,见文档Q2
--paddle_type [可选] 该参数指定转换为动态图代码(dygraph)或者静态图代码(static),默认为dygraph

使用转换后的模型

  • 静态图: 转换后的模型包括model_with_codeinference_model两个目录。
    model_with_code中保存了模型参数,和转换后的python模型静态图代码。
    inference_model中保存了序列化的模型结构和参数,可直接使用paddle的接口进行加载,见paddle.static.load_inference_model
  • 动态图: 转换后的模型包括model.pdparamsx2paddle_code.py两个文件,以及inference_model一个目录。
    model.pdparams中保存了模型参数。
    x2paddle_code.py是转换后的python模型动态图代码。
    inference_model中保存了序列化的模型结构和参数,可直接使用paddle的接口进行加载,见paddle.static.load_inference_model

小工具

X2Paddle提供了工具解决如下问题,详见tools/README.md

  1. 检测模型是否在PaddleLite中支持
  2. 合并模型参数文件

相关文档

  1. X2Paddle使用过程中常见问题
  2. 如何导出TensorFlow的pb模型
  3. X2Paddle测试模型库
  4. X2Paddle支持的op列表
  5. PyTorch模型导出为ONNX模型
  6. X2Paddle添加内置的Caffe自定义层

更新历史

2020.12.09

  1. 新增PyTorch2Paddle转换方式,转换得到Paddle动态图代码,并动转静获得inference_model。 方式一:trace方式,转换后的代码有模块划分,每个模块的功能与PyTorch相同。 方式二:script方式,转换后的代码按执行顺序逐行出现。
  2. 新增Caffe/ONNX/Tensorflow到Paddle动态图的转换。
  3. 新增TensorFlow op(14个):Neg、Greater、FloorMod、LogicalAdd、Prd、Equal、Conv3D、Ceil、AddN、DivNoNan、Where、MirrorPad、Size、TopKv2
  4. 新增Optimizer模块,主要包括op融合、op消除功能,转换后的代码可读性更强,进行预测时耗时更短。

Acknowledgements

X2Paddle refers to the following projects:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].