Metrics for multilabel dataset: accuracy_multi() missing 1 required positional argument: 'thresh'

I’ve been getting the following error accuracy_multi() missing 1 required positional argument: 'thresh' while working on a multi-label dataset.

My get_data function looks like this:

img_folder = 'images'
def get_data(sz):
    tfms = tfms_from_model(model, sz, aug_tfms=transforms_top_down, max_zoom=1.05)
    return ImageClassifierData.from_csv(PATH, img_folder, label_csv, tfms=tfms,
                    suffix='', val_idxs=val_idxs)

(my dataset doesn’t have a specific “test” folder and I haven’t made on either – should this matter?)

My learn object is learn = ConvLearner.pretrained(model, data). Notice I’m not passing in a metrics object like how Lesson 2 (planets) does. In this case it seems FastAI library uses accuracy_multi as a metric.

from “fastai/courses/dl1/fastai/conv_learner.py” https://github.com/fastai/fastai/blob/master/fastai/conv_learner.py#L88-#L90

if data.is_reg: self.crit = F.l1_loss
        elif self.metrics is None:
            self.metrics = [accuracy_multi] if self.data.is_multi else [accuracy]

The error I’m getting is accuracy_multi() missing 1 required positional argument: ‘thresh’.

Questions:

  1. How do I go about setting “thresh”?

  2. Is there a particular metric I should be using to measure loss?

  3. Perhaps unrelated: To create a test folder do I just make a new folder with a sample of the training images and fastAi library will not use the test images when training?

Thanks!

1 Like