.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "build/examples_depth/demo_monodepth2.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_depth_demo_monodepth2.py: 01. Predict depth from a single image with pre-trained Monodepth2 models =========================================================================== This is a quick demo of using GluonCV Monodepth2 model for KITTI on real-world images. Please follow the `installation guide <../../index.html#installation>`__ to install MXNet and GluonCV if not yet. .. GENERATED FROM PYTHON SOURCE LINES 8-17 .. code-block:: default import numpy as np import mxnet as mx from mxnet.gluon.data.vision import transforms import gluoncv # using cpu ctx = mx.cpu(0) .. GENERATED FROM PYTHON SOURCE LINES 18-22 Prepare the image ----------------- Let's first download the example image, .. GENERATED FROM PYTHON SOURCE LINES 22-28 .. code-block:: default url = 'https://raw.githubusercontent.com/KuangHaofei/GluonCV_Test/master/monodepthv2/tutorials/test_img.png' filename = 'test_img.png' gluoncv.utils.download(url, filename, True) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none Downloading test_img.png from https://raw.githubusercontent.com/KuangHaofei/GluonCV_Test/master/monodepthv2/tutorials/test_img.png... 0%| | 0/728 [00:00` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: demo_monodepth2.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_