Skip to content

Commit

Permalink
Add code to repository and update README
Browse files Browse the repository at this point in the history
  • Loading branch information
LuigiRiz committed Mar 23, 2023
1 parent 145af9e commit 217f0a3
Show file tree
Hide file tree
Showing 21 changed files with 3,111 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__pycache__/
65 changes: 64 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,67 @@ Thirdly, we present a new method for NCD based on online clustering that exploit
Lastly, we introduce a new evaluation protocol to assess the performance of NCD for point cloud semantic segmentation.
We thoroughly evaluate our method on SemanticKITTI and SemanticPOSS datasets, showing that it can significantly outperform the baseline.

Camera ready and code will be released soon!
:fire: For more information have a look at our [PAPER](https://arxiv.org/pdf/2303.11610)! :fire:

Authors:
Luigi Riz,
[Cristiano Saltori](https://scholar.google.com/citations?user=PID7Z4oAAAAJ&hl),
[Elisa Ricci](https://scholar.google.ca/citations?user=xf1T870AAAAJ&hl),
[Fabio Poiesi](https://scholar.google.co.uk/citations?user=BQ7li6AAAAAJ&hl)

## News :new:
- 3/2023: NOPS code is **OUT**!:fire:
- 3/2023: NOPS is accepted to CVPR 2023!:fire: Our work is the first allowing the segmentation of known and unknown classes in 3D Lidar scans!

## Installation

The code has been tested with Python 3.8, CUDA 11.3, pytorch 1.10.1 and pytorch-lighting 1.4.8. Any other version may require to update the code for compatibility.

### Conda
To run the code, you need to install:
- [Pytorch 1.10.1](https://pytorch.org/get-started/previous-versions/)
- [Minkowski Engine](https://github.com/NVIDIA/MinkowskiEngine)
- [Pytorch-Lighting 1.4.8](https://www.pytorchlightning.ai) (be sure to install torchmetrics=0.7.2)
- [Scipy 1.7.3](https://scipy.org/install/)
- [Wandb](https://docs.wandb.ai/quickstart)

## Data preparation
To download the data follow the instructions provided by [SemanticKITTI](http://www.semantic-kitti.org) and [SemanticPOSS](http://www.poss.pku.edu.cn/semanticposs.html). Then, use this structure of the folders:
```
./
├──
├── ...
└── path_to_data_shown_in_yaml_config/
└── sequences
├── 00/
│ ├── velodyne/
| | ├── 000000.bin
| | ├── 000001.bin
| | └── ...
│ └── labels/
| ├── 000000.label
| ├── 000001.label
| └── ...
└── ...
```

## Commands
### Pretraining
To run the pretraining:
```
python main_pretrain.py -s [SPLIT NUMBER] --dataset [SemanticPOSS, SemanticKITTI]
```
For additional command line arguments, run:
```
python main_pretrain.py -h
```

### Discovery
To run the discovery step (pretraining is not mandatory):
```
python main_discover.py -s [SPLIT NUMBER] --dataset [SemanticPOSS, SemanticKITTI]
```
For additional command line arguments, run:
```
python main_discover.py -h
```
198 changes: 198 additions & 0 deletions config/semkitti_dataset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
dataset_path: /data/disk1/share/luriz/datasets/SemanticKITTI/dataset/

folder_name:
input: velodyne
label: labels

split_sequence: # sequence numbers
train:
- '00'
- '01'
- '02'
- '03'
- '04'
- '05'
- '06'
- '07'
- '09'
- '10'
valid:
- '08'
test:
- '11'
- '12'
- '13'
- '14'
- '15'
- '16'
- '17'
- '18'
- '19'
- '20'
- '21'

learning_map:
0 : -1 # "unlabeled"
1 : -1 # "outlier" mapped to "unlabeled" --------------------------mapped
10: 0 # "car"
11: 1 # "bicycle"
13: 4 # "bus" mapped to "other-vehicle" --------------------------mapped
15: 2 # "motorcycle"
16: 4 # "on-rails" mapped to "other-vehicle" ---------------------mapped
18: 3 # "truck"
20: 4 # "other-vehicle"
30: 5 # "person"
31: 6 # "bicyclist"
32: 7 # "motorcyclist"
40: 8 # "road"
44: 9 # "parking"
48: 10 # "sidewalk"
49: 11 # "other-ground"
50: 12 # "building"
51: 13 # "fence"
52: -1 # "other-structure" mapped to "unlabeled" ------------------mapped
60: 8 # "lane-marking" to "road" ---------------------------------mapped
70: 14 # "vegetation"
71: 15 # "trunk"
72: 16 # "terrain"
80: 17 # "pole"
81: 18 # "traffic-sign"
99: -1 # "other-object" to "unlabeled" ----------------------------mapped
252: 0 # "moving-car" to "car" ------------------------------------mapped
253: 6 # "moving-bicyclist" to "bicyclist" ------------------------mapped
254: 5 # "moving-person" to "person" ------------------------------mapped
255: 7 # "moving-motorcyclist" to "motorcyclist" ------------------mapped
256: 4 # "moving-on-rails" mapped to "other-vehicle" --------------mapped
257: 4 # "moving-bus" mapped to "other-vehicle" -------------------mapped
258: 3 # "moving-truck" to "truck" --------------------------------mapped
259: 4 # "moving-other"-vehicle to "other-vehicle" ----------------mapped

learning_map_inv: # inverse of previous map
-1: 0 # "unlabeled", and others ignored
0: 10 # "car"
1: 11 # "bicycle"
2: 15 # "motorcycle"
3: 18 # "truck"
4: 20 # "other-vehicle"
5: 30 # "person"
6: 31 # "bicyclist"
7: 32 # "motorcyclist"
8: 40 # "road"
9: 44 # "parking"
10: 48 # "sidewalk"
11: 49 # "other-ground"
12: 50 # "building"
13: 51 # "fence"
14: 70 # "vegetation"
15: 71 # "trunk"
16: 72 # "terrain"
17: 80 # "pole"
18: 81 # "traffic-sign"

color_map: # bgr
0 : [0, 0, 0]
1 : [0, 0, 255]
10: [245, 150, 100]
11: [245, 230, 100]
13: [250, 80, 100]
15: [150, 60, 30]
16: [255, 0, 0]
18: [180, 30, 80]
20: [255, 0, 0]
30: [30, 30, 255]
31: [200, 40, 255]
32: [90, 30, 150]
40: [255, 0, 255]
44: [255, 150, 255]
48: [75, 0, 75]
49: [75, 0, 175]
50: [0, 200, 255]
51: [50, 120, 255]
52: [0, 150, 255]
60: [170, 255, 150]
70: [0, 175, 0]
71: [0, 60, 135]
72: [80, 240, 150]
80: [150, 240, 255]
81: [0, 0, 255]
99: [255, 255, 50]
252: [245, 150, 100]
256: [255, 0, 0]
253: [200, 40, 255]
254: [30, 30, 255]
255: [90, 30, 150]
257: [250, 80, 100]
258: [180, 30, 80]
259: [255, 0, 0]

labels:
0 : "unlabeled"
1 : "outlier"
10: "car"
11: "bicycle"
13: "bus"
15: "motorcycle"
16: "on-rails"
18: "truck"
20: "other-vehicle"
30: "person"
31: "bicyclist"
32: "motorcyclist"
40: "road"
44: "parking"
48: "sidewalk"
49: "other-ground"
50: "building"
51: "fence"
52: "other-structure"
60: "lane-marking"
70: "vegetation"
71: "trunk"
72: "terrain"
80: "pole"
81: "traffic-sign"
99: "other-object"
252: "moving-car"
253: "moving-bicyclist"
254: "moving-person"
255: "moving-motorcyclist"
256: "moving-on-rails"
257: "moving-bus"
258: "moving-truck"
259: "moving-other-vehicle"

content: # as a ratio with the total number of points
0: 0.018889854628292943
1: 0.0002937197336781505
10: 0.040818519255974316
11: 0.00016609538710764618
13: 2.7879693665067774e-05
15: 0.00039838616015114444
16: 0.0
18: 0.0020633612104619787
20: 0.0016218197275284021
30: 0.00017698551338515307
31: 1.1065903904919655e-08
32: 5.532951952459828e-09
40: 0.1987493871255525
44: 0.014717169549888214
48: 0.14392298360372
49: 0.0039048553037472045
50: 0.1326861944777486
51: 0.0723592229456223
52: 0.002395131480328884
60: 4.7084144280367186e-05
70: 0.26681502148037506
71: 0.006035012012626033
72: 0.07814222006271769
80: 0.002855498193863172
81: 0.0006155958086189918
99: 0.009923127583046915
252: 0.001789309418528068
253: 0.00012709999297008662
254: 0.00016059776092534436
255: 3.745553104802113e-05
256: 0.0
257: 0.00011351574470342043
258: 0.00010157861367183268
259: 4.3840131989471124e-05
125 changes: 125 additions & 0 deletions config/semposs_dataset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
dataset_path: /data/disk1/share/luriz/datasets/SemanticPOSS/dataset/

folder_name:
input: velodyne
label: labels

split_sequence: # sequence numbers
train:
- '00'
- '01'
- '02'
- '04'
- '05'
valid:
- '03'

learning_map:
0: -1 # unlabeled
1: -1 # unlabeled -------------------------------mapped
2: -1 # unlabeled -------------------------------mapped
3: -1 # unlabeled -------------------------------mapped
4: 0 # 1 person
5: 0 # 2+ person --------------------------------mapped
6: 1 # rider
7: 2 # car
8: 3 # trunk
9: 4 # plants
10: 5 # traffic sign 1
11: 5 # traffic sign 2 --------------------------mapped
12: 5 # traffic sign 3 --------------------------mapped
13: 6 # pole
14: 7 # trashcan
15: 8 # building
16: 9 # cone/stone
17: 10 # fence
18: -1 # unlabeled -------------------------------mapped
19: -1 # unlabeled -------------------------------mapped
20: -1 # unlabeled -------------------------------mapped
21: 11 # bike
22: 12 # other-ground

learning_map_inv: # inverse of previous map
-1: 0 # "unlabeled", and others ignored
0: 4 # "person"
1: 6 # "rider"
2: 7 # "car"
3: 8 # "trunk"
4: 9 # "plants"
5: 10 # "traffic-sign"
6: 13 # "pole"
7: 14 # "trashcan"
8: 15 # "building"
9: 16 # "cone/stone"
10: 17 # "fence"
11: 21 # "bike"
12: 22 # "other-ground"

color_map: # bgr
0: [128, 128, 128] # unlabeled
1: [0, 0, 0] # unlabeled
2: [0, 0, 0] # unlabeled
3: [0, 0, 0] # unlabeled
4: [255, 30, 30] # 1 person
5: [255, 30, 30] # 2+ person
6: [255, 40, 200] # rider
7: [100, 150, 245] # car
8: [135,60,0] # trunk
9: [0, 175, 0] # plants
10: [255, 0, 0] # traffic sign 1 # standing sign
11: [255, 0, 0] # traffic sign 2 # hanging sign
12: [255, 0, 0] # traffic sign 3 # high/big hanging sign
13: [255, 240, 150] # pole
14: [125, 255, 0] # trashcan
15: [255, 200, 0] # building
16: [50, 255, 255] # cone/stone
17: [255, 120, 50] # fence
18: [0, 0, 0] # unlabeled
19: [0, 0, 0] # unlabeled
20: [0, 0, 0] # unlabeled
21: [100, 230, 245] # bike
22: [0, 0, 0] # other-ground

labels:
0: "unlabeled"
4: "person"
5: "2+ person"
6: "rider"
7: "car"
8: "trunk"
9: "plants"
10: "traffic sign" # standing sign
11: "traffic sign 2" # hanging sign
12: "traffic sign 3" # high/big hanging sign
13: "pole"
14: "trashcan"
15: "building"
16: "cone-stone"
17: "fence"
21: "bike"
22: "other-ground"

content: # as a ratio with the total number of points
0: 2.14244059e-02
1: 2.59110680e-08
2: 0.0
3: 0.0
4: 1.45552885e-02
5: 2.97170930e-03
6: 4.27795878e-03
7: 7.47442017e-02
8: 1.19028088e-02
9: 3.64772113e-01
10: 2.93810782e-03
11: 1.22949054e-03
12: 1.45168831e-03
13: 4.73977693e-03
14: 8.20411782e-04
15: 2.22458412e-01
16: 9.10416468e-04
17: 1.53973464e-02
18: 7.59448221e-04
19: 3.80011723e-05
20: 3.34610350e-04
21: 5.48716718e-02
22: 1.99402106e-01
Loading

0 comments on commit 217f0a3

Please sign in to comment.