{
  "id": 313933,
  "title": "How to train data from the template provided?",
  "url": "/competitions/eestecchallenge/discussion/313933",
  "author_name": "",
  "post_date": "2022-03-19T18:40:12.998326700Z",
  "votes": null,
  "comment_count": 1,
  "views": 0,
  "content": "<p>I Trained and tested the models using cifar10 from the keras dataset as a proof of concept, but now I want to use the one provided on the competition.</p>\n<p>OLD:<br>\n<code>(trainX, trainY), (testX, testY) = cifar10.load_data()</code></p>\n<p>**How do I use the template to load the train and test data **</p>\n<p>`import tensorflow as tf<br>\ndata_dir = '/kaggle/input/eestecchallenge/dataset/dataset/'<br>\nbatch_size =100<br>\ntrain_ds = tf.keras.utils.image_dataset_from_directory(<br>\n  data_dir,<br>\n  validation_split=0.2,<br>\n  subset=\"training\",<br>\n  seed=123,<br>\n  image_size=(32, 32),<br>\n  batch_size=batch_size)</p>\n<p>val_ds = tf.keras.utils.image_dataset_from_directory(<br>\n  data_dir,<br>\n  validation_split=0.2,<br>\n  subset=\"validation\",<br>\n  seed=123,<br>\n  image_size=(32, 32),<br>\n  batch_size=batch_size)`</p>\n<p>These train_ds and val_ds , how do I use them to the model.fit(…) function</p>",
  "messages": [
    {
      "id": "1729194",
      "postDate": "03/19/2022 18:40:12",
      "content": "<p>I Trained and tested the models using cifar10 from the keras dataset as a proof of concept, but now I want to use the one provided on the competition.</p>\n<p>OLD:<br>\n<code>(trainX, trainY), (testX, testY) = cifar10.load_data()</code></p>\n<p>**How do I use the template to load the train and test data **</p>\n<p>`import tensorflow as tf<br>\ndata_dir = '/kaggle/input/eestecchallenge/dataset/dataset/'<br>\nbatch_size =100<br>\ntrain_ds = tf.keras.utils.image_dataset_from_directory(<br>\n  data_dir,<br>\n  validation_split=0.2,<br>\n  subset=\"training\",<br>\n  seed=123,<br>\n  image_size=(32, 32),<br>\n  batch_size=batch_size)</p>\n<p>val_ds = tf.keras.utils.image_dataset_from_directory(<br>\n  data_dir,<br>\n  validation_split=0.2,<br>\n  subset=\"validation\",<br>\n  seed=123,<br>\n  image_size=(32, 32),<br>\n  batch_size=batch_size)`</p>\n<p>These train_ds and val_ds , how do I use them to the model.fit(…) function</p>",
      "rawMarkdown": "I Trained and tested the models using cifar10 from the keras dataset as a proof of concept, but now I want to use the one provided on the competition.\n\nOLD:\n`(trainX, trainY), (testX, testY) = cifar10.load_data()`\n\n**How do I use the template to load the train and test data **\n\n`import tensorflow as tf\ndata_dir = '/kaggle/input/eestecchallenge/dataset/dataset/'\nbatch_size =100\ntrain_ds = tf.keras.utils.image_dataset_from_directory(\n  data_dir,\n  validation_split=0.2,\n  subset=\"training\",\n  seed=123,\n  image_size=(32, 32),\n  batch_size=batch_size)\n\nval_ds = tf.keras.utils.image_dataset_from_directory(\n  data_dir,\n  validation_split=0.2,\n  subset=\"validation\",\n  seed=123,\n  image_size=(32, 32),\n  batch_size=batch_size)`\n\nThese train_ds and val_ds , how do I use them to the model.fit(...) function",
      "votes": null
    },
    {
      "id": "1729202",
      "postDate": "03/19/2022 18:56:09",
      "content": "<blockquote>\n  <p>I Trained and tested the models using cifar10 from the keras dataset as a proof of concept, but now I want to use the one provided on the competition.</p>\n  <p>OLD:<br>\n  <code>(trainX, trainY), (testX, testY) = cifar10.load_data()</code></p>\n  <p>**How do I use the template to load the train and test data **</p>\n  <p>`import tensorflow as tf<br>\n  data_dir = '/kaggle/input/eestecchallenge/dataset/dataset/'<br>\n  batch_size =100<br>\n  train_ds = tf.keras.utils.image_dataset_from_directory(<br>\n    data_dir,<br>\n    validation_split=0.2,<br>\n    subset=\"training\",<br>\n    seed=123,<br>\n    image_size=(32, 32),<br>\n    batch_size=batch_size)</p>\n  <p>val_ds = tf.keras.utils.image_dataset_from_directory(<br>\n    data_dir,<br>\n    validation_split=0.2,<br>\n    subset=\"validation\",<br>\n    seed=123,<br>\n    image_size=(32, 32),<br>\n    batch_size=batch_size)`</p>\n  <p>These train_ds and val_ds , how do I use them to the model.fit(…) function</p>\n  <p>I Trained and tested the models using cifar10 from the keras dataset as a proof of concept, but now I want to use the one provided on the competition.</p>\n  <p>OLD:<br>\n  <code>(trainX, trainY), (testX, testY) = cifar10.load_data()</code></p>\n  <p>**How do I use the template to load the train and test data **</p>\n  <p>`import tensorflow as tf<br>\n  data_dir = '/kaggle/input/eestecchallenge/dataset/dataset/'<br>\n  batch_size =100<br>\n  train_ds = tf.keras.utils.image_dataset_from_directory(<br>\n    data_dir,<br>\n    validation_split=0.2,<br>\n    subset=\"training\",<br>\n    seed=123,<br>\n    image_size=(32, 32),<br>\n    batch_size=batch_size)</p>\n  <p>val_ds = tf.keras.utils.image_dataset_from_directory(<br>\n    data_dir,<br>\n    validation_split=0.2,<br>\n    subset=\"validation\",<br>\n    seed=123,<br>\n    image_size=(32, 32),<br>\n    batch_size=batch_size)`</p>\n  <p>These train_ds and val_ds , how do I use them to the model.fit(…) function</p>\n</blockquote>\n<p>The given dataset is the cifar10 dataset with two classes removed.<br>\nAs a result, the correct calling of the model fit function is:<br>\nmodel.fit(train_ds, validation_data=val_ds, epochs=###)</p>",
      "rawMarkdown": "> I Trained and tested the models using cifar10 from the keras dataset as a proof of concept, but now I want to use the one provided on the competition.\n> \n> OLD:\n> `(trainX, trainY), (testX, testY) = cifar10.load_data()`\n> \n> **How do I use the template to load the train and test data **\n> \n> `import tensorflow as tf\n> data_dir = '/kaggle/input/eestecchallenge/dataset/dataset/'\n> batch_size =100\n> train_ds = tf.keras.utils.image_dataset_from_directory(\n>   data_dir,\n>   validation_split=0.2,\n>   subset=\"training\",\n>   seed=123,\n>   image_size=(32, 32),\n>   batch_size=batch_size)\n> \n> val_ds = tf.keras.utils.image_dataset_from_directory(\n>   data_dir,\n>   validation_split=0.2,\n>   subset=\"validation\",\n>   seed=123,\n>   image_size=(32, 32),\n>   batch_size=batch_size)`\n> \n> These train_ds and val_ds , how do I use them to the model.fit(...) function\n\n> I Trained and tested the models using cifar10 from the keras dataset as a proof of concept, but now I want to use the one provided on the competition.\n> \n> OLD:\n> `(trainX, trainY), (testX, testY) = cifar10.load_data()`\n> \n> **How do I use the template to load the train and test data **\n> \n> `import tensorflow as tf\n> data_dir = '/kaggle/input/eestecchallenge/dataset/dataset/'\n> batch_size =100\n> train_ds = tf.keras.utils.image_dataset_from_directory(\n>   data_dir,\n>   validation_split=0.2,\n>   subset=\"training\",\n>   seed=123,\n>   image_size=(32, 32),\n>   batch_size=batch_size)\n> \n> val_ds = tf.keras.utils.image_dataset_from_directory(\n>   data_dir,\n>   validation_split=0.2,\n>   subset=\"validation\",\n>   seed=123,\n>   image_size=(32, 32),\n>   batch_size=batch_size)`\n> \n> These train_ds and val_ds , how do I use them to the model.fit(...) function\n\nThe given dataset is the cifar10 dataset with two classes removed.\nAs a result, the correct calling of the model fit function is:\nmodel.fit(train_ds, validation_data=val_ds, epochs=###)",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 1729202,
      "author_name": "andreasmaniatopoulos",
      "author_url": "",
      "post_date": "03/19/2022 18:56:09",
      "content": "<blockquote>\n  <p>I Trained and tested the models using cifar10 from the keras dataset as a proof of concept, but now I want to use the one provided on the competition.</p>\n  <p>OLD:<br>\n  <code>(trainX, trainY), (testX, testY) = cifar10.load_data()</code></p>\n  <p>**How do I use the template to load the train and test data **</p>\n  <p>`import tensorflow as tf<br>\n  data_dir = '/kaggle/input/eestecchallenge/dataset/dataset/'<br>\n  batch_size =100<br>\n  train_ds = tf.keras.utils.image_dataset_from_directory(<br>\n    data_dir,<br>\n    validation_split=0.2,<br>\n    subset=\"training\",<br>\n    seed=123,<br>\n    image_size=(32, 32),<br>\n    batch_size=batch_size)</p>\n  <p>val_ds = tf.keras.utils.image_dataset_from_directory(<br>\n    data_dir,<br>\n    validation_split=0.2,<br>\n    subset=\"validation\",<br>\n    seed=123,<br>\n    image_size=(32, 32),<br>\n    batch_size=batch_size)`</p>\n  <p>These train_ds and val_ds , how do I use them to the model.fit(…) function</p>\n  <p>I Trained and tested the models using cifar10 from the keras dataset as a proof of concept, but now I want to use the one provided on the competition.</p>\n  <p>OLD:<br>\n  <code>(trainX, trainY), (testX, testY) = cifar10.load_data()</code></p>\n  <p>**How do I use the template to load the train and test data **</p>\n  <p>`import tensorflow as tf<br>\n  data_dir = '/kaggle/input/eestecchallenge/dataset/dataset/'<br>\n  batch_size =100<br>\n  train_ds = tf.keras.utils.image_dataset_from_directory(<br>\n    data_dir,<br>\n    validation_split=0.2,<br>\n    subset=\"training\",<br>\n    seed=123,<br>\n    image_size=(32, 32),<br>\n    batch_size=batch_size)</p>\n  <p>val_ds = tf.keras.utils.image_dataset_from_directory(<br>\n    data_dir,<br>\n    validation_split=0.2,<br>\n    subset=\"validation\",<br>\n    seed=123,<br>\n    image_size=(32, 32),<br>\n    batch_size=batch_size)`</p>\n  <p>These train_ds and val_ds , how do I use them to the model.fit(…) function</p>\n</blockquote>\n<p>The given dataset is the cifar10 dataset with two classes removed.<br>\nAs a result, the correct calling of the model fit function is:<br>\nmodel.fit(train_ds, validation_data=val_ds, epochs=###)</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "1729194": "I Trained and tested the models using cifar10 from the keras dataset as a proof of concept, but now I want to use the one provided on the competition.\n\nOLD:\n`(trainX, trainY), (testX, testY) = cifar10.load_data()`\n\n**How do I use the template to load the train and test data **\n\n`import tensorflow as tf\ndata_dir = '/kaggle/input/eestecchallenge/dataset/dataset/'\nbatch_size =100\ntrain_ds = tf.keras.utils.image_dataset_from_directory(\n  data_dir,\n  validation_split=0.2,\n  subset=\"training\",\n  seed=123,\n  image_size=(32, 32),\n  batch_size=batch_size)\n\nval_ds = tf.keras.utils.image_dataset_from_directory(\n  data_dir,\n  validation_split=0.2,\n  subset=\"validation\",\n  seed=123,\n  image_size=(32, 32),\n  batch_size=batch_size)`\n\nThese train_ds and val_ds , how do I use them to the model.fit(...) function",
    "1729202": "> I Trained and tested the models using cifar10 from the keras dataset as a proof of concept, but now I want to use the one provided on the competition.\n> \n> OLD:\n> `(trainX, trainY), (testX, testY) = cifar10.load_data()`\n> \n> **How do I use the template to load the train and test data **\n> \n> `import tensorflow as tf\n> data_dir = '/kaggle/input/eestecchallenge/dataset/dataset/'\n> batch_size =100\n> train_ds = tf.keras.utils.image_dataset_from_directory(\n>   data_dir,\n>   validation_split=0.2,\n>   subset=\"training\",\n>   seed=123,\n>   image_size=(32, 32),\n>   batch_size=batch_size)\n> \n> val_ds = tf.keras.utils.image_dataset_from_directory(\n>   data_dir,\n>   validation_split=0.2,\n>   subset=\"validation\",\n>   seed=123,\n>   image_size=(32, 32),\n>   batch_size=batch_size)`\n> \n> These train_ds and val_ds , how do I use them to the model.fit(...) function\n\n> I Trained and tested the models using cifar10 from the keras dataset as a proof of concept, but now I want to use the one provided on the competition.\n> \n> OLD:\n> `(trainX, trainY), (testX, testY) = cifar10.load_data()`\n> \n> **How do I use the template to load the train and test data **\n> \n> `import tensorflow as tf\n> data_dir = '/kaggle/input/eestecchallenge/dataset/dataset/'\n> batch_size =100\n> train_ds = tf.keras.utils.image_dataset_from_directory(\n>   data_dir,\n>   validation_split=0.2,\n>   subset=\"training\",\n>   seed=123,\n>   image_size=(32, 32),\n>   batch_size=batch_size)\n> \n> val_ds = tf.keras.utils.image_dataset_from_directory(\n>   data_dir,\n>   validation_split=0.2,\n>   subset=\"validation\",\n>   seed=123,\n>   image_size=(32, 32),\n>   batch_size=batch_size)`\n> \n> These train_ds and val_ds , how do I use them to the model.fit(...) function\n\nThe given dataset is the cifar10 dataset with two classes removed.\nAs a result, the correct calling of the model fit function is:\nmodel.fit(train_ds, validation_data=val_ds, epochs=###)"
  },
  "source": "meta"
}