rex_xai.input_data

Attributes

Setup

Classes

Data

Functions

_guess_mode(input)

Module Contents

rex_xai.input_data.Setup
rex_xai.input_data._guess_mode(input)
class rex_xai.input_data.Data(input, model_shape, device, mode=None, process=True)
input
mode = None
target: rex_xai.prediction.Prediction | None = None
device
setup: Setup | None = None
model_shape
model_height: int | None
model_width: int | None
model_channels: int | None = 1
model_order = None
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(means, stds, astype, norm)
try_unsqueeze()
generic_image_preprocess(means=None, stds=None, astype='float32', norm=255.0)
Parameters:

norm (Optional[float])

__get_shape()
set_mask_value(m)