From 2b16b03f9cbed77a8ce8e24fedb720b4ff6bbdd1 Mon Sep 17 00:00:00 2001 From: Spencer Delcore <sdelcore@uwaterloo.ca> Date: Thu, 23 Mar 2023 17:44:52 -0400 Subject: [PATCH] changed scripts to focus on COCO20k as dataset --- README.md | 2 ++ datasets/COCO | 1 + main_lost.py | 3 ++- scripts/run-dataset.sh | 4 ++-- scripts/run-single-image.sh | 21 +++++++++------------ 5 files changed, 16 insertions(+), 15 deletions(-) create mode 120000 datasets/COCO diff --git a/README.md b/README.md index 66cbd01..0fb1abc 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,8 @@ touch __init__.py echo -e "import sys\nfrom os.path import dirname, join\nsys.path.insert(0, join(dirname(__file__), '.'))" >> __init__.py; cd - +# make sure coco dataset is present at $LOST_PATH/datasets/COCO +ln -sf /root/coco /root/lost/datasets/COCO # replace $COCO_ROOT with path to COCO # replace * with the script you want to run COCO_ROOT=$COCO_ROOT ./scripts/run_*.sh diff --git a/datasets/COCO b/datasets/COCO new file mode 120000 index 0000000..6385f3b --- /dev/null +++ b/datasets/COCO @@ -0,0 +1 @@ +/root/coco \ No newline at end of file diff --git a/main_lost.py b/main_lost.py index f1def0e..49f8cb2 100755 --- a/main_lost.py +++ b/main_lost.py @@ -133,6 +133,7 @@ if __name__ == "__main__": # ------------------------------------------------------------------------------------------------------- # Model device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu") + print("Running on device:", device) model = get_model(args.arch, args.patch_size, args.resnet_dilate, device) # ------------------------------------------------------------------------------------------------------- @@ -161,7 +162,7 @@ if __name__ == "__main__": if args.visualize: vis_folder = f"{args.output_dir}/visualizations/{exp_name}" os.makedirs(vis_folder, exist_ok=True) - + # ------------------------------------------------------------------------------------------------------- # Loop over images preds_dict = {} diff --git a/scripts/run-dataset.sh b/scripts/run-dataset.sh index fa2a485..1a10509 100755 --- a/scripts/run-dataset.sh +++ b/scripts/run-dataset.sh @@ -1,5 +1,5 @@ -OUTPUT_PATH=/root/lost/outputs/kitti +OUTPUT_PATH=/root/lost/outputs/coco DINO_ARCH=vit_base LOST_FEATURES=k @@ -12,7 +12,7 @@ mkdir -p $OUTPUT_PATH echo $OUTPUT_PATH python main_lost.py \ - --dataset KITTI \ + --dataset COCO20k \ --output_dir $OUTPUT_PATH \ --arch $DINO_ARCH \ --which_feature $LOST_FEATURES \ diff --git a/scripts/run-single-image.sh b/scripts/run-single-image.sh index 3588885..e9059f2 100755 --- a/scripts/run-single-image.sh +++ b/scripts/run-single-image.sh @@ -1,11 +1,8 @@ declare -a images=( - #"000011" "004540" "004541" "007256" "007259" "007267" "007265" "007271" - #"000188" "000085" "000038" "000056" "000093" "000263" - #"000028" "000048" "000066" "004459" "000435" "003333" "000291" - "000003" + "COCO_train2014_000000000081" # SOME IMAGE NAME ) -DATASET_PATH=$KITTI_ROOT/training/image_2/ +DATASET_PATH=$COCO_ROOT/train2014/ LOST_PATH=~/lost DINO_PATH=$LOST_PATH/dino OUTPUT_PATH=$LOST_PATH/outputs/samples @@ -20,12 +17,12 @@ rm -rf $OUTPUT_PATH for i in "${images[@]}" do echo evaluating $i - mkdir -p $OUTPUT_PATH/$i/lost + mkdir -p $OUTPUT_PATH/$i cd $LOST_PATH python main_lost.py \ - --image_path $DATASET_PATH/$i.png \ - --output_dir $OUTPUT_PATH/$i/lost \ + --image_path $DATASET_PATH/$i.jpg \ + --output_dir $OUTPUT_PATH/$i \ --arch $DINO_ARCH \ --which_feature $LOST_FEATURES \ --k_patches $K_PATCHES \ @@ -33,8 +30,8 @@ do --num_init_seeds 1 python main_lost.py \ - --image_path $DATASET_PATH/$i.png \ - --output_dir $OUTPUT_PATH/$i/lost \ + --image_path $DATASET_PATH/$i.jpg \ + --output_dir $OUTPUT_PATH/$i \ --arch $DINO_ARCH \ --which_feature $LOST_FEATURES \ --k_patches $K_PATCHES \ @@ -42,8 +39,8 @@ do --num_init_seeds 1 python main_lost.py \ - --image_path $DATASET_PATH/$i.png \ - --output_dir $OUTPUT_PATH/$i/lost \ + --image_path $DATASET_PATH/$i.jpg \ + --output_dir $OUTPUT_PATH/$i \ --arch $DINO_ARCH \ --which_feature $LOST_FEATURES \ --k_patches $K_PATCHES \ -- GitLab