Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,14 @@ Read the [CONTRIBUTING.md](CONTRIBUTING.md) file.
Cite our work if you find it useful

```bibtex
@article{NG2024SOccDPT,
title={SOccDPT: 3D Semantic Occupancy from Dense Prediction Transformers trained under memory constraints},
author={NG, Aditya},
journal={Advances in Artificial Intelligence and Machine Learning},
volume={ISSN: 2582-9793, Source Id: 21101164612},
year={2024},
url={https://www.oajaiml.com/}
@article{nalgunda2024soccdpt,
author = {Aditya Nalgunda Ganesh},
title = {SOccDPT: 3D Semantic Occupancy from Dense Prediction Transformers trained under memory constraints},
journal = {Advances in Artificial Intelligence and Machine Learning},
volume = {4},
number = {2},
pages = {2201--2212},
year = {2024}
}
```

Expand Down
13 changes: 8 additions & 5 deletions socc_plotter/socc.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@
def get_socc(
disparity: np.ndarray,
semantics: np.ndarray,
scale: Tuple[float, float, float] = (1, 1, -1),
scale: Tuple[float, float, float] = (1, 1, 1),
intrinsics: Optional[np.ndarray] = None,
subsample: int = 30,
mask: Optional[np.ndarray] = None,
fov_x: float = 70, # degrees
fov_y: float = 70, # degrees
baseline: float = 1.5,
clip_range: float = 80.0,
voxel_size: float = 0.2,
occupancy_threshold: int = 1,
) -> Tuple[np.ndarray, np.ndarray]:
"""
Takes depth and semantics as input and produces 3D semantic occupancy
Expand All @@ -31,7 +35,6 @@ def get_socc(
cx = intrinsics[0, 2]
cy = intrinsics[1, 2]
focal_length = (fx + fy) / 2.0
baseline = 1.5
points = np.zeros((HEIGHT, WIDTH, 3), dtype=np.float32)

if mask is None:
Expand Down Expand Up @@ -64,12 +67,12 @@ def get_socc(
points = points[::subsample, :]
colors = colors[::subsample, :]

points = points.clip(-80, 80)
points = points.clip(-clip_range, clip_range)

points, colors = uniform_density_colorwise(points, colors, 0.2, 1)
points, colors = uniform_density_colorwise(points, colors, voxel_size, occupancy_threshold)

points[:, 0], points[:, 1], points[:, 2] = (
-points[:, 0].copy(),
points[:, 0].copy(),
points[:, 1].copy(),
points[:, 2].copy(),
)
Expand Down