Skip to content

Latest commit

 

History

History
55 lines (37 loc) · 4.79 KB

code_overview.md

File metadata and controls

55 lines (37 loc) · 4.79 KB

Overview

This is an overview of the codes for V2ReID. The codes find their inspiration from VOLO and TransReID. Each .py file contains further descriptions. Please do not hesitate to contact us if have any questions or suggestions! 😊

datasets directory contains modules related to reading and sampling the input datasets. Please refer to the configs under DATALOADER and INPUT to choose the the desired parameters:

  • bases.py retrieves the information of the ReID dataset (train, query and gallery), such as number of vehicle IDs, number of images, number of camera IDs (not used in training), and the image paths for data loading.
  • make_dataloader.py loads the train, query and gallery data and applies data augmentation such as resizing, padding, flips, etc.
  • sampler.py implements the random identity sampler, that's used when training with the triplet loss. The data needs to be sampled in a specific way, such that we have k instances for each N vehicle identity per batch.
  • veri.py specifically reads VeRi-776. For other datasets, e.g. VehicleID, you'll need to modify it.

loss directory contains modules related to the different losses (ID, triplet and center). Please refer to the configs under LOSS to choose the desired parameters.

The total loss is formulated as

$$ \text{total loss} = \lambda_{ID} \times \mathcal{L_{\text{ID}}} + \lambda_{tri} \times \mathcal{L_{\text{tri}}} + \lambda_{cen} \times \mathcal{L_{\text{cen}}} $$

where $\mathcal{L_{\text{(.)}}}$ is the loss and $\lambda_{(.)}$ the associated weight. Use the following configs if you want to train:

  • using the ID loss only: set TIRPLET_LOSS and CENTER_LOSS to False
  • using the ID and triplet loss: set TIRPLET_LOSS to True and CENTER_LOSS to False
  • using the three losses: set TIRPLET_LOSS and CENTER_LOSS to True The weights can be adjusted with ID_LOSS_WEIGHT, TRIPLET_LOSS_WEIGHT and CENTER_LOSS_WEIGHT.

models directory contains modules related to the backbone architecture (VOLO). Please refer to the configs under MODEL.

  • volo.py: implementation of VOLO. We added a snippet for overlapping patches, the batch normalization/layer normalization neck and how to create your own model with your own settings.

solver directory contains modules related to the optimization and optimization scheduler (i.e. learning rate scheduler). Please refer to the configs under SOLVER.

tools directory contains the training options (with and without center loss)

utils directory contains modules related to the evaluation and logging the process.