multi-temporal-crop-classification-baseline icon indicating copy to clipboard operation
multi-temporal-crop-classification-baseline copied to clipboard

_generate_matrix implicitly assumes zero encodes nodata

Open robmarkcole opened this issue 1 year ago • 1 comments

I've had some headaches evaluating on another dataset since the implementation here in _generate_matrix assumes nodata is encoded as zero - however in my dataset 0 was a class and 255 was nodata.

Suggest either clarifying this expectation of the encoding, or allowing passing of a nodata value similar to here and here

robmarkcole avatar Jan 26 '24 23:01 robmarkcole

Hi Robin, _generate_matrix is not causing the problem. Two other places in the acuracy_metric module are causing the issue for your usecase. One is plot_confusion_matrix function which explicitly removes class 0 as the nodata class (but this is just visualization). The main source of the problem for you is line 240 in the module: for i in range(1, evaluator.num_class): which needs to get changed to for i in range(evaluator.num_class): to include class 0 as a valid class and produces metric for it in the csv file. I will revise the module to be able to handle more general cases as you suggested.

samKhallaghi avatar Feb 05 '24 05:02 samKhallaghi