<div align="center">
<h1>
Torchreid-Pip: Packaged version of Torchreid
</h1>
<h4>
<img width="700" alt="teaser" src="https://raw.githubusercontent.com/goksenin-uav/torchreid-pip/main/doc/logo.png">
</h4>
</div>
This repo is a packaged version of the [Torchreid](https://github.com/KaiyangZhou/deep-person-reid) algorithm.
### Installation
```
pip install torchreid
```
### Overview
##### 1. Import ``torchreid``
```python
import torchreid
```
##### 2. Load data manager
```python
datamanager = torchreid.data.ImageDataManager(
root="reid-data",
sources="market1501",
targets="market1501",
height=256,
width=128,
batch_size_train=32,
batch_size_test=100,
transforms=["random_flip", "random_crop"]
)
```
##### 3 Build model, optimizer and lr_scheduler
```python
model = torchreid.models.build_model(
name="resnet50",
num_classes=datamanager.num_train_pids,
loss="softmax",
pretrained=True
)
model = model.cuda()
optimizer = torchreid.optim.build_optimizer(
model,
optim="adam",
lr=0.0003
)
scheduler = torchreid.optim.build_lr_scheduler(
optimizer,
lr_scheduler="single_step",
stepsize=20
)
```
##### 4. Build engine
```python
engine = torchreid.engine.ImageSoftmaxEngine(
datamanager,
model,
optimizer=optimizer,
scheduler=scheduler,
label_smooth=True
)
```
##### 5. Run training and test
```python
engine.run(
save_dir="log/resnet50",
max_epoch=60,
eval_freq=10,
print_freq=10,
test_only=False
)
```
Citation
---------
If you use this code or the models in your research, please give credit to the following papers:
```bibtex
@article{torchreid,
title={Torchreid: A Library for Deep Learning Person Re-Identification in Pytorch},
author={Zhou, Kaiyang and Xiang, Tao},
journal={arXiv preprint arXiv:1910.10093},
year={2019}
}
@inproceedings{zhou2019osnet,
title={Omni-Scale Feature Learning for Person Re-Identification},
author={Zhou, Kaiyang and Yang, Yongxin and Cavallaro, Andrea and Xiang, Tao},
booktitle={ICCV},
year={2019}
}
@article{zhou2021osnet,
title={Learning Generalisable Omni-Scale Representations for Person Re-Identification},
author={Zhou, Kaiyang and Yang, Yongxin and Cavallaro, Andrea and Xiang, Tao},
journal={TPAMI},
year={2021}
}
```
Raw data
{
"_id": null,
"home_page": "https://github.com/goksenin-uav/torchreid-pip",
"name": "torchreid",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "machine-learning,deep-learning,ml,pytorch,vision,loss,image-classification,video-classification",
"author": "kadirnar",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/62/9a/d3d8da1d1a8a189b2b2d6f191b21cd7fbdb91a587a9c992bcd9666895284/torchreid-0.2.5.tar.gz",
"platform": null,
"description": "<div align=\"center\">\n<h1>\n Torchreid-Pip: Packaged version of Torchreid \n</h1>\n<h4>\n <img width=\"700\" alt=\"teaser\" src=\"https://raw.githubusercontent.com/goksenin-uav/torchreid-pip/main/doc/logo.png\">\n</h4>\n</div>\n\nThis repo is a packaged version of the [Torchreid](https://github.com/KaiyangZhou/deep-person-reid) algorithm.\n### Installation\n```\npip install torchreid\n```\n\n### Overview\n##### 1. Import ``torchreid``\n```python\nimport torchreid\n```\n##### 2. Load data manager\n\n```python \ndatamanager = torchreid.data.ImageDataManager(\n root=\"reid-data\",\n sources=\"market1501\",\n targets=\"market1501\",\n height=256,\n width=128,\n batch_size_train=32,\n batch_size_test=100,\n transforms=[\"random_flip\", \"random_crop\"]\n)\n```\n##### 3 Build model, optimizer and lr_scheduler\n\n```python \nmodel = torchreid.models.build_model(\n name=\"resnet50\",\n num_classes=datamanager.num_train_pids,\n loss=\"softmax\",\n pretrained=True\n)\n\nmodel = model.cuda()\n\noptimizer = torchreid.optim.build_optimizer(\n model,\n optim=\"adam\",\n lr=0.0003\n)\n\nscheduler = torchreid.optim.build_lr_scheduler(\n optimizer,\n lr_scheduler=\"single_step\",\n stepsize=20\n)\n```\n##### 4. Build engine\n\n```python\nengine = torchreid.engine.ImageSoftmaxEngine(\n datamanager,\n model,\n optimizer=optimizer,\n scheduler=scheduler,\n label_smooth=True\n)\n```\n##### 5. Run training and test\n\n```python\nengine.run(\n save_dir=\"log/resnet50\",\n max_epoch=60,\n eval_freq=10,\n print_freq=10,\n test_only=False\n)\n```\nCitation\n---------\nIf you use this code or the models in your research, please give credit to the following papers:\n```bibtex\n@article{torchreid,\n title={Torchreid: A Library for Deep Learning Person Re-Identification in Pytorch},\n author={Zhou, Kaiyang and Xiang, Tao},\n journal={arXiv preprint arXiv:1910.10093},\n year={2019}\n} \n\n@inproceedings{zhou2019osnet,\n title={Omni-Scale Feature Learning for Person Re-Identification},\n author={Zhou, Kaiyang and Yang, Yongxin and Cavallaro, Andrea and Xiang, Tao},\n booktitle={ICCV},\n year={2019}\n}\n\n@article{zhou2021osnet,\n title={Learning Generalisable Omni-Scale Representations for Person Re-Identification},\n author={Zhou, Kaiyang and Yang, Yongxin and Cavallaro, Andrea and Xiang, Tao},\n journal={TPAMI},\n year={2021}\n}\n```\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Torchreid-Pip: Deep learning person re-identification in PyTorch.",
"version": "0.2.5",
"project_urls": {
"Homepage": "https://github.com/goksenin-uav/torchreid-pip"
},
"split_keywords": [
"machine-learning",
"deep-learning",
"ml",
"pytorch",
"vision",
"loss",
"image-classification",
"video-classification"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "629ad3d8da1d1a8a189b2b2d6f191b21cd7fbdb91a587a9c992bcd9666895284",
"md5": "966130b65859fb1b14531cb831a7b7dc",
"sha256": "bc1055c6fb8444968798708dd13fdad00148e9d7cf3cb18cf52f4b949857fe08"
},
"downloads": -1,
"filename": "torchreid-0.2.5.tar.gz",
"has_sig": false,
"md5_digest": "966130b65859fb1b14531cb831a7b7dc",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 92656,
"upload_time": "2022-10-16T12:33:29",
"upload_time_iso_8601": "2022-10-16T12:33:29.693923Z",
"url": "https://files.pythonhosted.org/packages/62/9a/d3d8da1d1a8a189b2b2d6f191b21cd7fbdb91a587a9c992bcd9666895284/torchreid-0.2.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-10-16 12:33:29",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "goksenin-uav",
"github_project": "torchreid-pip",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "torchreid"
}