mit-han-lab / spvnas

[ECCV 2020] Searching Efficient 3D Architectures with Sparse Point-Voxel Convolution
http://spvnas.mit.edu/
MIT License
588 stars 109 forks source link

about submit test prediction to SemanticKITTI competition #89

Closed suyunzzz closed 2 years ago

suyunzzz commented 2 years ago

Hello,

Sorry for the delayed response since I'm involved with some other projects recently. I believe your understanding is correct. But this actually doesn't hurt in both training and testing since we are working on voxelized grids in training (where voxels with at least 2 conflicting labels will be ignored) and using the original labels in testing. Hope that answer helps.

Thanks, Haotian

Originally posted by @kentangSJTU in https://github.com/mit-han-lab/spvnas/issues/17#issuecomment-723093805

suyunzzz commented 2 years ago

Hello,

Sorry for the delayed response since I'm involved with some other projects recently. I believe your understanding is correct. But this actually doesn't hurt in both training and testing since we are working on voxelized grids in training (where voxels with at least 2 conflicting labels will be ignored) and using the original labels in testing. Hope that answer helps.

Thanks, Haotian

Originally posted by @kentangSJTU in #17 (comment)

hello, I want to know how can i get right label format(SemanticKITTI competition format)?

this is my code, can it work?

feed_dict = process_point_cloud(pc, label)
inputs = feed_dict['lidar'].to(device)
outputs = model(inputs)
predictions = outputs.argmax(1).cpu().numpy()
predictions = predictions[feed_dict['inverse_map']] 
suyunzzz commented 2 years ago

@zhijian-liu hello, zhijian, could you please give a answer? :)

kentang-mit commented 2 years ago

Hello,

Sorry for the delayed response. I think you can try that

def create_label_map(num_classes=19):
    name_label_mapping = {
        "unlabeled": 0,
        "outlier": 1,
        "car": 10,
        "bicycle": 11,
        "bus": 13,
        "motorcycle": 15,
        "on-rails": 16,
        "truck": 18,
        "other-vehicle": 20,
        "person": 30,
        "bicyclist": 31,
        "motorcyclist": 32,
        "road": 40,
        "parking": 44,
        "sidewalk": 48,
        "other-ground": 49,
        "building": 50,
        "fence": 51,
        "other-structure": 52,
        "lane-marking": 60,
        "vegetation": 70,
        "trunk": 71,
        "terrain": 72,
        "pole": 80,
        "traffic-sign": 81,
        "other-object": 99,
        "moving-car": 252,
        "moving-bicyclist": 253,
        "moving-person": 254,
        "moving-motorcyclist": 255,
        "moving-on-rails": 256,
        "moving-bus": 257,
        "moving-truck": 258,
        "moving-other-vehicle": 259,
    }

    for k in name_label_mapping:
        name_label_mapping[k] = name_label_mapping[k.replace("moving-", "")]
    train_label_name_mapping = {
        0: "car",
        1: "bicycle",
        2: "motorcycle",
        3: "truck",
        4: "other-vehicle",
        5: "person",
        6: "bicyclist",
        7: "motorcyclist",
        8: "road",
        9: "parking",
        10: "sidewalk",
        11: "other-ground",
        12: "building",
        13: "fence",
        14: "vegetation",
        15: "trunk",
        16: "terrain",
        17: "pole",
        18: "traffic-sign",
    }

    label_map = np.zeros(num_classes)
    for i in range(num_classes):
        cls_name = train_label_name_mapping[i]
        label_map[i] = name_label_mapping[cls_name]
    return label_map.astype(np.int64)

Once you have the label_map, just do label_map[predictions] to convert your predictions to the submission format. The predictions should be an np.int32 or np.int64 tensor.

Best, Haotian

suyunzzz commented 2 years ago
name_label_mapping 

thanks a lot, I forgot to do the mapping

moshicaixi commented 1 year ago
name_label_mapping 

thanks a lot, I forgot to do the mapping

Hi, could you supply a whole test file, including how to save the predictions into label file? THX

suyunzzz commented 1 year ago
name_label_mapping 

thanks a lot, I forgot to do the mapping

Hi, could you supply a whole test file, including how to save the predictions into label file? THX

https://blog.csdn.net/suyunzzz/article/details/124167886?spm=1001.2014.3001.5501 @moshicaixi