-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Add an example of retraining all internal reider classifiers for GTA V dataset - Rearrange some examples
- Loading branch information
Showing
7 changed files
with
74 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
Example 12: Use a supported module directly | ||
=========================================== | ||
Example 12: Train all the internal reider classifiers for GTA V dataset | ||
======================================================================= | ||
|
||
- **Description**: Use a supported detector/tracker/reider directly in your code. | ||
- **Description**: Use the standalone :func:`trainReIDClassifier()` to train and save a classifier .PKL files for GTA V dataset. | ||
- **Featuring**: | ||
- :py:class:`MyYOLOULT` | :py:class:`pyppbox.modules.detectors.yoloult.MyYOLOULT` | ||
- :py:class:`DCFGYOLOULT` | :py:class:`pyppbox.config.myconfig.DCFGYOLOULT` | ||
- :py:meth:`trainReIDClassifier` | :py:meth:`pyppbox.standalone.trainReIDClassifier` | ||
|
||
ℹ️ **Source code and input file(s)** -> `{pyppbox repo}/examples`_ | ||
|
||
.. _{pyppbox repo}/examples: https://github.com/rathaumons/pyppbox/tree/main/examples | ||
|
||
.. literalinclude:: ../../examples/example_12_direct_module.py | ||
.. literalinclude:: ../../examples/example_12_retain_gta5_reid_classifiers.py | ||
:encoding: latin-1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
Example 13: Use pyppbox in multithreading application | ||
===================================================== | ||
Example 13: Use a supported module directly | ||
=========================================== | ||
|
||
- **Description**: Use a pyppbox in multithreading application. | ||
- **Description**: Use a supported detector/tracker/reider directly in your code. | ||
- **Featuring**: | ||
- :py:class:`MT` | :py:class:`pyppbox.ppb.mt.MT` | ||
- :py:func:`visualizePeople` | :py:func:`pyppbox.utils.visualizetools.visualizePeople` | ||
- :py:class:`MyYOLOULT` | :py:class:`pyppbox.modules.detectors.yoloult.MyYOLOULT` | ||
- :py:class:`DCFGYOLOULT` | :py:class:`pyppbox.config.myconfig.DCFGYOLOULT` | ||
|
||
ℹ️ **Source code and input file(s)** -> `{pyppbox repo}/examples`_ | ||
|
||
.. _{pyppbox repo}/examples: https://github.com/rathaumons/pyppbox/tree/main/examples | ||
|
||
.. literalinclude:: ../../examples/example_13_multithreading.py | ||
.. literalinclude:: ../../examples/example_13_direct_module.py | ||
:encoding: latin-1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Example 14: Use pyppbox in multithreading application | ||
===================================================== | ||
|
||
- **Description**: Use a pyppbox in multithreading application. | ||
- **Featuring**: | ||
- :py:class:`MT` | :py:class:`pyppbox.ppb.mt.MT` | ||
- :py:func:`visualizePeople` | :py:func:`pyppbox.utils.visualizetools.visualizePeople` | ||
|
||
ℹ️ **Source code and input file(s)** -> `{pyppbox repo}/examples`_ | ||
|
||
.. _{pyppbox repo}/examples: https://github.com/rathaumons/pyppbox/tree/main/examples | ||
|
||
.. literalinclude:: ../../examples/example_14_multithreading.py | ||
:encoding: latin-1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
################################################################################# | ||
# Example of retraining all the internal reider classifiers for GTA V dataset | ||
################################################################################# | ||
|
||
import os | ||
import pyppbox | ||
from pyppbox.standalone import trainReIDClassifier | ||
|
||
|
||
pyppbox_root = os.path.dirname(pyppbox.__file__) | ||
|
||
gta5_osnet_ain_config = { | ||
'ri_name': 'Torchreid', | ||
'classifier_pkl': f'{pyppbox_root}/data/modules/torchreid/classifier/gta5_osnet_ain_ms_d_c.pkl', | ||
'train_data': f'{pyppbox_root}/data/datasets/GTA_V_DATASET/body_128x256', | ||
'model_name': 'osnet_ain_x1_0', | ||
'model_path': f'{pyppbox_root}/data/modules/torchreid/models/torchreid/osnet_ain_ms_d_c.pth.tar', | ||
'min_confidence': 0.35, | ||
'device': 'cuda' | ||
} | ||
|
||
gta5_osnet_config = { | ||
'ri_name': 'Torchreid', | ||
'classifier_pkl': f'{pyppbox_root}/data/modules/torchreid/classifier/gta5_osnet_ms_d_c.pkl', | ||
'train_data': f'{pyppbox_root}/data/datasets/GTA_V_DATASET/body_128x256', | ||
'model_name': 'osnet_x1_0', | ||
'model_path': f'{pyppbox_root}/data/modules/torchreid/models/torchreid/osnet_ms_d_c.pth.tar', | ||
'min_confidence': 0.35, | ||
'device': 'cuda' | ||
} | ||
|
||
gta5_facenet_config = { | ||
'ri_name': 'FaceNet', | ||
'gpu_mem': 0.585, | ||
'model_det': f'{pyppbox_root}/data/modules/facenet/models/det', | ||
'model_file': f'{pyppbox_root}/data/modules/facenet/models/20180402-114759/20180402-114759.pb', | ||
'classifier_pkl': f'{pyppbox_root}/data/modules/facenet/classifier/gta5.pkl', | ||
'train_data': f'{pyppbox_root}/data/datasets/GTA_V_DATASET/face_182x182', | ||
'batch_size': 1000, | ||
'min_confidence': 0.75, | ||
'yl_h_calibration': [-125, 75], | ||
'yl_w_calibration': [-55, 55] | ||
} | ||
|
||
trainReIDClassifier(reider=gta5_osnet_ain_config) | ||
trainReIDClassifier(reider=gta5_osnet_config) | ||
trainReIDClassifier(reider=gta5_facenet_config) | ||
|
File renamed without changes.
File renamed without changes.