rm CUDA_VISIBLE_DEVICES

pull/294/head
KaiyangZhou 2019-12-03 10:35:21 +00:00
parent 4cc4adb54a
commit 35472dfe54
2 changed files with 4 additions and 16 deletions

View File

@ -143,9 +143,9 @@ Get started: 30 seconds to Torchreid
A unified interface
-----------------------
In "deep-person-reid/scripts/", we provide a unified interface to train and test a model. See "scripts/main.py" and "scripts/default_config.py" for more details. "configs/" contains some predefined configs which you can use as a starting point.
In "deep-person-reid/scripts/", we provide a unified interface to train and test a model. See "scripts/main.py" and "scripts/default_config.py" for more details. The folder "configs/" contains some predefined configs which you can use as a starting point.
Below we provide an example to train and test `OSNet (Zhou et al. ICCV'19) <https://arxiv.org/abs/1905.00953>`_. Assume :code:`PATH_TO_DATA` is the directory containing reid datasets.
Below we provide an example to train and test `OSNet (Zhou et al. ICCV'19) <https://arxiv.org/abs/1905.00953>`_. Assume :code:`PATH_TO_DATA` is the directory containing reid datasets. The environmental variable :code:`CUDA_VISIBLE_DEVICES` is omitted, which you need to specify if you have a pool of gpus and want to use a specific set of them.
Conventional setting
^^^^^^^^^^^^^^^^^^^^^
@ -157,8 +157,7 @@ To train OSNet on Market1501, do
python scripts/main.py \
--config-file configs/im_osnet_x1_0_softmax_256x128_amsgrad_cosine.yaml \
--transforms random_flip random_erase \
--root $PATH_TO_DATA \
--gpu-devices 0
--root $PATH_TO_DATA
The config file sets Market1501 as the default dataset. If you wanna use DukeMTMC-reID, do
@ -171,7 +170,6 @@ The config file sets Market1501 as the default dataset. If you wanna use DukeMTM
-t dukemtmcreid \
--transforms random_flip random_erase \
--root $PATH_TO_DATA \
--gpu-devices 0 \
data.save_dir log/osnet_x1_0_dukemtmcreid_softmax_cosinelr
The code will automatically (download and) load the ImageNet pretrained weights. After the training is done, the model will be saved as "log/osnet_x1_0_market1501_softmax_cosinelr/model.pth.tar-250". Under the same folder, you can find the `tensorboard <https://pytorch.org/docs/stable/tensorboard.html>`_ file. To visualize the learning curves using tensorboard, you can run :code:`tensorboard --logdir=log/osnet_x1_0_market1501_softmax_cosinelr` in the terminal and visit :code:`http://localhost:6006/` in your web browser.
@ -183,7 +181,6 @@ Evaluation is automatically performed at the end of training. To run the test ag
python scripts/main.py \
--config-file configs/im_osnet_x1_0_softmax_256x128_amsgrad_cosine.yaml \
--root $PATH_TO_DATA \
--gpu-devices 0 \
model.load_weights log/osnet_x1_0_market1501_softmax_cosinelr/model.pth.tar-250 \
test.evaluate True
@ -200,8 +197,7 @@ Suppose you wanna train OSNet on DukeMTMC-reID and test its performance on Marke
-s dukemtmcreid \
-t market1501 \
--transforms random_flip color_jitter \
--root $PATH_TO_DATA \
--gpu-devices 0
--root $PATH_TO_DATA
Here we only test the cross-domain performance. However, if you also want to test the performance on the source dataset, i.e. DukeMTMC-reID, you can set :code:`-t dukemtmcreid market1501`, which will evaluate the model on the two datasets separately.

View File

@ -116,11 +116,6 @@ def main():
parser.add_argument(
'--root', type=str, default='', help='path to data root'
)
parser.add_argument(
'--gpu-devices',
type=str,
default='',
)
parser.add_argument(
'opts',
default=None,
@ -129,9 +124,6 @@ def main():
)
args = parser.parse_args()
if args.gpu_devices:
os.environ['CUDA_VISIBLE_DEVICES'] = args.gpu_devices
cfg = get_default_config()
cfg.use_gpu = torch.cuda.is_available()
if args.config_file: