• Stars
    star
    100
  • Rank 340,703 (Top 7 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created about 6 years ago
  • Updated about 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

My implementation of the paper [In Defense of the Triplet Loss for Person Re-Identification]

triplet-ReID-pytorch

This is a simple implementation of the algorithm proposed in paper In Defense of the Triplet Loss for Person Re-Identification.

This project is based on pytorch0.4.0 and python3.

To be straight-forward and simple, only the method of training on pretrained Resnet-50 with batch-hard sampler(TriNet according to the authors) is implemented.

prepare dataset

Run the script of datasets/download_market1501.sh to download and uncompress the Market1501 dataset.

    $ cd triplet-reid-pytorch/datasets
    $ sh download_market1501.sh 

train the model

  • To train on the Market1501 dataset, just run the training script:
    $ cd triplet-reid-pytorch
    $ python3 train.py

This will train an embedder model based on ResNet-50. The trained model will be stored in the path of /res/model.pkl.

embed the query and gallery dataset

  • To embed the gallery set and query set of Market1501, run the corresponding embedding scripts:
    $ python3 embed.py \
      --store_pth ./res/emb_gallery.pkl \
      --data_pth datasets/Market-1501-v15.09.15/bounding_box_test

    $ python3 embed.py \
      --store_pth ./res/emb_query.pkl \
      --data_pth datasets/Market-1501-v15.09.15/query

These scripts will use the trained embedder to embed the gallery and query set of Market1501, and store the embeddings as /res/embd_gallery.pkl and /res/emb_query.pkl.

evaluate the embeddings

  • Then compute the rank-1 cmc and mAP:
    $ python3 eval.py --gallery_embs ./res/emb_gallery.pkl \
      --query_embs ./res/emb_query.pkl \
      --cmc_rank 1

This will evaluate the model with the query and gallery dataset.

Notes

After refering to some other paper and implementations, I got to to know two tricks that help to boost the performance:

  • adjust the stride of the last stage of resnet from 2 to 1.
  • use augmentation method of random erasing.

With these two tricks, the mAP and rank-1 cmc on Market1501 dataset reaches 76.04/88.27, much higher than the result claimed in the paper.

More Repositories

1

BiSeNet

Add bisenetv2. My implementation of BiSeNet
Python
1,286
star
2

DeepLab-v3-plus-cityscapes

mIOU=80.02 on cityscapes. My implementation of deeplabv3+ (also know as 'Encoder-Decoder with Atrous Separable Convolution for Semantic Image Segmentation' based on the dataset of cityscapes).
Python
157
star
3

gdGPT

Train llm (bloom, llama, baichuan2-7b, chatglm3-6b) with deepspeed pipeline mode. Faster than zero/zero++/fsdp.
Python
51
star
4

SphereReID

My implementation of paper: SphereReID: Deep Hypersphere Manifold Embedding for Person Re-Identification
Python
41
star
5

fixmatch-pytorch

90%+ with 40 labels. please see the readme for details.
Python
35
star
6

Deeplab-Large-FOV

My Implementation of the deeplab_v1 (known as deeplab large fov)
Python
27
star
7

MFM

code for paper "Masked Frequency Modeling for Self-Supervised Visual Pre-Training" (https://arxiv.org/pdf/2206.07706.pdf)
Python
21
star
8

SFT-ReID

My implementation of Spectral-Feature-Transformation-ReID, link to the paper: https://arxiv.org/abs/1811.11405
Python
19
star
9

DenseCL

DenseCL + regionCL-D
Python
14
star
10

SelfSup

ssl method pretrain experiments and weights: mocov2 + fast-moco + regioncl + mixup + densecl
Python
4
star
11

porn_identification

implement image processing with a combination of C and python3 based on socket communication
C
3
star
12

Segmentatron

My implementation of some segmentation algorithms
Python
3
star
13

AutoAugment_opencv

autoaugment and randomaugment implemented with python opencv(cv2)
Python
3
star
14

ImageNet-Loader

An imagenet dataloader implemented with opencv and pybind11 based on multi-threading
C++
2
star
15

mixMatch

Pytorch reproduction of the experiment in the paper of MixMatch.
Python
2
star
16

CAPTCHA_IND

Identify CAPTCHA basing on CNN implemented by mxnet
Python
1
star
17

GAN-mxnet

GAN implemented with mxnet
Python
1
star