Dataset
Bases: StaticCollection
A class describing a given dataset.
Attributes:
Name | Type | Description |
---|---|---|
name |
String
|
The name of the dataset. |
metadata |
Dictionary
|
A dictionary of metadata that describes the dataset. |
Examples:
>>> Dataset.create(name="dataset1")
>>> Dataset.create(name="dataset1", metadata={})
>>> Dataset.create(name="dataset1", metadata={"foo": "bar", "pi": 3.14})
Source code in valor/coretypes.py
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 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 |
|
Functions
valor.Dataset.__init__(*, name, metadata=None, connection=None)
Creates a local instance of a dataset.
Use 'Dataset.create' classmethod to create a dataset with persistence.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the dataset. |
required |
metadata
|
dict
|
A dictionary of metadata that describes the dataset. |
None
|
connection
|
ClientConnection
|
An initialized client connection. |
None
|
Source code in valor/coretypes.py
valor.Dataset.add_groundtruth(groundtruth)
Add a ground truth to the dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
groundtruth
|
GroundTruth
|
The ground truth to create. |
required |
Source code in valor/coretypes.py
valor.Dataset.add_groundtruths(groundtruths, ignore_existing_datums=False, timeout=10.0)
Add multiple ground truths to the dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
groundtruths
|
List[GroundTruth]
|
The ground truths to create. |
required |
ignore_existing_datums
|
bool
|
If True, will ignore datums that already exist in the backend. If False, will raise an error if any datums already exist. Default is False. |
False
|
timeout
|
float
|
The number of seconds the client should wait until raising a timeout. |
10.0
|
Source code in valor/coretypes.py
valor.Dataset.create(name, metadata=None, connection=None)
classmethod
Creates a dataset that persists in the back end.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the dataset. |
required |
metadata
|
dict
|
A dictionary of metadata that describes the dataset. |
None
|
connection
|
ClientConnection
|
An initialized client connection. |
None
|
Source code in valor/coretypes.py
valor.Dataset.delete(timeout=0)
Delete the dataset from the back end.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
timeout
|
int
|
Sets a timeout in seconds. |
0
|
Source code in valor/coretypes.py
valor.Dataset.finalize()
valor.Dataset.get(name, connection=None)
classmethod
Retrieves a dataset from the back end database.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the dataset. |
required |
Returns:
Type | Description |
---|---|
Union[Dataset, None]
|
The dataset or 'None' if it doesn't exist. |
Source code in valor/coretypes.py
valor.Dataset.get_datums(filters=None)
Get all datums associated with a given dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filters
|
Filter
|
An optional datum filter. |
None
|
Returns:
Type | Description |
---|---|
List[Datum]
|
A list of |
Source code in valor/coretypes.py
valor.Dataset.get_evaluations(metrics_to_sort_by=None, *_, timeout=None)
Get all evaluations associated with a given dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
metrics_to_sort_by
|
dict[str, str | dict[str, str]]
|
An optional dict of metric types to sort the evaluations by. |
None
|
timeout
|
float
|
The number of seconds the client should wait until raising a timeout. |
None
|
Returns:
Type | Description |
---|---|
List[Evaluation]
|
A list of |
Source code in valor/coretypes.py
valor.Dataset.get_groundtruth(datum)
Get a particular ground truth.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
datum
|
Union[Datum, str]
|
The desired datum. |
required |
Returns:
Type | Description |
---|---|
Union[GroundTruth, None]
|
The matching ground truth or 'None' if it doesn't exist. |
Source code in valor/coretypes.py
valor.Dataset.get_labels()
Get all labels associated with a given dataset.
Returns:
Type | Description |
---|---|
List[Label]
|
A list of |
Source code in valor/coretypes.py
valor.Dataset.get_summary(*_, timeout=None)
Get the summary of a given dataset.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
timeout
|
float
|
The number of seconds the client should wait until raising a timeout. |
None
|
Returns:
Type | Description |
---|---|
DatasetSummary
|
The summary of the dataset. This class has the following fields: name : name of the dataset num_datums : total number of datums in the dataset num_annotations : total number of labeled annotations in the dataset; if an object (such as a bounding box) has multiple labels, then each label is counted separately num_bounding_boxes : total number of bounding boxes in the dataset num_polygons : total number of polygons in the dataset num_rasters : total number of rasters in the dataset labels : list of the unique labels in the dataset datum_metadata : list of the unique metadata dictionaries in the dataset that are associated to datums groundtruth_annotation_metadata : list of the unique metadata dictionaries in the dataset that are associated to annotations |