(self,seg_array)
| 39 | return classes_idx, classes_str |
| 40 | |
| 41 | def colormap2classmap(self,seg_array): |
| 42 | seg_array_flattened = torch.LongTensor(seg_array.reshape(-1,3)).cuda() |
| 43 | seg_map_class_flattened = torch.zeros((seg_array.shape[0],seg_array.shape[1],1)).view(-1,1).cuda() |
| 44 | for color, cls in self.color2idx.items(): |
| 45 | matching_indices = (seg_array_flattened == torch.LongTensor(color).cuda()) |
| 46 | matching_indices = (matching_indices.sum(dim=1)==3) |
| 47 | seg_map_class_flattened[matching_indices] = cls |
| 48 | seg_map_class = seg_map_class_flattened.view(seg_array.shape[0],seg_array.shape[1],1) |
| 49 | return seg_map_class |
| 50 | |
| 51 | def classmap2colormap(self,seg_map_class): |
| 52 | seg_map_class_flattened = seg_map_class.view(-1,1) |
no outgoing calls
no test coverage detected