Coder Social home page Coder Social logo

mask-guided-attention-network's Introduction

Mask-guided attention network

This work reproduces the paper Mask-Guided Attention Network for Occluded Pedestrian Detection. Original authors have their own implementations, but they remove training parts. We use their codes and rewrite the training parts on our own. Same as the original implementation, we also work on the open-source toolbox mmdetetcion.

Initialize MMdetection framework

  • We are using a detetction toolbox based on PyTorch: mmdetetcion. All the information is available on GitHub.
  • Follow their documents to install the toolbox completely.

Add self-defined detector

After successful installation, we only need to add few codes to set up our self-defined detector. This repository only include added codes. You can just add them into mmdetection framework.

  • mmdet/model/detector/mgan.py: for MGAN forward training and loss
  • model/detector/__init__.py: add from .mgan import MGAN, and add 'MGAN' in __all__ list
  • mmdet/model/mgan_head/: MGAN brach
  • mmdet/utilis/: tools for network calculations
  • mmdet/models/backbones/vgg.py : VGG backbone
  • configs/mgan.py: network structure claim, hyperparamter, and directories

The whole mmdetection files structure looks like:

|-- LICENSE
|-- README.md
|-- build
|-- configs
|   `-- mgan.py                     # MGAN network structure                         
|-- data
|   `-- cityscapes -> $DATASET_DIR  # link to dataset
|-- demo
|-- docker
|-- docs
|-- mmcv
|-- mmdet
|   |-- __init__.py                 # add MGAN class
|   |-- __pycache__
|   |-- apis
|   |-- core
|   |-- datasets
|   |-- models
|   |   |-- __init__.py             # add 'mgan_head' class
|   |   |-- __pycache__
|   |   |-- anchor_heads
|   |   |-- backbones               # add backbone VGG
|   |   |   |-- __init__.py
|   |   |   `-- vgg.py
|   |   |-- bbox_heads
|   |   |-- builder.py
|   |   |-- detectors               # add MGAN detectot
|   |   |   |-- __init__.py
|   |   |   |-- mgan.py
|   |   |-- losses
|   |   |-- mask_heads
|   |   |-- mgan_heads              # add MGAN head
|   |   |   |-- __init__.py
|   |   |   |-- __pycache__
|   |   |   `-- mgan_head.py
|   |   |-- necks
|   |   |-- plugins
|   |   |-- registry.py
|   |   |-- roi_extractors
|   |   |-- shared_heads
|   |   `-- utils
|   |-- ops
|   |-- utils
|   `-- version.py
|-- mmdet.egg-info
|-- models
|   `-- 50_65.pth                   # checkpoint
|-- pytest.ini
|-- requirements
|-- requirements.txt
|-- result
|-- setup.py
|-- tests
|-- tools
`-- work_dirs

Then you can train MGAN network by:

python tools/train.py configs/mgan.py

You can test your codes by:

python tools/test_mgan.py configs/mgan.py models/50_65.pth --eval bbox --out result/50_65_bdd.pkl

where the checkpoint can be downloaded from original authors' GitHub.

You can also use our docker to reproduce it.

Convert your own dataset into COCO style

The dataset should have the same annotation convention as COCO dataset. For example, for BDD dataset can be converted in this way.

Visualize attention as heatmap

ToDo

mask-guided-attention-network's People

Contributors

tianmingqiu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mask-guided-attention-network's Issues

Is the training configuration correct?

Hi. Thank you for your excellent work replicating the Mask Guided Attention Network.
However, Is the training configuration correct? I noticed that the author's code does not provide the training information.

mmcv & mmdetection version?

Hi,

Excellent work replicating the Mask Guided Attention Network.

There may be a slight mistake in the instructions in Section “Add Self-Defined Detection”

“mmdet/utilis/: tools for network calculations” may have meant to be “mmdet/models/utils”, can you confim if this is correct?

Also, I am running into a number of errors when using the train instructions. Can you clarify the version of mmcv and mmdetection you are using and provide an output of your Env package versions?

Please see output of the environment I am using at the moment:

Name Version Build Channel

