Skip to content

some annos have '0' in size #8

@zjr-bit

Description

@zjr-bit

Hi, thanks for your great work.
When I try to use V2XSim in mmdetection3D, I find that there are some zeros in key size in some sample_annotations. So I use the below code to find them:

from nuscenes.nuscenes import NuScenes
version = 'v2.0'
root_path = 'xxx'
nusc = NuScenes(version=version, dataroot=root_path, verbose=True)

'''impletment of nusc.list_categories()'''
import numpy as np
print('Category stats for split %s:' % nusc.version)

# Add all annotations.
categories = dict()
count = 0
has_zero = dict()
for record in nusc.sample_annotation:
    if record['category_name'] not in categories:
        categories[record['category_name']] = []
    if np.all(np.array(record['size'])>0):
        categories[record['category_name']].append(record['size'] + [record['size'][1] / record['size'][0]])
    else:
        # print('{} category_name: {}'.format(record['token'], record['category_name']))
        count += 1
        if record['category_name'] not in has_zero:
            has_zero[record['category_name']] = []
        else:
            has_zero[record['category_name']].append(record['token'])
            
# Print stats.
for name, stats in sorted(categories.items()):
    stats = np.array(stats)
    print('{:27} n={:5}, width={:5.2f}\u00B1{:.2f}, len={:5.2f}\u00B1{:.2f}, height={:5.2f}\u00B1{:.2f}, '
            'lw_aspect={:5.2f}\u00B1{:.2f}'.format(name[:27], stats.shape[0],
                                                    np.mean(stats[:, 0]), np.std(stats[:, 0]),
                                                    np.mean(stats[:, 1]), np.std(stats[:, 1]),
                                                    np.mean(stats[:, 2]), np.std(stats[:, 2]),
                                                    np.mean(stats[:, 3]), np.std(stats[:, 3])))
print('total num of sample_anns which has 0 size: {}'.format(count))
for name, toks in sorted(has_zero.items()):
    print('{}: {}'.format(name, len(toks)))

The output are as below:

Category stats for split v2.0:
vehicle.bicycle             n=163636, width= 0.86±0.00, len= 1.49±0.00, height= 1.08±0.00, lw_aspect= 1.73±0.00
vehicle.car                 n=3131521, width= 2.02±0.24, len= 4.47±0.82, height= 1.65±0.29, lw_aspect= 2.20±0.26
vehicle.emergency.police    n=159584, width= 2.04±0.00, len= 4.97±0.00, height= 1.55±0.00, lw_aspect= 2.44±0.00
vehicle.motorcycle          n=469049, width= 0.81±0.04, len= 2.21±0.13, height= 1.23±0.06, lw_aspect= 2.91±11.38
total num of sample_anns which has 0 size: 366383
vehicle.bicycle: 366382

I was wondering if this was an error or if there was a deliberate intention behind it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions