Compute the union of class IDs in label and generate a list to include all class IDs Args: x: a list of numbers (for example, class_IDs) Returns a list showing the union (the union the class IDs)
(x: list | np.ndarray)
| 694 | |
| 695 | |
| 696 | def label_union(x: list | np.ndarray) -> list: |
| 697 | """ |
| 698 | Compute the union of class IDs in label and generate a list to include all class IDs |
| 699 | Args: |
| 700 | x: a list of numbers (for example, class_IDs) |
| 701 | |
| 702 | Returns |
| 703 | a list showing the union (the union the class IDs) |
| 704 | """ |
| 705 | return list(set.union(set(np.array(x).tolist()))) |
| 706 | |
| 707 | |
| 708 | def prob2class(x: torch.Tensor, sigmoid: bool = False, threshold: float = 0.5, **kwargs: Any) -> torch.Tensor: |