mmtracking
mmtracking copied to clipboard
Hello! How to visualization the reid data.
After training the reid model, how to visualization it
You can use the tool in mmcls: https://github.com/open-mmlab/mmclassification/blob/master/mmcls/core/visualization/image.py
Thank you!
when I train reid with my own dataset, But I find It demands me set a label 0 . Why it need the label 0 dataset @JingweiZhang12
File "/usr/local/lib/python3.8/site-packages/torch/utils/data/_utils/worker.py", line 287, in _worker_loop
data = fetcher.fetch(index)
File "/usr/local/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 49, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/usr/local/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 49, in
Please post your complete error log.
File "train.py", line 117, in main
train_model(
File "/usr/local/lib/python3.8/site-packages/mmdet/apis/train.py", line 208, in train_detector
runner.run(data_loaders, cfg.workflow)
File "/usr/local/lib/python3.8/site-packages/mmcv/runner/epoch_based_runner.py", line 127, in run
epoch_runner(data_loaders[i], **kwargs)
File "/usr/local/lib/python3.8/site-packages/mmcv/runner/epoch_based_runner.py", line 47, in train
for i, data_batch in enumerate(self.data_loader):
File "/usr/local/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 530, in next
data = self._next_data()
File "/usr/local/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1224, in _next_data
return self._process_data(data)
File "/usr/local/lib/python3.8/site-packages/torch/utils/data/dataloader.py", line 1250, in _process_data
data.reraise()
File "/usr/local/lib/python3.8/site-packages/torch/_utils.py", line 457, in reraise
raise exception
KeyError: Caught KeyError in DataLoader worker process 0.
Original Traceback (most recent call last):
File "/usr/local/lib/python3.8/site-packages/torch/utils/data/_utils/worker.py", line 287, in _worker_loop
data = fetcher.fetch(index)
File "/usr/local/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 49, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File "/usr/local/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 49, in
ERROR:torch.distributed.elastic.multiprocessing.api:failed (exitcode: 1) local_rank: 0 (pid: 1836) of binary: /usr/local/bin/python
Traceback (most recent call last):
File "/usr/local/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/local/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/usr/local/lib/python3.8/site-packages/torch/distributed/launch.py", line 193, in
main()
File "/usr/local/lib/python3.8/site-packages/torch/distributed/launch.py", line 189, in main
launch(args)
File "/usr/local/lib/python3.8/site-packages/torch/distributed/launch.py", line 174, in launch
run(args)
File "/usr/local/lib/python3.8/site-packages/torch/distributed/run.py", line 715, in run
elastic_launch(
File "/usr/local/lib/python3.8/site-packages/torch/distributed/launcher/api.py", line 131, in call
return launch_agent(self._config, self._entrypoint, list(args))
File "/usr/local/lib/python3.8/site-packages/torch/distributed/launcher/api.py", line 245, in launch_agent
raise ChildFailedError(
torch.distributed.elastic.multiprocessing.errors.ChildFailedError:
openbayes.py FAILED
Failures: <NO_OTHER_FAILURES>
Root Cause (first observed failure): [0]: time : 2022-08-24_07:08:26 host : openbayesalgo-id35uyq9vjt3-main rank : 0 (local_rank: 0) exitcode : 1 (pid: 1836) error_file: <N/A> traceback : To enable traceback see: https://pytorch.org/docs/stable/elastic/errors.html
And. I have a confusuion about using mmcls to visualization the result, mmtrack predicting a tensor array such as
tensor([-0.0052, 0.0104, 0.0013, -0.0052, -0.0104, -0.0208, -0.0209, -0.0210,
-0.0013, 0.0209, -0.0104, -0.0211, 0.0104, -0.0209, -0.0013, 0.0052,
0.0208, -0.0105, -0.0208, 0.0052, -0.0026, -0.0210, -0.0104, 0.0210,
0.0209, -0.0209, 0.0013, 0.0105, 0.0105, -0.0013, 0.0208, 0.0026,
0.0052, -0.0026, 0.0208, 0.0104, -0.0104, -0.0104, 0.0026, 0.0104,
0.0104, 0.0208, -0.0052, -0.0105, 0.0104, 0.0209, 0.0209, -0.0104,
0.0002, -0.0208, -0.0026, 0.0052, 0.0026, 0.0052, -0.0105, -0.0052,
-0.0104, -0.0208, 0.0104, 0.0104, -0.0052, 0.0052, 0.0052, -0.0026,
-0.0013, -0.0208, -0.0209, 0.0208, -0.0104, -0.0104, -0.0208, 0.0208,
-0.0208, -0.0209, 0.0052, -0.0104, 0.0209, 0.0104, -0.0052, 0.0208,
-0.0208, 0.0209, 0.0209, -0.0104, -0.0013, 0.0209, -0.0104, -0.0208,
0.0026, -0.0209, -0.0104, 0.0208, 0.0104, 0.0209, 0.0104, 0.0208,
0.0104, -0.0208, -0.0052, -0.0104, -0.0210, 0.0208, 0.0104, 0.0052,
0.0208, 0.0104, -0.0104, 0.0052, 0.0104, 0.0013, -0.0208, -0.0052,
-0.0104, 0.0104, -0.0104, -0.0026, 0.0208, -0.0104, -0.0208, 0.0104,
0.0209, -0.0210, 0.0104, -0.0104, 0.0052, -0.0208, 0.0104, -0.0104],
device='cuda:0')]
but how to transplant to mmcls @JingweiZhang12
You can set breakpoint here: https://github.com/open-mmlab/mmtracking/blob/be8a7afbd719b7846a76caca74dd7f331036cdc3/mmtrack/datasets/reid_dataset.py#L52, and see how to generate self.index_dic.
You can use the tool in mmcls: https://github.com/open-mmlab/mmclassification/blob/master/mmcls/core/visualization/image.py
How can I visualize the CAM of the output?
import mmcv
from mmcls.core import visualization as vis img_name = info['img_prefix']+"/"+info['img_info']['filename'] img1 = mmcv.imread(img_name) info1 = {} info1['gt_label'] = info['gt_label'] info1 = int(info1) with vis.ImshowInfosContextManager() as manager: manager.put_img_infos(img1, info1,out_file='w.png') manager.put_img_infos(img2, info2, out_file='2_out.png')
you can try this, But if you want to see reid data ,this way is valid @noreenanwar
import mmcv
from mmcls.core import visualization as vis img_name = info['img_prefix']+"/"+info['img_info']['filename'] img1 = mmcv.imread(img_name) info1 = {} info1['gt_label'] = info['gt_label'] info1 = int(info1) with vis.ImshowInfosContextManager() as manager: manager.put_img_infos(img1, info1,out_file='w.png') manager.put_img_infos(img2, info2, out_file='2_out.png')
you can try this, But if you want to see reid data ,this way is valid @noreenanwar
this is just for Reid data?