Deeplab新数据集未找到新类

2024-06-28 11:26:09 发布

您现在位置:Python中文网/ 问答频道 /正文

嘿,我正在尝试向pascal数据集中添加一个新类,使其成为21个可检测的类。我采取了以下步骤:

  1. 分割图像。我挑了鸡,做了4个独立的鸡段。下面是一个例子:

enter image description hereenter image description hereenter image description here

  1. 将相应的图像放置在Voc2012 SegementionClass、SegmentationClassRaw、SegmentationObject和JPEG图像中

  2. 添加注释XML

  3. 将新图像添加到“VOC2012\ImageSets\Main”中的所有txt文件中

  4. 在“VOC2012\ImageSets\Main”中添加3个新的txt文件:chicken_train.txt、chicken_trainval.txt和chicken_val.txt。为包含鸡的文件名添加1。将2个鸡肉文件添加到VOC2012\ImageSets\Segmentation\train.txt,并将另外2个添加到trainval+val

  5. 在“data_generator.py”中创建新数据集:

    _EXTENDED_SEG_INFORMATION = DatasetDescriptor( splits_to_sizes={ 'train': 1466, 'train_aug': 10583, 'trainval': 2915, 'val': 1451, }, num_classes=22, ignore_label=255, )

  6. 为“扩展”数据集创建新的颜色映射:

    def create_extended_label_colormap(): 返回np.asarray([ [0,0,0],#背景 [128,0,0],#飞机 [0,128,0],#自行车 [128,128,0],#鸟 [0,0,128],#船 [128,0,128],#瓶 [0,128,128],#总线 [128,128,128],#汽车 [64,0,0],#猫 [192,0,0],#主席 [64,128,0],#牛 [64,0,128],#diningtable [64,0,128],#狗 [192,01228],#马 [64128128],#摩托车 [192128128],#人 [0,64,0],#盆栽植物 [128,64,0],#绵羊 [0192,0],#沙发 [128,192,0],#列车 [0,64128],#电视 [128,64128],#鸡肉 ])

  7. 使用以下命令生成TFRecord:

    py“research\deeplab\datasets\build\u voc2012\u data.py”--image\folder=“D:\deeplab\models master\research\deeplab\datasets\pascal\u voc\u seg\VOCdevkit\voc2012\JPEGImages”--semantic\u segmentation\u folder=“research\deeplab\datasets\pascal\u voc\u seg\VOCdevkit\voc2012\SegmentationClassRaw”--列表\u文件夹=“研究\deeplab\datasets\pascal\u voc\u seg\VOCdevkit\VOC2012\ImageSets\Segmentation”--image\u format=“jpg”--output\u dir=“研究\deeplab\datasets\extended\tfrecord”

  8. 人为地,为新的鸡类设置权重,使其显示出来。使用命令进行训练:

    python“D:\DeepLab\models master\research\DeepLab\train.py”--logtostderr--train\u split=“trainval”--model\u variant=“exception\u 65”--atrus\u rates=6--atrus\u rates=12--atrus rates=18--output\u stride=16--decoder\u output\u stride=4--train\u crop\u size=“513”--train\u batch\u size=2--dataset=“扩展“--training\u number\u of_steps=1000--fine\u tune\u batch\u norm=true--tf\u initial\u checkpoint=“D:\DeepLab\models master\research\DeepLab\datasets\pascal\u voc\u seg\init\u models\deeplabv3\u pascal\u train\u aug\model.ckpt”--train\u logdir=“D:\DeepLab\models master\research\DeepLab\DeepLab\DeepLab\DeepLab\DeepLab\train\train\train\train\trainval\set=“D:\DeepLab\models master\research\DeepLab\datasets\extended\tfrecord"--标签权重=.001--标签权重=.01--标签权重=.01--标签权重=.01--标签权重=.01--标签权重=.01--标签权重=.01--标签权重=.01--标签权重=.01--标签权重=.01--标签权重=.01--标签权重=.01--标签权重=.01--标签权重=.01--标签权重=.01--标签权重=.01--标签权重=.01--标签权重=.01--标签权重=.01--标签权重=.01--标签权重=.01--标签权重=.01--标签权重=.01--标签权重=.01--标签权重=100

  9. 导出模型并对其进行测试会给我带来一些不太好的结果:

enter image description here

  1. 图像上的eval命令也会产生较差的结果:

    评估/miou_1.0_1类[0.00715755112] eval/miou_1.0_16类[0.00142123573]eval/miou_1.0_17类[0.000168 795494] 评估/评估1.0级12[0] 评估/评估1.0级14[0] 评估/评估1.0级[0.126532018] 评估/miou_1.0_5级[0] 评估/miou_1.0_13类[0.0135749253] 评估/评估1.0级15[0.0179808438] 评估/评估1.0级3[0.000226198768] 评估/miou_1.0_8类[0.22916005]

    评估/miou_1.0_2类[8.26003941e-07] 评估/miou_1.0_7类[0.000108588596] 评估/评估1.0级4[0] 评估/百万_1.0_第19类[0] 评估/评估1.0级18[0.00898866542] 评估/miou_1.0_6级[4.23762758e-05] 评估/miou_1.0_总体[0.0191962905] 评估/评估1.0级21[0] 评估/miou_1.0_10级[0.00145707454] 评估/评估1.0级9[4.08720407e-05] 评估/评估1.0级20[0.00886027142] 评估/评估1.0级11[0.00659790076]

我试着训练10000次迭代,看看这是否能修复它,并且它确实会填充其他每一个类,但鸡类(类21)仍然保持在0百万。我做错了什么

附加说明:如果我坚持使用基本的pascal类,我可以得到一个相当好的模型,总的来说大约是8100万。问题只有在我尝试介绍新课程时才会出现

我不确定是否需要在“研究\对象\检测\数据”中替换掉“pascal\标签\地图”,或者是否不需要这样做


Tags: 数据图像mastertxtmodelstrain标签datasets