From d72b6c1edc7b6b9f1b401ec358a8c3e5de634aa9 Mon Sep 17 00:00:00 2001 From: SamSamhuns Date: Mon, 26 Feb 2024 23:09:29 +0400 Subject: [PATCH] Update setup instructions & reqs --- README.md | 12 ++++++++++++ adv_patch_gen/README.md | 22 ++++++++++++---------- adv_patch_gen/requirements.txt | 1 + train_patch.py | 2 +- 4 files changed, 26 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index a4b5d93e9a5f..a832205c651b 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,8 @@ https://github.com/SamSamhuns/yolov5_adversarial/assets/13418507/b389449f-98a4-4 | :----------------------------------------------------------: | :--------------------------------------------------------: | | | | +## Setup + Note: Install all required dependencies as mentioned in the main YOLOv5 repository and install additional yolov5 adversarial dependency as follows: ```shell @@ -27,8 +29,18 @@ pip install -r adv_patch_gen/requirements.txt Detailed instructions for setup and docker use at [adv_patch_gen/README.md](adv_patch_gen/README.md) +## Download VisDrone Dataset + +Download Task 1 trainset, valset, and testset-dev sets from . Place data under `data/visdrone_data`. + +## Conver VisDrone Dataset to YOLO format + +Refer to [adv_patch_gen/conv_visdrone_2_yolo/README.md](adv_patch_gen/conv_visdrone_2_yolo/README.md) + ## Train an adversarial patch against the detector +Dataset paths should be correctly set in the config json file. + ```shell python train_patch.py --cfg adv_patch_gen/configs/base.json ``` diff --git a/adv_patch_gen/README.md b/adv_patch_gen/README.md index ba0a4c58a76f..d03cbfa2cba0 100644 --- a/adv_patch_gen/README.md +++ b/adv_patch_gen/README.md @@ -1,14 +1,5 @@ # Installing additional requirements -To setup pycocotools: - -```bash -pip install Cython -sudo apt-get install python3.8-dev # or any desired python version -pip install pycocotools # https://github.com/ppwwyyxx/cocoapi -# pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI # depreciated -``` - ## Convert YOLO annotation to COCO annotation Refer to @@ -31,4 +22,15 @@ mkdir -p "$(pwd)"/data ```shell t=yolov5_adversarial:latest && docker run -ti --rm --gpus device=0 -v "$(pwd)"/data:/home/user1/app/data -v "$(pwd)"/runs:/home/user1/app/runs $t bash -`` \ No newline at end of file +``` + +#### Notes on requirements for pycocotools setup: + +If the `pip install -r requirements.txt` is not working. + +```bash +pip install Cython +sudo apt-get install python3.8-dev # or any desired python version +pip install pycocotools # https://github.com/ppwwyyxx/cocoapi +# pip install git+https://github.com/philferriere/cocoapi.git#subdirectory=PythonAPI # depreciated +``` \ No newline at end of file diff --git a/adv_patch_gen/requirements.txt b/adv_patch_gen/requirements.txt index a96b0a7dc985..4a3b5c288298 100644 --- a/adv_patch_gen/requirements.txt +++ b/adv_patch_gen/requirements.txt @@ -1,4 +1,5 @@ # specific to adv_patch_gen, yolov5 base requirements should be installed as well +Cython==3.0.8 easydict==1.12 pycocotools==2.0.6 tensorboard==2.16.2 \ No newline at end of file diff --git a/train_patch.py b/train_patch.py index 7ee0afc420ef..b50e35b9dc6c 100644 --- a/train_patch.py +++ b/train_patch.py @@ -22,7 +22,7 @@ from torch.cuda.amp import autocast from torchvision import transforms as T -from tensorboardX import SummaryWriter +from torch.utils.tensorboard import SummaryWriter from tensorboard import program from models.common import DetectMultiBackend