Skip to content

Panoptic FPN - custom dataset training configuration settings issue #12338

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
koupn opened this issue Mar 29, 2025 · 0 comments
Open

Panoptic FPN - custom dataset training configuration settings issue #12338

koupn opened this issue Mar 29, 2025 · 0 comments
Assignees
Labels
reimplementation Issues in model reimplementation

Comments

@koupn
Copy link

koupn commented Mar 29, 2025

Hi, I am trying to train Panoptic FPN model on custom dataset (COCO Panoptic format). For my dataset num_stuff_classes=4 and num_things_classes=13. Running on Linux platform with CPU under conda environment. My config file is as follows:
###########

the new config inherits the base configs to highlight the necessary modification

base = './panoptic_fpn/panoptic-fpn_r50_fpn_1x_coco.py'

METAINFO = {
'classes':
('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q'),
'thing_classes':
('b', 'c', 'd', 'f', 'g', 'h', 'i', 'j', 'k', 'n', 'o', 'p', 'q'),
'stuff_classes':
('a', 'e', 'l', 'm'),
'palette':
[(220, 20, 60), (119, 11, 32), (0, 0, 142), (0, 0, 230), (106, 0, 228),
(0, 60, 100), (0, 80, 100), (0, 0, 70), (0, 0, 192), (250, 170, 30),
(100, 170, 30), (220, 220, 0), (175, 116, 175), (250, 0, 30),
(165, 42, 42), (255, 77, 255), (0, 226, 252), (50,150,10)]
}

explicitly over-write all the num_classes field from default

model = dict(
roi_head=dict(
bbox_head=dict(
num_classes=17),
mask_head=dict(
num_classes=17),),
semantic_head=dict(
num_stuff_classes=4,
num_things_classes=13,),
panoptic_fusion_head=dict(
num_stuff_classes=4,
num_things_classes=13))

update panoptic annotation files location and METAINFO

data_root = 'DACC/'
dataset_type = 'CocoPanopticDataset'

train_cfg = dict(max_epochs=4, type='EpochBasedTrainLoop', val_interval=4)

train_dataloader = dict(
dataset=dict(
type=dataset_type,
ann_file='annotations/Panoptic_train.json',
metainfo=METAINFO,
data_root=data_root,
data_prefix=dict(
img='train/', seg='annotations/panoptic_train/')
),
num_workers=1
)
val_dataloader = dict(
dataset=dict(
type=dataset_type,
ann_file='annotations/Panoptic_val.json',
metainfo=METAINFO,
data_root=data_root,
data_prefix=dict(
img='val/', seg='annotations/panoptic_val/')
),
num_workers=1
)
test_dataloader = dict(
dataset=dict(
type=dataset_type,
ann_file='annotations/Panoptic_val.json',
metainfo=METAINFO,
data_root=data_root,
data_prefix=dict(
img='val/', seg='annotations/panoptic_val/')
),
num_workers=1
)
val_evaluator = dict(
ann_file='DACC/annotations/Panoptic_val.json',
backend_args=None,
seg_prefix='DACC/annotations/panoptic_val/',
type='CocoPanopticMetric')

test_evaluator = dict(
ann_file='DACC/annotations/Panoptic_val.json',
backend_args=None,
seg_prefix='DACC/annotations/panoptic_val/',
type='CocoPanopticMetric')

load_from = '/home/kou/anaconda3/envs/openmmlab/mmdetection/checkpoints/panoptic_fpn_r50_fpn_1x_coco_20210821_101153-9668fd13.pth'
##############
Now, my training is getting killed without any error message, screenshot attached. I have tried to adjust num_classes under roi_head(bbox_head, mask_head) to 13 and 17 both separately , but it doesn't work.
For num_classes=13 it throws "IndexError: index 13 is out of bounds for dimension 1 with size 13" , screenshot attached below.

Can someone help me point out my mistake in configuration settings?
Thanking you _/_

Image

Image

@koupn koupn added the reimplementation Issues in model reimplementation label Mar 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
reimplementation Issues in model reimplementation
Projects
None yet
Development

No branches or pull requests

2 participants