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

visualizer's sem_seg function dtype uint8 cannot handle classes more than 256! #5391

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion detectron2/utils/visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,9 @@ def draw_dataset_dict(self, dic):
if sem_seg is None and "sem_seg_file_name" in dic:
with PathManager.open(dic["sem_seg_file_name"], "rb") as f:
sem_seg = Image.open(f)
sem_seg = np.asarray(sem_seg, dtype="uint8")
# sem_seg = np.asarray(sem_seg, dtype="uint8")
# The dtype uint8 is 0-255 which is not suitable for GT visualization of Pascal Context 459 whose class num is more than 256 and make the visualization text wrong!
sem_seg = np.asarray(sem_seg, dtype=np.int16)
if sem_seg is not None:
self.draw_sem_seg(sem_seg, area_threshold=0, alpha=0.5)

Expand Down