{
  "id": 190849,
  "title": "Any tips on increasing IO speed?",
  "url": "/competitions/rsna-str-pulmonary-embolism-detection/discussion/190849",
  "author_name": "Alexander Soare",
  "post_date": "2020-10-13T15:09:20.554000",
  "votes": 3,
  "comment_count": 14,
  "views": 0,
  "content": "<p>I'm using the this <a href=\"https://www.kaggle.com/vaillant/rsna-str-pe-detection-jpeg-256\" target=\"_blank\">256x256 JPEGs dataset</a> with <code>cv2.imread</code>.  I realised that the limiting factor on my training speed is the data loader (no augmentations) so I'm assuming it's IO speed. Any tips to speed this up?</p>",
  "messages": [
    {
      "id": 1050307,
      "postDate": "2020-10-15T08:59:11.443Z",
      "content": "<p>Hi <a href=\"https://www.kaggle.com/alexandersoare\" target=\"_blank\">@alexandersoare</a>, you can try a library called TurboJPEG to read JPEG images. It should be faster than <code>cv2.imread()</code> from OpenCV. You can read more on how to implement it here: <a href=\"https://www.learnopencv.com/efficient-image-loading/\" target=\"_blank\">https://www.learnopencv.com/efficient-image-loading/</a></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F554091%2F04a87006f36961b8291e419050248e4c%2FScreen%202020-10-15%20at%2010.55.44.jpg?generation=1602752237934324&amp;alt=media\" alt=\"\"></p>",
      "rawMarkdown": "Hi @alexandersoare, you can try a library called TurboJPEG to read JPEG images. It should be faster than `cv2.imread()` from OpenCV. You can read more on how to implement it here: https://www.learnopencv.com/efficient-image-loading/\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F554091%2F04a87006f36961b8291e419050248e4c%2FScreen%202020-10-15%20at%2010.55.44.jpg?generation=1602752237934324&alt=media)",
      "votes": 7,
      "replies": [
        {
          "id": 1050492,
          "postDate": "2020-10-15T13:15:36.337Z",
          "content": "<p>Hi <a href=\"https://www.kaggle.com/kozodoi\" target=\"_blank\">@kozodoi</a>  - how can I install turbojpeg in a kaggle notebook?</p>",
          "rawMarkdown": "Hi @kozodoi  - how can I install turbojpeg in a kaggle notebook?"
        },
        {
          "id": 1050524,
          "postDate": "2020-10-15T13:57:09.570Z",
          "content": "<p><a href=\"https://www.kaggle.com/cascadenite\" target=\"_blank\">@cascadenite</a> In a notebook with the Internet enabled you can use:<br>\n<code>!pip install -U git+git://github.com/lilohuang/PyTurboJPEG.git</code></p>\n<p>See <a href=\"https://github.com/lilohuang/PyTurboJPEG\" target=\"_blank\">here</a> for more details.</p>",
          "rawMarkdown": "@cascadenite In a notebook with the Internet enabled you can use:\n`!pip install -U git+git://github.com/lilohuang/PyTurboJPEG.git`\n\n See [here](https://github.com/lilohuang/PyTurboJPEG) for more details.\n\n\n\n",
          "votes": 1
        },
        {
          "id": 1050834,
          "postDate": "2020-10-15T19:13:19.603Z",
          "content": "<p>got it - thanks!  That's reduced the training time by about 20% (only 1hr15/epoch for Effnet0 now - obviously still far too slow but an improvement so thank you)</p>",
          "rawMarkdown": "got it - thanks!  That's reduced the training time by about 20% (only 1hr15/epoch for Effnet0 now - obviously still far too slow but an improvement so thank you)"
        },
        {
          "id": 1055968,
          "postDate": "2020-10-21T10:05:19.523Z",
          "content": "<p><a href=\"https://www.kaggle.com/cascadenite\" target=\"_blank\">@cascadenite</a> <br>\ndid u get this error</p>\n<pre><code>Unable to locate turbojpeg library automatically. You may specify the turbojpeg library path manually.\ne.g. jpeg = TurboJPEG(lib_pat\n</code></pre>\n<p>h)<br>\nhow to resolve it..</p>",
          "rawMarkdown": "@cascadenite \ndid u get this error\n```\nUnable to locate turbojpeg library automatically. You may specify the turbojpeg library path manually.\ne.g. jpeg = TurboJPEG(lib_pat\n```h)\nhow to resolve it.."
        },
        {
          "id": 1056132,
          "postDate": "2020-10-21T13:00:29.297Z",
          "content": "<p><a href=\"https://www.kaggle.com/jaideepvalani\" target=\"_blank\">@jaideepvalani</a> See the comment of <a href=\"https://www.kaggle.com/lndosu\" target=\"_blank\">@lndosu</a> above</p>",
          "rawMarkdown": "@jaideepvalani See the comment of @lndosu above"
        },
        {
          "id": 1056178,
          "postDate": "2020-10-21T13:41:36.920Z",
          "content": "<p><a href=\"https://www.kaggle.com/alexandersoare\" target=\"_blank\">@alexandersoare</a>  yeah i saw.. does this reduces the image quality TUrbo Jpeg ?</p>",
          "rawMarkdown": "@alexandersoare  yeah i saw.. does this reduces the image quality TUrbo Jpeg ?\n"
        },
        {
          "id": 1059321,
          "postDate": "2020-10-24T23:26:51.287Z",
          "content": "<p>It's too late for me to use TurboJPEG in this competition, but I'll def use it in others.. :-).</p>",
          "rawMarkdown": "It's too late for me to use TurboJPEG in this competition, but I'll def use it in others.. :-)."
        },
        {
          "id": 1059567,
          "postDate": "2020-10-25T08:24:10.030Z",
          "content": "<p><a href=\"https://www.kaggle.com/jaideepvalani\" target=\"_blank\">@jaideepvalani</a> would feel weird if it did reduce the image quality. Something that should be printed on the box</p>",
          "rawMarkdown": "@jaideepvalani would feel weird if it did reduce the image quality. Something that should be printed on the box"
        }
      ]
    },
    {
      "id": 1048518,
      "postDate": "2020-10-13T15:09:20.553Z",
      "content": "<p>I'm using the this <a href=\"https://www.kaggle.com/vaillant/rsna-str-pe-detection-jpeg-256\" target=\"_blank\">256x256 JPEGs dataset</a> with <code>cv2.imread</code>.  I realised that the limiting factor on my training speed is the data loader (no augmentations) so I'm assuming it's IO speed. Any tips to speed this up?</p>",
      "rawMarkdown": "I'm using the this [256x256 JPEGs dataset](https://www.kaggle.com/vaillant/rsna-str-pe-detection-jpeg-256) with `cv2.imread`.  I realised that the limiting factor on my training speed is the data loader (no augmentations) so I'm assuming it's IO speed. Any tips to speed this up?",
      "votes": 3
    },
    {
      "id": 1049855,
      "postDate": "2020-10-14T20:52:43.927Z",
      "content": "<p>Hi Alexander, I’m having the same issue. I increased my number of workers and set pin_memory=True. That increased speed by about 40%.</p>",
      "rawMarkdown": "Hi Alexander, I’m having the same issue. I increased my number of workers and set pin_memory=True. That increased speed by about 40%.",
      "votes": 2
    },
    {
      "id": 1048735,
      "postDate": "2020-10-13T18:40:29.123Z",
      "content": "<p>You can try to use TFRecords dataset provided by organizers <a href=\"https://www.kaggle.com/c/rsna-str-pulmonary-embolism-detection/discussion/189545\" target=\"_blank\">https://www.kaggle.com/c/rsna-str-pulmonary-embolism-detection/discussion/189545</a>.</p>",
      "rawMarkdown": "You can try to use TFRecords dataset provided by organizers https://www.kaggle.com/c/rsna-str-pulmonary-embolism-detection/discussion/189545.",
      "votes": 2
    },
    {
      "id": 1050981,
      "postDate": "2020-10-16T02:22:17.107Z",
      "content": "<p>Hi@Nikita Kozodoi,Thanks for the great sharing.<br>\nI get the following error in kaggle notebookHow can I use TurboJPEG?</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F4289810%2Fe90b9869ea1672b976a6939cbd73bf22%2F2020-10-16%2011.18.25.png?generation=1602814737399905&amp;alt=media\" alt=\"\"></p>",
      "rawMarkdown": "Hi@Nikita Kozodoi,Thanks for the great sharing.\nI get the following error in kaggle notebookHow can I use TurboJPEG?\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F4289810%2Fe90b9869ea1672b976a6939cbd73bf22%2F2020-10-16%2011.18.25.png?generation=1602814737399905&alt=media)",
      "replies": [
        {
          "id": 1051056,
          "postDate": "2020-10-16T05:33:08.047Z",
          "content": "<p><code>!apt-get update</code><br>\n<code>!apt-get install libturbojpeg</code><br>\n<code>!pip install -U git+git://github.com/lilohuang/PyTurboJPEG.git</code></p>\n<p>You have to install libjpeg-turbo.</p>",
          "rawMarkdown": "`!apt-get update`\n`!apt-get install libturbojpeg`\n`!pip install -U git+git://github.com/lilohuang/PyTurboJPEG.git`\n\nYou have to install libjpeg-turbo.",
          "votes": 1
        },
        {
          "id": 1051096,
          "postDate": "2020-10-16T06:54:47.070Z",
          "content": "<p><a href=\"https://www.kaggle.com/Yohan\" target=\"_blank\">@Yohan</a> <br>\nThank you so much!<br>\nThanks to you, I was able to solve the error.</p>",
          "rawMarkdown": "@Yohan \nThank you so much!\nThanks to you, I was able to solve the error."
        }
      ]
    }
  ],
  "comments": [
    {
      "id": 1050307,
      "author_name": "Nikita Kozodoi",
      "author_url": "",
      "post_date": "2020-10-15T08:59:11.443000",
      "content": "<p>Hi <a href=\"https://www.kaggle.com/alexandersoare\" target=\"_blank\">@alexandersoare</a>, you can try a library called TurboJPEG to read JPEG images. It should be faster than <code>cv2.imread()</code> from OpenCV. You can read more on how to implement it here: <a href=\"https://www.learnopencv.com/efficient-image-loading/\" target=\"_blank\">https://www.learnopencv.com/efficient-image-loading/</a></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F554091%2F04a87006f36961b8291e419050248e4c%2FScreen%202020-10-15%20at%2010.55.44.jpg?generation=1602752237934324&amp;alt=media\" alt=\"\"></p>",
      "votes": 7,
      "replies": [
        {
          "id": 1050492,
          "author_name": "Mark P",
          "author_url": "",
          "post_date": "2020-10-15T13:15:36.337000",
          "content": "<p>Hi <a href=\"https://www.kaggle.com/kozodoi\" target=\"_blank\">@kozodoi</a>  - how can I install turbojpeg in a kaggle notebook?</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 1050524,
          "author_name": "Nikita Kozodoi",
          "author_url": "",
          "post_date": "2020-10-15T13:57:09.570000",
          "content": "<p><a href=\"https://www.kaggle.com/cascadenite\" target=\"_blank\">@cascadenite</a> In a notebook with the Internet enabled you can use:<br>\n<code>!pip install -U git+git://github.com/lilohuang/PyTurboJPEG.git</code></p>\n<p>See <a href=\"https://github.com/lilohuang/PyTurboJPEG\" target=\"_blank\">here</a> for more details.</p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 1050834,
          "author_name": "Mark P",
          "author_url": "",
          "post_date": "2020-10-15T19:13:19.603000",
          "content": "<p>got it - thanks!  That's reduced the training time by about 20% (only 1hr15/epoch for Effnet0 now - obviously still far too slow but an improvement so thank you)</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 1055968,
          "author_name": "Jaideep",
          "author_url": "",
          "post_date": "2020-10-21T10:05:19.523000",
          "content": "<p><a href=\"https://www.kaggle.com/cascadenite\" target=\"_blank\">@cascadenite</a> <br>\ndid u get this error</p>\n<pre><code>Unable to locate turbojpeg library automatically. You may specify the turbojpeg library path manually.\ne.g. jpeg = TurboJPEG(lib_pat\n</code></pre>\n<p>h)<br>\nhow to resolve it..</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 1056132,
          "author_name": "Alexander Soare",
          "author_url": "",
          "post_date": "2020-10-21T13:00:29.297000",
          "content": "<p><a href=\"https://www.kaggle.com/jaideepvalani\" target=\"_blank\">@jaideepvalani</a> See the comment of <a href=\"https://www.kaggle.com/lndosu\" target=\"_blank\">@lndosu</a> above</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 1056178,
          "author_name": "Jaideep",
          "author_url": "",
          "post_date": "2020-10-21T13:41:36.920000",
          "content": "<p><a href=\"https://www.kaggle.com/alexandersoare\" target=\"_blank\">@alexandersoare</a>  yeah i saw.. does this reduces the image quality TUrbo Jpeg ?</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 1059321,
          "author_name": "عثمان",
          "author_url": "",
          "post_date": "2020-10-24T23:26:51.287000",
          "content": "<p>It's too late for me to use TurboJPEG in this competition, but I'll def use it in others.. :-).</p>",
          "votes": 0,
          "replies": []
        },
        {
          "id": 1059567,
          "author_name": "Alexander Soare",
          "author_url": "",
          "post_date": "2020-10-25T08:24:10.030000",
          "content": "<p><a href=\"https://www.kaggle.com/jaideepvalani\" target=\"_blank\">@jaideepvalani</a> would feel weird if it did reduce the image quality. Something that should be printed on the box</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 1049855,
      "author_name": "Mark P",
      "author_url": "",
      "post_date": "2020-10-14T20:52:43.927000",
      "content": "<p>Hi Alexander, I’m having the same issue. I increased my number of workers and set pin_memory=True. That increased speed by about 40%.</p>",
      "votes": 2,
      "replies": []
    },
    {
      "id": 1048735,
      "author_name": "Araik Tamazian",
      "author_url": "",
      "post_date": "2020-10-13T18:40:29.123000",
      "content": "<p>You can try to use TFRecords dataset provided by organizers <a href=\"https://www.kaggle.com/c/rsna-str-pulmonary-embolism-detection/discussion/189545\" target=\"_blank\">https://www.kaggle.com/c/rsna-str-pulmonary-embolism-detection/discussion/189545</a>.</p>",
      "votes": 2,
      "replies": []
    },
    {
      "id": 1050981,
      "author_name": "SHINO",
      "author_url": "",
      "post_date": "2020-10-16T02:22:17.107000",
      "content": "<p>Hi@Nikita Kozodoi,Thanks for the great sharing.<br>\nI get the following error in kaggle notebookHow can I use TurboJPEG?</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F4289810%2Fe90b9869ea1672b976a6939cbd73bf22%2F2020-10-16%2011.18.25.png?generation=1602814737399905&amp;alt=media\" alt=\"\"></p>",
      "votes": 0,
      "replies": [
        {
          "id": 1051056,
          "author_name": "Yohan Lee",
          "author_url": "",
          "post_date": "2020-10-16T05:33:08.047000",
          "content": "<p><code>!apt-get update</code><br>\n<code>!apt-get install libturbojpeg</code><br>\n<code>!pip install -U git+git://github.com/lilohuang/PyTurboJPEG.git</code></p>\n<p>You have to install libjpeg-turbo.</p>",
          "votes": 1,
          "replies": []
        },
        {
          "id": 1051096,
          "author_name": "SHINO",
          "author_url": "",
          "post_date": "2020-10-16T06:54:47.070000",
          "content": "<p><a href=\"https://www.kaggle.com/Yohan\" target=\"_blank\">@Yohan</a> <br>\nThank you so much!<br>\nThanks to you, I was able to solve the error.</p>",
          "votes": 0,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1050307": "Hi @alexandersoare, you can try a library called TurboJPEG to read JPEG images. It should be faster than `cv2.imread()` from OpenCV. You can read more on how to implement it here: https://www.learnopencv.com/efficient-image-loading/\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F554091%2F04a87006f36961b8291e419050248e4c%2FScreen%202020-10-15%20at%2010.55.44.jpg?generation=1602752237934324&alt=media)",
    "1048518": "I'm using the this [256x256 JPEGs dataset](https://www.kaggle.com/vaillant/rsna-str-pe-detection-jpeg-256) with `cv2.imread`.  I realised that the limiting factor on my training speed is the data loader (no augmentations) so I'm assuming it's IO speed. Any tips to speed this up?",
    "1049855": "Hi Alexander, I’m having the same issue. I increased my number of workers and set pin_memory=True. That increased speed by about 40%.",
    "1048735": "You can try to use TFRecords dataset provided by organizers https://www.kaggle.com/c/rsna-str-pulmonary-embolism-detection/discussion/189545.",
    "1050981": "Hi@Nikita Kozodoi,Thanks for the great sharing.\nI get the following error in kaggle notebookHow can I use TurboJPEG?\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F4289810%2Fe90b9869ea1672b976a6939cbd73bf22%2F2020-10-16%2011.18.25.png?generation=1602814737399905&alt=media)"
  }
}