How to use fastai unet_learner?

Following the guide, I am still unable to get past the learn.fit(). For full details, please refer to the SO post, linked as the topic

To be succinct:

I have the same structure (images, labels, codes) as the test example (camvid). The only discernable difference is:

  • My images/labels are 256x256
  • My codes (classes) n = 20

However, I keep getting IndexError Target 20 is out of bounds.. I have confirmed that the labels are indeed within 1:20, running the following snippet:

for i in range(len(lnames)):
    y = Image.open(lnames[i])
    y_array = np.array(y)
    print(np.unique(y_array))

[20]
[20]
[20]
[ 5  7  8 11 12 13 14 17 20]
[ 5 12 13 14 15 16 17 20]
...
[14 17 20]
[14 17 20]
[ 8  9 10 11 12 13 14 16 17 19 20]
[ 1  2  3  4  7  8  9 10 11 12 13 14 16 17 18 19 20]
[ 2  3  9 10 12 13 14 16 17 19 20]
[ 1  2  3  4  7  8  9 10 11 12 13 14 16 17 18 19 20]

Any ideas?

I think I had this issue when the classes weren’t sequential. i.e. the was a gap in the class numbers. I don’t really understand the numbers you showed, but there is no 6.