Update README.md
Browse files
README.md
CHANGED
|
@@ -12,4 +12,51 @@ This repo contains the pre-trained weights of OSNet, specialized for person reco
|
|
| 12 |
|
| 13 |
Related work:
|
| 14 |
- [Omni-Scale Feature Learning for Person Re-Identification](https://arxiv.org/abs/1905.00953)
|
| 15 |
-
- [Learning Generalisable Omni-Scale Representations for Person Re-Identification](https://arxiv.org/abs/1910.06827)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
Related work:
|
| 14 |
- [Omni-Scale Feature Learning for Person Re-Identification](https://arxiv.org/abs/1905.00953)
|
| 15 |
+
- [Learning Generalisable Omni-Scale Representations for Person Re-Identification](https://arxiv.org/abs/1910.06827)
|
| 16 |
+
|
| 17 |
+
# Get started
|
| 18 |
+
|
| 19 |
+
Install the [Torchreid](https://github.com/KaiyangZhou/deep-person-reid) package.
|
| 20 |
+
|
| 21 |
+
```bash
|
| 22 |
+
# cd to your preferred directory and clone this repo
|
| 23 |
+
git clone https://github.com/KaiyangZhou/deep-person-reid.git
|
| 24 |
+
|
| 25 |
+
# create environment
|
| 26 |
+
cd deep-person-reid/
|
| 27 |
+
conda create --name torchreid python=3.7
|
| 28 |
+
conda activate torchreid
|
| 29 |
+
|
| 30 |
+
# install dependencies
|
| 31 |
+
# make sure `which python` and `which pip` point to the correct path
|
| 32 |
+
pip install -r requirements.txt
|
| 33 |
+
|
| 34 |
+
# install torch and torchvision (select the proper cuda version to suit your machine)
|
| 35 |
+
conda install pytorch torchvision cudatoolkit=9.0 -c pytorch
|
| 36 |
+
|
| 37 |
+
# install torchreid (don't need to re-build it if you modify the source code)
|
| 38 |
+
python setup.py develop
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
Use Torchreid as a feature extractor in your project.
|
| 42 |
+
|
| 43 |
+
```python
|
| 44 |
+
from torchreid.utils import FeatureExtractor
|
| 45 |
+
|
| 46 |
+
extractor = FeatureExtractor(
|
| 47 |
+
model_name='osnet_x1_0',
|
| 48 |
+
model_path='a/b/c/model.pth.tar',
|
| 49 |
+
device='cuda'
|
| 50 |
+
)
|
| 51 |
+
|
| 52 |
+
image_list = [
|
| 53 |
+
'a/b/c/image001.jpg',
|
| 54 |
+
'a/b/c/image002.jpg',
|
| 55 |
+
'a/b/c/image003.jpg',
|
| 56 |
+
'a/b/c/image004.jpg',
|
| 57 |
+
'a/b/c/image005.jpg'
|
| 58 |
+
]
|
| 59 |
+
|
| 60 |
+
features = extractor(image_list)
|
| 61 |
+
print(features.shape) # output (5, 512)
|
| 62 |
+
```
|