Split train data to train and validation by using tensorflow_datasets.load (TF 2.1)

后端 未结 1 635
無奈伤痛
無奈伤痛 2020-12-20 20:34

I\'m trying to run the following Colab project, but when I want to split the training data into validation and train parts I get this error:

KeyError: \"Inva         


        
相关标签:
1条回答
  • 2020-12-20 20:41

    According to the Tensorflow Dataset docs the percentage splitting is possible as e. g. first_10_percent = tfds.Split.TRAIN.subsplit(tfds.percent[:10])

    Your code would work when changing the split list as in the example:

    (training_set, validation_set), dataset_info = tfds.load(
    'tf_flowers',
    split=[
           tfds.Split.TRAIN.subsplit(tfds.percent[:70]),
           tfds.Split.TRAIN.subsplit(tfds.percent[70:])
    ],
    with_info=True,
    as_supervised=True,
    )
    

    With the above code the training_set has 2590 entries, while validation_set has 1080.

    0 讨论(0)
提交回复
热议问题