ViT ReID算法和OS_Net算法
#ViT_reid建模
#代码地址:
https://github.com/damo-cv/TransReID
#创建conda虚拟环境
conda create -n tran_reid python=3.5
#conda激活虚拟环境
conda activate tran_reid
#安装所有环境
pip install -r requirements.txt
#所需数据集
[Market-1501](https://drive.google.com/file/d/0B8-rUzbwVRk0c054eEozWG9COHM/view),
[MSMT17](https://arxiv.org/abs/1711.08565),
[DukeMTMC-reID](https://arxiv.org/abs/1609.01775),
[Occluded-Duke](https://github.com/lightas/Occluded-DukeMTMC-Dataset), and the vehicle datasets [VehicleID](https://www.pkuml.org/resources/pku-vehicleid.html),
[VeRi-776](https://github.com/JDAI-CV/VeRidataset)
#预训练模型
[ViT-Base](https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-vitjx/jx_vit_base_p16_224-80ecf9dd.pth),
[ViT-Small](https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-weights/vit_small_p16_224-15ec54c9.pth),
[DeiT-Small](https://dl.fbaipublicfiles.com/deit/deit_small_distilled_patch16_224-649709d9.pth),
[DeiT-Base](https://dl.fbaipublicfiles.com/deit/deit_base_distilled_patch16_224-df68dfff.pth)
#下载预训练模型
#后台下载
nohup wget https://github.com/rwightman/pytorch-image-models/releases/download/v0.1-vitjx/jx_vit_base_p16_224-80ecf9dd.pth > log.out 2>& 1&
#遇到问题
ImportError: cannot import name 'container_abcs' from 'torch._six'
#解决方案
1.8以下版本使用 from torch._six import container_abcs;
1.8以上版本使用import collections.abc as container_abcs
#数据训练
python train.py --config_file configs/DukeMTMC/vit_base.yml MODEL.DEVICE_ID "('0')"
#后台训练
nohup python train.py --config_file configs/DukeMTMC/vit_base.yml MODEL.DEVICE_ID "('0,1')"> log.out 2>& 1&
#数据训练
nohup python train.py --config_file configs/DukeMTMC/vit_transreid_stride.yml MODEL.DEVICE_ID "('0,1')"> log.out 2>& 1&
#进行推理
python test.py --config_file configs/DukeMTMC/vit_transreid_stride.yml MODEL.DEVICE_ID "('0,1')" TEST.WEIGHT '../logs/duke_vit_transreid_stride/transformer_120.pth'
#拷贝OSNET地址
#代码地址
#https://github.com/mikel-brostrom/Yolov5_StrongSORT_OSNet
git clone https://github.com/mikel-brostrom/Yolov5_StrongSORT_OSNet.git
#创建osnet_reid虚拟环境
conda create -n osnet_reid python=3.8
#激活虚拟环境
conda activate osnet_reid
#安装必要文件
pip install -r requirements.txt
#对人进行追踪
python track.py --source 0 --yolo-weights yolov5/weights/crowdhuman_yolov5m.pt --classes 0 # tracks persons, only
#重新下载代码
git clone --recurse-submodules https://github.com/mikel-brostrom/Yolov5_StrongSORT_OSNet.git
#程序运行遇到问题
解决方案:https://www.nhooo.com/note/qa377j.html
论文解读:
ECCV2020 ReID文章阅读 - 知乎 (zhihu.com)
2021 ICCV person re-identification(行人重识别)论文总结 part2 - 知乎 (zhihu.com)