GithubHelp home page GithubHelp logo

camstyle's Introduction

Camera Style Adaptation for Person Re-identification

================================================================

Code for Camera Style Adaptation for Person Re-identification (CVPR 2018).

Preparation

Requirements: Python=3.6 and Pytorch>=0.3.0

  1. Install Pytorch

  2. Download dataset

  3. Download CamStyle Images

CamStyle Generation

You can generate CamStyle imgaes with CycleGAN-for-CamStyle

Training and test re-ID model

  1. IDE
# For Market-1501
python main.py -d market --logs-dir logs/market-ide
# For Duke
python main.py -d duke --logs-dir logs/duke-ide
  1. IDE + CamStyle
# For Market-1501
python main.py -d market --logs-dir logs/market-ide-camstyle --camstyle 46
# For Duke
python main.py -d duke --logs-dir logs/duke-ide--camstyle --camstyle 46
  1. IDE + CamStyle + Random Erasing[4]
# For Market-1501
python main.py -d market --logs-dir logs/market-ide-camstyle-re --camstyle 46 --re 0.5
# For Duke
python main.py -d duke --logs-dir logs/duke-ide--camstyle-re --camstyle 46 --re 0.5
  1. IDE + CamStyle + Random Erasing[4] + re-ranking[3]
# For Market-1501
python main.py -d market --logs-dir logs/market-ide-camstyle-re --camstyle 46 --re 0.5 --rerank
# For Duke
python main.py -d duke --logs-dir logs/duke-ide--camstyle-re --camstyle 46 --re 0.5 --rerank

 

Results

Market-1501 Duke
Methods Rank-1 mAP Rank-1 mAP
IDE 85.6 65.8 72.3 51.8
IDE+CamStyle 88.1 68.7 75.2 53.4
IDE+CamStyle+Random Erasing 89.4 71.5 78.3 57.6

References

  • [1] Our code is conducted based on open-reid

  • [2] Unpaired Image-to-Image Translation using Cycle-Consistent Adversarial Networks, ICCV 2017

  • [3] Re-ranking Person Re-identification with k-reciprocal Encoding. CVPR 2017.

  • [4] Random Erasing Data Augmentation. Arxiv 2017.

Citation

If you find this code useful in your research, please consider citing:

@inproceedings{zhong2018camera,
title={Camera Style Adaptation for Person Re-identification},
author={Zhong, Zhun and Zheng, Liang and Zheng, Zhedong and Li, Shaozi and Yang, Yi},
booktitle={CVPR},
year={2018}
}

Contact me

If you have any questions about this code, please do not hesitate to contact me.

Zhun Zhong

camstyle's People

Contributors

zhunzhong07 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  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  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  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  avatar  avatar  avatar  avatar

camstyle's Issues

about the test

The data augmentation is used for training. When testing, do you use the generated images? Or the test is just like the normal test?

ide without camstyle got higher mAP(my batch-size is 64)

Sorry to interrupt again, when I ran "python main.py -d market --logs-dir logs/market-ide" I got this
2018-05-21 12-36-53
so I just comment the camstyle part in main.py(sepecficly, the function named get_data and the function named main), then I got the result like this
mAP : 70.2%
top-1 : 87.9%
then I got everything back, I ran "python main.py -d market --logs-dir logs/market-ide-camstyle --camstyle 22", I suppose the number behind --camstyle divided by batch-size is the ratio between fake and real images.
However I got the mAP of 68.6% and top-1 of 87.5%, so the result was deteriorating after I added the camstyle image. I hope you can solve my problem. Thank you.

Baseline (IDE) accuracy 1% off

Hello,
Thanks for sharing the code!
I ran your code without any modification for re-id baseline without using camstyle.
I was only able to get 84.3% instead of 85.6% in Readme.

Is there any other hyperparameter setting that I have to change to achieve 85% accuracy for baseline IDE?
Any idea where that 1 % gap comes from?

Thank you!

RuntimeError: CUDA error: out of memory

Hi, when I run the comand
“python main.py -d market --logs-dir logs/market-ide-camstyle --camstyle 46”

I get errot
“RuntimeError: CUDA error: out of memory”
Can you help me with your answer?

something wrong with my computergot like batch_size=0

(pytorch) D:\test03>python main.py -d market --logs-dir logs/market-ide
Market dataset loaded
subset | # ids | # images

