test_kitti_dataset.py 18.2 KB
Newer Older
dingchang's avatar
dingchang committed
1
# Copyright (c) OpenMMLab. All rights reserved.
yinchimaoliang's avatar
yinchimaoliang committed
2
import numpy as np
xiliu8006's avatar
xiliu8006 committed
3
import os
yinchimaoliang's avatar
yinchimaoliang committed
4
import pytest
xiliu8006's avatar
xiliu8006 committed
5
import tempfile
yinchimaoliang's avatar
yinchimaoliang committed
6
7
8
9
10
11
import torch

from mmdet3d.core.bbox import LiDARInstance3DBoxes
from mmdet3d.datasets import KittiDataset


xiliu8006's avatar
xiliu8006 committed
12
def _generate_kitti_dataset_config():
yinchimaoliang's avatar
yinchimaoliang committed
13
14
15
16
    data_root = 'tests/data/kitti'
    ann_file = 'tests/data/kitti/kitti_infos_train.pkl'
    classes = ['Pedestrian', 'Cyclist', 'Car']
    pts_prefix = 'velodyne_reduced'
xiliu8006's avatar
xiliu8006 committed
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
    pipeline = [
        dict(
            type='LoadPointsFromFile',
            coord_type='LIDAR',
            load_dim=4,
            use_dim=4,
            file_client_args=dict(backend='disk')),
        dict(
            type='MultiScaleFlipAug3D',
            img_scale=(1333, 800),
            pts_scale_ratio=1,
            flip=False,
            transforms=[
                dict(
                    type='GlobalRotScaleTrans',
                    rot_range=[0, 0],
                    scale_ratio_range=[1.0, 1.0],
                    translation_std=[0, 0, 0]),
                dict(type='RandomFlip3D'),
                dict(
                    type='PointsRangeFilter',
                    point_cloud_range=[0, -40, -3, 70.4, 40, 1]),
                dict(
                    type='DefaultFormatBundle3D',
41
                    class_names=classes,
xiliu8006's avatar
xiliu8006 committed
42
43
44
45
46
                    with_label=False),
                dict(type='Collect3D', keys=['points'])
            ])
    ]
    modality = dict(use_lidar=True, use_camera=False)
yinchimaoliang's avatar
yinchimaoliang committed
47
    split = 'training'
xiliu8006's avatar
xiliu8006 committed
48
49
50
    return data_root, ann_file, classes, pts_prefix, pipeline, modality, split


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
def _generate_kitti_multi_modality_dataset_config():
    data_root = 'tests/data/kitti'
    ann_file = 'tests/data/kitti/kitti_infos_train.pkl'
    classes = ['Pedestrian', 'Cyclist', 'Car']
    pts_prefix = 'velodyne_reduced'
    img_norm_cfg = dict(
        mean=[103.530, 116.280, 123.675], std=[1.0, 1.0, 1.0], to_rgb=False)
    pipeline = [
        dict(
            type='LoadPointsFromFile',
            coord_type='LIDAR',
            load_dim=4,
            use_dim=4,
            file_client_args=dict(backend='disk')),
        dict(type='LoadImageFromFile'),
        dict(
            type='MultiScaleFlipAug3D',
            img_scale=(1333, 800),
            pts_scale_ratio=1,
            flip=False,
            transforms=[
                dict(type='Resize', multiscale_mode='value', keep_ratio=True),
                dict(
                    type='GlobalRotScaleTrans',
                    rot_range=[0, 0],
                    scale_ratio_range=[1., 1.],
                    translation_std=[0, 0, 0]),
                dict(type='RandomFlip3D'),
                dict(type='Normalize', **img_norm_cfg),
                dict(type='Pad', size_divisor=32),
                dict(
                    type='PointsRangeFilter',
                    point_cloud_range=[0, -40, -3, 70.4, 40, 1]),
                dict(
                    type='DefaultFormatBundle3D',
                    class_names=classes,
                    with_label=False),
                dict(type='Collect3D', keys=['points', 'img'])
            ])
    ]
    modality = dict(use_lidar=True, use_camera=True)
    split = 'training'
    return data_root, ann_file, classes, pts_prefix, pipeline, modality, split


