A fork of BAM and CBAM.
- update for newer version of PyTorch
- cleaned up code, organized directory
- debugged and updated training script
- Added training for other tasks
- development (
black
,pytest
, etc)
- Python >= 3.6
- PyTorch >= 1.5
- Detectron2 >= 0.21
- fvcore (comes with Detectron2)
If you don't have detectron2, you can either install it yourself, or use:
git clone --recursive git@github.com:haruishi43/bam-cbam.git
cd third/detectron2
pip install .
python classification/train_cifar.py --data <path/to/dataset/root> --prefix cifar_run_1
- Train CIFAR100 using
--cifar100
. - See other arguments inside the
parse_args()
function @train_cifar.py
.
python classification/train_imagenet.py --data <path/to/dataset/root> --prefix imagenet_run_1
- See other arguments inside the
parse_args()
function @train_imagenetpy
. - Download ImageNet from the official website and use this script to orgaize it.
Orgaize COCO dataset (see detectron2's guide for more information).
export DETECTRON2_DATASETS=/path/to/datasets # else detectron2 will use ./datasets
python detection/train_coco.py --num-gpus 8 \
--config-file detection/configs/COCO-Detection/faster_rcnn_R_50_CBAM_1x.yaml
The original configuration are for using 8 gpus, you might need to change parameters for single gpu:
CUDA_VISIBLE_DEVICES=0, python detection/train_coco.py --ngpu 1 \
--config-file detection/configs/COCO-Detection/faster_rcnn_R_50_CBAM_1x.yaml \
SOLVER.IMS_PER_BATCH 2 SOLVER.BASE_LR 0.0025