Home

Awesome

beyond-part-models-gluon

Implementation of <Beyond Part Models: Person Retrieval with Refined Part Pooling>, using gluon(mxnet)

Memo

Result

The model is based on resnet50. Input images are resized to 384x128. Feature channels are set 256. Batchsize is set 32, which is different from the paper. Here we just show some results.

Market-1501

BSNetworkPCBPNRPPFTCMC1CMC5CMC10mAPNote
32Resnet50_v2w/ow/o89.7696.2097.5175.22(512dim)
64Resnet50_v2w/ow/o85.3---68.5
32Resnet50_v2w/ow/o91.7596.5998.2277.68
32Resnet50_v1w/ow/o88.3994.8096.7671.78
64Resnet50_v2w6w/o92.397.298.277.4(in paper)
32Resnet50_v2w6w/o92.6196.8297.7477.33
32Resnet50_v1w6w/o----
32Resnet50_v2w6wno91.6696.5997.8676.83
32Resnet50_v1w6wno----
64Resnet50_v2w6wyes93.897.598.581.6(in paper)
32Resnet50_v2w6wyes92.6496.9798.0177.09(processing)
32Resnet50_v1w6wyes----

Usage

Usage: 
    main.py [options]
    main.py --withpcb [options]
    main.py --withpcb --withrpp [options]

General Options:
    -h, --help                  Print this message
    --logfile=<str>             File path for saving log message. 
    --device_type=<str>         Device Type for running the model [default: cpu]
    --device_id=<int>           Device ID for running the model [default: 0]
    
Network Options:
    --basenet_type=<str>        BaseNet type for Model [default: resnet50_v2]
    --classes_num=<int>         Output classes number of the network [default: 751]
    --feature_channels=<int>    Feature channels of the network [default: 512]
    --partnum=<int>             The number of the pcb parts. [default: 6]
    --feature_weight_share      If the six partnum share weights.
    --base_not_pretrained       If the base network don't pretrained on ImageNet
    --pretrain_path=<str>       Path to pretrained model. 

Training Setting Options:
    --Optim=<str>               Optimizer Type [default: sgd]
    --LRpolicy=<str>            Learning rate policy [default: multistep]
    --milestones=<list>         Step milestone for multistep policy [default: [40,]]
    --gamma=<float>             Gamma for multistep policy [default: 0.1]
    
    --max_epochs=<int>          Max Train epochs [default: 60]
    --val_epochs=<int>          Val step stone [default: 5]
    --snap_epochs=<int>         Snap step stone [default: 5]
    --Snap=<str>                Model state dict file path [default: saved/]

Data Options:
    --resize_size=<tuple>       Image resize size tuple (height, width) [default: (384, 128)]
    --crop_size=<tuple>         Image crop size tuple (height, width) [default: (384, 128)]
    --batchsize=<int>           Batchsize [default: 32]

Train Data Options:
    --trainList=<str>           Train files list txt [default: datas/Market1501/train.txt]
    --trainIMpath=<str>         Train sketch images path prefix [default: datas/Market1501/]
    
Test Data Options:
    --queryList=<str>           Query files list txt [default: datas/Market1501/query.txt]
    --queryIMpath=<str>         Query sketch images path prefix [default: datas/Market1501/]
    --galleryList=<str>         Gallery files list txt [default: datas/Market1501/gallery.txt]
    --galleryIMpath=<str>       Gallery sketch images path prefix [default: datas/Market1501/]
    
Learning Rate Options:
    --learning_rate=<float>     Learning rate for training process [default: 0.01]
    --weight_decay=<float>      Weight decay for training process [default: 0.0005]
    --momentum=<float>          Momentum for the SGD Optimizer [default: 0.9]

    --base_not_train            If don't train base network.
    --base_lr_scale=<float>     Learing rate scale rate for the base network [default: 0.1]
    
    --tail_not_train            If don't train tail module, when w/o pcb and w/o rpp.
    --tail_lr_scale=<float>     Learing rate scale rate for the tail module.
    
    --rpp_not_train             If don't train the rpp module.
    --rpp_lr_scale=<float>      Learing rate scale rate for the rpp module.

Note

I will introduce my code in this part. The experiment contains all scripts used for experiments.

data

In the data package, I put the scripts about loading data and save snapshots.

metric

In the reidmetric.py, which define a metric class designed for Re-ID.

model

The model package contains the design of the model structures. The PCBRPPNet is the implementation of the beyond part model. Params withpcb, withrpp and feature_shared_weight are designed for the different situation.

process

I defined two kind of processor to control the processes of the training and testing. We could implement function for our own experiments.

Acknowledgement