inference_demo.ipynb 2.04 KB
Newer Older
wuyuefeng's avatar
Demo  
wuyuefeng committed
1
2
3
4
5
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 7,
6
7
8
9
   "source": [
    "from mmdet3d.apis import init_model, inference_detector, show_result_meshlab"
   ],
   "outputs": [],
wuyuefeng's avatar
Demo  
wuyuefeng committed
10
11
12
13
   "metadata": {
    "pycharm": {
     "is_executing": false
    }
14
   }
wuyuefeng's avatar
Demo  
wuyuefeng committed
15
16
17
18
19
20
21
22
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "source": [
    "config_file = '../configs/second/hv_second_secfpn_6x8_80e_kitti-3d-car.py'\n",
    "# download the checkpoint from model zoo and put it in `checkpoints/`\n",
    "checkpoint_file = '../work_dirs/second/epoch_40.pth'"
23
24
25
26
27
28
29
   ],
   "outputs": [],
   "metadata": {
    "pycharm": {
     "is_executing": false
    }
   }
wuyuefeng's avatar
Demo  
wuyuefeng committed
30
31
32
33
  },
  {
   "cell_type": "code",
   "execution_count": 9,
34
35
36
37
38
   "source": [
    "# build the model from a config file and a checkpoint file\n",
    "model = init_model(config_file, checkpoint_file, device='cuda:0')"
   ],
   "outputs": [],
wuyuefeng's avatar
Demo  
wuyuefeng committed
39
40
41
42
   "metadata": {
    "pycharm": {
     "is_executing": false
    }
43
   }
wuyuefeng's avatar
Demo  
wuyuefeng committed
44
45
46
47
48
49
50
51
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "source": [
    "# test a single sample\n",
    "pcd = 'kitti_000008.bin'\n",
    "result, data = inference_detector(model, pcd)"
52
53
   ],
   "outputs": [],
wuyuefeng's avatar
Demo  
wuyuefeng committed
54
55
56
57
   "metadata": {
    "pycharm": {
     "is_executing": false
    }
58
59
60
61
62
   }
  },
  {
   "cell_type": "code",
   "execution_count": 11,
wuyuefeng's avatar
Demo  
wuyuefeng committed
63
64
65
66
   "source": [
    "# show the results\n",
    "out_dir = './'\n",
    "show_result_meshlab(data, result, out_dir)"
67
68
69
70
71
72
73
   ],
   "outputs": [],
   "metadata": {
    "pycharm": {
     "is_executing": false
    }
   }
wuyuefeng's avatar
Demo  
wuyuefeng committed
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.7"
  },
  "pycharm": {
   "stem_cell": {
    "cell_type": "raw",
    "source": [],
    "metadata": {
     "collapsed": false
    }
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}