How can I write a custom evaluation metric for mmyolo instance segmentation?

47 views Asked by At

I am currently working on a custom dataset in the format of CocoDataset. I want to evaluate the dataset on mean_iou but the CocoMetrics only seem to provide mAP metrics. I tried to use mmEval metrics but I get an error as described below.

My config is based on this example config. Training and evaluation works on the default val and test evaluators.

# ... dataset paths, dataloader etc...

# import the mmeval metric class
from mmeval import MeanIoU

# specify the mmeval metric for the test evaluation
test_cfg = dict(
    test_evaluator=dict(
        type='MMEvalMetric',
        metric=MeanIoU(num_classes=num_class)
    )
)
# ... other configs

This gives me the error

File "<unknown>", line 1
    MeanIoU=<class 'mmeval.metrics.mean_iou.MeanIoU'>
            ^
SyntaxError: invalid syntax

....
During handling of the above exception, another exception occurred:
SyntaxError: Failed to format the config file, please check the syntax of: 
MeanIoU=<class 'mmeval.metrics.mean_iou.MeanIoU'>

Any ideas what I am doing wrong? Or a better way to evaluate with mean_iou?

0

There are 0 answers