@@ -284,15 +284,14 @@ def from_proto(cls, proto: PointProto) -> "Point":
284
284
285
285
class Region (MessageData ):
286
286
287
- def __init__ (
288
- self ,
289
- proto_region : RegionProto = None ,
290
- box : List [float ] = None ,
291
- concepts : List [Concept ] = None ,
292
- mask : Union [Mask , 'Image' , PILImage .Image , np .ndarray ] = None ,
293
- point : Union [Point , Tuple [float , float , float ]] = None ,
294
- track_id : str = None ,
295
- ):
287
+ def __init__ (self ,
288
+ proto_region : RegionProto = None ,
289
+ box : List [float ] = None ,
290
+ concepts : List [Concept ] = None ,
291
+ mask : Union [Mask , 'Image' , PILImage .Image , np .ndarray ] = None ,
292
+ point : Union [Point , Tuple [float , float , float ]] = None ,
293
+ track_id : str = None ,
294
+ text : str = None ):
296
295
if proto_region is None :
297
296
proto_region = RegionProto ()
298
297
self .proto = proto_region
@@ -306,7 +305,17 @@ def __init__(
306
305
if point :
307
306
self .point = point
308
307
if track_id :
309
- self .track_id
308
+ self .track_id = track_id
309
+ if text :
310
+ self .text = text
311
+
312
+ @property
313
+ def text (self ):
314
+ return self .proto .data .text .raw
315
+
316
+ @text .setter
317
+ def text (self , value : str ):
318
+ self .proto .data .text .raw = value
310
319
311
320
@property
312
321
def box (self ) -> List [float ]:
0 commit comments