outline changes
This commit is contained in:
parent
5d611d5fae
commit
37a7e0a0e7
@ -48,6 +48,7 @@ class Pipeline:
|
||||
split = compose(star(parallel(*map(lift, (first, first, second)))), rpartial(tee, 3))
|
||||
classify = compose(chain.from_iterable, lift(classifier), partial(chunks, batch_size))
|
||||
pairwise_apply = compose(star, parallel)
|
||||
# TODO: use signal compress
|
||||
join = compose(starlift(lambda prd, rpr, mdt: {"classification": prd, **mdt, "representation": rpr}), star(zip))
|
||||
|
||||
# />--classify--\
|
||||
|
||||
@ -9,6 +9,7 @@ class PredictionModelHandle:
|
||||
"""Simplifies usage of ModelHandle instances for prediction purposes."""
|
||||
|
||||
def __init__(self, model_handle):
|
||||
# TODO: extract signal
|
||||
self.__predict = rcompose(model_handle.prep_images, model_handle.model.predict)
|
||||
|
||||
def predict(self, *args, **kwargs):
|
||||
|
||||
@ -32,6 +32,7 @@ class ModelWrapper(abc.ABC):
|
||||
|
||||
def prep_images(self, images):
|
||||
images = map(self.__resize_and_convert, images)
|
||||
# TODO: signal, images = ...
|
||||
tensor = self.__images_to_tensor(images)
|
||||
tensor = self.__preprocess_tensor(tensor)
|
||||
|
||||
|
||||
@ -184,6 +184,7 @@ def concat_images(im1: Image, im2: Image, metadata: dict, axis):
|
||||
|
||||
for im, offset in zip(images, offsets):
|
||||
box = (offset, 0) if not axis else (0, offset)
|
||||
# TODO: replace image that cannot be opened with white image of same size
|
||||
im_aggr.paste(im, box=box)
|
||||
|
||||
return im_aggr
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user