Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
SVivdich02 committed Jan 3, 2024
1 parent ab56dd4 commit 331304f
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 45 deletions.
9 changes: 0 additions & 9 deletions tests/test_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,3 @@
"voxel_size": 0.25,
}
)

real_init_map_size = sum(
len(kitti.get_point_cloud(i).points)
for i in range(config.start_index, config.end_index)
)

real_image_count = config.end_index - (
config.start_index - config.start_image_index_offset
)
76 changes: 42 additions & 34 deletions tests/test_in_cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,40 +28,48 @@
"expected_points2instances",
[
(
np.array([
[0.1, 0.1, 5555],
[0.2, 0.2, 6666],
[0.3, 0.3, 7777],
[0.4, 0.4, 2],
[0.5, 0.5, 8888],
[0.6, 0.6, 9999],
[0.7, 0.7, 5],
[0.8, 0.8, 3],
[0.9, 0.9, 1],
]),
np.array([
[1, 2, 3, 4, 5, 6],
[0, 2, 3, 4, 5, 6],
[1, 0, 3, 4, 5, 6],
[1, 2, 0, 4, 5, 6],
[1, 2, 3, 0, 5, 6],
[1, 2, 3, 4, 0, 6],
[1, 2, 3, 4, 5, 0],
[0, 0, 3, 4, 5, 6],
[1, 0, 0, 4, 5, 6],
]),
np.array([
[0.4, 0.4, 2],
[0.7, 0.7, 5],
[0.8, 0.8, 3],
[0.9, 0.9, 1],
]),
np.array([
[1, 2, 0, 4, 5, 6],
[1, 2, 3, 4, 5, 0],
[0, 0, 3, 4, 5, 6],
[1, 0, 0, 4, 5, 6],
]),
np.array(
[
[0.1, 0.1, 5555],
[0.2, 0.2, 6666],
[0.3, 0.3, 7777],
[0.4, 0.4, 2],
[0.5, 0.5, 8888],
[0.6, 0.6, 9999],
[0.7, 0.7, 5],
[0.8, 0.8, 3],
[0.9, 0.9, 1],
]
),
np.array(
[
[1, 2, 3, 4, 5, 6],
[0, 2, 3, 4, 5, 6],
[1, 0, 3, 4, 5, 6],
[1, 2, 0, 4, 5, 6],
[1, 2, 3, 0, 5, 6],
[1, 2, 3, 4, 0, 6],
[1, 2, 3, 4, 5, 0],
[0, 0, 3, 4, 5, 6],
[1, 0, 0, 4, 5, 6],
]
),
np.array(
[
[0.4, 0.4, 2],
[0.7, 0.7, 5],
[0.8, 0.8, 3],
[0.9, 0.9, 1],
]
),
np.array(
[
[1, 2, 0, 4, 5, 6],
[1, 2, 3, 4, 5, 0],
[0, 0, 3, 4, 5, 6],
[1, 0, 0, 4, 5, 6],
]
),
)
],
)
Expand Down
5 changes: 4 additions & 1 deletion tests/test_init_instances_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@
from services.preprocessing.init.instances_matrix import InitInstancesMatrixProcessor

from tests.test_data import config
from tests.test_data import real_image_count
from tests.utils import generate_init_pcd


@pytest.mark.parametrize("init_pcd", [generate_init_pcd(config)])
def test_init_map(init_pcd: o3d.geometry.PointCloud):
points2instances = InitInstancesMatrixProcessor().process(config, init_pcd)

real_image_count = config.end_index - (
config.start_index - config.start_image_index_offset
)

assert points2instances.shape == (len(init_pcd.points), real_image_count)
6 changes: 5 additions & 1 deletion tests/test_init_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@
from services.preprocessing.init.map import InitMapProcessor

from tests.test_data import config
from tests.test_data import real_init_map_size


def test_init_map():
init_pcd = InitMapProcessor().process(config)

real_init_map_size = sum(
len(config.dataset.get_point_cloud(i).points)
for i in range(config.start_index, config.end_index)
)

assert len(init_pcd.points) == real_init_map_size

0 comments on commit 331304f

Please sign in to comment.