blocks.datasets¶
Classes¶
IteraitDataset: WARNING: must be adapted to Andy.RPNDataset: Base RPN dataset wrapper for region classification and regression as the target.RectangleRPNDataset:RPNDatasetembodiment for rectangles.
-
class
blocks.datasets.IteraitDataset(config_str)[source]¶ Bases:
datasets.BaseDatasetWARNING: must be adapted to Andy.
- Base Iterait dataset providing methods for:
downloading annotations from Andy
creating symlinks to data @eric
building hipipe datasets
All Iterait dataset configs must contain
data_root.- Available options to be configured are:
task_ids: a list of Andy task IDs to download the annotations fordataset_ids: a list of Andy dataset IDs to make symlinks tohipipe_dirs: a list of directories with hipipe CMake files to be buildhipipe_build_type: hipipe build type (optional, defaults toDebug)annotator_url: Andy API url (optional, defaults tohttps://andy.iterait.com)annotator_data_root: Andy data root (optional, defaults to/var/andy/data)
example usage in config¶dataset: # ... data_root: data iterait: task_ids: [1, 2, 3] dataset_ids: [42] hipipe_dirs: dataset hipipe_build_type: Release
Tip
Start your work with
emloop dataset init ...which will create thedata_root, download the most up to date annotations, create symlinks to the data and build hipipe streams if necessary.Tip
If you wrap a hipipe dataset, use
blocks.utils.reflection.try_import()function. Otherwise you would not be able to create the dataset until you build it manually.
-
ANNOTATOR_DATA_ROOT_CFGNAME= 'annotator_data_root'¶ Name of the Annotator data root configuration.
-
ANNOTATOR_PASSWORD_ENV_VARIABLE= 'ANDY_PASS'¶ Name of the Annotator password env. variable.
-
ANNOTATOR_URL_CFGNAME= 'annotator_url'¶ Name of the Annotator URL configuration.
-
ANNOTATOR_USERNAME_ENV_VARIABLE= 'ANDY_USER'¶ Name of the Annotator username env. variable.
-
DATASET_IDS_CFGNAME= 'dataset_ids'¶ Name of the Annotator dataset IDs configuration.
-
DATA_ROOT_CFGNAME= 'data_root'¶ Name of the data root configuration.
-
DEFAULT_ANNOTATOR_DATA_ROOT= '/var/annotator/data'¶ Default value for the Annotator data root configuration.
-
DEFAULT_ANNOTATOR_URL= 'https://andy.iterait.com'¶ Default value for the Annotator URL configuration.
-
DEFAULT_HIPIPE_BUILD_TYPE= 'Debug'¶ Default value for the hipipe build type configuration.
-
HIPIPE_BUILD_TYPE_CFGNAME= 'hipipe_build_type'¶ Name of the hipipe build type configuration.
-
HIPIPE_DIRS_CFGNAME= 'hipipe_dirs'¶ Name of the hipipe dirs configuration.
-
ITERAIT_SECTION_CFGNAME= 'iterait'¶ Name of the dataset iterait config section.
-
TASK_IDS_CFGNAME= 'task_ids'¶ Name of the Annotator tasks IDs configuration.
-
__init__(config_str)[source]¶ Create new dataset.
Decode the given YAML config string and pass the obtained
**kwargsto_configure_dataset().- Parameters
config_str (
str) – dataset configuration as YAML string
-
download_annotations()[source]¶ ” Download the most up to date annotations for the configured task IDS.
- Return type
None
-
class
blocks.datasets.RPNDataset(config_str)[source]¶ Bases:
blocks.datasets.iterait_dataset.IteraitDatasetBase RPN dataset wrapper for region classification and regression as the target.
This dataset may be adjusted for any region type such as rectangles or ellipses.

-
__init__(config_str)[source]¶ Create new RPNDataset.
- Parameters
config_str (
str) – yaml encoded configuration string
-
_overlap_to_label(overlap)[source]¶ Map overlap ratio to a -1/0/1 label. The semantics are the following: - -1: neutral not positive nor negative anchor - 0: negative anchor (no object is within it) - 1: positive anchor (object region has high overlap with the anchor)
-
abstract
apply_diff(anchor, diff)[source]¶ Apply predicted diff to the given anchor and return the result.
-
configure_shape(features_spatial_dim, pool_amount)[source]¶ Configure the dataset with the features spatial dimension and amount of pooling the input images experience.
Note
The dataset has to be configured at least once prior to utilizing the streams.
-
abstract
diffs_dim()[source]¶ Return trainable region-anchor diffs dimension. E.g. for rectangles this would be 4.
- Return type
-
abstract
get_diff(anchor, region)[source]¶ Get trainable difference of the given anchor to the given region.
-
abstract
get_regions(batch, index)[source]¶ Return an iteration of regions for the given batch and example id.
-
get_sensible_anchor_indices(region)[source]¶ Return an iteration of anchor indices (x, y) to be considered for the given region.
By default, all the anchor indices are returned which may be computationally expensive. You may want to limit the amount of returned indices, e.g.: return only anchors from certain radius around the region.
-
property
n_anchors_per_position¶ The number of anchors for each position.
-
-
class
blocks.datasets.RectangleRPNDataset(config_str)[source]¶ Bases:
blocks.datasets.rpn.RPNDatasetRPNDatasetembodiment for rectangles.Warning
This dataset does not implement
self.get_regions()method and hence, cannot be used directly.