{
  "id": 674707,
  "title": "7th place writeup (LB: 0.857, Private: 0.839)",
  "content": "<p>السلام عليكم رمضان مبارك على الجميع</p>\n<p>First, thank you to the organizers for hosting this challenge! My approach relied on treating the problem as a YOLO object detection task from two different angles, heavily optimizing for a channel-swapping quirk in the test data, and ensembling the results.</p>\n<p>Here is a breakdown of the methodology that achieved <strong>0.857 Public LB / 0.839 Private LB</strong>.</p>\n<h3>Core Approach: The Dual-Track Strategy</h3>\n<p>Instead of relying on a single model architecture, I split the problem into two parallel tracks:</p>\n<ul>\n<li><strong>2-Class Track (YOLOv26s):</strong> A simpler binary detection task focusing strictly on <code>face</code> and <code>shemagh</code>.</li>\n<li><strong>3-Class Track (YOLOv26m):</strong> A richer detection task focusing on <code>face</code>, <code>shemagh_correct</code>, and <code>shemagh_wrong</code> to provide a stronger signal for the <code>right_place</code> classification.</li>\n</ul>\n<h3>Step-by-Step Pipeline</h3>\n<p><strong>1. Data Preparation &amp; Offline Augmentation</strong></p>\n<ul>\n<li>Removed 6 duplicate images using MD5 hashing and resolved overlapping bounding boxes (keeping the larger box if the IoU exceeded the threshold).</li>\n<li>Created a stratified train/val split to maintain class balance.</li>\n<li>Because <code>shemagh</code> was the minority class, I generated synthetic training samples using offline augmentations (channel shuffle, color jitter, Gaussian blur, rotation, CLAHE) to balance the dataset before training.</li>\n</ul>\n<p><strong>2. Model Training</strong>\nBoth tracks were trained independently on 768×768 images but with different hyperparameters optimized for their specific tasks:</p>\n<ul>\n<li><strong>2-Class Track:</strong> Trained a smaller model (YOLOv26s) for 130 epochs with a learning rate of 0.001 and lighter augmentations (Mosaic 0.8, Mixup 0.15).</li>\n<li><strong>3-Class Track:</strong> Trained a medium model (YOLOv26m) for 100 epochs with a lower learning rate (0.0002) and heavier augmentations (Mosaic 0.503, Cutmix 0.329) to handle the harder 3-class separation.</li>\n</ul>\n<p><strong>3. Test-Time Channel Optimization (The \"Channel Map\")</strong>\nI noticed that roughly 50.7% of the test images had swapped BGR channels. To fix this dynamically during inference:</p>\n<ul>\n<li>I ran inference on all 6 permutations of the (B, G, R) channels for every test image.</li>\n<li>I selected the permutation that yielded the highest combined confidence for both face and shemagh.</li>\n<li>This correct channel order was saved and loaded for the final prediction run.</li>\n</ul>\n<p><strong>4. Inference &amp; TTA</strong>\nUsing the corrected channel map, I ran Test Time Augmentation (TTA) across 3 scales (768, 832, 896) with horizontal flipping. This resulted in 6 predictions per image, which were merged using class-aware NMS.</p>\n<ul>\n<li><em>Right-Place Heuristic:</em> I used a geometric rule where <code>right_place = 1</code> if any shemagh bounding box overlapped with a face bounding box (IoU threshold tuned on the validation set).</li>\n</ul>\n<p><strong>5. Ensembling with Weighted Boxes Fusion (WBF)</strong></p>\n<p>I used a two-level ensembling strategy to maximize the strengths of both tracks:</p>\n<ul>\n<li><strong>Level 1 (Intra-track):</strong> WBF was applied to the best models and pseudo-labeled models within the 2-class track (yielding 0.843) and across 4 models in the 3-class track (yielding 0.850).</li>\n<li><strong>Level 2 (Cross-track):</strong> The final submission was a weighted blend of the 2-class WBF (0.3 weight) and 3-class WBF (0.7 weight). For the <code>right_place</code> flag, I used a union approach: if either track predicted a 1, the final prediction was 1.</li>\n</ul>",
  "comments": [],
  "comment_count": 0,
  "messages": [
    {
      "id": 3408950,
      "postDate": "2026-02-21T17:45:45.597Z",
      "content": "<p>السلام عليكم رمضان مبارك على الجميع</p>\n<p>First, thank you to the organizers for hosting this challenge! My approach relied on treating the problem as a YOLO object detection task from two different angles, heavily optimizing for a channel-swapping quirk in the test data, and ensembling the results.</p>\n<p>Here is a breakdown of the methodology that achieved <strong>0.857 Public LB / 0.839 Private LB</strong>.</p>\n<h3>Core Approach: The Dual-Track Strategy</h3>\n<p>Instead of relying on a single model architecture, I split the problem into two parallel tracks:</p>\n<ul>\n<li><strong>2-Class Track (YOLOv26s):</strong> A simpler binary detection task focusing strictly on <code>face</code> and <code>shemagh</code>.</li>\n<li><strong>3-Class Track (YOLOv26m):</strong> A richer detection task focusing on <code>face</code>, <code>shemagh_correct</code>, and <code>shemagh_wrong</code> to provide a stronger signal for the <code>right_place</code> classification.</li>\n</ul>\n<h3>Step-by-Step Pipeline</h3>\n<p><strong>1. Data Preparation &amp; Offline Augmentation</strong></p>\n<ul>\n<li>Removed 6 duplicate images using MD5 hashing and resolved overlapping bounding boxes (keeping the larger box if the IoU exceeded the threshold).</li>\n<li>Created a stratified train/val split to maintain class balance.</li>\n<li>Because <code>shemagh</code> was the minority class, I generated synthetic training samples using offline augmentations (channel shuffle, color jitter, Gaussian blur, rotation, CLAHE) to balance the dataset before training.</li>\n</ul>\n<p><strong>2. Model Training</strong>\nBoth tracks were trained independently on 768×768 images but with different hyperparameters optimized for their specific tasks:</p>\n<ul>\n<li><strong>2-Class Track:</strong> Trained a smaller model (YOLOv26s) for 130 epochs with a learning rate of 0.001 and lighter augmentations (Mosaic 0.8, Mixup 0.15).</li>\n<li><strong>3-Class Track:</strong> Trained a medium model (YOLOv26m) for 100 epochs with a lower learning rate (0.0002) and heavier augmentations (Mosaic 0.503, Cutmix 0.329) to handle the harder 3-class separation.</li>\n</ul>\n<p><strong>3. Test-Time Channel Optimization (The \"Channel Map\")</strong>\nI noticed that roughly 50.7% of the test images had swapped BGR channels. To fix this dynamically during inference:</p>\n<ul>\n<li>I ran inference on all 6 permutations of the (B, G, R) channels for every test image.</li>\n<li>I selected the permutation that yielded the highest combined confidence for both face and shemagh.</li>\n<li>This correct channel order was saved and loaded for the final prediction run.</li>\n</ul>\n<p><strong>4. Inference &amp; TTA</strong>\nUsing the corrected channel map, I ran Test Time Augmentation (TTA) across 3 scales (768, 832, 896) with horizontal flipping. This resulted in 6 predictions per image, which were merged using class-aware NMS.</p>\n<ul>\n<li><em>Right-Place Heuristic:</em> I used a geometric rule where <code>right_place = 1</code> if any shemagh bounding box overlapped with a face bounding box (IoU threshold tuned on the validation set).</li>\n</ul>\n<p><strong>5. Ensembling with Weighted Boxes Fusion (WBF)</strong></p>\n<p>I used a two-level ensembling strategy to maximize the strengths of both tracks:</p>\n<ul>\n<li><strong>Level 1 (Intra-track):</strong> WBF was applied to the best models and pseudo-labeled models within the 2-class track (yielding 0.843) and across 4 models in the 3-class track (yielding 0.850).</li>\n<li><strong>Level 2 (Cross-track):</strong> The final submission was a weighted blend of the 2-class WBF (0.3 weight) and 3-class WBF (0.7 weight). For the <code>right_place</code> flag, I used a union approach: if either track predicted a 1, the final prediction was 1.</li>\n</ul>",
      "rawMarkdown": "السلام عليكم رمضان مبارك على الجميع\n\nFirst, thank you to the organizers for hosting this challenge! My approach relied on treating the problem as a YOLO object detection task from two different angles, heavily optimizing for a channel-swapping quirk in the test data, and ensembling the results.\n\nHere is a breakdown of the methodology that achieved **0.857 Public LB / 0.839 Private LB**.\n\n### Core Approach: The Dual-Track Strategy\n\nInstead of relying on a single model architecture, I split the problem into two parallel tracks:\n\n* **2-Class Track (YOLOv26s):** A simpler binary detection task focusing strictly on `face` and `shemagh`.\n* **3-Class Track (YOLOv26m):** A richer detection task focusing on `face`, `shemagh_correct`, and `shemagh_wrong` to provide a stronger signal for the `right_place` classification.\n\n### Step-by-Step Pipeline\n\n**1. Data Preparation & Offline Augmentation**\n\n* Removed 6 duplicate images using MD5 hashing and resolved overlapping bounding boxes (keeping the larger box if the IoU exceeded the threshold).\n* Created a stratified train/val split to maintain class balance.\n* Because `shemagh` was the minority class, I generated synthetic training samples using offline augmentations (channel shuffle, color jitter, Gaussian blur, rotation, CLAHE) to balance the dataset before training.\n\n**2. Model Training**\nBoth tracks were trained independently on 768×768 images but with different hyperparameters optimized for their specific tasks:\n\n* **2-Class Track:** Trained a smaller model (YOLOv26s) for 130 epochs with a learning rate of 0.001 and lighter augmentations (Mosaic 0.8, Mixup 0.15).\n* **3-Class Track:** Trained a medium model (YOLOv26m) for 100 epochs with a lower learning rate (0.0002) and heavier augmentations (Mosaic 0.503, Cutmix 0.329) to handle the harder 3-class separation.\n\n**3. Test-Time Channel Optimization (The \"Channel Map\")**\nI noticed that roughly 50.7% of the test images had swapped BGR channels. To fix this dynamically during inference:\n\n* I ran inference on all 6 permutations of the (B, G, R) channels for every test image.\n* I selected the permutation that yielded the highest combined confidence for both face and shemagh.\n* This correct channel order was saved and loaded for the final prediction run.\n\n**4. Inference & TTA**\nUsing the corrected channel map, I ran Test Time Augmentation (TTA) across 3 scales (768, 832, 896) with horizontal flipping. This resulted in 6 predictions per image, which were merged using class-aware NMS.\n\n* *Right-Place Heuristic:* I used a geometric rule where `right_place = 1` if any shemagh bounding box overlapped with a face bounding box (IoU threshold tuned on the validation set).\n\n**5. Ensembling with Weighted Boxes Fusion (WBF)**\n\nI used a two-level ensembling strategy to maximize the strengths of both tracks:\n\n* **Level 1 (Intra-track):** WBF was applied to the best models and pseudo-labeled models within the 2-class track (yielding 0.843) and across 4 models in the 3-class track (yielding 0.850).\n* **Level 2 (Cross-track):** The final submission was a weighted blend of the 2-class WBF (0.3 weight) and 3-class WBF (0.7 weight). For the `right_place` flag, I used a union approach: if either track predicted a 1, the final prediction was 1.\n\n",
      "votes": 3
    }
  ],
  "complete": true,
  "source": "live",
  "fetched_at": "2026-10-19T10:48:04Z",
  "competition_id": 129750,
  "competition_slug": "dal-shemagh-detection-challenge",
  "team_id": 15193899,
  "solution_url": "/competitions/dal-shemagh-detection-challenge/writeups/7th-place-writeup-lb-0-857-private-0-839"
}