train | 0 | 0
query | 0 | 0
gallery | 0 | 0
camstyle | 0 | 0
Traceback (most recent call last):
File "main.py", line 198, in
main(parser.parse_args())
File "main.py", line 83, in main
args.width, args.batch_size, args.camstyle, args.re, args.workers)
File "main.py", line 69, in get_data
shuffle=True, pin_memory=True, drop_last=True)
File "C:\ProgramData\Anaconda3\envs\pytorch\lib\site-packages\torch\utils\data\dataloader.py", line 437, in init
batch_sampler = BatchSampler(sampler, batch_size, drop_last)
File "C:\ProgramData\Anaconda3\envs\pytorch\lib\site-packages\torch\utils\data\sampler.py", line 128, in init
"but got batch_size={}".format(batch_size))
ValueError: batch_size should be a positive integeral value, but got batch_size=0

when I ran 'python main.py -d market --logs-dir logs/market-ide' on my computer, I got the information above,what can I do to solove this problem? thank you.

ValueError: num_samples should be a positive integer value, but got num_samples=0

root@833c2b940c92:/home/CamStyle# CUDA_VISIBLE_DEVICES=0 python main.py -d market --logs-dir logs/market-ide-camstyle --camstyle 46
Market dataset loaded
subset | # ids | # images

train | 751 | 12936
query | 750 | 3368
gallery | 751 | 15913
camstyle | 0 | 0
Traceback (most recent call last):
File "main.py", line 201, in
main(parser.parse_args())
File "main.py", line 86, in main
args.width, args.batch_size, args.camstyle, args.re, args.workers)
File "main.py", line 72, in get_data
shuffle=True, pin_memory=True, drop_last=True)
File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/dataloader.py", line 176, in init
sampler = RandomSampler(dataset)
File "/usr/local/lib/python3.6/dist-packages/torch/utils/data/sampler.py", line 66, in init
"value, but got num_samples={}".format(self.num_samples))
ValueError: num_samples should be a positive integer value, but got num_samples=0

not class methods!

when I run the comand

python main.py -d duke --logs-dir logs/duke-ide

I get errot

  File "main.py", line 42, in get_data
    T.Resize((height, width), interpolation=3),
AttributeError: module 'reid.utils.data.transforms' has no attribute 'Resize'

So I saw you reid.utils.data.transforms module,in face ,not Resize attribute.

result question

Why is the Rank-1 and mAP of the IDE+CamStyle experiment when I directly use the code and the author's picture lower than the Rank-1 and mAP of the IDE experiment?
In IDE + CamStyle, I just run "python main.py -d duke --logs-dir logs/duke-ide--camstyle --camstyle 46" with "DukeMTMC-reID-CamStyle".
In IDE, I just run "python main.py -d duke --logs-dir logs/duke-ide".
What more do I need to do?

No module called dominate

"html.py", line 1, in
import dominate
ImportError: No module named dominate

i can't find dominate file in your project, can you help me with this?

a error on my computer

aaron@PC:~/reid/CamStyle$ python main.py -d market --logs-dir logs/market-ide
Market dataset loaded
subset | # ids | # images

train | 0 | 0
query | 0 | 0
gallery | 0 | 0
camstyle | 0 | 0
Traceback (most recent call last):
File "main.py", line 198, in
main(parser.parse_args())
File "main.py", line 138, in main
trainer.train(epoch, train_loader, optimizer)
File "/home/aaron/reid/CamStyle/reid/trainers.py", line 28, in train
for i, inputs in enumerate(data_loader):
File "/home/aaron/anaconda3/lib/python3.5/site-packages/torch/utils/data/dataloader.py", line 417, in iter
return DataLoaderIter(self)
File "/home/aaron/anaconda3/lib/python3.5/site-packages/torch/utils/data/dataloader.py", line 242, in init
self._put_indices()
File "/home/aaron/anaconda3/lib/python3.5/site-packages/torch/utils/data/dataloader.py", line 290, in _put_indices
indices = next(self.sample_iter, None)
File "/home/aaron/anaconda3/lib/python3.5/site-packages/torch/utils/data/sampler.py", line 119, in iter
for idx in self.sampler:
File "/home/aaron/anaconda3/lib/python3.5/site-packages/torch/utils/data/sampler.py", line 50, in iter
return iter(torch.randperm(len(self.data_source)).long())
RuntimeError: invalid argument 1: must be strictly positive at /opt/conda/conda-bld/pytorch_1523242347739/work/torch/lib/TH/generic/THTensorMath.c:2247
......
when I ran 'python main.py -d market --logs-dir logs/market-ide' on my computer, I got the information above, so I checked the code. I found in the line 36 of evaluators.py, you used 'for i, (imgs, fnames, pids, _) in enumerate(data_loader):' to process the data_loader, while in line 28 of trainers.py you used 'for i, inputs in enumerate(data_loader):', then you defined a function named _parse_data to process this 'inputs', then I got the error. So I was wondering if you have the same problem, and am I supposed to change the code there?
(I tried on pytorch 0.3.1 on both python 3.5 and python 3.6, and also I thought maybe it was my pytorch's problem?

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.