mmpose icon indicating copy to clipboard operation
mmpose copied to clipboard

为什么所有Bottom_up模型的config文件中的输入图片大小都是宽高相同的?

Open calmiLovesAI opened this issue 2 years ago • 6 comments

例如在res50_crowdpose_512x512.py中:

data_cfg = dict(
    image_size=512,
    base_size=256,
    base_sigma=2,
    heatmap_size=[128],
    num_joints=channel_cfg['dataset_joints'],
    dataset_channel=channel_cfg['dataset_channel'],
    inference_channel=channel_cfg['inference_channel'],
    num_scales=1,
    scale_aware_sigma=False,
)

如果我想让输入图片size变为[512, 384],应该怎么设置参数?

calmiLovesAI avatar May 09 '22 08:05 calmiLovesAI

Please use English or English & Chinese for issues so that we could have broader discussion.

mm-assistant[bot] avatar May 09 '22 08:05 mm-assistant[bot]

https://github.com/open-mmlab/mmpose/blob/8014e546df98a2cb73e08a59328d5e97bca32893/tests/test_pipelines/test_bottom_up_pipelines.py#L96

印象中,也支持矩形输入

jin-s13 avatar May 09 '22 08:05 jin-s13

我把data_cfg修改成了:

data_cfg = dict(
    image_size=[384, 512],
    base_size=256,
    base_sigma=2,
    heatmap_size=[96, 128],
    num_joints=channel_cfg['dataset_joints'],
    dataset_channel=channel_cfg['dataset_channel'],
    inference_channel=channel_cfg['inference_channel'],
    num_scales=1,
    scale_aware_sigma=False,
)

然后训练的时候报错:

Traceback (most recent call last):
  File "tools/train.py", line 203, in <module>
    main()
  File "tools/train.py", line 199, in main
    meta=meta)
  File "/home/featurize/mmpose/mmpose/apis/train.py", line 205, in train_model
    runner.run(data_loaders, cfg.workflow, cfg.total_epochs)
  File "/environment/miniconda3/lib/python3.7/site-packages/mmcv/runner/epoch_based_runner.py", line 127, in run
    epoch_runner(data_loaders[i], **kwargs)
  File "/environment/miniconda3/lib/python3.7/site-packages/mmcv/runner/epoch_based_runner.py", line 47, in train
    for i, data_batch in enumerate(self.data_loader):
  File "/environment/miniconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 521, in __next__
    data = self._next_data()
  File "/environment/miniconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1203, in _next_data
    return self._process_data(data)
  File "/environment/miniconda3/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1229, in _process_data
    data.reraise()
  File "/environment/miniconda3/lib/python3.7/site-packages/torch/_utils.py", line 434, in reraise
    raise exception
AssertionError: Caught AssertionError in DataLoader worker process 0.
Original Traceback (most recent call last):
  File "/environment/miniconda3/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 287, in _worker_loop
    data = fetcher.fetch(index)
  File "/environment/miniconda3/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 49, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/environment/miniconda3/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 49, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/home/featurize/mmpose/mmpose/datasets/datasets/base/kpt_2d_sview_rgb_img_bottom_up_dataset.py", line 188, in __getitem__
    return self.prepare_train_img(idx)
  File "/home/featurize/mmpose/mmpose/datasets/datasets/base/kpt_2d_sview_rgb_img_bottom_up_dataset.py", line 171, in prepare_train_img
    return self.pipeline(results)
  File "/home/featurize/mmpose/mmpose/datasets/pipelines/shared_transform.py", line 99, in __call__
    data = t(data)
  File "/home/featurize/mmpose/mmpose/datasets/pipelines/bottom_up_transform.py", line 488, in __call__
    self.output_size)
AssertionError: (1, 2, array([ 96, 128]))

calmiLovesAI avatar May 09 '22 08:05 calmiLovesAI

这里的 image_size=512 指的是输入网络的图片大小,如果你的输入图片不是 512 x 512 的,在数据预处理的时候会 resize 到 512 x 512,因此无需在 config 文件中指定 image_size=[384, 512]

liqikai9 avatar May 09 '22 08:05 liqikai9

这里的 image_size=512 指的是输入网络的图片大小,如果你的输入图片不是 512 x 512 的,在数据预处理的时候会 resize 到 512 x 512,因此无需在 config 文件中指定 image_size=[384, 512]

这个我知道,我就想问一下能不能将输入图片宽高指定为不一样的,目前来看还是会报错的

calmiLovesAI avatar May 09 '22 13:05 calmiLovesAI

heatmap_size=[[96, 128]]试试?

Dwrety avatar Jun 01 '22 02:06 Dwrety