isht7 / pytorch-deeplab-resnet

DeepLab resnet v2 model in pytorch
MIT License
602 stars 117 forks source link

read the ground truth of the pascal voc dataset #47

Open zhangyingbit opened 5 years ago

zhangyingbit commented 5 years ago

hello, the code you use to read the ground truth of dataset is

    gt_temp = cv2.imread(os.path.join(gt_path,piece+'.png'))[:,:,0]
    gt_temp[gt_temp == 255] = 0

why there is "[:,:,0]" for the ground truth? thank you very much! and when I use cv2 to read the ground truth of pascal voc dataset,

import cv2
import numpy as np
img_cv= cv2.imread('/Users/zhangying/Desktop/2007_000129.png')
img_array_cv = img_cv[:,:,0]
print('use the method CV\n ',np.unique(img_array_cv))

the output is

use the method CV
  [  0 128 192]

however the sum of the categories is 21 for voc dataset(128>20,192>20, is it reasonable?). How do you think about this problem? Thanks a lot!