# pylint: disable=duplicate-code"""CC-3DT with BEV detector on nuScenes."""from__future__importannotationsfromvis4d.configimportclass_configfromvis4d.config.typingimportDataConfig,ExperimentConfigfromvis4d.data.constimportCommonKeysasKfromvis4d.data.datasets.nuscenes_detectionimportNuScenesDetectionfromvis4d.data.io.hdf5importHDF5Backendfromvis4d.engine.callbacksimportEvaluatorCallbackfromvis4d.engine.connectorsimportCallbackConnectorfromvis4d.eval.nuscenesimport(NuScenesDet3DEvaluator,NuScenesTrack3DEvaluator,)fromvis4d.zoo.baseimportget_default_callbacks_cfgfromvis4d.zoo.cc_3dt.cc_3dt_bevformer_base_velo_lstm_nuscimport(get_configasget_cc_3dt_config,)fromvis4d.zoo.cc_3dt.dataimport(CONN_NUSC_DET3D_EVAL,CONN_NUSC_TRACK3D_EVAL,get_test_dataloader,)
[docs]defget_config()->ExperimentConfig:"""Returns the config dict for CC-3DT on nuScenes. Returns: ExperimentConfig: The configuration """######################################################## General Config ########################################################config=get_cc_3dt_config().ref_mode()config.experiment_name="cc_3dt_nusc_test"######################################################## Datasets with augmentations ########################################################config.pure_detection=""data=DataConfig()data.train_dataloader=Nonetest_dataset=class_config(NuScenesDetection,data_root="data/nuscenes",version="v1.0-test",split="test",keys_to_load=[K.images,K.original_images],data_backend=class_config(HDF5Backend),pure_detection=config.pure_detection,cache_as_binary=True,cached_file_path="data/nuscenes/test.pkl",)data.test_dataloader=get_test_dataloader(test_dataset=test_dataset,samples_per_gpu=1,workers_per_gpu=4)config.data=data######################################################## CALLBACKS ######################################################### Logger and Checkpointcallbacks=get_default_callbacks_cfg(config.output_dir)# Evaluatorcallbacks.append(class_config(EvaluatorCallback,evaluator=class_config(NuScenesDet3DEvaluator,data_root="data/nuscenes",version="v1.0-test",split="test",save_only=True,),save_predictions=True,save_prefix=config.output_dir,test_connector=class_config(CallbackConnector,key_mapping=CONN_NUSC_DET3D_EVAL),))callbacks.append(class_config(EvaluatorCallback,evaluator=class_config(NuScenesTrack3DEvaluator),save_predictions=True,save_prefix=config.output_dir,test_connector=class_config(CallbackConnector,key_mapping=CONN_NUSC_TRACK3D_EVAL),))config.callbacks=callbacksreturnconfig.value_mode()