keras-io icon indicating copy to clipboard operation
keras-io copied to clipboard

How to replace preprocessing.text_dataset_from_directory with the numpy array?

Open Pro100rus32 opened this issue 3 years ago • 1 comments
trafficstars

Code

how to input a string instead of preprocessing.text_dataset_from_directory? I tried using strings from python and the numpy array - but alas, no luck.

I tried to figure out what a dataset looks like, but all I get is this: <BatchDataset element_spec=(TensorSpec(shape=(None,), dtype=tf.string, name=None), TensorSpec(shape=(None,), dtype=tf.int32, name=None))>

So I don't even know what a dataset for training a neural network should look like.

Pro100rus32 avatar Mar 10 '22 15:03 Pro100rus32

My attempts continue, I didn't think this library was that complicated, quite different from what I saw on the website: "This makes Keras easy to learn and easy to use.".

This time I tried to make a dataset, but it still doesn't work: raw_train_ds = tf.data.Dataset.from_tensor_slices(["Hey", "Hello", "Bye"]), tf.data.Dataset.from_tensor_slices([1, 1, 0])

I get something similar, but it's not what I need, because the code doesn't work further: My: (<TensorSliceDataset element_spec=TensorSpec(shape=(), dtype=tf.string, name=None)>, <TensorSliceDataset element_spec=TensorSpec(shape=(), dtype=tf.int32, name=None)>) In code: <BatchDataset element_spec=(TensorSpec(shape=(None,), dtype=tf.string, name=None), TensorSpec(shape=(None,), dtype=tf.int32, name=None))>

I still don't know how I can find out what is included in the data set. The website only has information about 3 methods, but not the standard one. I would like to try to learn something simpler, but there are NO simple examples. No one on the forum seems to know how to do the simplest example, so I will keep trying : )

Pro100rus32 avatar Mar 11 '22 11:03 Pro100rus32

Hi @Pro100rus32, thanks for reaching out. The issue backlog is not the best place for support requests. Can you repost this to one of the forums below? That way your question will have more visibility.

Thanks!

pcoet avatar Aug 22 '23 21:08 pcoet