BaseBlock

class imagepypelines.BaseBlock(io_map, name=None, notes=None, requires_training=False, requires_labels=False)[source]

Bases: object

BaseBlock object which is the root class for SimpleBlock and BatchBlock subclasses

This is the building block (pun intended) for the entire imagepypelines pipelining system. All blocks, both SimpleBlocks and BatchBlocks, will inherit from this object. Which contains base functionality to setup a block’s printers, unique name, standard input/output_shapes and special functions for pipeline objects to call

Parameters:
  • io_map (IoMap,dict) – dictionary of input-output mappings for this Block
  • name (str) – name for this block, it will be automatically created/modified to make sure it is unique
  • notes (str) – a short description of this block
  • requires_training (bool) – whether or not this block will require training
  • requires_labels (bool) – whether or not this block will require labels during training
io_map

object that maps inputs to this block to outputs subclass of tuple where I/O is stored as: ( (input1,output1),(input2,output2)… )

Type:IoMap
name

unique name for this block

Type:str
notes

a short description of this block, what operations it performs, etc. This will be included in the blocks ‘description’ variance

Type:str
requires_training

whether or not this block will require training

Type:bool
trained

whether or not this block has been trained, True by default if requires_training = False

Type:bool
printer

printer object for this block, registered to ‘name’

Type:ip.Printer
description

a readable description of this block that includes user defined notes and a summary of inputs and outputs

Type:str

Attributes Summary

EXTANT

Methods Summary

after_process() (optional overload)function that runs after processing for optional functionality.
before_process(data[, labels]) (optional overload)function that runs before processing for optional functionality.
label_strategy(labels) overarching label management function for this block
process_strategy(data) overarching processing management function for this block
rename(name) Renames this block to the given name
train(data[, labels]) (optional or required overload)trains the block.

Attributes Documentation

EXTANT = {}

Methods Documentation

after_process()[source]

(optional overload)function that runs after processing for optional functionality. intended for optional use as a cleanup function

Parameters:None
before_process(data, labels=None)[source]

(optional overload)function that runs before processing for optional functionality. this function takes in the full data list and label list. does nothing unless overloaded

Parameters:
  • data (list) – list of datums to process
  • labels (list,None) – corresponding label for each datum, None by default (for unsupervised systems)
label_strategy(labels)[source]

overarching label management function for this block

Parameters:labels (list,None) – corresponding label for each datum, None by default (for unsupervised systems)
Returns:labels for datums (Nones for unsupervised systems)
Return type:labels (list)
process_strategy(data)[source]

overarching processing management function for this block

Parameters:data (list) – list of datums to process
Returns:processed datums
Return type:list
rename(name)[source]

Renames this block to the given name

Parameters:name (str) – the new name for your Block
Returns:object reference to this block (self)
Return type:ip.Block

Note

unlike naming your block using the name parameter in instantiation, imagepypelines will not guarantee that this name will be unique. It is considered the user’s responsibility to determine that this will not cause problems in your pipeline.

train(data, labels=None)[source]

(optional or required overload)trains the block. overloading is required if the ‘requires_training’ parameter is set to True

users are expected to save pertinent variables as instance variables

Parameters:
  • data (list) – list of datums to train on
  • labels (list,None) – corresponding label for each datum, None by default (for unsupervised systems)
Returns:

None