DatasetFormatter.from_toplosses() returning too large of indexes

After training a multiclass classifier similar to as was done in Part 1 of the course for the satellite images, I try to use the ImageCleaner widget following the example provided in, however when I run:

ds, idxs = DatasetFormatter().from_toplosses(learn)
ImageCleaner(ds, idxs, path)

I get the following error:
IndexError: index 7176 is out of bounds for axis 0 with size 2155

Looking into the code for the from_toplosses() method, I see the idxs are being returned using torch.topk() and it appears that it returns indexes, I assume, from a vector of dimensions (n_samples * n_classes), if I calculate the indexes as idxs = idxs // len( then the indexes fall within the correct range of values however if I use these newly calculated idxs in ImageCleaner(ds, idxs, path) it throws the following error:

TypeError: only integer scalar arrays can be converted to a scalar index

and then I run out of ideas of what else to try :slight_smile:

Anyone else run into this error before?

Any solution to above problem ?

Unfortunately, I don’t remember, if or how I resolved this. sorry!