@@ -99,6 +99,8 @@ class Label(PersistentEntity):
9999 will be assigned upon saving. If the argument is None, it will be set to ID()
100100 :param is_anomalous: boolean that indicates whether the label is the
101101 Anomalous label. Always set to False for non-anomaly projects.
102+ :param is_background: boolean that indicates whether the label is the background label.
103+ This label is exclusive to semantic segmentation projects. False for other projects.
102104 """
103105
104106 def __init__ ( # noqa: PLR0913
@@ -111,6 +113,7 @@ def __init__( # noqa: PLR0913
111113 creation_date : datetime .datetime | None = None ,
112114 is_empty : bool = False ,
113115 is_anomalous : bool = False ,
116+ is_background : bool = False ,
114117 ephemeral : bool = True ,
115118 ):
116119 color = Color .random () if color is None else color
@@ -123,6 +126,7 @@ def __init__( # noqa: PLR0913
123126 self ._is_empty = is_empty
124127 self ._creation_date = creation_date
125128 self .is_anomalous = is_anomalous
129+ self .is_background = is_background
126130 PersistentEntity .__init__ (self , id_ = id_ , ephemeral = ephemeral )
127131
128132 @property
@@ -138,8 +142,8 @@ def creation_date(self) -> datetime.datetime:
138142 def __repr__ (self ):
139143 """String representation of the label."""
140144 return (
141- f"Label({ self .id_ } , name={ self .name } , hotkey={ self .hotkey } , "
142- f"domain ={ self .domain } , color ={ self .color . hex_str } , is_anomalous ={ self .is_anomalous } )"
145+ f"Label({ self .id_ } , name={ self .name } , hotkey={ self .hotkey } , domain= { self . domain } , "
146+ f"color ={ self .color . hex_str } , is_anomalous ={ self .is_anomalous } , is_background ={ self .is_background } )"
143147 )
144148
145149 def __eq__ (self , other : object ) -> bool :
0 commit comments