mlreco.main_funcs module

class mlreco.main_funcs.Handlers[source]

Bases: object

cfg = None
data_io = None
data_io_iter = None
csv_logger = None
weight_io = None
train_logger = None
watch = None
iteration = 0
keys()[source]
__dict__ = mappingproxy({'__module__': 'mlreco.main_funcs', 'cfg': None, 'data_io': None, 'data_io_iter': None, 'csv_logger': None, 'weight_io': None, 'train_logger': None, 'watch': None, 'iteration': 0, 'keys': <function Handlers.keys>, '__dict__': <attribute '__dict__' of 'Handlers' objects>, '__weakref__': <attribute '__weakref__' of 'Handlers' objects>, '__doc__': None, '__annotations__': {}})
__module__ = 'mlreco.main_funcs'
__weakref__

list of weak references to the object (if defined)

mlreco.main_funcs.cycle(data_io)[source]
mlreco.main_funcs.train(cfg, event_list=None)[source]
mlreco.main_funcs.inference(cfg, event_list=None)[source]
mlreco.main_funcs.process_config(cfg, verbose=True)[source]
mlreco.main_funcs.make_directories(cfg, loaded_iteration, handlers=None)[source]
mlreco.main_funcs.prepare(cfg, event_list=None)[source]

Prepares high level API handlers, namely trainval instance and torch DataLoader (w/ iterator) INPUT

  • cfg is a full configuration block after pre-processed by process_config function

OUTPUT
  • Handler instance attached with trainval/DataLoader instances (if in config)

mlreco.main_funcs.apply_event_filter(handlers, event_list=None)[source]

Reconfigures IO to apply an event filter INPUT:

  • handlers is Handlers instance generated by prepare() function

  • event_list is an array of integers

mlreco.main_funcs.log(handlers, tstamp_iteration, tsum, res, cfg, epoch, first_id)[source]

Log relevant information to CSV files and stdout.

mlreco.main_funcs.train_loop(handlers)[source]

Trainval loop. With optional minibatching as determined by the parameters cfg[‘iotool’][‘batch_size’] vs cfg[‘iotool’][‘minibatch_size’].

mlreco.main_funcs.inference_loop(handlers)[source]

Inference loop. Loops over weight files specified in cfg[‘trainval’][‘model_path’]. For each weight file, runs the inference cfg[‘trainval’][‘iterations’] times. Note: Accuracy/loss will be per batch in the CSV log file, not per event. Write an analysis function to do per-event analysis (TODO).