inference_demo.ipynb 2.49 KB
Newer Older
wuyuefeng's avatar
Demo  
wuyuefeng committed
1
2
3
4
{
 "cells": [
  {
   "cell_type": "code",
5
   "execution_count": 25,
wuyuefeng's avatar
Demo  
wuyuefeng committed
6
7
8
9
   "metadata": {
    "pycharm": {
     "is_executing": false
    }
10
   },
ChaimZhu's avatar
ChaimZhu committed
11
   "outputs": [],
wuyuefeng's avatar
Demo  
wuyuefeng committed
12
   "source": [
13
14
    "from mmdet3d.apis import LidarDet3DInferencer"
   ]
wuyuefeng's avatar
Demo  
wuyuefeng committed
15
16
17
  },
  {
   "cell_type": "code",
ChaimZhu's avatar
ChaimZhu committed
18
   "execution_count": null,
19
   "metadata": {},
ChaimZhu's avatar
ChaimZhu committed
20
   "outputs": [],
21
22
23
24
   "source": [
    "# initialize inferencer\n",
    "inferencer = LidarDet3DInferencer('pointpillars_kitti-3class')"
   ]
25
26
27
  },
  {
   "cell_type": "code",
ChaimZhu's avatar
ChaimZhu committed
28
   "execution_count": null,
wuyuefeng's avatar
Demo  
wuyuefeng committed
29
30
31
32
   "metadata": {
    "pycharm": {
     "is_executing": false
    }
33
34
35
36
37
38
39
   },
   "outputs": [],
   "source": [
    "# inference\n",
    "inputs = dict(points='./data/kitti/000008.bin')\n",
    "inferencer(inputs)"
   ]
wuyuefeng's avatar
Demo  
wuyuefeng committed
40
41
42
  },
  {
   "cell_type": "code",
43
44
   "execution_count": null,
   "metadata": {},
45
   "outputs": [],
46
47
48
49
50
   "source": [
    "# inference and visualize\n",
    "# NOTE: use the `Esc` key to exit Open3D window in Jupyter Notebook Environment\n",
    "inferencer(inputs, show=True)"
   ]
51
52
53
  },
  {
   "cell_type": "code",
ChaimZhu's avatar
ChaimZhu committed
54
   "execution_count": null,
55
   "metadata": {},
ChaimZhu's avatar
ChaimZhu committed
56
   "outputs": [],
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
   "source": [
    "# If your operating environment does not have a display device,\n",
    "# (e.g. a remote server), you can save the predictions and visualize\n",
    "# them in local devices.\n",
    "inferencer(inputs, show=False, out_dir='./remote_outputs')\n",
    "\n",
    "# Simulate the migration process\n",
    "%mv ./remote_outputs ./local_outputs\n",
    "\n",
    "# Visualize the predictions from the saved files\n",
    "# NOTE: use the `Esc` key to exit Open3D window in Jupyter Notebook Environment\n",
    "local_inferencer = LidarDet3DInferencer('pointpillars_kitti-3class')\n",
    "inputs = local_inferencer._inputs_to_list(inputs)\n",
    "local_inferencer.visualize_preds_fromfile(inputs, ['local_outputs/preds/000008.json'], show=True)"
   ]
wuyuefeng's avatar
Demo  
wuyuefeng committed
72
73
74
  }
 ],
 "metadata": {
75
76
77
  "interpreter": {
   "hash": "a0c343fece975dd89087e8c2194dd4d3db28d7000f1b32ed9ed9d584dd54dbbe"
  },
wuyuefeng's avatar
Demo  
wuyuefeng committed
78
  "kernelspec": {
79
80
81
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
wuyuefeng's avatar
Demo  
wuyuefeng committed
82
83
84
85
86
87
88
89
90
91
92
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
93
   "version": "3.9.16"
wuyuefeng's avatar
Demo  
wuyuefeng committed
94
95
96
97
98
99
  },
  "pycharm": {
   "stem_cell": {
    "cell_type": "raw",
    "metadata": {
     "collapsed": false
100
101
    },
    "source": []
wuyuefeng's avatar
Demo  
wuyuefeng committed
102
103
104
105
106
107
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}