Handler package¶
-
class
handlers.BytesHandler(delegate_to=None, shape=[])[source]¶ Bases:
handlers.FeatureHandlerHandler for byte features
-
dtype¶ Returns the tf data type.
This property is used when parsing a tfrecord.
-
handle(row, key)[source]¶ Convert data dict into tf feature.
Parameters: Returns: key to tf feature.
Return type:
-
isfixedlen¶ Returns if handler works on fixed length features.
This property is used when parsing a tfrecord.
-
-
class
handlers.FeatureHandler(delegate_to, shape)[source]¶ Bases:
objectBase class for converting data into tensorflow features
This class is used during serialization of data into tfrecords. Moreover, hanlder properties are also used when parsing tfrecords.
-
delegate_to¶ str – Name of handler that manages the feature.
-
shape¶ list – List of int containing the shape of the feature.
-
dtype¶ Returns the tf data type.
This property is used when parsing a tfrecord.
-
handle(row, key)[source]¶ Convert data dict into tf feature.
Parameters: Returns: key to tf feature.
Return type:
-
isfixedlen¶ Returns if handler works on fixed length features.
This property is used when parsing a tfrecord.
-
-
class
handlers.Float32Handler(delegate_to=None, shape=[])[source]¶ Bases:
handlers.FeatureHandlerHandler for float features
-
dtype¶ Returns the tf data type.
This property is used when parsing a tfrecord.
-
handle(row, key)[source]¶ Convert data dict into tf feature.
Parameters: Returns: key to tf feature.
Return type:
-
isfixedlen¶ Returns if handler works on fixed length features.
This property is used when parsing a tfrecord.
-
-
class
handlers.Int64Handler(delegate_to=None, shape=[])[source]¶ Bases:
handlers.FeatureHandlerHandler for integer features
-
dtype¶ Returns the tf data type.
This property is used when parsing a tfrecord.
-
handle(row, key)[source]¶ Convert data dict into tf feature.
Parameters: Returns: key to tf feature.
Return type:
-
isfixedlen¶ Returns if handler works on fixed length features.
This property is used when parsing a tfrecord.
-
-
class
handlers.NiftiHandler(img_folder, img_shape, img_dtype, img_slice=None, img_key='image')[source]¶ Bases:
handlers.FeatureHandlerHandler for nifti images
Loads nifti images using an img_id, potentially resizes them to img_shape, and returns a byte feature. Moreover, it adds img_shape as int feature.
-
img_folder¶ str – Path to folder containing the nifti images.
-
img_shape¶ list of int – Desired shape for the images.
-
img_dtype¶ str – Desired data type for the images.
-
slices¶ dict – Mapping of slice name to slice tuple
-
dtype¶ Returns the tf data type.
This property is used when parsing a tfrecord.
-
handle(row, key)[source]¶ Convert data dict into tf feature.
Parameters: Returns: key to tf feature.
Return type:
-
isfixedlen¶ Returns if handler works on fixed length features.
This property is used when parsing a tfrecord.
-
-
handlers.features_from_handlers(keys_to_handlers)[source]¶ Construct Fixed/VarLen Features
Used for parsing of serialized data, converts feature information (isfixedlen, shape, dtype) into TF feature.
Parameters: keys_to_handlers (dict) – Mapping of keys to handlers Returns: Mapping of keys to TF features Return type: keys_to_features (dict)