chen-zhoujian / SegNet-pytorch

38 stars 6 forks source link

已经解决。 #3

Closed colinleng closed 2 years ago

colinleng commented 2 years ago

1、按照您文章写的将数据集改成了road=1 其他的都是0分成两类 2、之后进行了训练遇到的问题如下: segnet Target255 is out of bounds 请大佬帮忙看下。这个是因为类型不对么?我是按照训练脚本默认的进行操作的: parser = argparse.ArgumentParser() parser.add_argument("--class_num", type=int, default=2, help="训练的类别的种类") parser.add_argument("--epoch", type=int, default=4, help="训练迭代次数") parser.add_argument("--batch_size", type=int, default=2, help="批训练大小") parser.add_argument("--learning_rate", type=float, default=0.01, help="学习率大小") parser.add_argument("--momentum", type=float, default=0.9) parser.add_argument("--category_weight", type=float, default=[0.7502381287857225, 1.4990483912788268], help="损失函数中类别的权重") parser.add_argument("--train_txt", type=str, default="./txt/train.txt", help="训练的图片和标签的路径") parser.add_argument("--pre_training_weight", type=str, default="./weights/vgg16_bn-6c64b313.pth", help="编码器预训练权重路径") parser.add_argument("--weights", type=str, default="./weights/", help="训练好的权重保存路径") opt = parser.parse_args()

chen-zhoujian commented 2 years ago

可以检查下数据集的标签

