Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I modified the settings because I wanted to train only people, but it's not normal. can you please check? #157

Open
moey920 opened this issue Oct 18, 2021 · 1 comment

Comments

@moey920
Copy link

moey920 commented Oct 18, 2021

I'm trying to train a human-only segmentation model using the cityscapes dataset in open-mmlab/mmsegmentation.
So, I modified the dataset as follows, but it does not produce normal results.
Please advise.

  1. I modified helpers/labels.py to:
#--------------------------------------------------------------------------------
# A list of all labels
#--------------------------------------------------------------------------------

# Please adapt the train IDs as appropriate for your approach.
# Note that you might want to ignore labels with ID 255 during training.
# Further note that the current train IDs are only a suggestion. You can use whatever you like.
# Make sure to provide your results using the original IDs and not the training IDs.
# Note that many IDs are ignored in evaluation and thus you never need to predict these!

labels = [
    #       name                     id    trainId   category            catId     hasInstances   ignoreInEval   color
    Label(  'unlabeled'            ,  0 ,      255 , 'void'            , 0       , False        , True         , (  0,  0,  0) ),
    Label(  'ego vehicle'          ,  1 ,      255 , 'void'            , 0       , False        , True         , (  0,  0,  0) ),
    Label(  'rectification border' ,  2 ,      255 , 'void'            , 0       , False        , True         , (  0,  0,  0) ),
    Label(  'out of roi'           ,  3 ,      255 , 'void'            , 0       , False        , True         , (  0,  0,  0) ),
    Label(  'static'               ,  4 ,      255 , 'void'            , 0       , False        , True         , (  0,  0,  0) ),
    Label(  'dynamic'              ,  5 ,      255 , 'void'            , 0       , False        , True         , (111, 74,  0) ),
    Label(  'ground'               ,  6 ,      255 , 'void'            , 0       , False        , True         , ( 81,  0, 81) ),
    Label(  'road'                 ,  7 ,      255 , 'flat'            , 1       , False        , True         , (128, 64,128) ),
    Label(  'sidewalk'             ,  8 ,      255 , 'flat'            , 1       , False        , True         , (244, 35,232) ),
    Label(  'parking'              ,  9 ,      255 , 'flat'            , 1       , False        , True         , (250,170,160) ),
    Label(  'rail track'           , 10 ,      255 , 'flat'            , 1       , False        , True         , (230,150,140) ),
    Label(  'building'             , 11 ,      255 , 'construction'    , 2       , False        , True         , ( 70, 70, 70) ),
    Label(  'wall'                 , 12 ,      255 , 'construction'    , 2       , False        , True         , (102,102,156) ),
    Label(  'fence'                , 13 ,      255 , 'construction'    , 2       , False        , True         , (190,153,153) ),
    Label(  'guard rail'           , 14 ,      255 , 'construction'    , 2       , False        , True         , (180,165,180) ),
    Label(  'bridge'               , 15 ,      255 , 'construction'    , 2       , False        , True         , (150,100,100) ),
    Label(  'tunnel'               , 16 ,      255 , 'construction'    , 2       , False        , True         , (150,120, 90) ),
    Label(  'pole'                 , 17 ,      255 , 'object'          , 3       , False        , True         , (153,153,153) ),
    Label(  'polegroup'            , 18 ,      255 , 'object'          , 3       , False        , True         , (153,153,153) ),
    Label(  'traffic light'        , 19 ,      255 , 'object'          , 3       , False        , True         , (250,170, 30) ),
    Label(  'traffic sign'         , 20 ,      255 , 'object'          , 3       , False        , True         , (220,220,  0) ),
    Label(  'vegetation'           , 21 ,      255 , 'nature'          , 4       , False        , True         , (107,142, 35) ),
    Label(  'terrain'              , 22 ,      255 , 'nature'          , 4       , False        , True         , (152,251,152) ),
    Label(  'sky'                  , 23 ,      255 , 'sky'             , 5       , False        , True         , ( 70,130,180) ),
    Label(  'person'               , 24 ,        0 , 'human'           , 6       , True         , False        , (255,255,  0) ),
    Label(  'rider'                , 25 ,      255 , 'human'           , 6       , True         , True         , (255, 60, 60) ),
    Label(  'car'                  , 26 ,      255 , 'vehicle'         , 7       , True         , True         , (  0,  0,142) ),
    Label(  'truck'                , 27 ,      255 , 'vehicle'         , 7       , True         , True         , (  0,  0, 70) ),
    Label(  'bus'                  , 28 ,      255 , 'vehicle'         , 7       , True         , True         , (  0, 60,100) ),
    Label(  'caravan'              , 29 ,      255 , 'vehicle'         , 7       , True         , True         , (  0,  0, 90) ),
    Label(  'trailer'              , 30 ,      255 , 'vehicle'         , 7       , True         , True         , (  0,  0,110) ),
    Label(  'train'                , 31 ,      255 , 'vehicle'         , 7       , True         , True         , (  0, 80,100) ),
    Label(  'motorcycle'           , 32 ,      255 , 'vehicle'         , 7       , True         , True         , (  0,  0,230) ),
    Label(  'bicycle'              , 33 ,      255 , 'vehicle'         , 7       , True         , True         , (119, 11, 32) ),
    Label(  'license plate'        , -1 ,       -1 , 'vehicle'         , 7       , False        , True         , (  0,  0,142) ),
]
  1. CreateTrainIdLabelImgs.py was executed to create *_labelTrainIds.png files based on the contents of the changed labels.py. Please also check if this part is working properly.

export CITYSCAPES_DATASET=pwd``
python preparation/createTrainIdLabelImgs.py

result : I thought only person would be represented by gt_mask here. However, it can still recognize other objects, such as cars and power poles. Is this condition normal?
aachen_000039_000019_gtFine_labelTrainIds


  1. We trained it with the data. This part is on the mmsegmentation side, so it may be difficult to help, but I would appreciate it if you only refer to the results.
    1. We trained from scratch without using pretrained-model (because it is a model trained with 19 classes). The loss is around -19.
    1. After 1000 iter, the result is as follows. When I check the *_labelTrainIds.png of the test set, it is all white. So acc comes out 100, and the result is all think that the class is road. But I think that only person is set to train with trainId of 0 above.

The first picture is a randomly uploaded *_labelTrainIds.png from the test set, and the second picture is the evaluation result.
(Sorry for not posting a picture that exactly matches the description. This is the result of training with classId of person and rider set to 0 and 1.)
berlin_000279_000019_gtFine_labelTrainIds
image

I've been trying to change the settings all day, but I can't solve it. Any help would be appreciated. I give you respect.

@talhaanwarch
Copy link

Hi, greetings. Dont consider my words final because i have just start working on it and have not concluded, so i am sharing the intermediate knowledge.
First i am not using this code base, so may be my way of work can be different.
This is how you can proceed.

  1. use pytorch cityscapes data set.
  2. pass that dataset to pytorch dataloader for iteration purpose.
  3. change all values to 0 in mask except person bit, it mean change all values to 0 and 24 (person) to 1. you can do it on dataset class by inheriting the cityscape class for pytorch and modifying it.
  4. now you have a binary segmentation model.
  5. you can use any segmentation framework, i say try qubvel work
  6. you can take some help from my binary segmentation task for medical images link here

hope it will help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants