input_data

Attributes

Setup

Classes

Data

Functions

_guess_mode(input)

Module Contents

input_data.Setup
input_data._guess_mode(input)
class input_data.Data(input, model_shape, device='cpu', mode=None, process=False)
Parameters:
input
mode: str | None = None
target: rex_xai.responsibility.prediction.Prediction | List[rex_xai.responsibility.prediction.Prediction] | None = None
device = 'cpu'
setup: Setup | None = None
transposed = False
model_shape
model_height: int | None
model_width: int | None
model_depth: int | None = None
model_channels: int | None = 1
model_order = None
mask_value = None
background = None
context = None
context_noise = 0.4
set_height(h)
Parameters:

h (int)

set_width(w)
Parameters:

w (int)

set_channels(c=None)
__repr__()
Return type:

str

set_classification(cl)
match_data_to_model_shape()

a PIL image has the from H * W * C, so if the model takes C * H * W we need to transpose self.data to get it into the correct form for the model to consume This function does not add in the batch channel at the beginning

generic_tab_preprocess()
load_data(astype='float32')
_normalise_rgb_data(means, stds, norm)

used for onnx input data only

try_unsqueeze()
generic_image_preprocess(means=None, stds=None, astype='float32', norm=255.0)
Parameters:

norm (Optional[float])

__get_shape()

returns height, width, channels, order, depth for the model

set_mask_value(m)