From bdf17e8356d3bf92978643d8e419e3b20d97879e Mon Sep 17 00:00:00 2001 From: zhanli <719901725@qq.com> Date: Fri, 22 Sep 2023 00:47:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=8B=A5=E5=B9=B2=E7=BB=86?= =?UTF-8?q?=E8=8A=82=E6=94=AF=E6=8C=81=E6=9C=AC=E5=9C=B0GPU=E5=92=8C?= =?UTF-8?q?=E8=BF=9C=E7=A8=8BGPU=E8=AE=AD=E7=BB=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++ README.md | 38 ++++++++++++++---- __pycache__/defaults.cpython-38.pyc | Bin 3454 -> 3485 bytes __pycache__/engine.cpython-38.pyc | Bin 5009 -> 5040 bytes __pycache__/eval_func.cpython-38.pyc | Bin 10105 -> 10136 bytes configs/cuhk_sysu-local.yaml | 15 +++++++ configs/prw-local.yaml | 13 ++++++ datasets/__pycache__/__init__.cpython-38.pyc | Bin 206 -> 237 bytes datasets/__pycache__/base.cpython-38.pyc | Bin 1772 -> 1803 bytes datasets/__pycache__/build.cpython-38.pyc | Bin 2525 -> 2556 bytes datasets/__pycache__/cuhk_sysu.cpython-38.pyc | Bin 3966 -> 3997 bytes datasets/__pycache__/prw.cpython-38.pyc | Bin 2924 -> 2955 bytes defaults.py | 2 +- loss/__pycache__/oim.cpython-38.pyc | Bin 2531 -> 2562 bytes loss/__pycache__/softmax_loss.cpython-38.pyc | Bin 2145 -> 2176 bytes models/__pycache__/coat.cpython-38.pyc | Bin 18354 -> 18385 bytes models/__pycache__/resnet.cpython-38.pyc | Bin 1899 -> 1930 bytes models/__pycache__/transformer.cpython-38.pyc | Bin 9267 -> 9298 bytes utils/__pycache__/km.cpython-38.pyc | Bin 4582 -> 4613 bytes utils/__pycache__/mask.cpython-38.pyc | Bin 9027 -> 9058 bytes utils/__pycache__/transforms.cpython-38.pyc | Bin 4879 -> 4910 bytes utils/__pycache__/utils.cpython-38.pyc | Bin 12178 -> 12209 bytes 22 files changed, 63 insertions(+), 8 deletions(-) create mode 100644 .gitignore create mode 100644 configs/cuhk_sysu-local.yaml create mode 100644 configs/prw-local.yaml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..16f4529 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +**/__pycache__ +*.pth +**/logs \ No newline at end of file diff --git a/README.md b/README.md index 301e02c..ece2c25 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -sThis repository hosts the source code of our paper: [[CVPR 2022] Cascade Transformers for End-to-End Person Search](https://arxiv.org/abs/2203.09642). In this work, we developed a novel Cascaded Occlusion-Aware Transformer (COAT) model for end-to-end person search. The COAT model outperforms **state-of-the-art** methods on the PRW benchmark dataset by a large margin and achieves state-of-the-art performance on the CUHK-SYSU dataset. +This repository hosts the source code of our paper: [[CVPR 2022] Cascade Transformers for End-to-End Person Search](https://arxiv.org/abs/2203.09642). In this work, we developed a novel Cascaded Occlusion-Aware Transformer (COAT) model for end-to-end person search. The COAT model outperforms **state-of-the-art** methods on the PRW benchmark dataset by a large margin and achieves state-of-the-art performance on the CUHK-SYSU dataset. | Dataset | mAP | Top-1 | Model | | --------- | ---- | ----- | ------------------------------------------------------------ | @@ -43,12 +43,23 @@ conda activate coat If you want to install another version of PyTorch, you can modify the versions in `coat_pt171.yml`. Just make sure the dependencies have the appropriate version. -## Experiments on CUHK-SYSU -**Training**: The code currently only supports single GPU. The default training script for CUHK-SYSU is as follows: +## CUHK-SYSU数据集实验 +**训练**: 目前代码只支持单GPU. The default training script for CUHK-SYSU is as follows: -``` +**在本地GTX4090训练**: + +``` bash cd COAT -python train.py --cfg configs/cuhk_sysu.yaml INPUT.BATCH_SIZE_TRAIN 3 SOLVER.BASE_LR 0.003 SOLVER.MAX_EPOCHS 14 SOLVER.LR_DECAY_MILESTONES [11] MODEL.LOSS.USE_SOFTMAX True SOLVER.LW_RCNN_SOFTMAX_2ND 0.1 SOLVER.LW_RCNN_SOFTMAX_3RD 0.1 OUTPUT_DIR ./logs/cuhk-sysu +# 说明:4090显存较小,所以batchsize只能设置为2, 实测可以运行 +python train.py --cfg configs/cuhk_sysu-local.yaml INPUT.BATCH_SIZE_TRAIN 2 SOLVER.BASE_LR 0.003 SOLVER.MAX_EPOCHS 14 SOLVER.LR_DECAY_MILESTONES [11] MODEL.LOSS.USE_SOFTMAX True SOLVER.LW_RCNN_SOFTMAX_2ND 0.1 SOLVER.LW_RCNN_SOFTMAX_3RD 0.1 OUTPUT_DIR ./logs/cuhk-sysu +``` + +**在本地UESTC训练**: + +```bash +cd COAT +# 说明:RTX8000显存48G,所以batchsize只能设置为3 +python train.py --cfg configs/cuhk_sysu.yaml INPUT.BATCH_SIZE_TRAIN 2 SOLVER.BASE_LR 0.003 SOLVER.MAX_EPOCHS 14 SOLVER.LR_DECAY_MILESTONES [11] MODEL.LOSS.USE_SOFTMAX True SOLVER.LW_RCNN_SOFTMAX_2ND 0.1 SOLVER.LW_RCNN_SOFTMAX_3RD 0.1 OUTPUT_DIR ./logs/cuhk-sysu ``` Note that the dataset-specific parameters are defined in `configs/cuhk_sysu.yaml`. When the batch size (`INPUT.BATCH_SIZE_TRAIN`) is 3, the training will take about 23GB GPU memory, being suitable for GPUs like RTX6000. When the batch size is 5, the training will take about 38GB GPU memory, being able to run on A100 GPU. The larger batch size usually results in better performance on CUHK-SYSU. @@ -57,6 +68,8 @@ For the CUHK-SYSU dataset, we use a relative low weight for softmax loss (`SOLVE **Testing**: The test script is very simple. You just need to add the flag `--eval` and provide the folder `--ckpt` where the [model](https://drive.google.com/file/d/1LkEwXYaJg93yk4Kfhyk3m6j8v3i9s1B7/view?usp=sharing) was saved. +测试:这个测试脚本非常简单,你只需要添加flag --eval以及对应提供--ckpt当模型已经保存的时候 + ``` python train.py --cfg ./configs/cuhk-sysu/config.yaml --eval --ckpt ./logs/cuhk-sysu/cuhk_COAT.pth ``` @@ -66,7 +79,7 @@ python train.py --cfg ./configs/cuhk-sysu/config.yaml --eval --ckpt ./logs/cuhk- ``` python train.py --cfg ./configs/cuhk-sysu/config.yaml --eval --ckpt ./logs/cuhk-sysu/cuhk_COAT.pth EVAL_USE_CB GM True ``` - + **Testing with different gallery sizes on CUHK-SYSU**: The default gallery size for evaluating CUHK-SYSU is 100. If you want to test with other pre-defined gallery sizes (50, 100, 500, 1000, 2000, 4000) for drawing the CUHK-SYSU gallery size curve, please set the parameter `EVAL_GALLERY_SIZE` with a gallery size. ``` @@ -76,8 +89,19 @@ python train.py --cfg ./configs/cuhk-sysu/config.yaml --eval --ckpt ./logs/cuhk- ## Experiments on PRW **Training**: The script is similar to CUHK-SYSU. The code currently only supports single GPU. The default training script for PRW is as follows: -``` +**在本地GTX4090训练**: + +```bash cd COAT +# PRW数据集较小,可以RTX4090的bs可以设置为3 +python train.py --cfg ./configs/prw-local.yaml INPUT.BATCH_SIZE_TRAIN 3 SOLVER.BASE_LR 0.003 SOLVER.MAX_EPOCHS 13 MODEL.LOSS.USE_SOFTMAX True OUTPUT_DIR ./logs/prw +``` + +**在本地UESTC训练**: + +```bash +cd COAT +# PRW数据集较小,可以RTX4090的bs可以设置为3 python train.py --cfg ./configs/prw.yaml INPUT.BATCH_SIZE_TRAIN 3 SOLVER.BASE_LR 0.003 SOLVER.MAX_EPOCHS 13 MODEL.LOSS.USE_SOFTMAX True OUTPUT_DIR ./logs/prw ``` diff --git a/__pycache__/defaults.cpython-38.pyc b/__pycache__/defaults.cpython-38.pyc index faee7c2c831d157f0c78d994c5b7275d7763a2aa..c04a0719928b503b2abb0d1ccb5ab8edf9cee316 100644 GIT binary patch delta 86 zcmew-HCLK1l$V!_0SJC%^Q2yo-^ka;%4jfoE^DQ+t*cdxOKNI?PikUOUS?i;Oh9T; fab|vAFp!^|5##Ld7y>4Aa}zW3Al%JbY$5CbnI#*{ delta 55 zcmbO${ZEQ7l$V!_0SIn*yh!;fw~?=pmC;T%Z5f=ae diff --git a/__pycache__/engine.cpython-38.pyc b/__pycache__/engine.cpython-38.pyc index 02d453af3794e5da0e495c837ab8ea37931120ed..e05be4346bb1e5cc47925970c828a8fc0ea9cbcc 100644 GIT binary patch delta 80 zcmbQJzCoQYl$V!_0SMf(cv7`xH}Y9A8C$zr#ki!V7Wkwl7UgB;rN;!M78Pga=LG}# Z$r&-u{*EDFLN_-tGY`Vu9K&QP2mpb-7!m*g delta 49 zcmdm>K2e=7l$V!_0SM-FJV>dK*~n+bBqF1qk)NBYpOc?nm64dI@9ggwqQAMC$y5*k DQ^pQ6 diff --git a/__pycache__/eval_func.cpython-38.pyc b/__pycache__/eval_func.cpython-38.pyc index db5dfaf42c27d55ec3fb91630cf121e14d4ae8ee..89b6a267f92c5d48c383de4fa9236ce7bff90dc3 100644 GIT binary patch delta 80 zcmezAH^ZMVl$V!_0SMf(cv7!hBR@A)KPNxEDkCvZ-`U?WM1Qk4ldmcO De`^mz diff --git a/configs/cuhk_sysu-local.yaml b/configs/cuhk_sysu-local.yaml new file mode 100644 index 0000000..0830c43 --- /dev/null +++ b/configs/cuhk_sysu-local.yaml @@ -0,0 +1,15 @@ +OUTPUT_DIR: "./logs/cuhk_coat" +INPUT: + DATASET: "CUHK-SYSU" + DATA_ROOT: "E:/DeepLearning/PersonSearch/COAT/datasets/CUHK-SYSU" + BATCH_SIZE_TRAIN: 3 +SOLVER: + MAX_EPOCHS: 14 + BASE_LR: 0.003 + LW_RCNN_SOFTMAX_2ND: 0.1 + LW_RCNN_SOFTMAX_3RD: 0.1 +MODEL: + LOSS: + LUT_SIZE: 5532 + CQ_SIZE: 5000 +DISP_PERIOD: 100 diff --git a/configs/prw-local.yaml b/configs/prw-local.yaml new file mode 100644 index 0000000..c5b1331 --- /dev/null +++ b/configs/prw-local.yaml @@ -0,0 +1,13 @@ +OUTPUT_DIR: "./logs/prw_coat" +INPUT: + DATASET: "PRW" + DATA_ROOT: "E:/DeepLearning/PersonSearch/COAT/datasets/PRW" + BATCH_SIZE_TRAIN: 3 +SOLVER: + MAX_EPOCHS: 13 + BASE_LR: 0.003 +MODEL: + LOSS: + LUT_SIZE: 482 + CQ_SIZE: 500 +DISP_PERIOD: 100 diff --git a/datasets/__pycache__/__init__.cpython-38.pyc b/datasets/__pycache__/__init__.cpython-38.pyc index 31729b673f3d61e66ebcd5dcb28ee9289ec77c7e..1b2abd73b04b591a3a7648848b22ed9d3c0f541d 100644 GIT binary patch delta 85 zcmX@d_?D43l$V!_0SMf(cvAmQZC>-zr delta 54 zcmaFMc#e@bl$V!_0SM-FJV^O9k+)4&T|Xl~H&s6;KfNj=F;Cyw-!Vi#C9x#2IJKl$ If8u#L0Ni5|lK=n! diff --git a/datasets/__pycache__/base.cpython-38.pyc b/datasets/__pycache__/base.cpython-38.pyc index cdc48e10ab93335e4c6f17369829387c4d997286..c5020d4a6472652d06c931b4acd3464ec88cb07d 100644 GIT binary patch delta 88 zcmaFE+s(%t%FD~e00eGXJgJTwdABp#IJsKIxTK~Q_@pKl1q1oX h88OcOjv-(|H#ade55i4JEJ-X*Eh&!K{E(5G6#$jo9Gd_D delta 56 zcmeC?d&A2c%FD~e00eV79;AqGFdk(j6N?C%(&pORRTSe#l? KtiOqgn-u`kl@S>L diff --git a/datasets/__pycache__/build.cpython-38.pyc b/datasets/__pycache__/build.cpython-38.pyc index 3d4bacf5e443e7d0a08c0884f9d0b369502ea572..440f1f0646144ae624404410cd7a4b621e1a86eb 100644 GIT binary patch delta 89 zcmcaB{70BCl$V!_0SMf(cv3C-Hu7C$wsCf~ig8IzE$~TAEXvEwOOFXiEh^5;&kF|f ilQUwR{T)NVgl=wPW*&r_l30>hoLW*Gv-uD6LskIFP97it delta 58 zcmew(d{>w+l$V!_0SM-FJV?37yOHlAv#g4KMt*LpeolURRYqc-zO%n$h<-|9Nn&wo MNwNNBX_kkq04I49U;qFB diff --git a/datasets/__pycache__/cuhk_sysu.cpython-38.pyc b/datasets/__pycache__/cuhk_sysu.cpython-38.pyc index ec9af5ce70ab96486f8989bea228a1f8f24ea2cb..201846d01f77580bc565f1736bb6cad15f999401 100644 GIT binary patch delta 88 zcmew-H&>oFl$V!_0SMf(cv7Ek-Q2{?JP0=>u_UoLwWK&^^Bu-Tya3!29v=Vz delta 57 zcmbO$|4)uLl$V!_0SM-FJV?pe$h(PARzp7{KQ~oBCqKO^BQa0k+21ilKP9mwu{gD) LSby_x#znjU1vV2- diff --git a/datasets/__pycache__/prw.cpython-38.pyc b/datasets/__pycache__/prw.cpython-38.pyc index b3e51702952fd77c3d297de399dcb837f029e9a2..c8c7b3cfbb026e4d375a3a8a28c0be101ecbc083 100644 GIT binary patch delta 88 zcmaDO)-BE(%FD~e00eGXJgM6@@@{0badfqcaY;=r@JUT9%FE14j|oUED$dN$3kLF& hGh&?m9Yer`Zf;^`9)z2cSdv(rT2dUd`8MN3P5`@l9iIRI delta 57 zcmeAceFdk(j6N?C%(&pORRTSe#l? LtiSme<3vsX^&}GJ diff --git a/defaults.py b/defaults.py index 3dc5909..54910f7 100644 --- a/defaults.py +++ b/defaults.py @@ -205,7 +205,7 @@ _C.DISP_PERIOD = 10 # Whether to use tensorboard for visualization _C.TF_BOARD = True # The device loading the model -_C.DEVICE = "cuda:1" +_C.DEVICE = "cuda:0" # Set seed to negative to fully randomize everything _C.SEED = 1 # Directory where output files are written diff --git a/loss/__pycache__/oim.cpython-38.pyc b/loss/__pycache__/oim.cpython-38.pyc index 6b2863f1425fb977c00c5a5fcd5565f6de76c938..a9d1b9b8e4cfac8b9ea8d412bbeb08e3f41ee80c 100644 GIT binary patch delta 84 zcmaDX+$6#q%FD~e00eGXJgGSwd9N^9*t%N9xTK~Q_@pKl1q1oX d88OcOjv-(|H#ade55mpKFD{PR{EP7=I{-Cc95ny{ delta 53 zcmZn?c`VEu%FD~e00eV79;7I2Fdk(j6N?C%%?+Yg%FD~e00eGXJgKQ0dBd43++3|&h%FD~e00eV79;B#mz)kuQ{&mx}=i+_HF5a~n7E9pJWdaJ7nYNlh*ANlh%u%gjrU2}ms}&dkpX i2J(|LVx0XQL%@V?ZenI0gqxe6lA2Q-v-u_WNoxS}C?1;t delta 58 zcmccE&$y|dkuQ{&mx}=i=5#zrDX81XcYs@3Q9mO;H&s6;KfNj=F;Cyw-!Vi#H$Npc Mr&xb82hT}s048=5L;wH) diff --git a/models/__pycache__/resnet.cpython-38.pyc b/models/__pycache__/resnet.cpython-38.pyc index 7a296d94cee86415c040aa101833d83114e7d6be..98caa71ef5951ba9981ecc0995c126ebe7f1c3e3 100644 GIT binary patch delta 86 zcmaFO*Tv5p%FD~e00eGXJgK%Dc?FrQoLsG9TvAgDd{PsO@-p+%V**l(iZk=`f`R$87Flj1m9h)}!W=sQ delta 54 zcmZ3d*007J%FD~e00eV79;8HXepPQFdk(j6N?C%(&Us{rxQ>?%F I3zL-q0J)hFQvd(} diff --git a/utils/__pycache__/utils.cpython-38.pyc b/utils/__pycache__/utils.cpython-38.pyc index e881386ea6f8b5e397d1eb990292a6a3fbe5a37c..cc0071042af7788e671f67e5434b2c1278e8bdff 100644 GIT binary patch delta 86 zcmbOfzcHRKl$V!_0SMf(cv7#JY~)L3wsdf{ig8IzE$~TAEXvEwOOFXiEh^5;&kF|f flQUwR{T)NVgl=wPW*&rFT9TPl9J9HbnOz3}hXouX delta 55 zcmdlOKPjFsl$V!_0SM-FJV;S6-pH5CETyQQk)NBYpOc?nm64dI@9ggwqF-8)nNzI4 Jc@;Ce4gktt5f%Ud