From c1b3a82ea7047ecd6f3c9fb2d2eab1a221468a6c Mon Sep 17 00:00:00 2001 From: Holy Lovenia Date: Sun, 27 Nov 2022 23:21:01 +0800 Subject: [PATCH] Tidy up for project submission --- README.md | 3 +++ object_detection_prediction.py | 2 +- run_data_preprocessing.sh | 16 ++++++++-------- run_object_detection_finetuning.sh | 10 +++++----- run_object_detection_prediction.sh | 2 +- 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 6afaf46..77fb6cc 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,9 @@ The demand for multimodal dialogue system has been rising in various domains, em ``` pip install -r requirements.txt ``` +- To obtain the preprocessed dialogue data, run `./run_data_preprocessing.sh` +- To obtain the preprocessed visual embeddings from DETR, run `./run_object_detection_finetuning.sh` and `./run_object_detection_prediction.sh` +- To obtain the preprocessed visual embeddings from ResNet-50 for the SIMMC 2.1 baselines, download from the [Google Drive](https://drive.google.com/file/d/1jr7r5Yaca80W5n0hizOakTG-F1ns6BGv/view?usp=sharing) provided by the organizers, then place the file under `./preprocessed_data/visual_features/` ## File Structure - git submodules diff --git a/object_detection_prediction.py b/object_detection_prediction.py index 385cba6..ac2adc9 100644 --- a/object_detection_prediction.py +++ b/object_detection_prediction.py @@ -143,7 +143,7 @@ def collate_fn(example_batch): pred_last_hidden_state = torch.index_select(outputs.last_hidden_state.squeeze(), 0, sorted_pred_indices) pred_boxes = torch.index_select(outputs.pred_boxes.squeeze(), 0, sorted_pred_indices) pred_results[MAPPING["id2scene"][batch["image_id"]] + ".png"] = torch.cat([ - pred_last_hidden_state.detach().cpu(), pred_boxes.detach().cpu() + pred_last_hidden_state.detach().cpu() #, pred_boxes.detach().cpu() ], dim=1) if not os.path.exists(data_args.preprocessed_data_dir): os.makedirs(data_args.preprocessed_data_dir) diff --git a/run_data_preprocessing.sh b/run_data_preprocessing.sh index 4d23be7..75bf743 100755 --- a/run_data_preprocessing.sh +++ b/run_data_preprocessing.sh @@ -1,11 +1,11 @@ DATA_FOLDER="/home/holy/datasets/simmc2.1/" -# python simmc2/model/ambiguous_candidates/format_ambiguous_candidates_data.py \ -# --simmc_train_json "/home/holy/datasets/simmc2.1/simmc2.1_dials_dstc11_train.json" \ -# --simmc_dev_json "/home/holy/datasets/simmc2.1/simmc2.1_dials_dstc11_dev.json" \ -# --simmc_devtest_json "/home/holy/datasets/simmc2.1/simmc2.1_dials_dstc11_devtest.json" \ -# --scene_json_folder "/home/holy/datasets/simmc2.1/public/" \ -# --ambiguous_candidates_save_path "./preprocessed_data/ambiguous_candidates/" +python simmc2/model/ambiguous_candidates/format_ambiguous_candidates_data.py \ + --simmc_train_json "/home/holy/datasets/simmc2.1/simmc2.1_dials_dstc11_train.json" \ + --simmc_dev_json "/home/holy/datasets/simmc2.1/simmc2.1_dials_dstc11_dev.json" \ + --simmc_devtest_json "/home/holy/datasets/simmc2.1/simmc2.1_dials_dstc11_devtest.json" \ + --scene_json_folder "/home/holy/datasets/simmc2.1/public/" \ + --ambiguous_candidates_save_path "./preprocessed_data/ambiguous_candidates/" # python simmc2/model/ambiguous_candidates/format_coref_candidates_data.py \ # --simmc_train_json "/home/holy/datasets/simmc2.1/simmc2.1_dials_dstc11_train.json" \ @@ -14,6 +14,6 @@ DATA_FOLDER="/home/holy/datasets/simmc2.1/" # --scene_json_folder "/home/holy/datasets/simmc2.1/public/" \ # --coref_candidates_save_path "./preprocessed_data/coref_candidates|no_mm/" -cd simmc2/model/mm_dst -./run_preprocess_gpt2.sh "/home/holy/projects/ambiguous-mm-dialogue/preprocessed_data/coref_candidates|no_mm" /home/holy/datasets/simmc2.1 +# cd simmc2/model/mm_dst +# ./run_preprocess_gpt2.sh "/home/holy/projects/ambiguous-mm-dialogue/preprocessed_data/coref_candidates|no_mm" /home/holy/datasets/simmc2.1 # ./run_preprocess_gpt2.sh "/home/holy/projects/ambiguous-mm-dialogue/preprocessed_data/coref_candidates|mm" /home/holy/datasets/simmc2.1 \ No newline at end of file diff --git a/run_object_detection_finetuning.sh b/run_object_detection_finetuning.sh index fa89c76..e1e2845 100755 --- a/run_object_detection_finetuning.sh +++ b/run_object_detection_finetuning.sh @@ -1,10 +1,10 @@ CUDA_VISIBLE_DEVICES=1 python object_detection_finetuning.py \ - --output_dir="./save/test/obj-det" \ - --cache_dir="./cache/test/obj-det" \ + --output_dir="./save/obj-det" \ + --cache_dir="./cache/obj-det" \ --model_name_or_path="facebook/detr-resnet-50" \ - --train_dataset_path="./preprocessed_data/coref_candidates/simmc2.1_coref_candidates_dstc11_train.json" \ - --dev_dataset_path="./preprocessed_data/coref_candidates/simmc2.1_coref_candidates_dstc11_dev.json" \ - --devtest_dataset_path="./preprocessed_data/coref_candidates/simmc2.1_coref_candidates_dstc11_devtest.json" \ + --train_dataset_path="./preprocessed_data/ambiguous_candidates/simmc2.1_ambiguous_candidates_dstc11_train.json" \ + --dev_dataset_path="./preprocessed_data/ambiguous_candidates/simmc2.1_ambiguous_candidates_dstc11_dev.json" \ + --devtest_dataset_path="./preprocessed_data/ambiguous_candidates/simmc2.1_ambiguous_candidates_dstc11_devtest.json" \ --per_device_train_batch_size=16 \ --per_device_eval_batch_size=16 \ --num_train_epochs=200 \ diff --git a/run_object_detection_prediction.sh b/run_object_detection_prediction.sh index 8048279..4040b4e 100755 --- a/run_object_detection_prediction.sh +++ b/run_object_detection_prediction.sh @@ -4,7 +4,7 @@ CUDA_VISIBLE_DEVICES=0 python object_detection_prediction.py \ --dev_dataset_path='./preprocessed_data/ambiguous_candidates/simmc2.1_ambiguous_candidates_dstc11_dev.json' \ --devtest_dataset_path='./preprocessed_data/ambiguous_candidates/simmc2.1_ambiguous_candidates_dstc11_devtest.json' \ --cache_dir="./cache/obj-det" \ - --model_name_or_path="./save/obj-det/facebook/detr-resnet-50/checkpoint-1160" \ + --model_name_or_path="./save/obj-det/facebook/detr-resnet-50" \ --per_device_train_batch_size=1 \ --per_device_eval_batch_size=1 \ --num_train_epochs=200 \