test_indoor_augment.py 3.71 KB
Newer Older
liyinhao's avatar
liyinhao committed
1
2
import numpy as np

3
from mmdet3d.datasets.pipelines.indoor_augment import (IndoorFlipData,
liyinhao's avatar
liyinhao committed
4
                                                       IndoorRotateData)
liyinhao's avatar
liyinhao committed
5
6
7
8
9


def test_indoor_flip_data():
    sunrgbd_flip_data = IndoorFlipData('sunrgbd')
    sunrgbd_results = dict()
liyinhao's avatar
liyinhao committed
10
    sunrgbd_results['point_cloud'] = np.array(
liyinhao's avatar
liyinhao committed
11
12
13
14
15
16
17
18
19
20
21
        [[1.02828765e+00, 3.65790772e+00, 1.97294697e-01, 1.61959505e+00],
         [-3.95979017e-01, 1.05465031e+00, -7.49204338e-01, 6.73096001e-01]])
    sunrgbd_results['gt_boxes'] = np.array([[
        0.213684, 1.036364, -0.982323, 0.61541, 0.572574, 0.872728, 3.07028526
    ],
                                            [
                                                -0.449953, 1.395455, -1.027778,
                                                1.500956, 1.637298, 0.636364,
                                                -1.58242359
                                            ]])
    sunrgbd_results = sunrgbd_flip_data(sunrgbd_results)
liyinhao's avatar
liyinhao committed
22
    sunrgbd_point_cloud = sunrgbd_results.get('point_cloud', None)
liyinhao's avatar
liyinhao committed
23
    sunrgbd_gt_boxes = sunrgbd_results.get('gt_boxes', None)
liyinhao's avatar
liyinhao committed
24
    assert sunrgbd_point_cloud.shape == (2, 4)
liyinhao's avatar
liyinhao committed
25
    assert sunrgbd_gt_boxes.shape == (2, 7)
liyinhao's avatar
liyinhao committed
26

liyinhao's avatar
liyinhao committed
27
28
    scannet_flip_data = IndoorFlipData('scannet')
    scannet_results = dict()
liyinhao's avatar
liyinhao committed
29
    scannet_results['point_cloud'] = np.array(
liyinhao's avatar
liyinhao committed
30
31
32
33
34
35
36
37
        [[1.6110241e+00, -1.6903955e-01, 5.8115810e-01, 5.9897250e-01],
         [1.3978075e+00, 4.2035791e-01, 3.8729519e-01, 4.0510958e-01]])
    scannet_results['gt_boxes'] = np.array([[
        0.55903838, 0.48201692, 0.65688646, 0.65370704, 0.60029864, 0.5163464
    ], [
        -0.03226406, 1.70392646, 0.60348618, 0.65165804, 0.72084366, 0.64667457
    ]])
    scannet_results = scannet_flip_data(scannet_results)
liyinhao's avatar
liyinhao committed
38
    scannet_point_cloud = scannet_results.get('point_cloud', None)
liyinhao's avatar
liyinhao committed
39
    scannet_gt_boxes = scannet_results.get('gt_boxes', None)
liyinhao's avatar
liyinhao committed
40
    assert scannet_point_cloud.shape == (2, 4)
liyinhao's avatar
liyinhao committed
41
    assert scannet_gt_boxes.shape == (2, 6)
42
43
44
45


def test_indoor_rotate_data():
    sunrgbd_indoor_rotate_data = IndoorRotateData('sunrgbd')
liyinhao's avatar
liyinhao committed
46

47
    sunrgbd_results = dict()
liyinhao's avatar
liyinhao committed
48
    sunrgbd_results['point_cloud'] = np.array(
49
50
51
52
53
54
55
56
57
58
59
        [[1.02828765e+00, 3.65790772e+00, 1.97294697e-01, 1.61959505e+00],
         [-3.95979017e-01, 1.05465031e+00, -7.49204338e-01, 6.73096001e-01]])
    sunrgbd_results['gt_boxes'] = np.array([[
        0.213684, 1.036364, -0.982323, 0.61541, 0.572574, 0.872728, 3.07028526
    ],
                                            [
                                                -0.449953, 1.395455, -1.027778,
                                                1.500956, 1.637298, 0.636364,
                                                -1.58242359
                                            ]])
    sunrgbd_results = sunrgbd_indoor_rotate_data(sunrgbd_results)
liyinhao's avatar
liyinhao committed
60
    sunrgbd_point_cloud = sunrgbd_results.get('point_cloud', None)
61
    sunrgbd_gt_boxes = sunrgbd_results.get('gt_boxes', None)
liyinhao's avatar
liyinhao committed
62
    assert sunrgbd_point_cloud.shape == (2, 4)
63
    assert sunrgbd_gt_boxes.shape == (2, 7)
liyinhao's avatar
liyinhao committed
64
65

    scannet_indoor_rotate_data = IndoorRotateData('scannet')
66
    scannet_results = dict()
liyinhao's avatar
liyinhao committed
67
    scannet_results['point_cloud'] = np.array(
68
69
70
71
72
73
74
75
        [[1.6110241e+00, -1.6903955e-01, 5.8115810e-01, 5.9897250e-01],
         [1.3978075e+00, 4.2035791e-01, 3.8729519e-01, 4.0510958e-01]])
    scannet_results['gt_boxes'] = np.array([[
        0.55903838, 0.48201692, 0.65688646, 0.65370704, 0.60029864, 0.5163464
    ], [
        -0.03226406, 1.70392646, 0.60348618, 0.65165804, 0.72084366, 0.64667457
    ]])
    scannet_results = scannet_indoor_rotate_data(scannet_results)
liyinhao's avatar
liyinhao committed
76
    scannet_point_cloud = scannet_results.get('point_cloud', None)
77
    scannet_gt_boxes = scannet_results.get('gt_boxes', None)
liyinhao's avatar
liyinhao committed
78
    assert scannet_point_cloud.shape == (2, 4)
79
    assert scannet_gt_boxes.shape == (2, 6)