testannot,trainannot,valannotフォルダ内の画像を下記の方法で確認したところ(https://teratail.com/questions/146307を参考にさせていただきました)Road_marking は
Roadに含まれることが分かりました。これが色がズレる原因のようです。
Python
1import cv2
2import matplotlib.pyplot as plt
3import numpy as np
4from PIL import Image
5
6pil_img = Image.open("./CamVid/trainannot/0001TP_006690.png") # PIL で読み込む。
7img = np.asarray(pil_img) # numpy 配列に変換する。
8
9print(img.shape) # (176, 240)
10print(img)
11
12
13class Label:
14 Sky = 0
15 Building = 1
16 Pole = 2
17 Road = 3
18 Pavement = 4
19 Tree = 5
20 SignSymbol = 6
21 Fence = 7
22 Car = 8
23 Pedestrian = 9
24 Bicyclist = 10
25 Unlabelled = 11
26
27plt.imshow(np.where(img == 3, 100, 0)) # == の後の数字を変えるとその領域が表示される Road=3
28plt.axis('off')
29plt.show()
参考サイトには12クラスとして下記されていますが、
[Sky, Building, Pole, Road_marking, Road, Pavement, Tree, SignSymbol, Fence, Car, Pedestrian, Bicyclist, Unlabelled]
これだと13クラスですので、Road_markingを削除して下記のように12クラスにするとうまくいきました。
[Sky, Building, Pole, Road, Pavement, Tree, SignSymbol, Fence, Car, Pedestrian, Bicyclist, Unlabelled]
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。