xiliu8006's avatar
xiliu8006 committed
96
97
def test_getitem():
    np.random.seed(0)
98
99
    data_root, ann_file, classes, pts_prefix, \
        _, modality, split = _generate_kitti_dataset_config()
xiliu8006's avatar
xiliu8006 committed
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
    pipeline = [
        dict(
            type='LoadPointsFromFile',
            coord_type='LIDAR',
            load_dim=4,
            use_dim=4,
            file_client_args=dict(backend='disk')),
        dict(
            type='LoadAnnotations3D',
            with_bbox_3d=True,
            with_label_3d=True,
            file_client_args=dict(backend='disk')),
        dict(
            type='ObjectSample',
            db_sampler=dict(
                data_root='tests/data/kitti/',
                info_path='tests/data/kitti/kitti_dbinfos_train.pkl',
                rate=1.0,
                prepare=dict(
                    filter_by_difficulty=[-1],
                    filter_by_min_points=dict(Pedestrian=10)),
                classes=['Pedestrian', 'Cyclist', 'Car'],
                sample_groups=dict(Pedestrian=6))),
        dict(
            type='ObjectNoise',
            num_try=100,
            translation_std=[1.0, 1.0, 0.5],
            global_rot_range=[0.0, 0.0],
            rot_range=[-0.78539816, 0.78539816]),
        dict(type='RandomFlip3D', flip_ratio_bev_horizontal=0.5),
        dict(
            type='GlobalRotScaleTrans',
            rot_range=[-0.78539816, 0.78539816],
            scale_ratio_range=[0.95, 1.05]),
        dict(
            type='PointsRangeFilter',
            point_cloud_range=[0, -40, -3, 70.4, 40, 1]),
        dict(
            type='ObjectRangeFilter',
            point_cloud_range=[0, -40, -3, 70.4, 40, 1]),
        dict(type='PointShuffle'),
        dict(
            type='DefaultFormatBundle3D',
            class_names=['Pedestrian', 'Cyclist', 'Car']),
        dict(
            type='Collect3D', keys=['points', 'gt_bboxes_3d', 'gt_labels_3d'])
    ]
147
148
149
    kitti_dataset = KittiDataset(data_root, ann_file, split, pts_prefix,
                                 pipeline, classes, modality)
    data = kitti_dataset[0]
yinchimaoliang's avatar
yinchimaoliang committed
150
151
152
153
154
155
156
157
158
159
160
    points = data['points']._data
    gt_bboxes_3d = data['gt_bboxes_3d']._data
    gt_labels_3d = data['gt_labels_3d']._data
    expected_gt_bboxes_3d = torch.tensor(
        [[9.5081, -5.2269, -1.1370, 0.4915, 1.2288, 1.9353, -2.7136]])
    expected_gt_labels_3d = torch.tensor([0])
    assert points.shape == (780, 4)
    assert torch.allclose(
        gt_bboxes_3d.tensor, expected_gt_bboxes_3d, atol=1e-4)
    assert torch.all(gt_labels_3d == expected_gt_labels_3d)

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
    # test multi-modality KITTI dataset
    np.random.seed(0)
    point_cloud_range = [0, -40, -3, 70.4, 40, 1]
    img_norm_cfg = dict(
        mean=[103.530, 116.280, 123.675], std=[1.0, 1.0, 1.0], to_rgb=False)
    multi_modality_pipeline = [
        dict(
            type='LoadPointsFromFile',
            coord_type='LIDAR',
            load_dim=4,
            use_dim=4),
        dict(type='LoadImageFromFile'),
        dict(type='LoadAnnotations3D', with_bbox_3d=True, with_label_3d=True),
        dict(
            type='Resize',
            img_scale=[(640, 192), (2560, 768)],
            multiscale_mode='range',
            keep_ratio=True),
        dict(
            type='GlobalRotScaleTrans',
            rot_range=[-0.78539816, 0.78539816],
            scale_ratio_range=[0.95, 1.05],
            translation_std=[0.2, 0.2, 0.2]),
        dict(type='RandomFlip3D', flip_ratio_bev_horizontal=0.5),
        dict(type='PointsRangeFilter', point_cloud_range=point_cloud_range),
        dict(type='ObjectRangeFilter', point_cloud_range=point_cloud_range),
        dict(type='PointShuffle'),
        dict(type='Normalize', **img_norm_cfg),
        dict(type='Pad', size_divisor=32),
        dict(type='DefaultFormatBundle3D', class_names=classes),
        dict(
            type='Collect3D',
            keys=['points', 'img', 'gt_bboxes_3d', 'gt_labels_3d']),
    ]
    modality = dict(use_lidar=True, use_camera=True)
    kitti_dataset = KittiDataset(data_root, ann_file, split, pts_prefix,
                                 multi_modality_pipeline, classes, modality)
    data = kitti_dataset[0]
    img = data['img']._data
    lidar2img = data['img_metas']._data['lidar2img']

    expected_lidar2img = np.array(
        [[6.02943726e+02, -7.07913330e+02, -1.22748432e+01, -1.70942719e+02],
         [1.76777252e+02, 8.80879879e+00, -7.07936157e+02, -1.02568634e+02],
         [9.99984801e-01, -1.52826728e-03, -5.29071223e-03, -3.27567995e-01],
         [0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 1.00000000e+00]])

    assert img.shape[:] == (3, 416, 1344)
    assert np.allclose(lidar2img, expected_lidar2img)

