diff --git a/README.md b/README.md index de197c61776c26523f3157b355fa955787ba373b..2eef3d1687c913c69389fab9e585e39c69db652c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,24 @@ # LOST +# ECE613 README +Convert KITTI Labels to COCO version +``` +cd tools/Kitti2Coco +python kitti2coco-label-trans.py train $KITTI_ROOT +python kitti2coco-label-trans.py val $KITTI_ROOT +cd - + +pip install -r requirements.txt +git clone https://github.com/facebookresearch/dino.git +cd dino; +touch __init__.py +echo -e "import sys\nfrom os.path import dirname, join\nsys.path.insert(0, join(dirname(__file__), '.'))" >> __init__.py; +cd - + +``` + + + +# Original README Pytorch implementation of the unsupervised object discovery method **LOST**. More details can be found in the paper: **Localizing Objects with Self-Supervised Transformers and no Labels**, BMVC 2021 [[arXiv](https://arxiv.org/abs/2109.14279)] diff --git a/main_lost.py b/main_lost.py index 898ff9b04acb18b71cfd3376333cb430c07c8520..c8e6b0b08be8454d34a67247d964ee96aeb5fd68 100755 --- a/main_lost.py +++ b/main_lost.py @@ -128,7 +128,7 @@ if __name__ == "__main__": if args.image_path is not None: dataset = ImageDataset(args.image_path) elif args.dataset == "KITTI": - dataset = ImageFolderDataset("/root/kitti/training/image_2/") + dataset = ImageFolderDataset("/root/kitti/training/image_2/") # TODO dont hard code else: dataset = Dataset(args.dataset, args.set, args.no_hard) @@ -337,8 +337,6 @@ if __name__ == "__main__": continue # Compare prediction to GT boxes - ious = [] - ious = bbox_iou(torch.from_numpy(pred), torch.from_numpy(np.asarray(gt_bbxs))) if torch.any(ious >= 0.50): @@ -348,7 +346,6 @@ if __name__ == "__main__": if i >= 0.50: corloc[im_id] += 1 - cnt += len(inp[2]) if cnt % 50 == 0: diff --git a/scripts/run-dataset.sh b/scripts/run-dataset.sh old mode 100644 new mode 100755 diff --git a/scripts/run-single-image.sh b/scripts/run-single-image.sh old mode 100644 new mode 100755 index 720f909c75fe9e2f9b587a7e2ce3b24cbc4df4a5..35888852e55af5d63919b0ed978d1b5088be463d --- a/scripts/run-single-image.sh +++ b/scripts/run-single-image.sh @@ -4,27 +4,24 @@ declare -a images=( #"000028" "000048" "000066" "004459" "000435" "003333" "000291" "000003" ) -DATASET_PATH=/root/kitti/training/image_2/ -DINO_PATH=/root/lost/dino + +DATASET_PATH=$KITTI_ROOT/training/image_2/ +LOST_PATH=~/lost +DINO_PATH=$LOST_PATH/dino +OUTPUT_PATH=$LOST_PATH/outputs/samples DINO_ARCH=vit_base LOST_FEATURES=k K_PATCHES=10 PATCH_SIZE=16 -OUTPUT_PATH=/root/lost/outputs/samples rm -rf $OUTPUT_PATH for i in "${images[@]}" do echo evaluating $i - - #mkdir -p $OUTPUT_PATH/$i/dino mkdir -p $OUTPUT_PATH/$i/lost - #mkdir -p $OUTPUT_PATH/$i/lost-dinoseg - #mkdir -p $OUTPUT_PATH/$i/images - - cd /root/lost/ + cd $LOST_PATH python main_lost.py \ --image_path $DATASET_PATH/$i.png \ @@ -53,5 +50,4 @@ do --visualize seed_expansion \ --num_init_seeds 1 - echo done \ No newline at end of file diff --git a/tools/Kitti2Coco/README.md b/tools/Kitti2Coco/README.md index e2a2d347f3c2b8b8d27aaaec4706947a4f3807ab..c79708b22e05c73170ccb45cef7f26ddcf18f3f8 100644 --- a/tools/Kitti2Coco/README.md +++ b/tools/Kitti2Coco/README.md @@ -5,4 +5,6 @@ taken from https://github.com/packyan/Kitti2Coco modifications done by Spencer Delcore ## this this a tool to tranfrom these two datasets labels. -use`kitti2coco-label-trans.py' to tansfrom labels. +``` +python kitti2coco-label-trans.py train $PATH_TO_KITTI +``` diff --git a/tools/Kitti2Coco/kitti2coco-label-trans.py b/tools/Kitti2Coco/kitti2coco-label-trans.py index 5eba83ff90385e6e219237e0fcb24760d6ebb643..7424245e8170d0e2f5335f316346d62303796a6a 100644 --- a/tools/Kitti2Coco/kitti2coco-label-trans.py +++ b/tools/Kitti2Coco/kitti2coco-label-trans.py @@ -18,9 +18,13 @@ valid_labels = [ 'Tram', 'Misc' ] + +KITTI_FOLDER_PATH = sys.argv[2] +KITTI_FILE_NAME = sys.argv[1] + #data_set path -kitti_img_path = '/root/kitti/training/image_2/' -kitti_label_path = '/root/kitti/training/label_2/' +kitti_img_path = KITTI_FOLDER_PATH + '/training/image_2/' +kitti_label_path = KITTI_FOLDER_PATH + '/training/label_2/' #transformed lables path kitti_label_tosave_path = 'labels2coco/' @@ -34,8 +38,6 @@ kitti_data_real_path = kitti_img_path index = 0 cvfont = cv2.FONT_HERSHEY_SIMPLEX -KITTI_FILE_NAME = sys.argv[1] - if KITTI_FILE_NAME != 'train' or KITTI_FILE_NAME != 'val': exit