Open david95j2 opened 1 year ago
@david95j2 You need to set metainfo to the dataset. example https://github.com/open-mmlab/mmyolo/blob/main/configs/yolov5/yolov5_s-v61_fast_1xb12-40e_cat.py#L31
@hhaAndroid sorry... my mistake
The reason for the above problem is that I did not modify the num_things_classes, num_stuff_classes of panoptic_fusion_head in the config file.
num_things_classes = 1
num_stuff_classes = 0
num_classes = num_things_classes + num_stuff_classes
model = dict(
backbone=dict(
embed_dims=192,
num_heads=[6, 12, 24, 48],
init_cfg=dict(type='Pretrained', checkpoint=pretrained),
# init_cfg=None
),
panoptic_head=dict(
num_queries=200,
in_channels=[192, 384, 768, 1536],
num_things_classes=num_things_classes,
num_stuff_classes=num_stuff_classes,
loss_cls=dict(class_weight=[1.0] * num_classes + [0.1])
),
panoptic_fusion_head=dict(
num_things_classes=num_things_classes,
num_stuff_classes=num_stuff_classes)
)
python3 tools/train.py configs/custom/mask2former_swin-s-p4-w7-224_lsj_8x2_50e_coco-panoptic.py
my result is empty
. so the following message will be printed
mmdet/datasets/coco_panoptic.py
print(f"\n\nlen(results) : {len(results)}\n\n") # debug
result_files, tmp_dir = self.format_results(results, jsonfile_prefix)
print(f"result_files : {result_files}") # debug
> len(results) : 4268
> result_files : {}
Traceback (most recent call last):
File "tools/train.py", line 250, in <module>
main()
File "tools/train.py", line 239, in main
train_detector(
File "/home/jylee/vsc/test/mmdetection/mmdet/apis/train.py", line 246, in train_detector
runner.run(data_loaders, cfg.workflow)
File "/home/jylee/vsc/test/mmdetection/seg/lib/python3.8/site-packages/mmcv/runner/iter_based_runner.py", line 144, in run
iter_runner(iter_loaders[i], **kwargs)
File "/home/jylee/vsc/test/mmdetection/seg/lib/python3.8/site-packages/mmcv/runner/iter_based_runner.py", line 70, in train
self.call_hook('after_train_iter')
File "/home/jylee/vsc/test/mmdetection/seg/lib/python3.8/site-packages/mmcv/runner/base_runner.py", line 317, in call_hook
getattr(hook, fn_name)(self)
File "/home/jylee/vsc/test/mmdetection/seg/lib/python3.8/site-packages/mmcv/runner/hooks/evaluation.py", line 266, in after_train_iter
self._do_evaluate(runner)
File "/home/jylee/vsc/test/mmdetection/mmdet/core/evaluation/eval_hooks.py", line 135, in _do_evaluate
key_score = self.evaluate(runner, results)
File "/home/jylee/vsc/test/mmdetection/seg/lib/python3.8/site-packages/mmcv/runner/hooks/evaluation.py", line 367, in evaluate
eval_res = self.dataloader.dataset.evaluate(
File "/home/jylee/vsc/test/mmdetection/mmdet/datasets/coco_panoptic.py", line 625, in evaluate
eval_pan_results = self.evaluate_pan_json(
File "/home/jylee/vsc/test/mmdetection/mmdet/datasets/coco_panoptic.py", line 530, in evaluate_pan_json
pred_json = mmcv.load(result_files['panoptic'])
KeyError: 'panoptic'
my results type is tuple..I don't know why the panoptic segmentation format sends out these results
print(f"results : {results}") # debug
result_files, tmp_dir = self.format_results(results, jsonfile_prefix)
> results : ([array([[0., 0., 0., 0., 0.],
[0., 0., 0., 0., 0.],
[0., 0., 0., 0., 0.],
......
[0., 0., 0., 0., 0.],
[0., 0., 0., 0., 0.]], dtype=float32)],
[[{'size': [462, 991], 'counts': b'bSo='},
{'size': [462, 991], 'counts': b'bSo='},
{'size': [462, 991], 'counts': b'bSo='},
.......
{'size': [462, 991], 'counts': b'bSo='},
{'size': [462, 991], 'counts': b'bSo='}]])
Coco Dataset, not custom dataset, get the following results
{'pan_results': array([[133, 133, 133, ..., 133, 133, 133],
[133, 133, 133, ..., 133, 133, 133],
[133, 133, 133, ..., 133, 133, 133],
...,
[133, 133, 133, ..., 133, 133, 133],
[133, 133, 133, ..., 133, 133, 133],
[133, 133, 133, ..., 133, 133, 133]], dtype=int32), 'ins_results': ([array([], shape=(0, 5), dtype=float32), array([], shape=(0, 5), dtype=float32),
.....,
[], [], [], []])}
How do I modify the config
to get these results
{'pan_results': array([[133, 133, 133, ..., 133, 133, 133],
[133, 133, 133, ..., 133, 133, 133],
[133, 133, 133, ..., 133, 133, 133],
...,
[133, 133, 133, ..., 133, 133, 133],
[133, 133, 133, ..., 133, 133, 133],
[133, 133, 133, ..., 133, 133, 133]], dtype=int32), 'ins_results': ([array([], shape=(0, 5), dtype=float32), array([], shape=(0, 5), dtype=float32),
.....,
[], [], [], []])}
Hi @david95j2
I am encountering the exact same problem, I am using class CocoPanopticDataset and still getting this same problem, I also want the results to look like
{'pan_results': array([[133, 133, 133, ..., 133, 133, 133], [133, 133, 133, ..., 133, 133, 133], [133, 133, 133, ..., 133, 133, 133], ..., [133, 133, 133, ..., 133, 133, 133], [133, 133, 133, ..., 133, 133, 133], [133, 133, 133, ..., 133, 133, 133]], dtype=int32), 'ins_results': ([array([], shape=(0, 5), dtype=float32), array([], shape=(0, 5), dtype=float32),
I am using mmdet 2.28
Did you manage to solve it?
Prerequisite
💬 Describe the reimplementation questions
An error occurred during training using
mask2former_swin-s-p4-w7-224_lsj_8x2_50e_mask-panoptic.py
withsingle class
. please tell me if I miss anythingInstructions To Reproduce the Issue:
Environment
Expected results
My Error log
Additional information
No response