neuralmonkey.readers package¶
Submodules¶
neuralmonkey.readers.audio_reader module¶
-
class
neuralmonkey.readers.audio_reader.
Audio
(rate, data)¶ Bases:
tuple
-
data
¶ Alias for field number 1
-
rate
¶ Alias for field number 0
-
-
neuralmonkey.readers.audio_reader.
audio_reader
(prefix: str = '', audio_format: str = 'wav') → typing.Callable¶ Get a reader of audio files loading them from a list of pahts.
Parameters: prefix – Prefix of the paths to the audio files. Returns: The reader function that takes a list of audio file paths (relative to provided prefix) and returns a list of numpy arrays.
neuralmonkey.readers.image_reader module¶
-
neuralmonkey.readers.image_reader.
image_reader
(prefix='', pad_w: typing.Union[int, NoneType] = None, pad_h: typing.Union[int, NoneType] = None, rescale_w: bool = False, rescale_h: bool = False, keep_aspect_ratio: bool = False, mode: str = 'RGB') → typing.Callable¶ Get a reader of images loading them from a list of pahts.
Parameters: - prefix – Prefix of the paths that are listed in a image files.
- pad_w – Width to which the images will be padded/cropped/resized.
- pad_h – Height to with the images will be padded/corpped/resized.
- rescale_w – If true, image is rescaled to have given width. It is cropped/padded otherwise.
- rescale_h – If true, image is rescaled to have given height. It is cropped/padded otherwise.
- keep_aspect_ratio – Flag whether the aspect ration should be kept during rescaling. Can only be used if both width and height are rescaled.
- mode – Scipy image loading mode, see scipy documentation for more details.
Returns: The reader function that takes a list of image paths (relative to provided prefix) and returns a list of images as numpy arrays of shape pad_h x pad_w x number of channels.
-
neuralmonkey.readers.image_reader.
imagenet_reader
(prefix: str, target_width: int = 227, target_height: int = 227) → typing.Callable¶ Load and prepare image the same way as Caffe scripts.
neuralmonkey.readers.numpy_reader module¶
-
neuralmonkey.readers.numpy_reader.
numpy_reader
(files: typing.List[str])¶
neuralmonkey.readers.plain_text_reader module¶
-
neuralmonkey.readers.plain_text_reader.
UtfPlainTextReader
(files: typing.List[str]) → typing.Iterable[typing.List[str]]¶
-
neuralmonkey.readers.plain_text_reader.
column_separated_reader
(column: int, delimiter: str = '\t', quotechar: str = None, encoding: str = 'utf-8') → typing.Callable[[typing.List[str]], typing.Iterable[typing.List[str]]]¶ Get reader for delimiter-separated tokenized text.
Parameters: column – number of column to be returned. It starts with 1 for the first
-
neuralmonkey.readers.plain_text_reader.
csv_reader
(column: int)¶
-
neuralmonkey.readers.plain_text_reader.
string_reader
(encoding: str = 'utf-8') → typing.Callable[[typing.List[str]], typing.Iterable[str]]¶
-
neuralmonkey.readers.plain_text_reader.
tokenized_text_reader
(encoding: str = 'utf-8') → typing.Callable[[typing.List[str]], typing.Iterable[typing.List[str]]]¶ Get reader for space-separated tokenized text.
-
neuralmonkey.readers.plain_text_reader.
tsv_reader
(column: int)¶
neuralmonkey.readers.string_vector_reader module¶
-
neuralmonkey.readers.string_vector_reader.
FloatVectorReader
(files: typing.List[str]) → typing.Iterable[typing.List[numpy.ndarray]]¶
-
neuralmonkey.readers.string_vector_reader.
IntVectorReader
(files: typing.List[str]) → typing.Iterable[typing.List[numpy.ndarray]]¶
-
neuralmonkey.readers.string_vector_reader.
get_string_vector_reader
(dtype: typing.Type = <class 'numpy.float32'>, columns: int = None)¶ Get a reader for vectors encoded as whitespace-separated numbers