Annotation
Bases: StaticCollection
A class used to annotate GroundTruths
and Predictions
.
Attributes:
Name | Type | Description |
---|---|---|
metadata |
Dictionary
|
A dictionary of metadata that describes the |
labels |
(List[Label], optional)
|
A list of labels to use for the |
bounding_box |
Box
|
A bounding box to assign to the |
polygon |
BoundingPolygon
|
A polygon to assign to the |
raster |
Raster
|
A raster to assign to the |
embedding |
List[float]
|
An embedding, described by a list of values with type float and a maximum length of 16,000. |
text |
(str, optional)
|
A piece of text to assign to the |
context_list |
(List[str], optional)
|
A list of contexts associated with an |
is_instance |
(bool, optional)
|
A boolean describing whether we should treat the Raster attached to an annotation as an instance segmentation or not. If set to true, then the Annotation will be validated for use in object detection tasks. If set to false, then the Annotation will be validated for use in semantic segmentation tasks. |
implied_task_types |
(list[str], optional)
|
The validated task types that are applicable to each Annotation. Doesn't need to bet set by the user. |
Examples:
Classification
>>> Annotation.create(
... labels=[
... Label(key="class", value="dog"),
... Label(key="category", value="animal"),
... ]
... )
Object-Detection Box
Object-Detection Polygon
>>> annotation = Annotation(
... labels=[Label(key="k1", value="v1")],
... polygon=BoundingPolygon(...),
... )
Raster
>>> annotation = Annotation(
... labels=[Label(key="k1", value="v1")],
... raster=Raster(...),
... is_instance=True
... )
Object-Detection with all supported Geometries defined.
>>> Annotation(
... labels=[Label(key="k1", value="v1")],
... bounding_box=Box(...),
... polygon=BoundingPolygon(...),
... raster=Raster(...),
... is_instance=True,
... )
Semantic-Segmentation Raster
>>> annotation = Annotation(
... labels=[Label(key="k1", value="v1")],
... raster=Raster(...),
... is_instance=False # or None
... )
Text Generation
>>> annotation = Annotation(
... text="Yes, Lincoln won the election of 1860. He received the highest number of votes...",
... context_list=["Republican speakers focused first on...", "Lincoln received 1,866,452 votes...", ...],
... )
Source code in valor/schemas/symbolic/collections.py
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 |
|
Functions
valor.Annotation.__init__(*, metadata=None, labels=None, bounding_box=None, polygon=None, raster=None, embedding=None, text=None, context_list=None, is_instance=None, implied_task_types=None)
Constructs an annotation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
metadata
|
Optional[dict]
|
A dictionary of metadata that describes the |
None
|
labels
|
Optional[List[Label]]
|
A list of labels to use for the |
None
|
bounding_box
|
Optional[Box]
|
A bounding box annotation. |
None
|
polygon
|
Optional[Polygon]
|
A polygon annotation. |
None
|
raster
|
Optional[Raster]
|
A raster annotation. |
None
|
embedding
|
Optional[Embedding]
|
An embedding, described by a list of values with type float and a maximum length of 16,000. |
None
|
text
|
Optional[str]
|
A text annotation. |
None
|
context_list
|
Optional[List[str]]
|
A list of contexts associated to the annotation text. Not all text annotations will have context_list. |
None
|
is_instance
|
Optional[bool]
|
A boolean describing whether we should treat the Raster attached to an annotation as an instance segmentation or not. If set to true, then the Annotation will be validated for use in object detection tasks. If set to false, then the Annotation will be validated for use in semantic segmentation tasks. |
None
|
implied_task_types
|
Optional[List[String]]
|
The validated task types that are applicable to each Annotation. Doesn't need to bet set by the user. |
None
|
Source code in valor/schemas/symbolic/collections.py
valor.Annotation.formatting()
staticmethod
Attribute format mapping.