yinchimaoliang's avatar
yinchimaoliang committed
211
212
213
214

def test_evaluate():
    if not torch.cuda.is_available():
        pytest.skip('test requires GPU and torch+cuda')
215
    data_root, ann_file, classes, pts_prefix, \
xiliu8006's avatar
xiliu8006 committed
216
        pipeline, modality, split = _generate_kitti_dataset_config()
217
218
    kitti_dataset = KittiDataset(data_root, ann_file, split, pts_prefix,
                                 pipeline, classes, modality)
yinchimaoliang's avatar
yinchimaoliang committed
219
220
221
222
223
224
225
226
227
    boxes_3d = LiDARInstance3DBoxes(
        torch.tensor(
            [[8.7314, -1.8559, -1.5997, 0.4800, 1.2000, 1.8900, 0.0100]]))
    labels_3d = torch.tensor([
        0,
    ])
    scores_3d = torch.tensor([0.5])
    metric = ['mAP']
    result = dict(boxes_3d=boxes_3d, labels_3d=labels_3d, scores_3d=scores_3d)
228
    ap_dict = kitti_dataset.evaluate([result], metric)
yinchimaoliang's avatar
yinchimaoliang committed
229
230
231
232
233
234
235
236
237
238
    assert np.isclose(ap_dict['KITTI/Overall_3D_easy'], 3.0303030303030307)
    assert np.isclose(ap_dict['KITTI/Overall_3D_moderate'], 3.0303030303030307)
    assert np.isclose(ap_dict['KITTI/Overall_3D_hard'], 3.0303030303030307)


def test_show():
    import mmcv
    from os import path as osp

    from mmdet3d.core.bbox import LiDARInstance3DBoxes
239
240
241
    tmp_dir = tempfile.TemporaryDirectory()
    temp_dir = tmp_dir.name
    data_root, ann_file, classes, pts_prefix, \
xiliu8006's avatar
xiliu8006 committed
242
        pipeline, modality, split = _generate_kitti_dataset_config()
yinchimaoliang's avatar
yinchimaoliang committed
243
244
245
246
247
248
249
250
251
252
253
254
255
    kitti_dataset = KittiDataset(
        data_root, ann_file, split=split, modality=modality, pipeline=pipeline)
    boxes_3d = LiDARInstance3DBoxes(
        torch.tensor(
            [[46.1218, -4.6496, -0.9275, 0.5316, 1.4442, 1.7450, 1.1749],
             [33.3189, 0.1981, 0.3136, 0.5656, 1.2301, 1.7985, 1.5723],
             [46.1366, -4.6404, -0.9510, 0.5162, 1.6501, 1.7540, 1.3778],
             [33.2646, 0.2297, 0.3446, 0.5746, 1.3365, 1.7947, 1.5430],
             [58.9079, 16.6272, -1.5829, 1.5656, 3.9313, 1.4899, 1.5505]]))
    scores_3d = torch.tensor([0.1815, 0.1663, 0.5792, 0.2194, 0.2780])
    labels_3d = torch.tensor([0, 0, 1, 1, 2])
    result = dict(boxes_3d=boxes_3d, scores_3d=scores_3d, labels_3d=labels_3d)
    results = [result]
