{
  "id": 611245,
  "title": "The problem of model training converging too quickly",
  "url": "/competitions/rsna-intracranial-aneurysm-detection/discussion/611245",
  "author_name": "Ataracsia",
  "post_date": "2025-10-09T17:02:28.415000",
  "votes": 0,
  "comment_count": 0,
  "views": 0,
  "content": "<p>I created several models, but for some reason, training converges after just one epoch.<br>\nI tried various approaches for the train data—simply slicing it, aggregating it with np.mean(), and so on.</p>\n<p>This is a modified version of the code I used for local training. It only has 10 SeriesInstanceUIDs, but it should work:<br>\n<a href=\"https://www.kaggle.com/code/ataracsia/rsna-iad-train-swin-s\" target=\"_blank\">[RSNA-IAD]train_swin_s.ipynb</a></p>\n<p>The key points of this Notebook are as follows:</p>\n<p><strong>Reference:</strong></p>\n<ul>\n<li>RSNA-IAD | Swin Transformer| LB</li>\n<li>Train 224x224 DICOM-&gt;PNGs EfficientNetV2S</li>\n</ul>\n<p><strong>Summary:</strong></p>\n<ol>\n<li>Convert .dcm files to 384x384 npy files, save them, and simultaneously save the patient's metadata to a .csv file</li>\n<li>Calculate mean, std, and kurtosis channel-wise for each SeriesInstanceUID and save them to npy files</li>\n<li>Save the path of each npy file to a .csv file</li>\n<li>Create a classification model using image data and meta data based on timm.createmodel(‘swin_small_patch4_window7_224’).</li>\n<li>Use a custom criterion.</li>\n<li>Split into 5 folds using Multilabel Stratified KFold and train for 20 epochs on each fold.</li>\n</ol>\n<p>The graph of training error and validation error from training on the first fold looks like this:<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F7389764%2Fc59bfcfa058869e325edde03c04b4f21%2F2025-10-10%20014324.png?generation=1760028871691289&amp;alt=media\" alt=\"\"><br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F7389764%2F30f245d657642f6a3f06022467eda067%2F2025-10-10%20014437.png?generation=1760028881846870&amp;alt=media\" alt=\"\"></p>\n<p>Do you think this code is functioning correctly? Or am I doing something wrong?</p>",
  "messages": [
    {
      "id": 3300156,
      "postDate": "2025-10-09T17:02:28.417Z",
      "content": "<p>I created several models, but for some reason, training converges after just one epoch.<br>\nI tried various approaches for the train data—simply slicing it, aggregating it with np.mean(), and so on.</p>\n<p>This is a modified version of the code I used for local training. It only has 10 SeriesInstanceUIDs, but it should work:<br>\n<a href=\"https://www.kaggle.com/code/ataracsia/rsna-iad-train-swin-s\" target=\"_blank\">[RSNA-IAD]train_swin_s.ipynb</a></p>\n<p>The key points of this Notebook are as follows:</p>\n<p><strong>Reference:</strong></p>\n<ul>\n<li>RSNA-IAD | Swin Transformer| LB</li>\n<li>Train 224x224 DICOM-&gt;PNGs EfficientNetV2S</li>\n</ul>\n<p><strong>Summary:</strong></p>\n<ol>\n<li>Convert .dcm files to 384x384 npy files, save them, and simultaneously save the patient's metadata to a .csv file</li>\n<li>Calculate mean, std, and kurtosis channel-wise for each SeriesInstanceUID and save them to npy files</li>\n<li>Save the path of each npy file to a .csv file</li>\n<li>Create a classification model using image data and meta data based on timm.createmodel(‘swin_small_patch4_window7_224’).</li>\n<li>Use a custom criterion.</li>\n<li>Split into 5 folds using Multilabel Stratified KFold and train for 20 epochs on each fold.</li>\n</ol>\n<p>The graph of training error and validation error from training on the first fold looks like this:<br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F7389764%2Fc59bfcfa058869e325edde03c04b4f21%2F2025-10-10%20014324.png?generation=1760028871691289&amp;alt=media\" alt=\"\"><br>\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F7389764%2F30f245d657642f6a3f06022467eda067%2F2025-10-10%20014437.png?generation=1760028881846870&amp;alt=media\" alt=\"\"></p>\n<p>Do you think this code is functioning correctly? Or am I doing something wrong?</p>",
      "rawMarkdown": "I created several models, but for some reason, training converges after just one epoch.\nI tried various approaches for the train data—simply slicing it, aggregating it with np.mean(), and so on.\n\nThis is a modified version of the code I used for local training. It only has 10 SeriesInstanceUIDs, but it should work:\n[[RSNA-IAD]train_swin_s.ipynb](https://www.kaggle.com/code/ataracsia/rsna-iad-train-swin-s)\n\nThe key points of this Notebook are as follows:\n\n**Reference:**\n- RSNA-IAD | Swin Transformer| LB\n- Train 224x224 DICOM->PNGs EfficientNetV2S\n\n**Summary:**\n\n1. Convert .dcm files to 384x384 npy files, save them, and simultaneously save the patient's metadata to a .csv file\n2. Calculate mean, std, and kurtosis channel-wise for each SeriesInstanceUID and save them to npy files\n3. Save the path of each npy file to a .csv file\n4. Create a classification model using image data and meta data based on timm.createmodel(‘swin_small_patch4_window7_224’).\n5. Use a custom criterion.\n6. Split into 5 folds using Multilabel Stratified KFold and train for 20 epochs on each fold.\n\nThe graph of training error and validation error from training on the first fold looks like this:\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F7389764%2Fc59bfcfa058869e325edde03c04b4f21%2F2025-10-10%20014324.png?generation=1760028871691289&alt=media)\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F7389764%2F30f245d657642f6a3f06022467eda067%2F2025-10-10%20014437.png?generation=1760028881846870&alt=media)\n\nDo you think this code is functioning correctly? Or am I doing something wrong?"
    }
  ],
  "comments": [],
  "raw_markdown_by_id": {
    "3300156": "I created several models, but for some reason, training converges after just one epoch.\nI tried various approaches for the train data—simply slicing it, aggregating it with np.mean(), and so on.\n\nThis is a modified version of the code I used for local training. It only has 10 SeriesInstanceUIDs, but it should work:\n[[RSNA-IAD]train_swin_s.ipynb](https://www.kaggle.com/code/ataracsia/rsna-iad-train-swin-s)\n\nThe key points of this Notebook are as follows:\n\n**Reference:**\n- RSNA-IAD | Swin Transformer| LB\n- Train 224x224 DICOM->PNGs EfficientNetV2S\n\n**Summary:**\n\n1. Convert .dcm files to 384x384 npy files, save them, and simultaneously save the patient's metadata to a .csv file\n2. Calculate mean, std, and kurtosis channel-wise for each SeriesInstanceUID and save them to npy files\n3. Save the path of each npy file to a .csv file\n4. Create a classification model using image data and meta data based on timm.createmodel(‘swin_small_patch4_window7_224’).\n5. Use a custom criterion.\n6. Split into 5 folds using Multilabel Stratified KFold and train for 20 epochs on each fold.\n\nThe graph of training error and validation error from training on the first fold looks like this:\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F7389764%2Fc59bfcfa058869e325edde03c04b4f21%2F2025-10-10%20014324.png?generation=1760028871691289&alt=media)\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F7389764%2F30f245d657642f6a3f06022467eda067%2F2025-10-10%20014437.png?generation=1760028881846870&alt=media)\n\nDo you think this code is functioning correctly? Or am I doing something wrong?"
  }
}