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

Problem1. Other palette colors are applied / Problem2. Train 2 classes #2197

Closed
sunghyun-nam opened this issue Oct 17, 2022 · 14 comments
Closed

Comments

@sunghyun-nam
Copy link

Problem 1.
Train was successful. But there is a weird thing.

When I run demo file with trained model, It shows different colors defined in scripts('mmseg.core.evaluation.class_names.py' and 'mmseg.datasets.voc.py')

Problem 2.
When I trained with custom datasets(num_classes=2 --- 'background', 'emergency_light'), emergency_light's IoU / ACC were '0.0' / 'nan'.

You know how to solve it?

@MengzhangLI
Copy link
Contributor

Hi:
A1: I checked the mmseg.datasets.voc.py and mmseg.core.evaluation.class_names.py and found they are both:

PALETTE = [[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], [192, 128, 0], [64, 0, 128],
                [192, 0, 128], [64, 128, 128], [192, 128, 128], [0, 64, 0],
                [128, 64, 0], [0, 192, 0], [128, 192, 0], [0, 64, 128]]

Could you clearify which class in which dataset is not identical? Thanks. (Perhaps I ignored some differences.)

A2: This error usually happened by wrong match up with num_classes= 1 or 2 and reduce_zero_label = True/False and suitable annotation file. If you want to implement binary segmentation, could you try to set reduce_zero_label = False and num_classes = 1? (Related issue: #2050).

Best,

@sunghyun-nam
Copy link
Author

Hi
Thank you for replying
A1
I modified CLASSES and PALETTE for my dataset. And the order of CLASSES and PALETTE is same in the mmseg.datasets.voc.py and mmseg.core.evaluation.class_names.py
All classes are not identical except 'background'.

CLASSES = ('_background_', 'fire_extinguisher', 'straight_valve', 'fire_extinguisher_box', 'emergency_light', 'flash_light', 'circular_valve')
PALETTE = [[0, 0, 0], [128, 0, 128], [128, 0, 0], [0, 128, 128], [128, 128, 0], [0, 0, 128], [0, 128, 0]]

A2:
reduce_zero_label = False / num_classes = 1

+--------------+-------+-------+
|    Class     |  IoU  |  Acc  |
+--------------+-------+-------+
| _background_ | 81.09 | 100.0 |
| flash_light  |  nan  |  nan  |
+--------------+-------+-------+
2022-10-18 10:56:56,032 - mmseg - INFO - Summary:
2022-10-18 10:56:56,032 - mmseg - INFO - 
+-------+-------+-------+
|  aAcc |  mIoU |  mAcc |
+-------+-------+-------+
| 100.0 | 81.09 | 100.0 |
+-------+-------+-------+

reduce_zero_label = True / num_classes = 1

+--------------+-----+-----+
|    Class     | IoU | Acc |
+--------------+-----+-----+
| _background_ | 0.0 | nan |
| flash_light  | nan | nan |
+--------------+-----+-----+
2022-10-18 11:03:57,927 - mmseg - INFO - Summary:
2022-10-18 11:03:57,927 - mmseg - INFO - 
+------+------+------+
| aAcc | mIoU | mAcc |
+------+------+------+
| nan  | 0.0  | nan  |
+------+------+------+

@MengzhangLI
Copy link
Contributor

A1: If you modified palette in your dataset class, the palette code uses is from that dataset class rather than mmseg.core.evaluation.class_names.py.

A2: It is because it is not binary segmentation task, could you try to set num_classes=2?

@MeowZheng
Copy link
Collaborator

I have a little question about your dataset, does it only have 2 kinds of labels? Did you merge all classes expect flash_light?

@sunghyun-nam
Copy link
Author

A1: If you modified palette in your dataset class, the palette code uses is from that dataset class rather than mmseg.core.evaluation.class_names.py.
A2: It is because it is not binary segmentation task, could you try to set num_classes=2?

--> A1: I also modified CLASSES and PALETTE in voc.py

--> A2: The variable was set like that on my first trial, and the result is shown at the top.
Problem 2.
When I trained with custom datasets(num_classes=2 --- 'background', 'emergency_light'), emergency_light's IoU / ACC were '0.0' / 'nan'.

@sunghyun-nam
Copy link
Author

I have a little question about your dataset, does it only have 2 kinds of labels? Did you merge all classes expect flash_light?

Problem 1 ---> I use dataset with 7 labels
Problem 2 ---> I use dataset with 2 labels

Datasets were merged only those contained in the label.

@GGBoy-Lab
Copy link

Hi Thank you for replying A1 I modified CLASSES and PALETTE for my dataset. And the order of CLASSES and PALETTE is same in the mmseg.datasets.voc.py and mmseg.core.evaluation.class_names.py All classes are not identical except 'background'.

CLASSES = ('_background_', 'fire_extinguisher', 'straight_valve', 'fire_extinguisher_box', 'emergency_light', 'flash_light', 'circular_valve')
PALETTE = [[0, 0, 0], [128, 0, 128], [128, 0, 0], [0, 128, 128], [128, 128, 0], [0, 0, 128], [0, 128, 0]]

A2: reduce_zero_label = False / num_classes = 1

+--------------+-------+-------+
|    Class     |  IoU  |  Acc  |
+--------------+-------+-------+
| _background_ | 81.09 | 100.0 |
| flash_light  |  nan  |  nan  |
+--------------+-------+-------+
2022-10-18 10:56:56,032 - mmseg - INFO - Summary:
2022-10-18 10:56:56,032 - mmseg - INFO - 
+-------+-------+-------+
|  aAcc |  mIoU |  mAcc |
+-------+-------+-------+
| 100.0 | 81.09 | 100.0 |
+-------+-------+-------+

reduce_zero_label = True / num_classes = 1

+--------------+-----+-----+
|    Class     | IoU | Acc |
+--------------+-----+-----+
| _background_ | 0.0 | nan |
| flash_light  | nan | nan |
+--------------+-----+-----+
2022-10-18 11:03:57,927 - mmseg - INFO - Summary:
2022-10-18 11:03:57,927 - mmseg - INFO - 
+------+------+------+
| aAcc | mIoU | mAcc |
+------+------+------+
| nan  | 0.0  | nan  |
+------+------+------+

question2:
I encountered a problem similar to yours, but it has been successfully solved. Have you solved your problem? I can share it if necessary.

@pytorchuser
Copy link

Hi Thank you for replying A1 I modified CLASSES and PALETTE for my dataset. And the order of CLASSES and PALETTE is same in the mmseg.datasets.voc.py and mmseg.core.evaluation.class_names.py All classes are not identical except 'background'.

CLASSES = ('_background_', 'fire_extinguisher', 'straight_valve', 'fire_extinguisher_box', 'emergency_light', 'flash_light', 'circular_valve')
PALETTE = [[0, 0, 0], [128, 0, 128], [128, 0, 0], [0, 128, 128], [128, 128, 0], [0, 0, 128], [0, 128, 0]]

A2: reduce_zero_label = False / num_classes = 1

+--------------+-------+-------+
|    Class     |  IoU  |  Acc  |
+--------------+-------+-------+
| _background_ | 81.09 | 100.0 |
| flash_light  |  nan  |  nan  |
+--------------+-------+-------+
2022-10-18 10:56:56,032 - mmseg - INFO - Summary:
2022-10-18 10:56:56,032 - mmseg - INFO - 
+-------+-------+-------+
|  aAcc |  mIoU |  mAcc |
+-------+-------+-------+
| 100.0 | 81.09 | 100.0 |
+-------+-------+-------+

reduce_zero_label = True / num_classes = 1

+--------------+-----+-----+
|    Class     | IoU | Acc |
+--------------+-----+-----+
| _background_ | 0.0 | nan |
| flash_light  | nan | nan |
+--------------+-----+-----+
2022-10-18 11:03:57,927 - mmseg - INFO - Summary:
2022-10-18 11:03:57,927 - mmseg - INFO - 
+------+------+------+
| aAcc | mIoU | mAcc |
+------+------+------+
| nan  | 0.0  | nan  |
+------+------+------+

question2: I encountered a problem similar to yours, but it has been successfully solved. Have you solved your problem? I can share it if necessary.

Hi, I encountered the Q2 either, could you please tell me how to solve this problem? Thank you so much.

@GGBoy-Lab
Copy link

GGBoy-Lab commented Jan 12, 2023 via email

@pytorchuser
Copy link

sorry, i can't figure out your email address. Could you please write the solution here?

@GGBoy-Lab
Copy link

GGBoy-Lab commented Jan 12, 2023 via email

@GGBoy-Lab
Copy link

sorry, i can't figure out your email address. Could you please write the solution here?

Sorry, I was busy with other work yesterday. Have you solved your problem?

@xiexinch
Copy link
Collaborator

Closing the issue, as there is no activity for a while.
We hope your issue has been resolved.
If not, please feel free to open a new one.

aravind-h-v pushed a commit to aravind-h-v/mmsegmentation that referenced this issue Mar 27, 2023
* Fix typo in StableDiffusionInpaintPipeline

* Add embedded prompt handling

---------

Co-authored-by: Patrick von Platen <patrick.v.platen@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants