.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "build/examples_deployment/export_network.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_build_examples_deployment_export_network.py: 1. Export trained GluonCV network to JSON ============================================ It is awesome if you are enjoy using GluonCV in Python for training and testing. At some point, you might ask: "Is it possible to deploy the existing models to somewhere out of Python environments?" The answer is "Absolutely!", and it's super easy actually. This article will show you how to export networks/models to be used somewhere other than Python. .. GENERATED FROM PYTHON SOURCE LINES 12-15 .. code-block:: default import gluoncv as gcv from gluoncv.utils import export_block .. GENERATED FROM PYTHON SOURCE LINES 16-17 First of all, we need a network to play with, a pre-trained one is perfect .. GENERATED FROM PYTHON SOURCE LINES 17-21 .. code-block:: default net = gcv.model_zoo.get_model('resnet18_v1', pretrained=True) export_block('resnet18_v1', net, preprocess=True, layout='HWC') print('Done.') .. rst-class:: sphx-glr-script-out Out: .. code-block:: none Downloading /root/.mxnet/models/resnet18_v1-a0666292.zip from https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/models/resnet18_v1-a0666292.zip... 0%| | 0/42434 [00:00` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: export_network.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_