256
    kitti_dataset.show(results, temp_dir, show=False)
yinchimaoliang's avatar
yinchimaoliang committed
257
    pts_file_path = osp.join(temp_dir, '000000', '000000_points.obj')
258
259
    gt_file_path = osp.join(temp_dir, '000000', '000000_gt.obj')
    pred_file_path = osp.join(temp_dir, '000000', '000000_pred.obj')
yinchimaoliang's avatar
yinchimaoliang committed
260
261
262
    mmcv.check_file_exist(pts_file_path)
    mmcv.check_file_exist(gt_file_path)
    mmcv.check_file_exist(pred_file_path)
263
264
    tmp_dir.cleanup()

265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
    # test show with pipeline
    eval_pipeline = [
        dict(
            type='LoadPointsFromFile',
            coord_type='LIDAR',
            load_dim=4,
            use_dim=4),
        dict(
            type='DefaultFormatBundle3D',
            class_names=classes,
            with_label=False),
        dict(type='Collect3D', keys=['points'])
    ]
    tmp_dir = tempfile.TemporaryDirectory()
    temp_dir = tmp_dir.name
    kitti_dataset.show(results, temp_dir, show=False, pipeline=eval_pipeline)
    pts_file_path = osp.join(temp_dir, '000000', '000000_points.obj')
    gt_file_path = osp.join(temp_dir, '000000', '000000_gt.obj')
    pred_file_path = osp.join(temp_dir, '000000', '000000_pred.obj')
    mmcv.check_file_exist(pts_file_path)
    mmcv.check_file_exist(gt_file_path)
    mmcv.check_file_exist(pred_file_path)
    tmp_dir.cleanup()

289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
    # test multi-modality show
    tmp_dir = tempfile.TemporaryDirectory()
    temp_dir = tmp_dir.name
    _, _, _, _, multi_modality_pipeline, modality, _ = \
        _generate_kitti_multi_modality_dataset_config()
    kitti_dataset = KittiDataset(data_root, ann_file, split, pts_prefix,
                                 multi_modality_pipeline, classes, modality)
    kitti_dataset.show(results, temp_dir, show=False)
    pts_file_path = osp.join(temp_dir, '000000', '000000_points.obj')
    gt_file_path = osp.join(temp_dir, '000000', '000000_gt.obj')
    pred_file_path = osp.join(temp_dir, '000000', '000000_pred.obj')
    img_file_path = osp.join(temp_dir, '000000', '000000_img.png')
    img_pred_path = osp.join(temp_dir, '000000', '000000_pred.png')
    img_gt_file = osp.join(temp_dir, '000000', '000000_gt.png')
    mmcv.check_file_exist(pts_file_path)
    mmcv.check_file_exist(gt_file_path)
    mmcv.check_file_exist(pred_file_path)
    mmcv.check_file_exist(img_file_path)
    mmcv.check_file_exist(img_pred_path)
    mmcv.check_file_exist(img_gt_file)
    tmp_dir.cleanup()
