File size: 27,432 Bytes
1456309
 
 
 
f8ab00f
1456309
 
84d96b2
1456309
 
 
 
9cf9ecf
84d96b2
 
 
 
 
 
 
 
 
7f616ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1456309
e886fcc
29263f0
e886fcc
1456309
 
 
841ad13
29263f0
 
 
7f616ca
 
 
 
 
 
 
 
 
 
a81f4d5
29263f0
325158c
a81f4d5
325158c
29263f0
 
 
a81f4d5
 
 
e886fcc
29263f0
 
 
325158c
29263f0
325158c
 
 
29263f0
a81f4d5
29263f0
7f616ca
 
 
 
 
 
 
 
 
a81f4d5
 
 
 
 
7f616ca
 
a81f4d5
 
 
7f616ca
a81f4d5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29263f0
a81f4d5
 
 
 
 
29263f0
7f616ca
 
 
 
 
 
 
 
a81f4d5
 
 
29263f0
7f616ca
 
 
325158c
 
 
 
 
 
 
a81f4d5
29263f0
a81f4d5
29263f0
 
 
 
 
 
 
 
 
 
 
 
eef0638
29263f0
 
 
 
 
 
 
 
 
 
 
 
eef0638
29263f0
a81f4d5
 
7f616ca
a81f4d5
 
29263f0
a81f4d5
29263f0
a81f4d5
29263f0
 
 
 
a81f4d5
 
 
29263f0
a81f4d5
 
 
 
 
29263f0
 
a81f4d5
29263f0
9492094
a81f4d5
9492094
29263f0
 
9492094
a81f4d5
9492094
 
 
a81f4d5
 
29263f0
7f616ca
29263f0
 
a81f4d5
 
 
29263f0
 
a81f4d5
29263f0
7f616ca
29263f0
a81f4d5
 
 
7f616ca
a81f4d5
7f616ca
 
a81f4d5
619b161
a81f4d5
29263f0
a81f4d5
29263f0
a81f4d5
 
 
 
29263f0
 
 
9492094
29263f0
e886fcc
 
 
 
 
 
 
 
 
29263f0
 
9de6077
29263f0
 
 
 
 
 
84d96b2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
---
license: cc-by-4.0
pretty_name: Pixels Point Polygons
size_categories:
- 100K<n<1M
task_categories:
- image-segmentation
- object-detection
tags:
- Aerial
- Environement
- Multimodal
- Earth Observation
- Image
- Lidar
- ALS
- pointcloud
- Building
- Polygon
- Vectorization
language:
- en
# configs:
# - config_name: all
#   data_files:
#   - split: train
#     path: "data/224/annotations/annotations_all_train.json"
#   - split: val
#     path: "data/224/annotations/annotations_all_val.json"
#   - split: test
#     path: "data/224/annotations/annotations_all_test.json"
# - config_name: CH
#   data_files:
#   - split: train
#     path: "data/224/annotations/annotations_CH_train.json"
#   - split: val
#     path: "data/224/annotations/annotations_CH_val.json"
#   - split: test
#     path: "data/224/annotations/annotations_CH_test.json"
# - config_name: NY
#   data_files:
#   - split: train
#     path: "data/224/annotations/annotations_NY_train.json"
#   - split: val
#     path: "data/224/annotations/annotations_NY_val.json"
#   - split: test
#     path: "data/224/annotations/annotations_NY_test.json"
# - config_name: NZ
#   data_files:
#   - split: train
#     path: "data/224/annotations/annotations_NZ_train.json"
#   - split: val
#     path: "data/224/annotations/annotations_NZ_val.json"
#   - split: test
#     path: "data/224/annotations/annotations_NZ_test.json"
---

<div align="center">
    <h1 align="center">The P<sup>3</sup> Dataset: Pixels, Points and Polygons <br> for Multimodal Building Vectorization</h1>
    <h3><align="center">Raphael Sulzer<sup>1,2</sup> &nbsp;&nbsp;&nbsp; Liuyun Duan<sup>1</sup>
    &nbsp;&nbsp;&nbsp; Nicolas Girard<sup>1</sup>&nbsp;&nbsp;&nbsp; Florent Lafarge<sup>2</sup></a></h3>
    <align="center"><sup>1</sup>LuxCarta Technology <br>  <sup>2</sup>Centre Inria d'UniversitΓ© CΓ΄te d'Azur
    <img src="./teaser.jpg" width=100% height=100%>
    <b>Figure 1</b>: A view of our dataset of Zurich, Switzerland
</div>

## Table of Contents