------------------ 原始邮件 ------------------ 发件人: "chen-zhoujian/SegNet-pytorch" @.>; 发送时间: 2022年10月12日(星期三) 晚上9:02 @.>; @.***>; 主题: [chen-zhoujian/SegNet-pytorch] 我有个问题想请教 (Issue #3)

1、按照您文章写的将数据集改成了road=1 其他的都是0分成两类 2、之后进行了训练遇到的问题如下: segnet Target255 is out of bounds 请大佬帮忙看下。这个是因为类型不对么?我是按照训练脚本默认的进行操作的: parser = argparse.ArgumentParser() parser.add_argument("--class_num", type=int, default=2, help="训练的类别的种类") parser.add_argument("--epoch", type=int, default=4, help="训练迭代次数") parser.add_argument("--batch_size", type=int, default=2, help="批训练大小") parser.add_argument("--learning_rate", type=float, default=0.01, help="学习率大小") parser.add_argument("--momentum", type=float, default=0.9) parser.add_argument("--category_weight", type=float, default=[0.7502381287857225, 1.4990483912788268], help="损失函数中类别的权重") parser.add_argument("--train_txt", type=str, default="./txt/train.txt", help="训练的图片和标签的路径") parser.add_argument("--pre_training_weight", type=str, default="./weights/vgg16_bn-6c64b313.pth", help="编码器预训练权重路径") parser.add_argument("--weights", type=str, default="./weights/", help="训练好的权重保存路径") opt = parser.parse_args()

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

colinleng commented 2 years ago

数据集的标签如下: labels = [

name id trainId category catId hasInstances ignoreInEval color

Label(  'unlabeled'            ,  0 ,      0 , 'void'            , 0       , False        , False         , (  0,  0,  0) ),
Label(  'ego vehicle'          ,  1 ,      0 , 'void'            , 0       , False        , False         , (  0,  0,  0) ),
Label(  'rectification border' ,  2 ,      0 , 'void'            , 0       , False        , False         , (  0,  0,  0) ),
Label(  'out of roi'           ,  3 ,      0 , 'void'            , 0       , False        , False         , (  0,  0,  0) ),
Label(  'static'               ,  4 ,      0 , 'void'            , 0       , False        , False         , (  0,  0,  0) ),
Label(  'dynamic'              ,  5 ,      0 , 'void'            , 0       , False        , False         , (111, 74,  0) ),
Label(  'ground'               ,  6 ,      0 , 'void'            , 0       , False        , False         , ( 81,  0, 81) ),
Label(  'road'                 ,  7 ,        1 , 'flat'            , 1       , False        , False        , (128, 64,128) ),
Label(  'sidewalk'             ,  8 ,        0 , 'flat'            , 1       , False        , False        , (244, 35,232) ),
Label(  'parking'              ,  9 ,      0 , 'flat'            , 1       , False        , False         , (250,170,160) ),
Label(  'rail track'           , 10 ,      0 , 'flat'            , 1       , False        , False         , (230,150,140) ),
Label(  'building'             , 11 ,        0 , 'construction'    , 2       , False        , False        , ( 70, 70, 70) ),
Label(  'wall'                 , 12 ,        0 , 'construction'    , 2       , False        , False        , (102,102,156) ),
Label(  'fence'                , 13 ,        0 , 'construction'    , 2       , False        , False        , (190,153,153) ),
Label(  'guard rail'           , 14 ,      0 , 'construction'    , 2       , False        , False         , (180,165,180) ),
Label(  'bridge'               , 15 ,      0 , 'construction'    , 2       , False        , False         , (150,100,100) ),
Label(  'tunnel'               , 16 ,      0 , 'construction'    , 2       , False        , False         , (150,120, 90) ),
Label(  'pole'                 , 17 ,        0 , 'object'          , 3       , False        , False        , (153,153,153) ),
Label(  'polegroup'            , 18 ,      0 , 'object'          , 3       , False        , False         , (153,153,153) ),
Label(  'traffic light'        , 19 ,        0 , 'object'          , 3       , False        , False        , (250,170, 30) ),
Label(  'traffic sign'         , 20 ,        0 , 'object'          , 3       , False        , False        , (220,220,  0) ),
Label(  'vegetation'           , 21 ,        0 , 'nature'          , 4       , False        , False        , (107,142, 35) ),
Label(  'terrain'              , 22 ,        0 , 'nature'          , 4       , False        , False        , (152,251,152) ),
Label(  'sky'                  , 23 ,       0 , 'sky'             , 5       , False        , False        , ( 70,130,180) ),
Label(  'person'               , 24 ,       0 , 'human'           , 6       , True         , False        , (220, 20, 60) ),
Label(  'rider'                , 25 ,       0 , 'human'           , 6       , True         , False        , (255,  0,  0) ),
Label(  'car'                  , 26 ,       0 , 'vehicle'         , 7       , True         , False        , (  0,  0,142) ),
Label(  'truck'                , 27 ,       0 , 'vehicle'         , 7       , True         , False        , (  0,  0, 70) ),
Label(  'bus'                  , 28 ,       0 , 'vehicle'         , 7       , True         , False        , (  0, 60,100) ),
Label(  'caravan'              , 29 ,      0 , 'vehicle'         , 7       , True         , False         , (  0,  0, 90) ),
Label(  'trailer'              , 30 ,      0 , 'vehicle'         , 7       , True         , False         , (  0,  0,110) ),
Label(  'train'                , 31 ,       0 , 'vehicle'         , 7       , True         , False        , (  0, 80,100) ),
Label(  'motorcycle'           , 32 ,       0 , 'vehicle'         , 7       , True         , False        , (  0,  0,230) ),
Label(  'bicycle'              , 33 ,       0 , 'vehicle'         , 7       , True         , False        , (119, 11, 32) ),
Label(  'license plate'        , -1 ,       0 , 'vehicle'         , 7       , False        , False         , (  0,  0,142) ),

]

是按照您那个数据集说明博客文章进行修改的。您看,是我哪里有问题么?

colinleng commented 2 years ago

只改了trainId和ignoreInEval,trainid把road对应的改成了1其他的都改成了0,ignoreInEval都改成了False

colinleng commented 2 years ago

和pytorch版本会有关系么

colinleng commented 2 years ago

您好。找到问题所在了,感谢大佬。