cellmap_flow.inferencer
Predicting a chunk and postprocessing it: the Inferencer.
The model itself (the device, the warmup, the forward and the device
slots) is inference.runner.ModelRunner; an Inferencer is a ModelRunner
that also applies a normalization and postprocessing chain, the layer’s own
or the process’s (process_chain()).
predict(read_roi, write_roi, config, **kwargs) and apply_postprocess
are what model scripts are written against, so both stay importable from
here; predict itself is the runner’s default forward.
Attributes
Classes
A ModelRunner that normalizes its input and postprocesses its output. |
Functions
|
Run |
Module Contents
- cellmap_flow.inferencer.logger
- cellmap_flow.inferencer.apply_postprocess(data, postprocess=None, **kwargs)
Run
datathrough a postprocessing chain.postprocess=Nonemeans the process’s chain,process_chain().postprocess; the server passes the chain of the layer being requested instead.
- class cellmap_flow.inferencer.Inferencer(model_config, use_half_prediction=False, device_slots=None, half_precision=False)
A ModelRunner that normalizes its input and postprocesses its output.
- process_chunk(idi, roi, input_norms=None, postprocess=None, cancelled=None, grid_origin=None)
Predict
roiand postprocess it.input_norms/postprocess: the chain to use for this chunk.Nonefalls back to the process’s chain (process_chain()), for callers (scripts) that set the chain process-wide.cancelled: asked while the chunk waits for a device slot; raises ChunkCancelled, without computing it, once that says yes.grid_origin: where (nm) the chunk gridroilies on starts, so the steps getroi’s index on that grid aschunk_corner; None means a grid starting at 0. The server and blockwise both start theirs at the raw data’s corner (see_chunk_index), so a region gets the same unique label ids from either.