TransWikia.com

Load numpy data from directory to keras image generator

Data Science Asked by Sangathamilan Ravichandran on December 29, 2020

I have two folders of hyperspectral data with five channels which are converted to numpy array. Each folder depicts the respective label.

Example :

dataset  
----good_data  
      ----good_image_01.npy  
      ----good_image_02.npy  
----bad_data  
    ----bad_image_01.npy  
    ----bad_image_02.npy

I have used keras image generator to feed the data to input pipeline previously with png images.

train_ds = tf.keras.preprocessing.image_dataset_from_directory(
  data_dir,
  validation_split=0.2,
  subset="training",
  seed=123,
  image_size=(img_height, img_width),
  batch_size=batch_size)

But I am not sure how to achieve the same with numpy dataset. can anyone help?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP