Skip to content Skip to sidebar Skip to footer

Is There A Way To Make Tensorflow Js Read/train Data From A Json File Instead Of A Csv?

So I'm new with machine learning and have been struggling with making my model train from the data provided from a json file. I have no problem training with a csv. Also converting

Solution 1:

Currently, tensorflow.js does not offer a way to load json data for training. So the options there are

  • Use a json to csv converter

That way tf.data.csv can be used to read the file

  • Use a custom loader

First one needs to get the data using the fetch API for instance. Then, the dataset needs to be constructed with the data returned. When the data is large, everythings needs not to be loaded in memory at the same time. This answer discusses how to handle that case.


Solution 2:

Try to avoid doing the conversion on your own; use the Javascript JSON library for functions like JSON.parse and JSON.stringify that go recursively deep in an array and turn it into a Javascript-subscriptable object.


Post a Comment for "Is There A Way To Make Tensorflow Js Read/train Data From A Json File Instead Of A Csv?"