RL4M / MRM-pytorch

An official implementation of Advancing Radiograph Representation Learning with Masked Record Modeling (ICLR'23)
MIT License
73 stars 5 forks source link

KeyError: 'Dice. front' when training the segementation task #9

Open SZUHvern opened 1 year ago

SZUHvern commented 1 year ago

Thank you for sharing the code!

There is an error occur when I trainning the segementation task: File ".../site-packages/mmcv/runner/hooks/evaluation.py", line 389, in evaluate return eval_res[self.key_indicator] KeyError: 'Dice.front'

After inspection, I found that in /mmseg/core/evaluation/metrics. py, the function 'total_area_to_metrics' has the following definition:

Allowed_ Metrics=['mIoU ',' mDice ',' mFscore ',' medDice '] But there is no 'if' item for 'medDice': For metric in metrics: If metric=='mIoU ': ... If metric=='mDice': ... I guess is any code missing here? or can I directly use [If metric=='mDice' or metric=='medDice ': ] ?

DopamineLcy commented 1 year ago

Thank you, and the function returns in https://github.com/RL4M/MRM-pytorch/blob/3730ba49a678eda870284205178bfe25627aaed8/Siim_Segmentation/mmseg/core/evaluation/metrics.py#L310 when metrics == ['medDice'] the function 'total_area_to_metrics' should not be executed

SZUHvern commented 1 year ago

if mmcv.is_list_of(results, np.ndarray) or mmcv.is_list_of(results, str):

Do you mean that the program will execute here? But the variable ‘results’ I get here is a list of tuple

DopamineLcy commented 1 year ago

Variable ‘results’ here should be a list of np.ndarray

SZUHvern commented 1 year ago

Thanks, But how can I get the mentioned list [np.array]? The annotation of type here is consistent with mine https://github.com/RL4M/MRM-pytorch/blob/3730ba49a678eda870284205178bfe25627aaed8/Siim_Segmentation/mmseg/datasets/custom.py#LL397C17-L397C17