Pointcept / PointTransformerV2

[NeurIPS'22] An official PyTorch implementation of PTv2.
356 stars 25 forks source link

classification model #16

Open fw-codes-files opened 1 year ago

fw-codes-files commented 1 year ago

hi, thanks to your great work. I check issues before, that I saw your comment on #11 .The codes about base = [ '../base/datasets/modelnet40.py', '../base/schedulers/multi-step_sgd.py', '../base/tests/classification.py', '../base/default_runtime.py' ] I don't find the references in the project. Could you plz release these py files? thanks a lot!

Gofinge commented 1 year ago

Do you mean issue #9 ? The example config in issue #9 was a config from an older version of our codebase and these are base configs that experiment config based on. Following config setting only for reference:

"../base/datasets/modelnet40.py"

# dataset settings
dataset_type = "ModelNetDataset"
data_root = "data/modelnet40_normal_resampled"
cache_data = False
names = ["airplane", "bathtub", "bed", "bench", "bookshelf",
         "bottle", "bowl", "car", "chair", "cone",
         "cup", "curtain", "desk", "door", "dresser",
         "flower_pot", "glass_box", "guitar", "keyboard", "lamp",
         "laptop", "mantel", "monitor", "night_stand", "person",
         "piano", "plant", "radio", "range_hood", "sink",
         "sofa", "stairs", "stool", "table", "tent",
         "toilet", "tv_stand", "vase", "wardrobe", "xbox"]

data = dict(
    num_classes=40,
    ignore_label=-1,  # dummy ignore
    names=names,
    train=dict(
        type=dataset_type,
        split="train",
        data_root=data_root,
        class_names=names,
        transform=[
            dict(type="NormalizeCoord"),
            # dict(type="RandomDropout", dropout_ratio=0.2, dropout_application_ratio=0.2),
            # dict(type="CenterShift", apply_z=True),
            # dict(type="RandomRotate", angle=[-1, 1], axis='z', center=[0, 0, 0], p=0.5),
            # dict(type="RandomRotate", angle=[-1/24, 1/24], axis='x', p=0.5),
            # dict(type="RandomRotate", angle=[-1/24, 1/24], axis='y', p=0.5),
            dict(type="RandomScale", scale=[0.9, 1.1]),
            # dict(type="RandomFlip", p=0.5),
            # dict(type="RandomJitter", sigma=0.005, clip=0.02),
            dict(type="RandomShift", shift=[0.2, 0.2, 0.2]),
            dict(type="Voxelize", voxel_size=0.02, hash_type='fnv', mode='train'),
            # dict(type="ElasticDistortion", distortion_params=[[0.2, 0.4], [0.8, 1.6]]),

            # dict(type="Voxelize", voxel_size=0.01, hash_type='fnv', mode='train'),
            # dict(type="SphereCrop", point_max=10000, mode='random'),
            # dict(type="CenterShift", apply_z=True),
            dict(type="ShufflePoint"),
            dict(type="ToTensor"),
        ],
        loop=2,
        test_mode=False,
    ),

    val=dict(
        type=dataset_type,
        split="test",
        data_root=data_root,
        class_names=names,
        transform=[
            dict(type="NormalizeCoord"),
            dict(type="ToTensor"),
        ],
        loop=1,
        test_mode=False,
    ),

    test=dict(
        type=dataset_type,
        split="test",
        data_root=data_root,
        class_names=names,
        transform=[
            dict(type="NormalizeCoord"),
            dict(type="ToTensor"),
        ],
        loop=1,
        test_mode=True,
        test_cfg=dict(
        )
    ),
)

criteria = [
    dict(type="CrossEntropyLoss",
         loss_weight=1.0,
         ignore_index=data["ignore_label"])
]

'../base/tests/classification.py'

test = dict(
    type="ClassificationTest",
    # scales=[0.9, 0.95, 1, 1.05, 1.1],
    scales=[1],
    shuffle=True
)

'../base/schedulers/multi-step_sgd.py'

epochs = 100
start_epoch = 0
optimizer = dict(type='SGD', lr=0.5, momentum=0.9, weight_decay=0.0001, nesterov=True)
scheduler = dict(type='MultiStepLR', milestones=[epochs * 0.6, epochs * 0.8], steps_per_epoch=1, gamma=0.1)

'../base/default_runtime.py' Also exists in the current version. To bring more flexibility to research config, current and future version PCR config only based on '../base/default_runtime.py'