_libgcc_mutex 0.1 main
addict 2.2.1 pypi_0 pypi
blas 1.0 mkl
bzip2 1.0.8 h516909a_2 conda-forge
ca-certificates 2020.4.5.1 hecc5488_0 conda-forge
cairo 1.16.0 h18b612c_1001 conda-forge
certifi 2020.4.5.1 py37hc8dfbb8_0 conda-forge
cudatoolkit 10.2.89 hfd86e86_1
cycler 0.10.0 pypi_0 pypi
cython 0.29.21 pypi_0 pypi
ffmpeg 4.0 hcdf2ecd_0
fontconfig 2.13.1 he4413a7_1000 conda-forge
freeglut 3.0.0 hf484d3e_1005 conda-forge
freetype 2.9.1 h8a8886c_1
future 0.18.2 pypi_0 pypi
gettext 0.19.8.1 hc5be6a0_1002 conda-forge
glib 2.64.2 h6f030ca_0 conda-forge
graphite2 1.3.13 he1b5a44_1001 conda-forge
harfbuzz 1.8.8 hffaf4a1_0
hdf5 1.10.2 hc401514_3 conda-forge
icu 58.2 hf484d3e_1000 conda-forge
intel-openmp 2020.0 166
jasper 2.0.14 h07fcdf6_1
jpeg 9b h024ee3a_2
kiwisolver 1.2.0 pypi_0 pypi
ld_impl_linux-64 2.34 h53a641e_0 conda-forge
libedit 3.1.20181209 hc058e9b_0
libffi 3.2.1 he1b5a44_1007 conda-forge
libgcc-ng 9.1.0 hdf63c60_0
libgfortran 3.0.0 1 conda-forge
libgfortran-ng 7.3.0 hdf63c60_0
libglu 9.0.0 he1b5a44_1001 conda-forge
libiconv 1.15 h516909a_1006 conda-forge
libopencv 3.4.2 hb342d67_1
libopus 1.3.1 h7b6447c_0
libpng 1.6.37 hbc83047_0
libstdcxx-ng 9.1.0 hdf63c60_0
libtiff 4.1.0 h2733197_0
libuuid 2.32.1 h14c3975_1000 conda-forge
libvpx 1.7.0 h439df22_0
libxcb 1.13 h14c3975_1002 conda-forge
libxml2 2.9.9 hea5a465_1
matplotlib 3.2.1 pypi_0 pypi
mkl 2020.0 166
mkl-service 2.3.0 py37he904b0f_0
mkl_fft 1.0.15 py37ha843d7b_0
mkl_random 1.1.0 py37hd6b4f25_0
mmcv 1.0.2 dev_0
mmdet 2.3.0rc0+f92765b dev_0
ncurses 6.2 he6710b0_1
ninja 1.9.0 py37hfd86e86_0
numpy 1.18.1 py37h4f9e942_0
numpy-base 1.18.1 py37hde5b4d6_1
olefile 0.46 py37_0
opencv 3.4.2 py37h6fd60c2_1
opencv-python 4.2.0.34 pypi_0 pypi
openssl 1.1.1g h516909a_0 conda-forge
pcre 8.44 he1b5a44_0 conda-forge
pillow 6.2.2 pypi_0 pypi
pip 20.0.2 py37_1
pixman 0.38.0 h516909a_1003 conda-forge
pthread-stubs 0.4 h14c3975_1001 conda-forge
py-opencv 3.4.2 py37hb342d67_1
pycocotools 12.0 pypi_0 pypi
pyparsing 2.4.7 pypi_0 pypi
python 3.7.7 hcf32534_0_cpython
python-dateutil 2.8.1 pypi_0 pypi
python_abi 3.7 1_cp37m conda-forge
pytorch 1.5.0 py3.7_cuda10.2.89_cudnn7.6.5_0 pytorch
pyyaml 5.3.1 pypi_0 pypi
readline 8.0 h7b6447c_0
setuptools 46.1.3 py37_0
six 1.14.0 py37_0
sqlite 3.31.1 h62c20be_1
terminaltables 3.1.0 pypi_0 pypi
tk 8.6.8 hbc83047_0
torchvision 0.6.0 py37_cu102 pytorch
wheel 0.34.2 py37_0
xorg-fixesproto 5.0 h14c3975_1002 conda-forge
xorg-inputproto 2.3.2 h14c3975_1002 conda-forge
xorg-kbproto 1.0.7 h14c3975_1002 conda-forge
xorg-libice 1.0.10 h516909a_0 conda-forge
xorg-libsm 1.2.3 h84519dc_1000 conda-forge
xorg-libx11 1.6.9 h516909a_0 conda-forge
xorg-libxau 1.0.9 h14c3975_0 conda-forge
xorg-libxdmcp 1.1.3 h516909a_0 conda-forge
xorg-libxext 1.3.4 h516909a_0 conda-forge
xorg-libxfixes 5.0.3 h516909a_1004 conda-forge
xorg-libxi 1.7.10 h516909a_0 conda-forge
xorg-libxrender 0.9.10 h516909a_1002 conda-forge
xorg-renderproto 0.11.1 h14c3975_1002 conda-forge
xorg-xextproto 7.3.0 h14c3975_1002 conda-forge
xorg-xproto 7.0.31 h14c3975_1007 conda-forge
xz 5.2.5 h7b6447c_0
yapf 0.30.0 pypi_0 pypi
zlib 1.2.11 h7b6447c_3
zstd 1.3.7 h0b5b093_0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.