Skip to content

Commit

Permalink
visualizer's sem_seg function dtype uint8 cannot handle classes more …
Browse files Browse the repository at this point in the history
…than 256

Update visualizer.py
  • Loading branch information
LWShowTime authored Nov 14, 2024
1 parent 9131ce0 commit 3b056b3
Showing 1 changed file with 3 additions and 1 deletion.
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

0 comments on commit 3b056b3

Please sign in to comment.