Code Monkey home page Code Monkey logo

top-dropblock's Introduction

https://arxiv.org/abs/2010.05435 PWC PWC PWC PWC

Top-DB-Net: Top DropBlock for Activation Enhancement in Person Re-Identification

This repository implements 'Top-DB-Net: Top DropBlock for Activation Enhancement in Person Re-Identification' presented at International Conference in Pattern Recognition (ICPR 2020)

Installation

Make sure your conda is installed.

# cd to your preferred directory and clone this repo
git clone https://github.com/RQuispeC/top-dropblock.git

# create environment
cd top-dropblock/
conda create --name topdropblock python=3.7
conda activate topdropblock

# install dependencies
# make sure `which python` and `which pip` point to the correct path
pip install -r requirements.txt

# install torch and torchvision (select the proper cuda version to suit your machine)
conda install pytorch torchvision cudatoolkit=9.0 -c pytorch

Train and Test

We made available config files for training and testing inside configs. For instance, to train Top-DBnet on Market-1501, run:

python main.py \
--config-file configs/im_top_bdnet_train_market1501.yaml \
--root $PATH_TO_DATA

To test Top-DBnet, update configs/im_top_bdnet_test.yaml with the dataset name and path to saved model:

model:
    load_weights: $PATH_TO_MODEL

test:
    rerank: False # Update this if you want to use re-ranking
    visrank: False # Update this if you want to visualize activation maps
    targets: ['cuhk03'] # Dataset name, e.g. ('cuhk03', 'market1501', 'dukemtmcreid')

Then do

python main.py \
--config-file configs/im_top_bdnet_test.yaml \
--root $PATH_TO_DATA

Trained models are available here

To output activations maps update visrankactivthr: True or visrankactiv: True on the config files.

drawing

Results

Dataset mAP Rank-1 mAP (RK) Rank-1 (RK)
Market1501 85.8 94.9 94.1 95.5
DukeMTMC-ReID 73.5 87.5 88.6 90.9
CUHK03(L) 75.4 79.4 88.5 86.7
CUHK03(D) 74.2 77.3 86.9 85.7

Citation

If you find this work useful to your research, please cite the following publication.

@article{quispe2020topdnet,
  title={Top-DB-Net: Top DropBlock for Activation Enhancement in Person Re-Identification},
  author={Quispe, Rodolfo and Pedrini, Helio},
  journal={25th International Conference on Pattern Recognition},
  year={2020}
}

This repo is based on deep-person-reid, for further questions regarding data setup and others take a look to their documentation.

News

  • Updated figure of architecture to match code implementation (refer to #4)

top-dropblock's People

Contributors

rquispec avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

top-dropblock's Issues

coding question

Hi,sir, when running main.py,getting Extracting features from query set ...,it will happen forward() error such as TypeError: forward() got an unexpected keyword argument 'drop_top'; or TypeError: forward() takes 2 or 3 positional arguments but 4 were given.
That from engine.py and torch's module,
share you help me?i am Freshman. Thanks very much!!!

How to evaluate on my data

Hello again.
Thank you for providing the pre-trained model before.
I have a question.
I want to use this model on my data and I want to get the distance of similarity of each images.
For instance, I would like to see
image1 = 'image1.png' image2 = 'image2.png' image3 = 'image3.png' dintance = top_dropblock(image1,image2,image3)
Like distance[0] has the distance between image1 and image2 and distance[1] has the distance between image1 and image3.

Attention module

Hi, if your work is combined with the attention module? Are there relevant experiments?

TypeError: run() got an unexpected keyword argument 'visactmap'

Hi, I'm new to this model. It's very interesting.
But I got an error. I changed like below in im_top_bdnet_train_market1501.yaml.
model:
name: 'resnet50'
pretrained: True

data:
type: 'image'
sources: ['market1501']
targets: ['market1501']
height: 384
width: 128
combineall: False
transforms: ['random_flip', 'random_crop', 'random_erase']
save_dir: 'log/top_bdnet_neck_botdropfeat_doubot_market1501_softmax_topdrop_0'

cuhk03:
labeled_images: True

sampler:
train_sampler: 'RandomIdentitySampler'

loss:
name: 'softmax'
softmax:
label_smooth: True
triplet:
weight_t: 1.0
weight_x: 1.0
dropbatch:
weight_db_t: 1.0
weight_db_x: 1.0
weight_b_db_t: 1.0
weight_b_db_x: 1.0
top_drop_epoch: 0

train:
optim: 'adam'
lr: 1.
max_epoch: 400
batch_size: 64
fixbase_epoch: 0
open_layers: ['bottleneck_global', 'bottleneck_db', 'reduction_global', 'reduction_db','classifier_global', 'classifier_db', 'batch_drop', 'bottleneck_drop_bottleneck_features', 'classifier_drop_bottleneck']
lr_scheduler: 'single_step'
stepsize: [50, 200, 300]

test:
batch_size: 300
dist_metric: 'euclidean'
normalize_feature: False
evaluate: False
eval_freq: 30
rerank: True
visactmap: False
And I put 'python main.py --config-file configs/im_top_bdnet_train_market1501.yaml --root reid-data' in cmd at deep-person-reid.

training parameter

Hi, I'm kazuki-can.
Thanks for your attractive work.
Since I'm going to write a paper about Computer Vision with this repository, I would like to know its training parameter.
I use the model file called "de00143e-market-model.pth.tar-400".

Thank you.

CUDA out of memory

Hi, I try multiple time to train the code but when application start it send me : "CUDA out of memory, try to allocate...".
I try multiple things to fix this error like reduce batch_size, but nothing working do you have a suggestion to it?

How long does it take to finish training?

I am training the model, but for each epoch , it takes for about 90 minutes. So , how long does it usually take to finish training?
After each epoch, it says 'Cython evaluation ( very fast so highly recommended) is unavailable, now use python evaluation.

How to get RK result

I have some question about RK, what is the meaning, and how can I find the paper introduce this method?

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.