|
10 | 10 | },
|
11 | 11 | {
|
12 | 12 | "cell_type": "code",
|
13 |
| - "execution_count": 1, |
| 13 | + "execution_count": 5, |
14 | 14 | "id": "d009f3b8-3f04-4aac-b10a-4a2e0a34836e",
|
15 |
| - "metadata": {}, |
16 |
| - "outputs": [ |
17 |
| - { |
18 |
| - "name": "stdout", |
19 |
| - "output_type": "stream", |
20 |
| - "text": [ |
21 |
| - "Jupyter environment detected. Enabling Open3D WebVisualizer.\n", |
22 |
| - "[Open3D INFO] WebRTC GUI backend enabled.\n", |
23 |
| - "[Open3D INFO] WebRTCWindowSystem: HTTP handshake server disabled.\n" |
24 |
| - ] |
| 15 | + "metadata": { |
| 16 | + "ExecuteTime": { |
| 17 | + "end_time": "2023-12-20T14:25:22.551281Z", |
| 18 | + "start_time": "2023-12-20T14:25:21.002067Z" |
25 | 19 | }
|
26 |
| - ], |
| 20 | + }, |
| 21 | + "outputs": [], |
27 | 22 | "source": [
|
28 | 23 | "import sys\n",
|
29 | 24 | "import mrob\n",
|
30 | 25 | "import time\n",
|
31 | 26 | "import os\n",
|
32 |
| - "from octreelib.grid import Grid, GridConfig, VisualizationConfig\n", |
33 |
| - "from octreelib.octree import MultiPoseOctree, OctreeConfig\n", |
34 |
| - "from typing import Tuple, List\n", |
| 27 | + "import tqdm\n", |
| 28 | + "from octreelib.grid import Grid, GridConfig\n", |
| 29 | + "from typing import Tuple, List, Dict\n", |
35 | 30 | "from dataclasses import dataclass\n",
|
36 | 31 | "import numpy as np\n",
|
37 | 32 | "import open3d as o3d\n",
|
38 | 33 | "\n",
|
39 | 34 | "sys.path.append(\"..\")\n",
|
40 | 35 | "from slam.backend import BaregBackend, EigenFactorBackend, Backend, BackendOutput\n",
|
41 |
| - "from slam.pipeline import StaticPipeline, StaticPipelineRuntimeParameters\n", |
| 36 | + "\n", |
42 | 37 | "from slam.segmenter import Segmenter, CAPESegmenter, RansacSegmenter\n",
|
43 | 38 | "from slam.subdivider import Subdivider, CountSubdivider, EigenValueSubdivider, SizeSubdivider\n",
|
44 |
| - "from slam.utils import Reader, HiltiReader, KittiReader" |
| 39 | + "from slam.utils import DatasetReader, HiltiReader, KittiReader" |
45 | 40 | ]
|
46 | 41 | },
|
47 | 42 | {
|
|
54 | 49 | },
|
55 | 50 | {
|
56 | 51 | "cell_type": "code",
|
57 |
| - "execution_count": 2, |
| 52 | + "execution_count": 6, |
58 | 53 | "id": "4e183c65-5a53-4152-a1e0-9eeb8afc49de",
|
59 |
| - "metadata": {}, |
| 54 | + "metadata": { |
| 55 | + "ExecuteTime": { |
| 56 | + "end_time": "2023-12-20T14:25:23.389009Z", |
| 57 | + "start_time": "2023-12-20T14:25:23.384258Z" |
| 58 | + } |
| 59 | + }, |
60 | 60 | "outputs": [],
|
61 | 61 | "source": [
|
62 | 62 | "SAMPLES_COUNT = 10"
|
|
72 | 72 | },
|
73 | 73 | {
|
74 | 74 | "cell_type": "code",
|
75 |
| - "execution_count": 3, |
| 75 | + "execution_count": 7, |
76 | 76 | "id": "49fcabc0-83d2-4bdb-821e-4f5735930ca1",
|
77 |
| - "metadata": {}, |
| 77 | + "metadata": { |
| 78 | + "ExecuteTime": { |
| 79 | + "end_time": "2023-12-20T14:25:24.005440Z", |
| 80 | + "start_time": "2023-12-20T14:25:23.992233Z" |
| 81 | + } |
| 82 | + }, |
78 | 83 | "outputs": [],
|
79 | 84 | "source": [
|
80 | 85 | "def evaluate(timestamps: List[float]):\n",
|
|
90 | 95 | " timestamps = np.array(timestamps)\n",
|
91 | 96 | " print_metrics(timestamps)\n",
|
92 | 97 | "\n",
|
93 |
| - "def read_patch(reader: Reader,path: str, start: int, end: int) -> List[o3d.geometry.PointCloud]:\n", |
| 98 | + "def read_patch(reader: DatasetReader,path: str, start: int, end: int) -> List[o3d.geometry.PointCloud]:\n", |
94 | 99 | " \"\"\"\n",
|
95 | 100 | " Reads patch of point clouds\n",
|
96 | 101 | " \"\"\"\n",
|
|
121 | 126 | },
|
122 | 127 | {
|
123 | 128 | "cell_type": "code",
|
124 |
| - "execution_count": 4, |
125 |
| - "id": "22088f09-504b-4221-a0df-8bd09ad2a15c", |
126 |
| - "metadata": {}, |
| 129 | + "execution_count": 8, |
127 | 130 | "outputs": [],
|
128 | 131 | "source": [
|
129 | 132 | "@dataclass\n",
|
|
147 | 150 | " distribution: float\n",
|
148 | 151 | " segmenters: float\n",
|
149 | 152 | " backend: float\n",
|
150 |
| - "\n", |
| 153 | + " \n", |
151 | 154 | "\n",
|
152 | 155 | "def run_pipeline(point_clouds: List[o3d.geometry.PointCloud], pipeline: PipelineConfiguration) -> PipelineDurations:\n",
|
153 | 156 | " \"\"\"\n",
|
|
159 | 162 | " initialization_start = time.perf_counter()\n",
|
160 | 163 | " pipeline.grid.insert_points(\n",
|
161 | 164 | " middle_pose_number,\n",
|
162 |
| - " point_clouds[middle_pose_number].points,\n", |
| 165 | + " np.asarray(point_clouds[middle_pose_number].points),\n", |
163 | 166 | " )\n",
|
164 | 167 | " initialization_end = time.perf_counter() - initialization_start\n",
|
165 | 168 | " \n",
|
|
171 | 174 | " for pose_number, point_cloud in enumerate(point_clouds):\n",
|
172 | 175 | " if pose_number == middle_pose_number:\n",
|
173 | 176 | " continue\n",
|
174 |
| - " pipeline.grid.insert_points(pose_number, point_cloud.points)\n", |
| 177 | + " pipeline.grid.insert_points(pose_number, np.asarray(point_cloud.points))\n", |
175 | 178 | " distribution_end = time.perf_counter() - distribution_start\n",
|
176 | 179 | "\n",
|
177 | 180 | " segmenters_start = time.perf_counter()\n",
|
|
190 | 193 | " segmenters=segmenters_end,\n",
|
191 | 194 | " backend=backend_end,\n",
|
192 | 195 | " )"
|
193 |
| - ] |
| 196 | + ], |
| 197 | + "metadata": { |
| 198 | + "collapsed": false, |
| 199 | + "ExecuteTime": { |
| 200 | + "end_time": "2023-12-20T14:25:24.923503Z", |
| 201 | + "start_time": "2023-12-20T14:25:24.918673Z" |
| 202 | + } |
| 203 | + }, |
| 204 | + "id": "1528c7c19e4d9cfe" |
194 | 205 | },
|
195 | 206 | {
|
196 | 207 | "cell_type": "markdown",
|
|
202 | 213 | },
|
203 | 214 | {
|
204 | 215 | "cell_type": "code",
|
205 |
| - "execution_count": 5, |
206 |
| - "id": "1156e0c8-d70d-4c12-a9ff-773ca383912b", |
| 216 | + "execution_count": null, |
| 217 | + "id": "1eed4317-fa5b-4980-8fae-58263c0b1cfd", |
207 | 218 | "metadata": {},
|
208 |
| - "outputs": [ |
209 |
| - { |
210 |
| - "name": "stdout", |
211 |
| - "output_type": "stream", |
212 |
| - "text": [ |
213 |
| - "Patch 0 -> 3; Samples count = 10\n", |
214 |
| - "First point clouds insertion stage\n", |
215 |
| - "\tmin = 2.647s\n", |
216 |
| - "\tmax = 2.863s\n", |
217 |
| - "\tmean = 2.708s\n", |
218 |
| - "\tstd = 0.066s\n", |
219 |
| - "Subdividers stage\n", |
220 |
| - "\tmin = 8.991s\n", |
221 |
| - "\tmax = 9.287s\n", |
222 |
| - "\tmean = 9.077s\n", |
223 |
| - "\tstd = 0.087s\n", |
224 |
| - "Distribution stage\n", |
225 |
| - "\tmin = 20.751s\n", |
226 |
| - "\tmax = 21.297s\n", |
227 |
| - "\tmean = 20.877s\n", |
228 |
| - "\tstd = 0.151s\n", |
229 |
| - "Segmenters stage\n", |
230 |
| - "\tmin = 7.337s\n", |
231 |
| - "\tmax = 9.898s\n", |
232 |
| - "\tmean = 7.762s\n", |
233 |
| - "\tstd = 0.769s\n", |
234 |
| - "Backend stage\n", |
235 |
| - "\tmin = 0.096s\n", |
236 |
| - "\tmax = 0.155s\n", |
237 |
| - "\tmean = 0.104s\n", |
238 |
| - "\tstd = 0.017s\n" |
239 |
| - ] |
240 |
| - } |
241 |
| - ], |
| 219 | + "outputs": [], |
242 | 220 | "source": [
|
243 | 221 | "# Pipeline configuration\n",
|
244 | 222 | "# TODO(user): You can manipulate configuration spec below as you want\n",
|
|
274 | 252 | "\n",
|
275 | 253 | " grid = Grid(\n",
|
276 | 254 | " GridConfig(\n",
|
277 |
| - " octree_type=MultiPoseOctree,\n", |
278 |
| - " octree_config=OctreeConfig(),\n", |
279 |
| - " grid_voxel_edge_length=4,\n", |
| 255 | + " voxel_edge_length=4,\n", |
280 | 256 | " )\n",
|
281 | 257 | " )\n",
|
282 | 258 | " \n",
|
|
297 | 273 | " segmenters_timestamps = []\n",
|
298 | 274 | " backend_timestamps = []\n",
|
299 | 275 | " \n",
|
300 |
| - " for sample in range(SAMPLES_COUNT):\n", |
| 276 | + " for sample in tqdm.tqdm(range(SAMPLES_COUNT)):\n", |
301 | 277 | " point_clouds = read_patch(dataset_reader, dataset_path, ind, ind + step)\n",
|
302 | 278 | " \n",
|
303 | 279 | " pipeline_durations = run_pipeline(point_clouds, create_configuration())\n",
|
|
0 commit comments