yinchimaoliang's avatar
yinchimaoliang committed
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
    # test multi-modality show with pipeline
    eval_pipeline = [
        dict(
            type='LoadPointsFromFile',
            coord_type='LIDAR',
            load_dim=4,
            use_dim=4),
        dict(type='LoadImageFromFile'),
        dict(
            type='DefaultFormatBundle3D',
            class_names=classes,
            with_label=False),
        dict(type='Collect3D', keys=['points', 'img'])
    ]
    tmp_dir = tempfile.TemporaryDirectory()
    temp_dir = tmp_dir.name
    kitti_dataset.show(results, temp_dir, show=False, pipeline=eval_pipeline)
    pts_file_path = osp.join(temp_dir, '000000', '000000_points.obj')
    gt_file_path = osp.join(temp_dir, '000000', '000000_gt.obj')
    pred_file_path = osp.join(temp_dir, '000000', '000000_pred.obj')
    img_file_path = osp.join(temp_dir, '000000', '000000_img.png')
    img_pred_path = osp.join(temp_dir, '000000', '000000_pred.png')
    img_gt_file = osp.join(temp_dir, '000000', '000000_gt.png')
    mmcv.check_file_exist(pts_file_path)
    mmcv.check_file_exist(gt_file_path)
    mmcv.check_file_exist(pred_file_path)
    mmcv.check_file_exist(img_file_path)
    mmcv.check_file_exist(img_pred_path)
    mmcv.check_file_exist(img_gt_file)
    tmp_dir.cleanup()

yinchimaoliang's avatar
yinchimaoliang committed
342
343
344

def test_format_results():
    from mmdet3d.core.bbox import LiDARInstance3DBoxes
345
    data_root, ann_file, classes, pts_prefix, \
xiliu8006's avatar
xiliu8006 committed
346
        pipeline, modality, split = _generate_kitti_dataset_config()
347
348
    kitti_dataset = KittiDataset(data_root, ann_file, split, pts_prefix,
                                 pipeline, classes, modality)
yinchimaoliang's avatar
yinchimaoliang committed
349
350
351
352
353
354
355
356
357
    boxes_3d = LiDARInstance3DBoxes(
        torch.tensor(
            [[8.7314, -1.8559, -1.5997, 0.4800, 1.2000, 1.8900, 0.0100]]))
    labels_3d = torch.tensor([
        0,
    ])
    scores_3d = torch.tensor([0.5])
    result = dict(boxes_3d=boxes_3d, labels_3d=labels_3d, scores_3d=scores_3d)
    results = [result]
358
    result_files, tmp_dir = kitti_dataset.format_results(results)
yinchimaoliang's avatar
yinchimaoliang committed
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
    expected_name = np.array(['Pedestrian'])
    expected_truncated = np.array([0.])
    expected_occluded = np.array([0])
    expected_alpha = np.array([-3.3410306])
    expected_bbox = np.array([[710.443, 144.00221, 820.29114, 307.58667]])
    expected_dimensions = np.array([[1.2, 1.89, 0.48]])
    expected_location = np.array([[1.8399826, 1.4700007, 8.410018]])
    expected_rotation_y = np.array([-3.1315928])
    expected_score = np.array([0.5])
    expected_sample_idx = np.array([0])
    assert np.all(result_files[0]['name'] == expected_name)
    assert np.allclose(result_files[0]['truncated'], expected_truncated)
    assert np.all(result_files[0]['occluded'] == expected_occluded)
    assert np.allclose(result_files[0]['alpha'], expected_alpha)
    assert np.allclose(result_files[0]['bbox'], expected_bbox)
    assert np.allclose(result_files[0]['dimensions'], expected_dimensions)
    assert np.allclose(result_files[0]['location'], expected_location)
    assert np.allclose(result_files[0]['rotation_y'], expected_rotation_y)
    assert np.allclose(result_files[0]['score'], expected_score)
    assert np.allclose(result_files[0]['sample_idx'], expected_sample_idx)
379
    tmp_dir.cleanup()
yinchimaoliang's avatar
yinchimaoliang committed
380
381


xiliu8006's avatar
xiliu8006 committed
382
def test_bbox2result_kitti():
383
    data_root, ann_file, classes, pts_prefix, \
xiliu8006's avatar
xiliu8006 committed
384
        pipeline, modality, split = _generate_kitti_dataset_config()
385
386
    kitti_dataset = KittiDataset(data_root, ann_file, split, pts_prefix,
                                 pipeline, classes, modality)
