open-mmlab / mmocr

OpenMMLab Text Detection, Recognition and Understanding Toolbox
https://mmocr.readthedocs.io/en/dev-1.x/
Apache License 2.0
4.22k stars 739 forks source link

Error when evaluation model MaskRCNN and FCENet #834

Open ThorPham opened 2 years ago

ThorPham commented 2 years ago

I have 500 images to evaluation and cmd i run : python tools/test.py /home/thorpham/Documents/mmocr/configs/textdet/maskrcnn/mask_rcnn_r50_fpn_160e_icdar2015.py /home/thorpham/Documents/mmocr/paper/maskCNN/epoch_10.pth --eval hmean-iou error appear : `File "tools/test.py", line 322, in main print(dataset.evaluate(outputs, **eval_kwargs)) File "/home/thorpham/Documents/mmocr/mmocr/datasets/icdar_dataset.py", line 157, in evaluate rank_list=rank_list) File "/home/thorpham/Documents/mmocr/mmocr/core/evaluation/hmean.py", line 103, in eval_hmean assert len(results) == len(img_infos) == len(ann_infos) AssertionError

` I check function eval len(results) only 250 but i have 500 images lead to results length difference img_infos length. I don't know why it's eval only a half dataset. Screenshot from 2022-03-12 22-23-17

gaotongxiao commented 2 years ago

Have you modified your config/code by any chance?

ThorPham commented 2 years ago

@gaotongxiao I only change file config for custom dataset. I eval successful on DBnet model for same data but on MaskRCNN and FCENet it's appear error. Can you guess where is the problem .

gaotongxiao commented 2 years ago

Could you share all the parts that you've modified following the issue template?

ThorPham commented 2 years ago

I just clone and install mmocr again But still remain error. I only change data in file config . `base = [ '../../base/runtime_10e.py', '../../base/det_models/ocr_mask_rcnn_r50_fpn_ohem.py', '../../base/schedules/schedule_sgd_160e.py', '../../base/det_datasets/icdar2015.py', '../../base/det_pipelines/maskrcnn_pipeline.py' ]

train_list = {{base.train_list}} test_list = {{base.test_list}}

train_pipeline = {{base.train_pipeline}} test_pipeline_icdar2015 = {{base.test_pipeline_icdar2015}}

dataset_type = 'IcdarDataset' data_root = '/home/thorpham/Documents/mmocr/data/'

data = dict( samples_per_gpu=8, workers_per_gpu=4, val_dataloader=dict(samples_per_gpu=4), test_dataloader=dict(samples_per_gpu=2), train=dict( type=dataset_type, ann_file=data_root + '/instances_training.json', img_prefix=data_root + '/imgs', pipeline=train_pipeline), val=dict( type=dataset_type, ann_file=data_root + '/instances_test.json', img_prefix=data_root + '/imgs', pipeline=test_pipeline_icdar2015), test=dict( type=dataset_type, ann_file=data_root + '/instances_val.json', img_prefix=data_root + '/imgs', pipeline=test_pipeline_icdar2015))

evaluation = dict(interval=10, metric='hmean-iou')`

gaotongxiao commented 2 years ago

Sorry for causing the inconvenience, I'm sure it's a bug on the batch inference of some models. We'll look into this one soon. For now, the workaround of this problem is setting test_dataloader=dict(samples_per_gpu=1).

ThorPham commented 2 years ago

@gaotongxiao Thank you for support. It's work.

gaotongxiao commented 2 years ago

Reopening it for the backlog :)