配置FCN 8s voc数据集

按着博文http://blog.csdn.net/u012968002/article/details/78958090 的流程走的  主要是各种路径要搞清楚 参见http://blog.csdn.net/supe_king/article/details/58121993

中间出现在网上找的方法个版本不管用  后来发现 还是路径的问题。

solve.py  的路径好确定  关键是train.protxt    test.protxt 中


sbdd是存放数据集的路径  我的是/home/chenge/Documents/FCN/fcn/data/pascal  pascal下存放了训练图测试图(都放在一块 用train.txt test.txt调用即可)标签


我开始的错误就是把 训练的txt和测试的txt都放在了和voc2011文件夹平行的位置  后来放进voc2011就可以运行了

在voc_layers.py中 改6处路径1.放test.txt的位置split_f  = '{}/{}.txt'.format(self.voc_dir,
                self.split)意思就是直接读取之前test.protxt中路径split

                                               2.测试图im = Image.open('{}/JPEGImages/{}.jpg'.format(self.voc_dir, idx)) 前面的框就是test中sbdd_dir

                                                        3.测试标签  im = Image.open('{}/SegmentationClass/{}.png'.format(self.voc_dir, idx))
        label = np.array(im, dtype=np.uint8)

   之后的训练的路径同理

给的模板程序训练标签是mat格式  可以改程序变为pgn格式的。

def load_label(self, idx):  
        """
        Load label image as 1 x height x width integer array of label indices.
        The leading singleton dimension is required by the loss.
        """  
        im = Image.open('{}/SegmentationClass/{}.png'.format(self.sbdd_dir, idx))
        label = np.array(im, dtype=np.uint8)  
        label = label[np.newaxis, ...]  
        return label 





猜你喜欢

转载自blog.csdn.net/koreyoshichen/article/details/79075663
今日推荐