{
  "id": 169422,
  "title": "TF Records for Triplet Loss",
  "url": "/competitions/flower-classification-with-tpus/discussion/169422",
  "author_name": "",
  "post_date": "2020-07-23T19:38:35.248475200Z",
  "votes": null,
  "comment_count": 2,
  "views": 0,
  "content": "<p>I need to parse tf records in a way that in each batch I can have pairs of multiple classes.\nI tried a lot but nothing worked.\nI found a way using tf.data.experimental.choose_from_datasets(datasets, choice) but it is too slow. \nCan some please suggest a solution?</p>",
  "messages": [
    {
      "id": "942519",
      "postDate": "07/23/2020 19:38:35",
      "content": "<p>I need to parse tf records in a way that in each batch I can have pairs of multiple classes.\nI tried a lot but nothing worked.\nI found a way using tf.data.experimental.choose_from_datasets(datasets, choice) but it is too slow. \nCan some please suggest a solution?</p>",
      "rawMarkdown": "I need to parse tf records in a way that in each batch I can have pairs of multiple classes.\nI tried a lot but nothing worked.\nI found a way using tf.data.experimental.choose_from_datasets(datasets, choice) but it is too slow. \nCan some please suggest a solution?",
      "votes": null
    },
    {
      "id": "944024",
      "postDate": "07/24/2020 18:44:31",
      "content": "<p>If you need specific data in each record, the best is to generate a dataset that has the data organized exactly as you want it. You can learn more about writing TFRecords here: <a href=\"https://codelabs.developers.google.com/codelabs/keras-flowers-data/#0\">TPU-speed data pipelines: tf.data.Dataset and TFRecords</a></p>\n\n<p>Or maybe <a href=\"https://www.tensorflow.org/api_docs/python/tf/data/Dataset#zip\">tf.data.dataset.zip</a> ? If you tell me more about the structure you Are looking for, I might be able to help more.</p>",
      "rawMarkdown": "If you need specific data in each record, the best is to generate a dataset that has the data organized exactly as you want it. You can learn more about writing TFRecords here: [TPU-speed data pipelines: tf.data.Dataset and TFRecords](https://codelabs.developers.google.com/codelabs/keras-flowers-data/#0)\n\nOr maybe [tf.data.dataset.zip](https://www.tensorflow.org/api_docs/python/tf/data/Dataset#zip) ? If you tell me more about the structure you Are looking for, I might be able to help more.",
      "votes": null
    },
    {
      "id": "944500",
      "postDate": "07/25/2020 06:49:48",
      "content": "<p>I am looking for a way where I can get each batch having at least 2 samples from each class. In each batch. </p>",
      "rawMarkdown": "I am looking for a way where I can get each batch having at least 2 samples from each class. In each batch.",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 944024,
      "author_name": "mgorner",
      "author_url": "",
      "post_date": "07/24/2020 18:44:31",
      "content": "<p>If you need specific data in each record, the best is to generate a dataset that has the data organized exactly as you want it. You can learn more about writing TFRecords here: <a href=\"https://codelabs.developers.google.com/codelabs/keras-flowers-data/#0\">TPU-speed data pipelines: tf.data.Dataset and TFRecords</a></p>\n\n<p>Or maybe <a href=\"https://www.tensorflow.org/api_docs/python/tf/data/Dataset#zip\">tf.data.dataset.zip</a> ? If you tell me more about the structure you Are looking for, I might be able to help more.</p>",
      "votes": null,
      "replies": [
        {
          "id": 944500,
          "author_name": "micheomaano",
          "author_url": "",
          "post_date": "07/25/2020 06:49:48",
          "content": "<p>I am looking for a way where I can get each batch having at least 2 samples from each class. In each batch. </p>",
          "votes": null,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "942519": "I need to parse tf records in a way that in each batch I can have pairs of multiple classes.\nI tried a lot but nothing worked.\nI found a way using tf.data.experimental.choose_from_datasets(datasets, choice) but it is too slow. \nCan some please suggest a solution?",
    "944024": "If you need specific data in each record, the best is to generate a dataset that has the data organized exactly as you want it. You can learn more about writing TFRecords here: [TPU-speed data pipelines: tf.data.Dataset and TFRecords](https://codelabs.developers.google.com/codelabs/keras-flowers-data/#0)\n\nOr maybe [tf.data.dataset.zip](https://www.tensorflow.org/api_docs/python/tf/data/Dataset#zip) ? If you tell me more about the structure you Are looking for, I might be able to help more.",
    "944500": "I am looking for a way where I can get each batch having at least 2 samples from each class. In each batch."
  },
  "source": "meta"
}