- [Abstract](#abstract)
- [Highlights](#highlights)
- [Dataset](#dataset)
- [Pretrained model weights](#pretrained-model-weights)
- [Code](#code)
- [Citation](#citation)
- [Acknowledgements](#acknowledgements)

## Abstract

<div align="justify">
We present the P<sup>3</sup> dataset, a large-scale multimodal benchmark for building vectorization, constructed from aerial LiDAR point clouds, high-resolution aerial imagery, and vectorized 2D building outlines, collected across three continents. The dataset contains over 10 billion LiDAR points with decimeter-level accuracy and RGB images at a ground sampling distance of 25 cm. While many existing datasets primarily focus on the image modality, P<sup>3</sup> offers a complementary perspective by also incorporating dense 3D information. We demonstrate that LiDAR point clouds serve as a robust modality for predicting building polygons, both in hybrid and end-to-end learning frameworks. Moreover, fusing aerial LiDAR and imagery further improves accuracy and geometric quality of predicted polygons. The P<sup>3</sup> dataset is publicly available, along with code and pretrained weights of three state-of-the-art models for building polygon prediction at https://github.com/raphaelsulzer/PixelsPointsPolygons.
</div>

## Highlights

- A global, multimodal dataset of aerial images, aerial LiDAR point clouds and building outline polygons, available at [huggingface.co/datasets/rsi/PixelsPointsPolygons](https://huggingface.co/datasets/rsi/PixelsPointsPolygons) 
- A library for training and evaluating state-of-the-art deep learning methods on the dataset, available at [github.com/raphaelsulzer/PixelsPointsPolygons](https://github.com/raphaelsulzer/PixelsPointsPolygons)
- Pretrained model weights, available at [huggingface.co/rsi/PixelsPointsPolygons](https://huggingface.co/rsi/PixelsPointsPolygons) 
- A paper with an extensive experimental validation, available at [arxiv.org/abs/2505.15379](https://arxiv.org/abs/2505.15379)

## Dataset

### Overview

<div align="left">
    <img src="./worldmap.jpg" width=60% height=50%>
</div>

### Download

The recommended and fastest way to download the dataset is to run

```
pip install huggingface_hub
python scripts/download_dataset.py --dataset-root $DATA_ROOT
```

Optionally you can also download the dataset by running

```
git lfs install
git clone https://huggingface.co/datasets/rsi/PixelsPointsPolygons $DATA_ROOT
```

Both options will download the full dataset, including aerial images (as .tif), aerial lidar point clouds (as .copc.laz) and building polygon annotaions (as MS-COCO .json) into `$DATA_ROOT` . The size of the dataset is around 163GB.

### Structure

<details>
<summary>πŸ“ Click to expand dataset folder structure</summary -->

```text
PixelsPointsPolygons/data/224
β”œβ”€β”€ annotations
β”‚   β”œβ”€β”€ annotations_all_test.json
β”‚   β”œβ”€β”€ annotations_all_train.json
β”‚   └── annotations_all_val.json
β”‚       ... (24 files total)
β”œβ”€β”€ images
β”‚   β”œβ”€β”€ train
β”‚   β”‚   β”œβ”€β”€ CH
β”‚   β”‚   β”‚   β”œβ”€β”€ 0
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ image0_CH_train.tif
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ image1000_CH_train.tif
β”‚   β”‚   β”‚   β”‚   └── image1001_CH_train.tif
β”‚   β”‚   β”‚   β”‚       ... (5000 files total)
β”‚   β”‚   β”‚   β”œβ”€β”€ 5000
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ image5000_CH_train.tif
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ image5001_CH_train.tif
β”‚   β”‚   β”‚   β”‚   └── image5002_CH_train.tif
β”‚   β”‚   β”‚   β”‚       ... (5000 files total)
β”‚   β”‚   β”‚   └── 10000
β”‚   β”‚   β”‚       β”œβ”€β”€ image10000_CH_train.tif
β”‚   β”‚   β”‚       β”œβ”€β”€ image10001_CH_train.tif
β”‚   β”‚   β”‚       └── image10002_CH_train.tif
β”‚   β”‚   β”‚           ... (5000 files total)
β”‚   β”‚   β”‚       ... (11 dirs total)
β”‚   β”‚   β”œβ”€β”€ NY
β”‚   β”‚   β”‚   β”œβ”€β”€ 0
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ image0_NY_train.tif
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ image1000_NY_train.tif
β”‚   β”‚   β”‚   β”‚   └── image1001_NY_train.tif
β”‚   β”‚   β”‚   β”‚       ... (5000 files total)
β”‚   β”‚   β”‚   β”œβ”€β”€ 5000
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ image5000_NY_train.tif
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ image5001_NY_train.tif
β”‚   β”‚   β”‚   β”‚   └── image5002_NY_train.tif
β”‚   β”‚   β”‚   β”‚       ... (5000 files total)
β”‚   β”‚   β”‚   └── 10000
β”‚   β”‚   β”‚       β”œβ”€β”€ image10000_NY_train.tif
β”‚   β”‚   β”‚       β”œβ”€β”€ image10001_NY_train.tif
β”‚   β”‚   β”‚       └── image10002_NY_train.tif
β”‚   β”‚   β”‚           ... (5000 files total)
β”‚   β”‚   β”‚       ... (11 dirs total)
β”‚   β”‚   └── NZ
β”‚   β”‚       β”œβ”€β”€ 0
β”‚   β”‚       β”‚   β”œβ”€β”€ image0_NZ_train.tif
β”‚   β”‚       β”‚   β”œβ”€β”€ image1000_NZ_train.tif
β”‚   β”‚       β”‚   └── image1001_NZ_train.tif
β”‚   β”‚       β”‚       ... (5000 files total)
β”‚   β”‚       β”œβ”€β”€ 5000
β”‚   β”‚       β”‚   β”œβ”€β”€ image5000_NZ_train.tif
β”‚   β”‚       β”‚   β”œβ”€β”€ image5001_NZ_train.tif
β”‚   β”‚       β”‚   └── image5002_NZ_train.tif
β”‚   β”‚       β”‚       ... (5000 files total)
β”‚   β”‚       └── 10000
β”‚   β”‚           β”œβ”€β”€ image10000_NZ_train.tif
β”‚   β”‚           β”œβ”€β”€ image10001_NZ_train.tif
β”‚   β”‚           └── image10002_NZ_train.tif
β”‚   β”‚               ... (5000 files total)
β”‚   β”‚           ... (11 dirs total)
β”‚   β”œβ”€β”€ val
β”‚   β”‚   β”œβ”€β”€ CH
β”‚   β”‚   β”‚   └── 0
β”‚   β”‚   β”‚       β”œβ”€β”€ image0_CH_val.tif
β”‚   β”‚   β”‚       β”œβ”€β”€ image100_CH_val.tif
β”‚   β”‚   β”‚       └── image101_CH_val.tif
β”‚   β”‚   β”‚           ... (529 files total)
β”‚   β”‚   β”œβ”€β”€ NY
β”‚   β”‚   β”‚   └── 0
β”‚   β”‚   β”‚       β”œβ”€β”€ image0_NY_val.tif
β”‚   β”‚   β”‚       β”œβ”€β”€ image100_NY_val.tif
β”‚   β”‚   β”‚       └── image101_NY_val.tif
β”‚   β”‚   β”‚           ... (529 files total)
β”‚   β”‚   └── NZ
β”‚   β”‚       └── 0
β”‚   β”‚           β”œβ”€β”€ image0_NZ_val.tif
β”‚   β”‚           β”œβ”€β”€ image100_NZ_val.tif
β”‚   β”‚           └── image101_NZ_val.tif
β”‚   β”‚               ... (529 files total)
β”‚   └── test
β”‚       β”œβ”€β”€ CH
β”‚       β”‚   β”œβ”€β”€ 0
β”‚       β”‚   β”‚   β”œβ”€β”€ image0_CH_test.tif
β”‚       β”‚   β”‚   β”œβ”€β”€ image1000_CH_test.tif
β”‚       β”‚   β”‚   └── image1001_CH_test.tif
β”‚       β”‚   β”‚       ... (5000 files total)
β”‚       β”‚   β”œβ”€β”€ 5000
β”‚       β”‚   β”‚   β”œβ”€β”€ image5000_CH_test.tif
β”‚       β”‚   β”‚   β”œβ”€β”€ image5001_CH_test.tif
β”‚       β”‚   β”‚   └── image5002_CH_test.tif
β”‚       β”‚   β”‚       ... (5000 files total)
β”‚       β”‚   └── 10000
β”‚       β”‚       β”œβ”€β”€ image10000_CH_test.tif
β”‚       β”‚       β”œβ”€β”€ image10001_CH_test.tif
β”‚       β”‚       └── image10002_CH_test.tif
β”‚       β”‚           ... (4400 files total)
β”‚       β”œβ”€β”€ NY
β”‚       β”‚   β”œβ”€β”€ 0
β”‚       β”‚   β”‚   β”œβ”€β”€ image0_NY_test.tif
β”‚       β”‚   β”‚   β”œβ”€β”€ image1000_NY_test.tif
β”‚       β”‚   β”‚   └── image1001_NY_test.tif
β”‚       β”‚   β”‚       ... (5000 files total)
β”‚       β”‚   β”œβ”€β”€ 5000
β”‚       β”‚   β”‚   β”œβ”€β”€ image5000_NY_test.tif
β”‚       β”‚   β”‚   β”œβ”€β”€ image5001_NY_test.tif
β”‚       β”‚   β”‚   └── image5002_NY_test.tif
β”‚       β”‚   β”‚       ... (5000 files total)
β”‚       β”‚   └── 10000
β”‚       β”‚       β”œβ”€β”€ image10000_NY_test.tif
β”‚       β”‚       β”œβ”€β”€ image10001_NY_test.tif
β”‚       β”‚       └── image10002_NY_test.tif
β”‚       β”‚           ... (4400 files total)
β”‚       └── NZ
β”‚           β”œβ”€β”€ 0
β”‚           β”‚   β”œβ”€β”€ image0_NZ_test.tif
β”‚           β”‚   β”œβ”€β”€ image1000_NZ_test.tif
β”‚           β”‚   └── image1001_NZ_test.tif
β”‚           β”‚       ... (5000 files total)
β”‚           β”œβ”€β”€ 5000
β”‚           β”‚   β”œβ”€β”€ image5000_NZ_test.tif
β”‚           β”‚   β”œβ”€β”€ image5001_NZ_test.tif
β”‚           β”‚   └── image5002_NZ_test.tif
β”‚           β”‚       ... (5000 files total)
β”‚           └── 10000
β”‚               β”œβ”€β”€ image10000_NZ_test.tif
β”‚               β”œβ”€β”€ image10001_NZ_test.tif
β”‚               └── image10002_NZ_test.tif
β”‚                   ... (4400 files total)
β”œβ”€β”€ lidar
β”‚   β”œβ”€β”€ train
β”‚   β”‚   β”œβ”€β”€ CH
β”‚   β”‚   β”‚   β”œβ”€β”€ 0
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ lidar0_CH_train.copc.laz
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ lidar1000_CH_train.copc.laz
β”‚   β”‚   β”‚   β”‚   └── lidar1001_CH_train.copc.laz
β”‚   β”‚   β”‚   β”‚       ... (5000 files total)
β”‚   β”‚   β”‚   β”œβ”€β”€ 5000
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ lidar5000_CH_train.copc.laz
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ lidar5001_CH_train.copc.laz
β”‚   β”‚   β”‚   β”‚   └── lidar5002_CH_train.copc.laz
β”‚   β”‚   β”‚   β”‚       ... (5000 files total)
β”‚   β”‚   β”‚   └── 10000
β”‚   β”‚   β”‚       β”œβ”€β”€ lidar10000_CH_train.copc.laz
β”‚   β”‚   β”‚       β”œβ”€β”€ lidar10001_CH_train.copc.laz
β”‚   β”‚   β”‚       └── lidar10002_CH_train.copc.laz
β”‚   β”‚   β”‚           ... (5000 files total)
β”‚   β”‚   β”‚       ... (11 dirs total)
β”‚   β”‚   β”œβ”€β”€ NY
β”‚   β”‚   β”‚   β”œβ”€β”€ 0
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ lidar0_NY_train.copc.laz
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ lidar10_NY_train.copc.laz
β”‚   β”‚   β”‚   β”‚   └── lidar1150_NY_train.copc.laz
β”‚   β”‚   β”‚   β”‚       ... (1071 files total)
β”‚   β”‚   β”‚   β”œβ”€β”€ 5000
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ lidar5060_NY_train.copc.laz
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ lidar5061_NY_train.copc.laz
β”‚   β”‚   β”‚   β”‚   └── lidar5062_NY_train.copc.laz
β”‚   β”‚   β”‚   β”‚       ... (2235 files total)
β”‚   β”‚   β”‚   └── 10000
β”‚   β”‚   β”‚       β”œβ”€β”€ lidar10000_NY_train.copc.laz
β”‚   β”‚   β”‚       β”œβ”€β”€ lidar10001_NY_train.copc.laz
β”‚   β”‚   β”‚       └── lidar10002_NY_train.copc.laz
β”‚   β”‚   β”‚           ... (4552 files total)
β”‚   β”‚   β”‚       ... (11 dirs total)
β”‚   β”‚   └── NZ
β”‚   β”‚       β”œβ”€β”€ 0
β”‚   β”‚       β”‚   β”œβ”€β”€ lidar0_NZ_train.copc.laz
β”‚   β”‚       β”‚   β”œβ”€β”€ lidar1000_NZ_train.copc.laz
β”‚   β”‚       β”‚   └── lidar1001_NZ_train.copc.laz
β”‚   β”‚       β”‚       ... (5000 files total)
β”‚   β”‚       β”œβ”€β”€ 5000
β”‚   β”‚       β”‚   β”œβ”€β”€ lidar5000_NZ_train.copc.laz
β”‚   β”‚       β”‚   β”œβ”€β”€ lidar5001_NZ_train.copc.laz
β”‚   β”‚       β”‚   └── lidar5002_NZ_train.copc.laz
β”‚   β”‚       β”‚       ... (5000 files total)
β”‚   β”‚       └── 10000
β”‚   β”‚           β”œβ”€β”€ lidar10000_NZ_train.copc.laz
β”‚   β”‚           β”œβ”€β”€ lidar10001_NZ_train.copc.laz
β”‚   β”‚           └── lidar10002_NZ_train.copc.laz
β”‚   β”‚               ... (4999 files total)
β”‚   β”‚           ... (11 dirs total)
β”‚   β”œβ”€β”€ val
β”‚   β”‚   β”œβ”€β”€ CH
β”‚   β”‚   β”‚   └── 0
β”‚   β”‚   β”‚       β”œβ”€β”€ lidar0_CH_val.copc.laz
β”‚   β”‚   β”‚       β”œβ”€β”€ lidar100_CH_val.copc.laz
β”‚   β”‚   β”‚       └── lidar101_CH_val.copc.laz
β”‚   β”‚   β”‚           ... (529 files total)
β”‚   β”‚   β”œβ”€β”€ NY
β”‚   β”‚   β”‚   └── 0
β”‚   β”‚   β”‚       β”œβ”€β”€ lidar0_NY_val.copc.laz
β”‚   β”‚   β”‚       β”œβ”€β”€ lidar100_NY_val.copc.laz
β”‚   β”‚   β”‚       └── lidar101_NY_val.copc.laz
β”‚   β”‚   β”‚           ... (529 files total)
β”‚   β”‚   └── NZ
β”‚   β”‚       └── 0
β”‚   β”‚           β”œβ”€β”€ lidar0_NZ_val.copc.laz
β”‚   β”‚           β”œβ”€β”€ lidar100_NZ_val.copc.laz
β”‚   β”‚           └── lidar101_NZ_val.copc.laz
β”‚   β”‚               ... (529 files total)
β”‚   └── test
β”‚       β”œβ”€β”€ CH
β”‚       β”‚   β”œβ”€β”€ 0
β”‚       β”‚   β”‚   β”œβ”€β”€ lidar0_CH_test.copc.laz
β”‚       β”‚   β”‚   β”œβ”€β”€ lidar1000_CH_test.copc.laz
β”‚       β”‚   β”‚   └── lidar1001_CH_test.copc.laz
β”‚       β”‚   β”‚       ... (5000 files total)
β”‚       β”‚   β”œβ”€β”€ 5000
β”‚       β”‚   β”‚   β”œβ”€β”€ lidar5000_CH_test.copc.laz
β”‚       β”‚   β”‚   β”œβ”€β”€ lidar5001_CH_test.copc.laz
β”‚       β”‚   β”‚   └── lidar5002_CH_test.copc.laz
β”‚       β”‚   β”‚       ... (5000 files total)
β”‚       β”‚   └── 10000
β”‚       β”‚       β”œβ”€β”€ lidar10000_CH_test.copc.laz
β”‚       β”‚       β”œβ”€β”€ lidar10001_CH_test.copc.laz
β”‚       β”‚       └── lidar10002_CH_test.copc.laz
β”‚       β”‚           ... (4400 files total)
β”‚       β”œβ”€β”€ NY
β”‚       β”‚   β”œβ”€β”€ 0
β”‚       β”‚   β”‚   β”œβ”€β”€ lidar0_NY_test.copc.laz
β”‚       β”‚   β”‚   β”œβ”€β”€ lidar1000_NY_test.copc.laz
β”‚       β”‚   β”‚   └── lidar1001_NY_test.copc.laz
β”‚       β”‚   β”‚       ... (4964 files total)
β”‚       β”‚   β”œβ”€β”€ 5000
β”‚       β”‚   β”‚   β”œβ”€β”€ lidar5000_NY_test.copc.laz
β”‚       β”‚   β”‚   β”œβ”€β”€ lidar5001_NY_test.copc.laz
β”‚       β”‚   β”‚   └── lidar5002_NY_test.copc.laz
β”‚       β”‚   β”‚       ... (4953 files total)
β”‚       β”‚   └── 10000
β”‚       β”‚       β”œβ”€β”€ lidar10000_NY_test.copc.laz
β”‚       β”‚       β”œβ”€β”€ lidar10001_NY_test.copc.laz
β”‚       β”‚       └── lidar10002_NY_test.copc.laz
β”‚       β”‚           ... (4396 files total)
β”‚       └── NZ
β”‚           β”œβ”€β”€ 0
β”‚           β”‚   β”œβ”€β”€ lidar0_NZ_test.copc.laz
β”‚           β”‚   β”œβ”€β”€ lidar1000_NZ_test.copc.laz
β”‚           β”‚   └── lidar1001_NZ_test.copc.laz
β”‚           β”‚       ... (5000 files total)
β”‚           β”œβ”€β”€ 5000
β”‚           β”‚   β”œβ”€β”€ lidar5000_NZ_test.copc.laz
β”‚           β”‚   β”œβ”€β”€ lidar5001_NZ_test.copc.laz
β”‚           β”‚   └── lidar5002_NZ_test.copc.laz
β”‚           β”‚       ... (5000 files total)
β”‚           └── 10000
β”‚               β”œβ”€β”€ lidar10000_NZ_test.copc.laz
β”‚               β”œβ”€β”€ lidar10001_NZ_test.copc.laz
β”‚               └── lidar10002_NZ_test.copc.laz
β”‚                   ... (4400 files total)
└── ffl
    β”œβ”€β”€ train
    β”‚   β”œβ”€β”€ CH
    β”‚   β”‚   β”œβ”€β”€ 0
    β”‚   β”‚   β”‚   β”œβ”€β”€ image0_CH_train.pt
    β”‚   β”‚   β”‚   β”œβ”€β”€ image1000_CH_train.pt
    β”‚   β”‚   β”‚   └── image1001_CH_train.pt
    β”‚   β”‚   β”‚       ... (5000 files total)
    β”‚   β”‚   β”œβ”€β”€ 5000
    β”‚   β”‚   β”‚   β”œβ”€β”€ image5000_CH_train.pt
    β”‚   β”‚   β”‚   β”œβ”€β”€ image5001_CH_train.pt
    β”‚   β”‚   β”‚   └── image5002_CH_train.pt
    β”‚   β”‚   β”‚       ... (5000 files total)
    β”‚   β”‚   └── 10000
    β”‚   β”‚       β”œβ”€β”€ image10000_CH_train.pt
    β”‚   β”‚       β”œβ”€β”€ image10001_CH_train.pt
    β”‚   β”‚       └── image10002_CH_train.pt
    β”‚   β”‚           ... (5000 files total)
    β”‚   β”‚       ... (11 dirs total)
    β”‚   β”œβ”€β”€ NY
    β”‚   β”‚   β”œβ”€β”€ 0
    β”‚   β”‚   β”‚   β”œβ”€β”€ image0_NY_train.pt
    β”‚   β”‚   β”‚   β”œβ”€β”€ image1000_NY_train.pt
    β”‚   β”‚   β”‚   └── image1001_NY_train.pt
    β”‚   β”‚   β”‚       ... (5000 files total)
    β”‚   β”‚   β”œβ”€β”€ 5000
    β”‚   β”‚   β”‚   β”œβ”€β”€ image5000_NY_train.pt
    β”‚   β”‚   β”‚   β”œβ”€β”€ image5001_NY_train.pt
    β”‚   β”‚   β”‚   └── image5002_NY_train.pt
    β”‚   β”‚   β”‚       ... (5000 files total)
    β”‚   β”‚   └── 10000
    β”‚   β”‚       β”œβ”€β”€ image10000_NY_train.pt
    β”‚   β”‚       β”œβ”€β”€ image10001_NY_train.pt
    β”‚   β”‚       └── image10002_NY_train.pt
    β”‚   β”‚           ... (5000 files total)
    β”‚   β”‚       ... (11 dirs total)
    β”‚   β”œβ”€β”€ NZ
    β”‚   β”‚   β”œβ”€β”€ 0
    β”‚   β”‚   β”‚   β”œβ”€β”€ image0_NZ_train.pt
    β”‚   β”‚   β”‚   β”œβ”€β”€ image1000_NZ_train.pt
    β”‚   β”‚   β”‚   └── image1001_NZ_train.pt
    β”‚   β”‚   β”‚       ... (5000 files total)
    β”‚   β”‚   β”œβ”€β”€ 5000
    β”‚   β”‚   β”‚   β”œβ”€β”€ image5000_NZ_train.pt
    β”‚   β”‚   β”‚   β”œβ”€β”€ image5001_NZ_train.pt
    β”‚   β”‚   β”‚   └── image5002_NZ_train.pt
    β”‚   β”‚   β”‚       ... (5000 files total)
    β”‚   β”‚   └── 10000
    β”‚   β”‚       β”œβ”€β”€ image10000_NZ_train.pt
    β”‚   β”‚       β”œβ”€β”€ image10001_NZ_train.pt
    β”‚   β”‚       └── image10002_NZ_train.pt
    β”‚   β”‚           ... (5000 files total)
    β”‚   β”‚       ... (11 dirs total)
    β”‚   β”œβ”€β”€ processed-flag-all
    β”‚   β”œβ”€β”€ processed-flag-CH
    β”‚   └── processed-flag-NY
    β”‚       ... (8 files total)
    β”œβ”€β”€ val
    β”‚   β”œβ”€β”€ CH
    β”‚   β”‚   └── 0
    β”‚   β”‚       β”œβ”€β”€ image0_CH_val.pt
    β”‚   β”‚       β”œβ”€β”€ image100_CH_val.pt
    β”‚   β”‚       └── image101_CH_val.pt
    β”‚   β”‚           ... (529 files total)
    β”‚   β”œβ”€β”€ NY
    β”‚   β”‚   └── 0
    β”‚   β”‚       β”œβ”€β”€ image0_NY_val.pt
    β”‚   β”‚       β”œβ”€β”€ image100_NY_val.pt
    β”‚   β”‚       └── image101_NY_val.pt
    β”‚   β”‚           ... (529 files total)
    β”‚   β”œβ”€β”€ NZ
    β”‚   β”‚   └── 0
    β”‚   β”‚       β”œβ”€β”€ image0_NZ_val.pt
    β”‚   β”‚       β”œβ”€β”€ image100_NZ_val.pt
    β”‚   β”‚       └── image101_NZ_val.pt
    β”‚   β”‚           ... (529 files total)
    β”‚   β”œβ”€β”€ processed-flag-all
    β”‚   β”œβ”€β”€ processed-flag-CH
    β”‚   └── processed-flag-NY
    β”‚       ... (8 files total)
    └── test
        β”œβ”€β”€ CH
        β”‚   β”œβ”€β”€ 0
        β”‚   β”‚   β”œβ”€β”€ image0_CH_test.pt
        β”‚   β”‚   β”œβ”€β”€ image1000_CH_test.pt
        β”‚   β”‚   └── image1001_CH_test.pt
        β”‚   β”‚       ... (5000 files total)
        β”‚   β”œβ”€β”€ 5000
        β”‚   β”‚   β”œβ”€β”€ image5000_CH_test.pt
        β”‚   β”‚   β”œβ”€β”€ image5001_CH_test.pt
        β”‚   β”‚   └── image5002_CH_test.pt
        β”‚   β”‚       ... (5000 files total)
        β”‚   └── 10000
        β”‚       β”œβ”€β”€ image10000_CH_test.pt
        β”‚       β”œβ”€β”€ image10001_CH_test.pt
        β”‚       └── image10002_CH_test.pt
        β”‚           ... (4400 files total)
        β”œβ”€β”€ NY
        β”‚   β”œβ”€β”€ 0
        β”‚   β”‚   β”œβ”€β”€ image0_NY_test.pt
        β”‚   β”‚   β”œβ”€β”€ image1000_NY_test.pt
        β”‚   β”‚   └── image1001_NY_test.pt
        β”‚   β”‚       ... (5000 files total)
        β”‚   β”œβ”€β”€ 5000
        β”‚   β”‚   β”œβ”€β”€ image5000_NY_test.pt
        β”‚   β”‚   β”œβ”€β”€ image5001_NY_test.pt
        β”‚   β”‚   └── image5002_NY_test.pt
        β”‚   β”‚       ... (5000 files total)
        β”‚   └── 10000
        β”‚       β”œβ”€β”€ image10000_NY_test.pt
        β”‚       β”œβ”€β”€ image10001_NY_test.pt
        β”‚       └── image10002_NY_test.pt
        β”‚           ... (4400 files total)
        β”œβ”€β”€ NZ
        β”‚   β”œβ”€β”€ 0
        β”‚   β”‚   β”œβ”€β”€ image0_NZ_test.pt
        β”‚   β”‚   β”œβ”€β”€ image1000_NZ_test.pt
        β”‚   β”‚   └── image1001_NZ_test.pt
        β”‚   β”‚       ... (5000 files total)
        β”‚   β”œβ”€β”€ 5000
        β”‚   β”‚   β”œβ”€β”€ image5000_NZ_test.pt
        β”‚   β”‚   β”œβ”€β”€ image5001_NZ_test.pt
        β”‚   β”‚   └── image5002_NZ_test.pt
        β”‚   β”‚       ... (5000 files total)
        β”‚   └── 10000
        β”‚       β”œβ”€β”€ image10000_NZ_test.pt
        β”‚       β”œβ”€β”€ image10001_NZ_test.pt
        β”‚       └── image10002_NZ_test.pt
        β”‚           ... (4400 files total)
        β”œβ”€β”€ processed-flag-all
        β”œβ”€β”€ processed-flag-CH
        └── processed-flag-NY
            ... (8 files total)
```

</details>

## Pretrained model weights

### Download

The recommended and fastest way to download the pretrained model weights is to run

```
python scripts/download_pretrained.py --model-root $MODEL_ROOT
```

Optionally you can also download the weights by running

```
git clone https://huggingface.co/rsi/PixelsPointsPolygons $MODEL_ROOT
```

Both options will download all checkpoints (as .pth) and results presented in the paper (as MS-COCO .json) into `$MODEL_ROOT` .

## Code

### Download

```
git clone https://github.com/raphaelsulzer/PixelsPointsPolygons
```

### Installation

To create a conda environment named `p3` and install the repository as a python package with all dependencies run
```
bash install.sh
```

or, if you want to manage the environment yourself run
```
pip install -r requirements-torch-cuda.txt
pip install .
```
⚠️ **Warning**: The implementation of the LiDAR point cloud encoder uses Open3D-ML. Currently, Open3D-ML officially only supports the PyTorch version specified in `requirements-torch-cuda.txt`.


<!-- ## Model Zoo


| Model                     | \<model>  | Encoder                   | \<encoder>            |Image  |LiDAR  | IoU       | C-IoU     |
|---------------            |----       |---------------            |---------------        |---    |---    |-----      |-----       |
| Frame Field Learning      |\<ffl>     | Vision Transformer (ViT)  | \<vit_cnn>            | βœ…    |       | 0.85      | 0.90      |
| Frame Field Learning      |\<ffl>     | PointPillars (PP) + ViT   | \<pp_vit_cnn>         |       | βœ…    | 0.80      | 0.88      |
| Frame Field Learning      |\<ffl>     | PP+ViT \& ViT             | \<fusion_vit_cnn>     | βœ…    |βœ…     | 0.78      | 0.85      |
| HiSup                     |\<hisup>   | Vision Transformer (ViT)  | \<vit_cnn>            | βœ…    |       | 0.85      | 0.90      |
| HiSup                     |\<hisup>   | PointPillars (PP) + ViT   | \<pp_vit_cnn>         |       | βœ…    | 0.80      | 0.88      |
| HiSup                     |\<hisup>   | PP+ViT \& ViT             | \<fusion_vit>         | βœ…    |βœ…     | 0.78      | 0.85      |
| Pix2Poly                  |\<pix2poly>| Vision Transformer (ViT)  | \<vit>                | βœ…    |       | 0.85      | 0.90      |
| Pix2Poly                  |\<pix2poly>| PointPillars (PP) + ViT   | \<pp_vit>             |       | βœ…    | 0.80      | 0.88      |
| Pix2Poly                  |\<pix2poly>| PP+ViT \& ViT             | \<fusion_vit>         | βœ…    |βœ…     | 0.78      | 0.85      | -->

### Setup

The project supports hydra configuration which allows to modify any parameter either from a `.yaml` file or directly from the command line.

To setup the project structure we recommend to specify your `$DATA_ROOT` and `$MODEL_ROOT` in `config/host/default.yaml`.

To view all available configuration options run
```
python scripts/train.py --help
```



<!-- The most important parameters are described below:
<details>
<summary>CLI Parameters</summary>

```text
        β”œβ”€β”€ processed-flag-all
        β”œβ”€β”€ processed-flag-CH
        └── processed-flag-NY
            ... (8 files total)
```

</details> -->

### Predict demo tile

After downloading the model weights and setting up the code you can predict a demo tile by running

```
python scripts/predict_demo.py checkpoint=best_val_iou experiment=$MODEL_$MODALITY +image_file=demo_data/image0_CH_val.tif +lidar_file=demo_data/lidar0_CH_val.copc.laz
```
At least one of `image_file` or `lidar_file` has to be specified. `$MODEL` can be one of the following: `ffl`, `hisup` or `p2p`. `$MODALITY` can be `image`, `lidar` or `fusion`.
The result will be stored in `prediction.png`.


### Reproduce paper results

To reproduce the results from the paper you can run the following commands

```
python scripts/modality_ablation.py
python scripts/lidar_density_ablation.py
python scripts/all_countries.py
```

### Custom training, prediction and evaluation

We recommend to first setup a custom experiment file `$EXP_FILE` in `config/experiment/` following the structure of one of the existing files, e.g. `ffl_fusion.yaml`. You can then run

```
# train your model (on multiple GPUs)
torchrun --nproc_per_node=$NUM_GPU scripts/train.py experiment=$EXP_FILE

# predict the test set with your model (on multiple GPUs)
torchrun --nproc_per_node=$NUM_GPU scripts/predict.py experiment=$EXP_FILE evaluation=test checkpoint=best_val_iou

# evaluate your prediction of the test set
python scripts/evaluate.py experiment=$EXP_FILE evaluation=test checkpoint=best_val_iou
```

You could also continue training from a provided pretrained model with

```
# train your model (on a single GPU)
python scripts/train.py experiment=p2p_fusion checkpoint=latest
```

## Citation

If you use our work please cite
```bibtex
@misc{sulzer2025p3datasetpixelspoints,
      title={The P$^3$ dataset: Pixels, Points and Polygons for Multimodal Building Vectorization}, 
      author={Raphael Sulzer and Liuyun Duan and Nicolas Girard and Florent Lafarge},
      year={2025},
      eprint={2505.15379},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2505.15379}, 
}
```


## Acknowledgements

This repository benefits from the following open-source work. We thank the authors for their great work.

1. [Frame Field Learning](https://github.com/Lydorn/Polygonization-by-Frame-Field-Learning)
2. [HiSup](https://github.com/SarahwXU/HiSup)
3. [Pix2Poly](https://github.com/yeshwanth95/Pix2Poly)