xiliu8006's avatar
xiliu8006 committed
387
388
389
390
391
392
393
394
395
    boxes_3d = LiDARInstance3DBoxes(
        torch.tensor(
            [[8.7314, -1.8559, -1.5997, 0.4800, 1.2000, 1.8900, 0.0100]]))
    labels_3d = torch.tensor([
        0,
    ])
    scores_3d = torch.tensor([0.5])
    result = dict(boxes_3d=boxes_3d, labels_3d=labels_3d, scores_3d=scores_3d)
    results = [result]
396
397
398
    tmp_dir = tempfile.TemporaryDirectory()
    temp_kitti_result_dir = tmp_dir.name
    det_annos = kitti_dataset.bbox2result_kitti(
xiliu8006's avatar
xiliu8006 committed
399
400
401
402
403
404
405
406
407
408
409
        results, classes, submission_prefix=temp_kitti_result_dir)
    expected_file_path = os.path.join(temp_kitti_result_dir, '000000.txt')
    expected_name = np.array(['Pedestrian'])
    expected_dimensions = np.array([1.2000, 1.8900, 0.4800])
    expected_rotation_y = np.array([0.0100]) - np.pi
    expected_score = np.array([0.5])
    assert np.all(det_annos[0]['name'] == expected_name)
    assert np.allclose(det_annos[0]['rotation_y'], expected_rotation_y)
    assert np.allclose(det_annos[0]['score'], expected_score)
    assert np.allclose(det_annos[0]['dimensions'], expected_dimensions)
    assert os.path.exists(expected_file_path)
410
    tmp_dir.cleanup()
xiliu8006's avatar
xiliu8006 committed
411

412
413
    tmp_dir = tempfile.TemporaryDirectory()
    temp_kitti_result_dir = tmp_dir.name
xiliu8006's avatar
xiliu8006 committed
414
415
416
417
418
419
    boxes_3d = LiDARInstance3DBoxes(torch.tensor([]))
    labels_3d = torch.tensor([])
    scores_3d = torch.tensor([])
    empty_result = dict(
        boxes_3d=boxes_3d, labels_3d=labels_3d, scores_3d=scores_3d)
    results = [empty_result]
420
    det_annos = kitti_dataset.bbox2result_kitti(
xiliu8006's avatar
xiliu8006 committed
421
422
423
        results, classes, submission_prefix=temp_kitti_result_dir)
    expected_file_path = os.path.join(temp_kitti_result_dir, '000000.txt')
    assert os.path.exists(expected_file_path)
424
    tmp_dir.cleanup()
xiliu8006's avatar
xiliu8006 committed
425
426


yinchimaoliang's avatar
yinchimaoliang committed
427
def test_bbox2result_kitti2d():
428
    data_root, ann_file, classes, pts_prefix, \
xiliu8006's avatar
xiliu8006 committed
429
        pipeline, modality, split = _generate_kitti_dataset_config()
430
431
    kitti_dataset = KittiDataset(data_root, ann_file, split, pts_prefix,
                                 pipeline, classes, modality)
yinchimaoliang's avatar
yinchimaoliang committed
432
433
434
435
    bboxes = np.array([[[46.1218, -4.6496, -0.9275, 0.5316, 0.5],
                        [33.3189, 0.1981, 0.3136, 0.5656, 0.5]],
                       [[46.1366, -4.6404, -0.9510, 0.5162, 0.5],
                        [33.2646, 0.2297, 0.3446, 0.5746, 0.5]]])
436
    det_annos = kitti_dataset.bbox2result_kitti2d([bboxes], classes)
yinchimaoliang's avatar
yinchimaoliang committed
437
438
439
440
441
442
443
444
445
446
    expected_name = np.array(
        ['Pedestrian', 'Pedestrian', 'Cyclist', 'Cyclist'])
    expected_bbox = np.array([[46.1218, -4.6496, -0.9275, 0.5316],
                              [33.3189, 0.1981, 0.3136, 0.5656],
                              [46.1366, -4.6404, -0.951, 0.5162],
                              [33.2646, 0.2297, 0.3446, 0.5746]])
    expected_score = np.array([0.5, 0.5, 0.5, 0.5])
    assert np.all(det_annos[0]['name'] == expected_name)
    assert np.allclose(det_annos[0]['bbox'], expected_bbox)
    assert np.allclose(det_annos[0]['score'], expected_score)