Tom
11/12/2021, 5:16 PMload_data_task
. This provides me images_train
and images_val
. And now i want to transform images_train
with task rescaling_images_task
.
I need to map over `images_train`d(for each image and label) and then apply to recaling_images_task
.
Outside of prefect this works with following code:
images_train_rescaled = images_train.map(lambda x, y: ((preprocess.rescaling_images() (x, training=True), y))
But how i can run this in prefect flow?
preprocess = PreprocessingClass_Images(cfg)
with Flow("Preprocess") as flow:
#1. load images
images_train, images_val = preprocess.load_data_task()
# 2. rescaling
#the code below works outside of prefect flow
images_train_rescaled = images_train.map(lambda x, y: ((preprocess.rescaling_images() (x, training=True), y))
Kevin Kho
with Flow("Preprocess") as flow:\
images_train, images_val = preprocess.load_data_task()
images_train_rescaled = rescaling_images_task.map(images_train)
but the rescaling_images_task
must be defined to handle 1 image.Tom
11/12/2021, 5:44 PMrescaling_images_task
and then "outside" it should work. I´ll try this.
Thanks Kevin =)Tom
11/12/2021, 5:46 PMimages_train_rescaled
in flow?
Or can i handle it as normal as outside of the flow?
For example: print("Class Names:", images_train.class_names)
?Kevin Kho
logger = prefect.context.get("logger")
<http://logger.info|logger.info>(images_train.class_names)
because print
is executed during build time but you want it to execute during runtime (which tasks are for)Tom
11/12/2021, 5:51 PM