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

what does self.label_map[i] = -1 mean in custom.py? #1050

Open
RoyZhDec opened this issue Nov 17, 2021 · 1 comment
Open

what does self.label_map[i] = -1 mean in custom.py? #1050

RoyZhDec opened this issue Nov 17, 2021 · 1 comment

Comments

@RoyZhDec
Copy link

RoyZhDec commented Nov 17, 2021

In custom.py, if I use custom_classes(classes is not None), the code below will process:
for i, c in enumerate(self.CLASSES): if c not in class_names: self.label_map[i] = -1 else: self.label_map[i] = class_names.index(c)
For example, if I use cityscapes for training and I only want to use "road" class, all other classes I treat as background, and I hope to get a binary segmentation model. So I add one parameter "classes=['road']" to build my own cityscapes dataset as follow:
super(CityscapesDataset_2class, self).__init__( img_suffix=img_suffix, seg_map_suffix=seg_map_suffix, classes=['road'], **kwargs)
Then besides 'road' train_id will still be 0, all other classes train_id will be -1, what exactly does this mean? -1 means ignore? Or just another class? Can I get a binary model? Looking forward your reply! BIG THANKS!!

@RockeyCoss
Copy link
Contributor

RockeyCoss commented Dec 29, 2021

Sorry for late reply.
Well, we use uint8 as the data type of the annotations. Therefore, when loading the annotation, -1 is actually 255. 255 is the default ignore index, which meas classes other than road will be ignored

wjkim81 pushed a commit to wjkim81/mmsegmentation that referenced this issue Dec 3, 2023
* [Enhancement] inference speed and flops tools. (open-mmlab#986)

* add the function to test the dummy forward speed of models.

* add tools to test the flops and inference speed of multiple models.

* [Feature] Add ViPNAS models for wholebody keypoint detection (open-mmlab#1009)

* add configs

* add dark configs

* add checkpoint and readme

* update webcam demo

* fix model path in webcam demo

* fix unittest

* update model metafiles (open-mmlab#1001)

* [Feature] Add ViPNAS mbv3 (open-mmlab#1025)

* add vipnas mbv3

* test other variants

* submission for mmpose

* add unittest

* add readme

* update .yml

* fix lint

* rebase

* fix pytest

Co-authored-by: jin-s13 <jinsheng13@foxmail.com>

* add cfg file for flops and speed test,  change the bulid_posenet to init_pose_model and fix some typo in cfg (open-mmlab#1028)

* Skip CI when some specific files were changed (open-mmlab#1041)

* add voxelpose

* unit test

* unit test

* unit test

* add docs/ckpts

* del unnecessary comments

* correct typos in comments and docs

* Add or modify docs

* change variable names

* reduce memory cost in test

* get person_id

* rebase

* resolve comments

* rebase master

* rename cfg files

* fix typos in comments

Co-authored-by: zengwang430521 <zengwang430521@gmail.com>
Co-authored-by: Yining Li <liyining0712@gmail.com>
Co-authored-by: Lumin <30328525+luminxu@users.noreply.github.com>
Co-authored-by: jin-s13 <jinsheng13@foxmail.com>
Co-authored-by: Qikai Li <87690686+liqikai9@users.noreply.github.com>
Co-authored-by: QwQ2000 <396707050@qq.com>
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