Skip to content

Commit

Permalink
add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
laihaotao committed Apr 20, 2019
1 parent 18d124a commit 71cf53c
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 4 deletions.
4 changes: 1 addition & 3 deletions datasets/get_dataset_cuhk03np.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
echo 'Please enter your user name for bitbucket'
read username
wget --user=$username --ask-password https://bitbucket.org/eric_thesis/reid2/downloads/cuhk03-np.zip
wget https://drive.google.com/uc?export=download&confirm=g71d&id=1pBCIAGSZ81pgvqjC-lUHtl0OYV1icgkz
unzip cuhk03-np.zip
rm -rf cuhk03-np.zip
6 changes: 6 additions & 0 deletions datasets/get_dataset_dukemtmc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
echo 'Please enter your user name for bitbucket'
read username
wget https://drive.google.com/uc?id=0B0VOCNYh8HeRdnBPa2ZWaVBYSVk
mv DukeMTMC-reID.zip dukemtmc-reid.zip
unzip dukemtmc-reid.zip
rm -rf dukemtmc-reid.zip
3 changes: 2 additions & 1 deletion datasets/get_dataset_market1501.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
echo 'Please enter your user name for bitbucket'
read username
wget --user=$username --ask-password https://bitbucket.org/eric_thesis/reid2/downloads/market1501.zip
wget https://drive.google.com/file/d/0B8-rUzbwVRk0c054eEozWG9COHM/view
mv Market-1501-v15.09.15.zip market1501.zip
unzip market1501.zip
rm -rf market1501.zip
43 changes: 43 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Person Re-Identification Baseline

This repo basically is the re-implementation (tensorflow + keras) of a person
re-identification baseline propose by the paper
["Bag of Tricks and A Strong Baseline for Deep Person Re-identification"](https://arxiv.org/abs/1903.07071).

The authors original implementation which is in Pytorch can be found in their
[repo](https://github.com/michuanhaohao/reid-strong-baseline).


## Enviornment

A powerful GPU is required for running the code, with Nivida GTX 1070ti, a training with the standard 120 epochs
will take almost 4 hours.

This implementatoin is based on tensorflow and keras (currently not other backend are suppoted rather
than `tf`), the tested version are listed below:

- python: 3.6.7
- tensorflow: 1.12.0
- tensorflow-base: 1.12.0
- tensorflow-gpu: 1.12.0
- keras: 2.2.4
- keras-applications: 1.0.6
- keras-base: 2.2.4
- keras-preprocessing: 1.0.5

## Run

Before you run, you need to speicify the dataset directory in your local machine. Go to the `reid.py` file,
check the global variable named `g_data_root`. If you don't have the dataset yet, you can get the dataset by
using the srcipt in the `datasets` folder. If you do so, set `g_data_root = './datasets'`.

To train or try the model out, go to the very end of the `reid.py` file. Comment the method you don't want
and uncomment the method you want then launch the terminal and run:

```
python reid.py
```

## Theory

For the theory behind the code, please check with the wiki.
15 changes: 15 additions & 0 deletions reid.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

''' global variables '''
g_data_root = '/home/h_lai/Documents/dl/reid/triplet/datasets'
# g_data_root = './datasets'
g_output_dir = './output'

g_num_ids = 16
Expand Down Expand Up @@ -232,6 +233,20 @@ def train_and_test(weight_path):
e = Evaluator(dataset, feat_model, g_img_h, g_img_w)
e.compute()

def train(target_model, save_weight_path):
target_model.fit_generator(
train_datagen.flow(),
steps_per_epoch=g_steps_per_epoch,
epochs=g_epochs, verbose=1, callbacks=callbacks
)
target_model.save_weights(save_weight_path)

def test(load_weight_path):
print('[reid] benchmark ...')
model.load_weights(load_weight_path)
e = Evaluator(dataset, feat_model, g_img_h, g_img_w)
e.compute()

# #################################################################################

# check list
Expand Down

0 comments on commit 71cf53c

Please sign in to comment.