PJLab-ADG / 3DTrans

An open-source codebase for exploring autonomous driving pre-training
https://bobrown.github.io/Team_3DTrans.github.io/
Apache License 2.0
585 stars 72 forks source link

Using the merge_labels.py file #20

Closed martiiv closed 9 months ago

martiiv commented 10 months ago

Hello!

I am trying to pretrain using AD-PT and I have encountered a problem. I am aware that after you configure the ONCE dataset using this command:

python -m pcdet.datasets.once.once_dataset --func create_once_infos --cfg_file tools/cfgs/dataset_configs/once/OD/once_dataset.yaml

I realized later that you can't pre train using the produced files so I needed to merge the labels of the produced files using merge_labels.py located in the tools_utils folder.

Converting the files I get a Keyworderror 'Vehicle' error when trying to run the pre training script

You need to merge the labels in the once_infos_train.pkl, once_dbinfos_train.pkl and once_dbinfos_val.pkl files to produce the once_infos_train_vehicle.pkl files. However, when trying to merge the labels I end up with an identical file. I am using the following command

python -m tools.tools_utils.merge_labels --raw_data_pkl once_dbinfos_train.pkl --save_path once_dbinfos_vehicle.pkl

I think I need to provide something with the --vehicle_pkl command as this argument reads from a vehicle.pkl file but I don't know what type of file I need to provide and/or where I get it from!

Has anyone encountered this problem before?

BOBrown commented 10 months ago

Hi Martiiv @martiiv

once dataset yaml and once pre-training dataset yaml achieved by our repo combine the 'Car', 'Bus', 'Truck' classes. So, you can find in once dataset yaml that, we use the once_infos_train_vehicle.pkl and once_infos_val_vehicle.pkl, which are generated by merging the the 'Car', 'Bus', 'Truck' classes into the 'Vehicle' classes.

You can download the once_infos_train_vehicle.pkl and once_infos_val_vehicle.pkl here: once_infos_val_vehicle and once_infos_train_vehicle

martiiv commented 10 months ago

Hello and thanks for the reply BoBrown @BOBrown

Could you provide the command you use to generate the vehicle infos pkl files? I have tried this command:

python -m pcdet.datasets.once.once_dataset --func create_once_infos --cfg_file tools/cfgs/dataset_configs/once/OD/once_dataset_vehicle_unlabeled_S.yaml

But this file: pcdet.datasets.once.once_dataset only generates the regular once_infos_train.pkl files Am I using the wrong module for generating the infos?

BOBrown commented 10 months ago

@martiiv

By performing the following command:

python -m pcdet.datasets.once.once_dataset --func create_once_infos --cfg_file tools/cfgs/dataset_configs/once/OD/once_dataset_vehicle_unlabeled_S.yaml

you can only obtain the once_infos_train.pkl, and you can change the class name from 'Car', 'Bus', 'Truck' to a unified class name 'Vehicle'.

martiiv commented 10 months ago

@BOBrown I see, so you use the merge_labels.py file to merge the classes? IF so could you list the command you use to merge the labels? I have tried: python -m tools.tools_utils.merge_labels.py --raw_data_pkl once_infos_train.pkl --save_path once_infos_train_vehicle.pkl but this produces an identical file to once_infos_train.pkl

BOBrown commented 10 months ago

@martiiv

merge_labels.py https://github.com/PJLab-ADG/3DTrans/blob/master/tools/tools_utils/merge_labels.py is not used for merging the 'Car', 'Bus', 'Truck' into 'Vehicle' class.

merge_labels.py is used for merging pseudo-labeled 'Vehicle', 'Cyclist', 'Pedestrian', where we can obtain the pseudo-labeled pkl of different classes using different detectors. Since we found that detector with CenterHead (such as CenterPoint) is good at recognizing the 'Pedestrian' class. So, we use PV-RCNN++ to pseudo-label 'Vehicle' and 'Cyclist' classes, and utilize CenterPoint to to pseudo-label 'Pedestrian'. Then, we use the merge_labels.py to merge the pseudo-labeled results.

Here is an example:

--vehicle_pkl ../output/vehi_cyclist_L_0.7_result.pkl --cyclist_pkl ../output/vehi_cyclist_L_0.7_result.pkl --pedestrian_pkl output/pede_L_0.7_result.pkl --raw_data_pkl ../data/once/once_infos_raw_large.pkl --save_path once_large_vehi_cyc_ped_pseudo.pkl
BOBrown commented 10 months ago

@martiiv

--raw_data_pkl is the path of ONCE unlabeled data, such as once_infos_raw_large.pkl.

martiiv commented 9 months ago

Thank you for all the help! Issue is solved now!