ShenghaiRong / tasn

Trilinear Attention Sampling Network for Fine-grained Image Recognition

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TASN

Code (MXNet version) for our cvpr'19 paper "Looking for the Devil in the Details: Learning Trilinear Attention Sampling Network for Fine-grained Image Recognition"

alt text

Prerequisites

cuda version = 8.0 cudnn5.0 nccl libopenblas liblapack libopencv

Install

First clone this repository:

sudo git clone https://github.com/Heliang-Zheng/TASN.git
cd TASN/tasn-mxnet

Then, please follow https://mxnet.incubator.apache.org/install/build_from_source.html to compile and install mxnet.

Or download pre-build mxnet (with cuda 8.0): https://drive.google.com/open?id=1Sfpw0x5XLqBFWAt99-zKOp4jAbOxm5Ws and install by:

cd TASN/tasn-mxnet/example/tasn
sudo bash install.sh

Train TASN

  1. get into the tasn dir:

     cd TASN/tasn-mxnet/example/tasn
    
  2. download data and pretrained model (on ImageNet):

     sudo bash init.sh
    
  3. set your nccl path in train.sh

  4. run :

     sudo bash train.sh
    

Experiments settings: on CUB-200-2011 dataset : http://www.vision.caltech.edu/visipedia/CUB-200-2011.html

CNN input resolution: 224*224

Accuracy: 87.0%

Just changing the scale of AttSampler() in train.py from 224/512 to 336/512 to obtain the accuracy of 88.0%

Model:

cub_224_87 https://drive.google.com/open?id=1uw9MVNVZqBTppN4TBbHB10CxoQonsTx9

cub_336_88 https://drive.google.com/open?id=1qQo8o2C5JpwxJGhrfk2xHM-f6kpxDKd1

Added files:

example/tasn/*

src/operator/contrib/att_sampler-inl.h

src/operator/contrib/att_sampler.cc

src/operator/contrib/att_sampler.cu

PyTorch versioin

On going.

Add master net.

Thank https://github.com/ShenghaiRong for reimplementing Attention sampler for pytorch verion.

Other Implements

Attention sampler implementation (free from rebuilding mxnet):

https://github.com/wkcn/AttentionSampler

Reference

@inproceedings{zheng2019looking, title={Looking for the Devil in the Details: Learning Trilinear Attention Sampling Network for Fine-grained Image Recognition}, author={Zheng, Heliang and Fu, Jianlong and Zha, Zheng-Jun and Luo, Jiebo}, booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition}, pages={5012--5021}, year={2019} }

About

Trilinear Attention Sampling Network for Fine-grained Image Recognition


Languages

Language:Python 31.7%Language:C++ 31.0%Language:Jupyter Notebook 8.4%Language:Perl 7.6%Language:Scala 5.9%Language:Cuda 4.2%Language:Julia 2.0%Language:Clojure 2.0%Language:R 1.7%Language:Shell 1.7%Language:C 0.9%Language:Java 0.8%Language:CMake 0.4%Language:Makefile 0.4%Language:Groovy 0.3%Language:HTML 0.2%Language:Dockerfile 0.2%Language:MATLAB 0.2%Language:CSS 0.1%Language:Batchfile 0.1%Language:Perl 6 0.0%Language:PowerShell 0.0%Language:Smalltalk 0.0%Language:ANTLR 0.0%