{
  "id": 418705,
  "title": "28th Place Solution",
  "url": "/competitions/benetech-making-graphs-accessible/writeups/complex-1-28th-place-solution",
  "author_name": "",
  "post_date": "2023-07-30T01:02:34.157Z",
  "votes": 13,
  "comment_count": 5,
  "views": 0,
  "content": "<p>First of all, we would like to thank Kaggle &amp; Benetech for hosting this very interesting competition. It was great fun to participate, and we learned a tremendous amount from it. 😀</p>\n<p>We used a combination of image classification, object detection, Donut, PaddleOCR, TrOCR, and lots of postprocessing! 😅</p>\n<hr>\n<h1>Models</h1>\n<p>We trained models for the following tasks:</p>\n<ol>\n<li>Plot type classification - ResNet34</li>\n<li>Rotated vs non-rotated X tick label classification - ResNet34</li>\n<li>Horizontal bar detection - FasterRCNN with ResNet50-FPN backbone</li>\n<li>Vertical bar detection (used in the histogram pipeline as well) - FasterRCNN with ResNet50-FPN backbone</li>\n<li>Line point detection - FasterRCNN with ResNet50-FPN backbone</li>\n<li>Scatter point &amp; dot detection (a single model for both) - FasterRCNN with ResNet50-FPN backbone</li>\n<li>Tick mark detection - FasterRCNN with ResNet50-FPN backbone</li>\n<li>X tick label detection (used only for detecting non-rotated X tick labels) - FasterRCNN with ResNet50-FPN backbone</li>\n<li>Y tick label detection - FasterRCNN with ResNet50-FPN backbone</li>\n<li>Donut (used only for recognizing rotated X tick labels) - <a href=\"https://huggingface.co/naver-clova-ix/donut-base\" target=\"_blank\"><code>'naver-clova-ix/donut-base'</code></a></li>\n</ol>\n<p>In addition, we used the following models as-is (i.e., without any fine-tuning):</p>\n<ol>\n<li>PaddleOCR for multi-line text detection &amp; conversion to single-line texts - <a href=\"https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.6/doc/doc_en/PP-OCRv3_introduction_en.md\" target=\"_blank\">PP-OCRv3</a></li>\n<li>TrOCR for OCR of single-line texts - <a href=\"https://huggingface.co/microsoft/trocr-base-printed\" target=\"_blank\"><code>'microsoft/trocr-base-printed'</code></a></li>\n</ol>\n<p><strong>Note:</strong> We used PaddleOCR because TrOCR can only read single-line texts. For single-line texts, we found TrOCR to be very accurate.</p>\n<hr>\n<h1>Inference Examples</h1>\n<p>The following images are examples of inference using each of the above models:</p>\n<p><strong>Plot type classification:</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Faf30206384b2f090c6fcbd0cb59bf959%2Fplot_type_inference.png?generation=1687424929176720&amp;alt=media\" alt=\"\"></p>\n<p><strong>Rotated vs non-rotated X tick label classification:</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F037c35db3590c5c1b67f85ab57fb36e2%2Frotation_inference.png?generation=1687422645141712&amp;alt=media\" alt=\"\"></p>\n<p><strong>Horizontal bar detection:</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Fd4d7e6bee836a68203a8b0a5a08f17d3%2Fhorizontal_bar_inference.png?generation=1687422676773859&amp;alt=media\"></p>\n<p><strong>Vertical bar detection (used in the histogram pipeline as well):</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F7746b8f7e88ee68b0d45729673d7a1ff%2Fvertical_bar_inference.png?generation=1687441005236360&amp;alt=media\"></p>\n<p><strong>Line point detection:</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F0ad448751c154024bf8f9bef757e8cc0%2Fline_inference.png?generation=1687422824609612&amp;alt=media\"></p>\n<p><strong>Scatter point &amp; dot detection (a single model for both):</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F652aa1e31c4486cc05a0de0fc2a4b275%2Fscatter_inference.png?generation=1687422924497010&amp;alt=media\"></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Ff8a45dce67f94bde15a6288b28ebef85%2Fdot_inference.png?generation=1687422948970505&amp;alt=media\"></p>\n<p><strong>Tick mark detection:</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F33f16e5a073df164463c026a48d40360%2Ftick_mark_inference.png?generation=1687422992117363&amp;alt=media\"></p>\n<p><strong>X tick label detection (used only for detecting non-rotated X tick labels):</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Fb793316f01d17ea577caa501d142591d%2Fx_tick_label_inference.png?generation=1687423056622492&amp;alt=media\"></p>\n<p><strong>Y tick label detection:</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F2b458db805a977b2c36447bdb6c53a31%2Fy_tick_label_inference.png?generation=1687423081364918&amp;alt=media\"></p>\n<p><strong>Donut (used only for recognizing rotated X tick labels):</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Ffbb5753a331e6cbb22fa19cc56a55a04%2Fdonut_inference.png?generation=1687429751410113&amp;alt=media\" alt=\"\"></p>\n<p><strong>Note:</strong> We trained our Donut model only on image patches below the X axis which contain rotated text.</p>\n<p><strong>PaddleOCR (for multi-line text detection &amp; conversion to single-line texts):</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Ff3647d71073644c6033c7116e1e33da2%2Fpaddle.png?generation=1687440095811819&amp;alt=media\" alt=\"\"></p>\n<p><strong>TrOCR (for OCR of single-line texts):</strong></p>\n<p>Image snippet:</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F49734d8ecacdb174d1bfaf431d15be99%2Ftrocr_snippet.jpg?generation=1687429867440216&amp;alt=media\" alt=\"\"></p>\n<p>Output: <code>\"A. Total Genotoxic Potency\"</code></p>\n<hr>\n<h1>Deep Learning Frameworks</h1>\n<p>We used:</p>\n<ul>\n<li>For image classification - <a href=\"https://docs.fast.ai/\" target=\"_blank\">fastai</a></li>\n<li>For object detection - <a href=\"https://airctic.github.io/icevision/0.12.0/\" target=\"_blank\">IceVision</a> + fastai</li>\n<li>For Donut - Hugging Face Transformers <a href=\"https://huggingface.co/docs/transformers/main_classes/trainer\" target=\"_blank\">Trainer</a> API</li>\n</ul>\n<hr>\n<h1>Data</h1>\n<p>In addition to the competition dataset, we used some additional images from the <em>ICPR 2022 CHART</em> dataset available at: <a href=\"https://chartinfo.github.io/toolsanddata.html\" target=\"_blank\">https://chartinfo.github.io/toolsanddata.html</a></p>\n<p>Bounding box annotations for the chart elements were added using either (i) custom Python scripts or (ii) manual annotation tools, viz. Make Sense (<a href=\"https://www.makesense.ai/\" target=\"_blank\">https://www.makesense.ai/</a>) and Roboflow. The annotations were created in the PASCAL VOC format.</p>\n<p>For line point detection, scatter point detection and tick mark detection, we had to convert the original point annotations to bounding box annotations. We noticed that the choice of bounding box size has a big impact on performance. Hence, we experimented with a few bounding box sizes, and found that the following sizes work well:</p>\n<table>\n<thead>\n<tr>\n<th>Line Point</th>\n<th>Scatter Point</th>\n<th>Tick Mark</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>18px</td>\n<td>16px</td>\n<td>16px</td>\n</tr>\n</tbody>\n</table>\n<p>For X tick label detection and Y tick label detection, we noticed that adding a 2px margin to the provided bounding boxes improves performance.</p>\n<p>Finally, we found that in a tiny fraction of images, one or more bounding boxes overstep the bounds of the image. We deleted these images from our dataset.</p>\n<hr>\n<h1>Model Validation Schemes</h1>\n<p><strong>Plot type classification:</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Fb0e8a053b3a9509a36b0a03b0935f248%2Fplot_type_val_scheme.png?generation=1689168901672895&amp;alt=media\" alt=\"\"></p>\n<p><strong>Rotated vs non-rotated X tick label classification:</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F7a1cdc221a5e10f875a76b9163888e21%2Frotation_val_scheme.png?generation=1689169392117974&amp;alt=media\" alt=\"\"></p>\n<p><strong>Horizontal bar detection:</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Fa866016d76730c38864c90c317fb89b7%2Fhorizontal_bar_val_scheme.png?generation=1689168936143640&amp;alt=media\" alt=\"\"></p>\n<p><strong>Vertical bar detection (used in the histogram pipeline as well):</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Fd27e058d0bb05846f5ea42eca69e101f%2Fvertical_bar_val_scheme.png?generation=1689168951683704&amp;alt=media\" alt=\"\"></p>\n<p><strong>Line point detection:</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Ffc25de18f4386ad8711b7953ddffc904%2Fline_val_scheme.png?generation=1689168967592482&amp;alt=media\" alt=\"\"></p>\n<p><strong>Scatter point &amp; dot detection (a single model for both):</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F2411ee14867dda5e3b7aba79d7d234cf%2Fscatter_dot_val_scheme.png?generation=1689170209501077&amp;alt=media\" alt=\"\"></p>\n<p><strong>Tick mark detection:</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Fc3cc591f20cadb2cb59c53fa40ba9b0b%2Ftick_mark_val_scheme.png?generation=1689170225648108&amp;alt=media\" alt=\"\"></p>\n<p><strong>X tick label detection (used only for detecting non-rotated X tick labels):</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F2c1ee44e72bbea46fb8e3e514ad042d2%2Fx_tick_label_val_scheme.png?generation=1689170239312207&amp;alt=media\" alt=\"\"></p>\n<p><strong>Y tick label detection:</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F04a9bed0423c7c186b6b4a3a24b1fc8a%2Fy_tick_label_val_scheme.png?generation=1689170253004364&amp;alt=media\" alt=\"\"></p>\n<p><strong>Donut (used only for recognizing rotated X tick labels):</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Fce3009c4f44c3d1126e268840097779b%2Fdonut_val_scheme.png?generation=1689170268258727&amp;alt=media\" alt=\"\"></p>\n<hr>\n<h1>Pipelines</h1>\n<h2>Image Classification</h2>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F65ff8a8d4344bd4c111c8a1d595b740a%2Fdiagram_image_classifier.png?generation=1687437455837261&amp;alt=media\" alt=\"\"></p>\n<h2>Horizontal Bar Pipeline</h2>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Ff1c8ac7ea8ce27d36a9c8f21ad5a3112%2Fdiagram_horizontal_bar.png?generation=1687695397682069&amp;alt=media\" alt=\"\"></p>\n<h2>Vertical Bar Pipeline</h2>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F4b4ea6617dd3907c0a044474cc475fef%2Fdiagram_vertical_bar.png?generation=1687695428772800&amp;alt=media\" alt=\"\"></p>\n<h2>Histogram Pipeline</h2>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F717f752077d0b61d3f277aba0ab66877%2Fdiagram_histogram.png?generation=1687696678498713&amp;alt=media\" alt=\"\"></p>\n<h2>Line Pipeline</h2>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F2e1debd34468def631db044e287cb0f5%2Fdiagram_line.png?generation=1687696700722044&amp;alt=media\" alt=\"\"></p>\n<h2>Scatter Pipeline</h2>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Fc9b7be151091d9a3cc030f8341d988bf%2Fdiagram_scatter.png?generation=1687518134085611&amp;alt=media\" alt=\"\"></p>\n<h2>Dot Pipeline</h2>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F8b79f1c390dff4b5c8a703767ee3a372%2Fdiagram_dot.png?generation=1687764390803909&amp;alt=media\" alt=\"\"></p>\n<hr>\n<h1>Results</h1>\n<table>\n<thead>\n<tr>\n<th></th>\n<th>Overall</th>\n<th>Scatter</th>\n<th>Dot</th>\n<th>Line</th>\n<th>Vertical Bar</th>\n<th>Horizontal Bar</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>public</td>\n<td>0.66</td>\n<td>0.06</td>\n<td>0.00</td>\n<td>0.26</td>\n<td>0.33</td>\n<td>0.01</td>\n</tr>\n<tr>\n<td>private</td>\n<td>0.49</td>\n<td>0.19</td>\n<td>0.01</td>\n<td>0.08</td>\n<td>0.20</td>\n<td>0.01</td>\n</tr>\n</tbody>\n</table>\n<hr>",
  "messages": [
    {
      "id": "2312747",
      "postDate": "06/22/2023 06:58:44",
      "content": "<p>First of all, we would like to thank Kaggle &amp; Benetech for hosting this very interesting competition. It was great fun to participate, and we learned a tremendous amount from it. 😀</p>\n<p>We used a combination of image classification, object detection, Donut, PaddleOCR, TrOCR, and lots of postprocessing! 😅</p>\n<hr>\n<h1>Models</h1>\n<p>We trained models for the following tasks:</p>\n<ol>\n<li>Plot type classification - ResNet34</li>\n<li>Rotated vs non-rotated X tick label classification - ResNet34</li>\n<li>Horizontal bar detection - FasterRCNN with ResNet50-FPN backbone</li>\n<li>Vertical bar detection (used in the histogram pipeline as well) - FasterRCNN with ResNet50-FPN backbone</li>\n<li>Line point detection - FasterRCNN with ResNet50-FPN backbone</li>\n<li>Scatter point &amp; dot detection (a single model for both) - FasterRCNN with ResNet50-FPN backbone</li>\n<li>Tick mark detection - FasterRCNN with ResNet50-FPN backbone</li>\n<li>X tick label detection (used only for detecting non-rotated X tick labels) - FasterRCNN with ResNet50-FPN backbone</li>\n<li>Y tick label detection - FasterRCNN with ResNet50-FPN backbone</li>\n<li>Donut (used only for recognizing rotated X tick labels) - <a href=\"https://huggingface.co/naver-clova-ix/donut-base\" target=\"_blank\"><code>'naver-clova-ix/donut-base'</code></a></li>\n</ol>\n<p>In addition, we used the following models as-is (i.e., without any fine-tuning):</p>\n<ol>\n<li>PaddleOCR for multi-line text detection &amp; conversion to single-line texts - <a href=\"https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.6/doc/doc_en/PP-OCRv3_introduction_en.md\" target=\"_blank\">PP-OCRv3</a></li>\n<li>TrOCR for OCR of single-line texts - <a href=\"https://huggingface.co/microsoft/trocr-base-printed\" target=\"_blank\"><code>'microsoft/trocr-base-printed'</code></a></li>\n</ol>\n<p><strong>Note:</strong> We used PaddleOCR because TrOCR can only read single-line texts. For single-line texts, we found TrOCR to be very accurate.</p>\n<hr>\n<h1>Inference Examples</h1>\n<p>The following images are examples of inference using each of the above models:</p>\n<p><strong>Plot type classification:</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Faf30206384b2f090c6fcbd0cb59bf959%2Fplot_type_inference.png?generation=1687424929176720&amp;alt=media\" alt=\"\"></p>\n<p><strong>Rotated vs non-rotated X tick label classification:</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F037c35db3590c5c1b67f85ab57fb36e2%2Frotation_inference.png?generation=1687422645141712&amp;alt=media\" alt=\"\"></p>\n<p><strong>Horizontal bar detection:</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Fd4d7e6bee836a68203a8b0a5a08f17d3%2Fhorizontal_bar_inference.png?generation=1687422676773859&amp;alt=media\"></p>\n<p><strong>Vertical bar detection (used in the histogram pipeline as well):</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F7746b8f7e88ee68b0d45729673d7a1ff%2Fvertical_bar_inference.png?generation=1687441005236360&amp;alt=media\"></p>\n<p><strong>Line point detection:</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F0ad448751c154024bf8f9bef757e8cc0%2Fline_inference.png?generation=1687422824609612&amp;alt=media\"></p>\n<p><strong>Scatter point &amp; dot detection (a single model for both):</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F652aa1e31c4486cc05a0de0fc2a4b275%2Fscatter_inference.png?generation=1687422924497010&amp;alt=media\"></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Ff8a45dce67f94bde15a6288b28ebef85%2Fdot_inference.png?generation=1687422948970505&amp;alt=media\"></p>\n<p><strong>Tick mark detection:</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F33f16e5a073df164463c026a48d40360%2Ftick_mark_inference.png?generation=1687422992117363&amp;alt=media\"></p>\n<p><strong>X tick label detection (used only for detecting non-rotated X tick labels):</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Fb793316f01d17ea577caa501d142591d%2Fx_tick_label_inference.png?generation=1687423056622492&amp;alt=media\"></p>\n<p><strong>Y tick label detection:</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F2b458db805a977b2c36447bdb6c53a31%2Fy_tick_label_inference.png?generation=1687423081364918&amp;alt=media\"></p>\n<p><strong>Donut (used only for recognizing rotated X tick labels):</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Ffbb5753a331e6cbb22fa19cc56a55a04%2Fdonut_inference.png?generation=1687429751410113&amp;alt=media\" alt=\"\"></p>\n<p><strong>Note:</strong> We trained our Donut model only on image patches below the X axis which contain rotated text.</p>\n<p><strong>PaddleOCR (for multi-line text detection &amp; conversion to single-line texts):</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Ff3647d71073644c6033c7116e1e33da2%2Fpaddle.png?generation=1687440095811819&amp;alt=media\" alt=\"\"></p>\n<p><strong>TrOCR (for OCR of single-line texts):</strong></p>\n<p>Image snippet:</p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F49734d8ecacdb174d1bfaf431d15be99%2Ftrocr_snippet.jpg?generation=1687429867440216&amp;alt=media\" alt=\"\"></p>\n<p>Output: <code>\"A. Total Genotoxic Potency\"</code></p>\n<hr>\n<h1>Deep Learning Frameworks</h1>\n<p>We used:</p>\n<ul>\n<li>For image classification - <a href=\"https://docs.fast.ai/\" target=\"_blank\">fastai</a></li>\n<li>For object detection - <a href=\"https://airctic.github.io/icevision/0.12.0/\" target=\"_blank\">IceVision</a> + fastai</li>\n<li>For Donut - Hugging Face Transformers <a href=\"https://huggingface.co/docs/transformers/main_classes/trainer\" target=\"_blank\">Trainer</a> API</li>\n</ul>\n<hr>\n<h1>Data</h1>\n<p>In addition to the competition dataset, we used some additional images from the <em>ICPR 2022 CHART</em> dataset available at: <a href=\"https://chartinfo.github.io/toolsanddata.html\" target=\"_blank\">https://chartinfo.github.io/toolsanddata.html</a></p>\n<p>Bounding box annotations for the chart elements were added using either (i) custom Python scripts or (ii) manual annotation tools, viz. Make Sense (<a href=\"https://www.makesense.ai/\" target=\"_blank\">https://www.makesense.ai/</a>) and Roboflow. The annotations were created in the PASCAL VOC format.</p>\n<p>For line point detection, scatter point detection and tick mark detection, we had to convert the original point annotations to bounding box annotations. We noticed that the choice of bounding box size has a big impact on performance. Hence, we experimented with a few bounding box sizes, and found that the following sizes work well:</p>\n<table>\n<thead>\n<tr>\n<th>Line Point</th>\n<th>Scatter Point</th>\n<th>Tick Mark</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>18px</td>\n<td>16px</td>\n<td>16px</td>\n</tr>\n</tbody>\n</table>\n<p>For X tick label detection and Y tick label detection, we noticed that adding a 2px margin to the provided bounding boxes improves performance.</p>\n<p>Finally, we found that in a tiny fraction of images, one or more bounding boxes overstep the bounds of the image. We deleted these images from our dataset.</p>\n<hr>\n<h1>Model Validation Schemes</h1>\n<p><strong>Plot type classification:</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Fb0e8a053b3a9509a36b0a03b0935f248%2Fplot_type_val_scheme.png?generation=1689168901672895&amp;alt=media\" alt=\"\"></p>\n<p><strong>Rotated vs non-rotated X tick label classification:</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F7a1cdc221a5e10f875a76b9163888e21%2Frotation_val_scheme.png?generation=1689169392117974&amp;alt=media\" alt=\"\"></p>\n<p><strong>Horizontal bar detection:</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Fa866016d76730c38864c90c317fb89b7%2Fhorizontal_bar_val_scheme.png?generation=1689168936143640&amp;alt=media\" alt=\"\"></p>\n<p><strong>Vertical bar detection (used in the histogram pipeline as well):</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Fd27e058d0bb05846f5ea42eca69e101f%2Fvertical_bar_val_scheme.png?generation=1689168951683704&amp;alt=media\" alt=\"\"></p>\n<p><strong>Line point detection:</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Ffc25de18f4386ad8711b7953ddffc904%2Fline_val_scheme.png?generation=1689168967592482&amp;alt=media\" alt=\"\"></p>\n<p><strong>Scatter point &amp; dot detection (a single model for both):</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F2411ee14867dda5e3b7aba79d7d234cf%2Fscatter_dot_val_scheme.png?generation=1689170209501077&amp;alt=media\" alt=\"\"></p>\n<p><strong>Tick mark detection:</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Fc3cc591f20cadb2cb59c53fa40ba9b0b%2Ftick_mark_val_scheme.png?generation=1689170225648108&amp;alt=media\" alt=\"\"></p>\n<p><strong>X tick label detection (used only for detecting non-rotated X tick labels):</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F2c1ee44e72bbea46fb8e3e514ad042d2%2Fx_tick_label_val_scheme.png?generation=1689170239312207&amp;alt=media\" alt=\"\"></p>\n<p><strong>Y tick label detection:</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F04a9bed0423c7c186b6b4a3a24b1fc8a%2Fy_tick_label_val_scheme.png?generation=1689170253004364&amp;alt=media\" alt=\"\"></p>\n<p><strong>Donut (used only for recognizing rotated X tick labels):</strong></p>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Fce3009c4f44c3d1126e268840097779b%2Fdonut_val_scheme.png?generation=1689170268258727&amp;alt=media\" alt=\"\"></p>\n<hr>\n<h1>Pipelines</h1>\n<h2>Image Classification</h2>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F65ff8a8d4344bd4c111c8a1d595b740a%2Fdiagram_image_classifier.png?generation=1687437455837261&amp;alt=media\" alt=\"\"></p>\n<h2>Horizontal Bar Pipeline</h2>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Ff1c8ac7ea8ce27d36a9c8f21ad5a3112%2Fdiagram_horizontal_bar.png?generation=1687695397682069&amp;alt=media\" alt=\"\"></p>\n<h2>Vertical Bar Pipeline</h2>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F4b4ea6617dd3907c0a044474cc475fef%2Fdiagram_vertical_bar.png?generation=1687695428772800&amp;alt=media\" alt=\"\"></p>\n<h2>Histogram Pipeline</h2>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F717f752077d0b61d3f277aba0ab66877%2Fdiagram_histogram.png?generation=1687696678498713&amp;alt=media\" alt=\"\"></p>\n<h2>Line Pipeline</h2>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F2e1debd34468def631db044e287cb0f5%2Fdiagram_line.png?generation=1687696700722044&amp;alt=media\" alt=\"\"></p>\n<h2>Scatter Pipeline</h2>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Fc9b7be151091d9a3cc030f8341d988bf%2Fdiagram_scatter.png?generation=1687518134085611&amp;alt=media\" alt=\"\"></p>\n<h2>Dot Pipeline</h2>\n<p><img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F8b79f1c390dff4b5c8a703767ee3a372%2Fdiagram_dot.png?generation=1687764390803909&amp;alt=media\" alt=\"\"></p>\n<hr>\n<h1>Results</h1>\n<table>\n<thead>\n<tr>\n<th></th>\n<th>Overall</th>\n<th>Scatter</th>\n<th>Dot</th>\n<th>Line</th>\n<th>Vertical Bar</th>\n<th>Horizontal Bar</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>public</td>\n<td>0.66</td>\n<td>0.06</td>\n<td>0.00</td>\n<td>0.26</td>\n<td>0.33</td>\n<td>0.01</td>\n</tr>\n<tr>\n<td>private</td>\n<td>0.49</td>\n<td>0.19</td>\n<td>0.01</td>\n<td>0.08</td>\n<td>0.20</td>\n<td>0.01</td>\n</tr>\n</tbody>\n</table>\n<hr>",
      "rawMarkdown": "First of all, we would like to thank Kaggle & Benetech for hosting this very interesting competition. It was great fun to participate, and we learned a tremendous amount from it. 😀\n\nWe used a combination of image classification, object detection, Donut, PaddleOCR, TrOCR, and lots of postprocessing! 😅\n\n---\n\n# Models\n\nWe trained models for the following tasks:\n\n1. Plot type classification - ResNet34\n2. Rotated vs non-rotated X tick label classification - ResNet34\n3. Horizontal bar detection - FasterRCNN with ResNet50-FPN backbone\n4. Vertical bar detection (used in the histogram pipeline as well) - FasterRCNN with ResNet50-FPN backbone\n5. Line point detection - FasterRCNN with ResNet50-FPN backbone\n6. Scatter point & dot detection (a single model for both) - FasterRCNN with ResNet50-FPN backbone\n7. Tick mark detection - FasterRCNN with ResNet50-FPN backbone\n8. X tick label detection (used only for detecting non-rotated X tick labels) - FasterRCNN with ResNet50-FPN backbone\n9. Y tick label detection - FasterRCNN with ResNet50-FPN backbone\n10. Donut (used only for recognizing rotated X tick labels) - <a href=\"https://huggingface.co/naver-clova-ix/donut-base\" target=\"_blank\">`'naver-clova-ix/donut-base'`</a>\n\nIn addition, we used the following models as-is (i.e., without any fine-tuning):\n\n1. PaddleOCR for multi-line text detection & conversion to single-line texts - <a href=\"https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.6/doc/doc_en/PP-OCRv3_introduction_en.md\" target=\"_blank\">PP-OCRv3</a>\n2. TrOCR for OCR of single-line texts - <a href=\"https://huggingface.co/microsoft/trocr-base-printed\" target=\"_blank\">`'microsoft/trocr-base-printed'`</a>\n\n**Note:** We used PaddleOCR because TrOCR can only read single-line texts. For single-line texts, we found TrOCR to be very accurate.\n\n---\n\n# Inference Examples\n\nThe following images are examples of inference using each of the above models:\n\n**Plot type classification:**\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Faf30206384b2f090c6fcbd0cb59bf959%2Fplot_type_inference.png?generation=1687424929176720&alt=media)\n\n**Rotated vs non-rotated X tick label classification:**\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F037c35db3590c5c1b67f85ab57fb36e2%2Frotation_inference.png?generation=1687422645141712&alt=media)\n\n**Horizontal bar detection:**\n\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Fd4d7e6bee836a68203a8b0a5a08f17d3%2Fhorizontal_bar_inference.png?generation=1687422676773859&alt=media\" width=500>\n\n**Vertical bar detection (used in the histogram pipeline as well):**\n\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F7746b8f7e88ee68b0d45729673d7a1ff%2Fvertical_bar_inference.png?generation=1687441005236360&alt=media\" width=500>\n\n**Line point detection:**\n\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F0ad448751c154024bf8f9bef757e8cc0%2Fline_inference.png?generation=1687422824609612&alt=media\" width=500>\n\n**Scatter point & dot detection (a single model for both):**\n\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F652aa1e31c4486cc05a0de0fc2a4b275%2Fscatter_inference.png?generation=1687422924497010&alt=media\" width=500>\n\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Ff8a45dce67f94bde15a6288b28ebef85%2Fdot_inference.png?generation=1687422948970505&alt=media\" width=500>\n\n**Tick mark detection:**\n\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F33f16e5a073df164463c026a48d40360%2Ftick_mark_inference.png?generation=1687422992117363&alt=media\" width=500>\n\n**X tick label detection (used only for detecting non-rotated X tick labels):**\n\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Fb793316f01d17ea577caa501d142591d%2Fx_tick_label_inference.png?generation=1687423056622492&alt=media\" width=500>\n\n**Y tick label detection:**\n\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F2b458db805a977b2c36447bdb6c53a31%2Fy_tick_label_inference.png?generation=1687423081364918&alt=media\" width=500>\n\n**Donut (used only for recognizing rotated X tick labels):**\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Ffbb5753a331e6cbb22fa19cc56a55a04%2Fdonut_inference.png?generation=1687429751410113&alt=media)\n\n**Note:** We trained our Donut model only on image patches below the X axis which contain rotated text.\n\n**PaddleOCR (for multi-line text detection & conversion to single-line texts):**\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Ff3647d71073644c6033c7116e1e33da2%2Fpaddle.png?generation=1687440095811819&alt=media)\n\n**TrOCR (for OCR of single-line texts):**\n\nImage snippet:\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F49734d8ecacdb174d1bfaf431d15be99%2Ftrocr_snippet.jpg?generation=1687429867440216&alt=media)\n\nOutput: `\"A. Total Genotoxic Potency\"`\n\n---\n\n# Deep Learning Frameworks\n\nWe used:\n\n- For image classification - <a href=\"https://docs.fast.ai/\" target=\"_blank\">fastai</a>\n- For object detection - <a href=\"https://airctic.github.io/icevision/0.12.0/\" target=\"_blank\">IceVision</a> + fastai\n- For Donut - Hugging Face Transformers <a href=\"https://huggingface.co/docs/transformers/main_classes/trainer\" target=\"_blank\">Trainer</a> API\n\n---\n\n# Data\n\nIn addition to the competition dataset, we used some additional images from the *ICPR 2022 CHART* dataset available at: https://chartinfo.github.io/toolsanddata.html\n\nBounding box annotations for the chart elements were added using either (i) custom Python scripts or (ii) manual annotation tools, viz. Make Sense (https://www.makesense.ai/) and Roboflow. The annotations were created in the PASCAL VOC format.\n\nFor line point detection, scatter point detection and tick mark detection, we had to convert the original point annotations to bounding box annotations. We noticed that the choice of bounding box size has a big impact on performance. Hence, we experimented with a few bounding box sizes, and found that the following sizes work well:\n\n| Line Point | Scatter Point | Tick Mark |\n|---|---|---|\n| 18px | 16px | 16px |\n\nFor X tick label detection and Y tick label detection, we noticed that adding a 2px margin to the provided bounding boxes improves performance.\n\nFinally, we found that in a tiny fraction of images, one or more bounding boxes overstep the bounds of the image. We deleted these images from our dataset.\n\n---\n\n# Model Validation Schemes\n\n**Plot type classification:**\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Fb0e8a053b3a9509a36b0a03b0935f248%2Fplot_type_val_scheme.png?generation=1689168901672895&alt=media)\n\n**Rotated vs non-rotated X tick label classification:**\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F7a1cdc221a5e10f875a76b9163888e21%2Frotation_val_scheme.png?generation=1689169392117974&alt=media)\n\n**Horizontal bar detection:**\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Fa866016d76730c38864c90c317fb89b7%2Fhorizontal_bar_val_scheme.png?generation=1689168936143640&alt=media)\n\n**Vertical bar detection (used in the histogram pipeline as well):**\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Fd27e058d0bb05846f5ea42eca69e101f%2Fvertical_bar_val_scheme.png?generation=1689168951683704&alt=media)\n\n**Line point detection:**\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Ffc25de18f4386ad8711b7953ddffc904%2Fline_val_scheme.png?generation=1689168967592482&alt=media)\n\n**Scatter point & dot detection (a single model for both):**\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F2411ee14867dda5e3b7aba79d7d234cf%2Fscatter_dot_val_scheme.png?generation=1689170209501077&alt=media)\n\n**Tick mark detection:**\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Fc3cc591f20cadb2cb59c53fa40ba9b0b%2Ftick_mark_val_scheme.png?generation=1689170225648108&alt=media)\n\n**X tick label detection (used only for detecting non-rotated X tick labels):**\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F2c1ee44e72bbea46fb8e3e514ad042d2%2Fx_tick_label_val_scheme.png?generation=1689170239312207&alt=media)\n\n**Y tick label detection:**\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F04a9bed0423c7c186b6b4a3a24b1fc8a%2Fy_tick_label_val_scheme.png?generation=1689170253004364&alt=media)\n\n**Donut (used only for recognizing rotated X tick labels):**\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Fce3009c4f44c3d1126e268840097779b%2Fdonut_val_scheme.png?generation=1689170268258727&alt=media)\n\n---\n\n# Pipelines\n\n## Image Classification\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F65ff8a8d4344bd4c111c8a1d595b740a%2Fdiagram_image_classifier.png?generation=1687437455837261&alt=media)\n\n## Horizontal Bar Pipeline\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Ff1c8ac7ea8ce27d36a9c8f21ad5a3112%2Fdiagram_horizontal_bar.png?generation=1687695397682069&alt=media)\n\n## Vertical Bar Pipeline\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F4b4ea6617dd3907c0a044474cc475fef%2Fdiagram_vertical_bar.png?generation=1687695428772800&alt=media)\n\n## Histogram Pipeline\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F717f752077d0b61d3f277aba0ab66877%2Fdiagram_histogram.png?generation=1687696678498713&alt=media)\n\n## Line Pipeline\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F2e1debd34468def631db044e287cb0f5%2Fdiagram_line.png?generation=1687696700722044&alt=media)\n\n## Scatter Pipeline\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Fc9b7be151091d9a3cc030f8341d988bf%2Fdiagram_scatter.png?generation=1687518134085611&alt=media)\n\n## Dot Pipeline\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F8b79f1c390dff4b5c8a703767ee3a372%2Fdiagram_dot.png?generation=1687764390803909&alt=media)\n\n---\n\n# Results\n\n|   | Overall | Scatter | Dot | Line | Vertical Bar | Horizontal Bar |\n|---|---|---|---|---|---|---|\n| public | 0.66 | 0.06 | 0.00 | 0.26 | 0.33 | 0.01 |\n| private | 0.49 | 0.19 | 0.01 | 0.08 | 0.20 | 0.01 |\n\n---",
      "votes": null
    },
    {
      "id": "2313984",
      "postDate": "06/23/2023 05:16:49",
      "content": "<p>Nice!! We did our best and tried everything we could think of with what we knew. I learned a lot from this competition!! <a href=\"https://www.kaggle.com/sambitmukherjee\" target=\"_blank\">@sambitmukherjee</a> </p>",
      "rawMarkdown": "Nice!! We did our best and tried everything we could think of with what we knew. I learned a lot from this competition!! @sambitmukherjee",
      "votes": null
    },
    {
      "id": "2317184",
      "postDate": "06/25/2023 13:53:56",
      "content": "<p>nice pipeline graphs</p>",
      "rawMarkdown": "nice pipeline graphs",
      "votes": null
    },
    {
      "id": "2317300",
      "postDate": "06/25/2023 15:26:28",
      "content": "<p>Thanks. I used a free web-based tool called Excalidraw…</p>",
      "rawMarkdown": "Thanks. I used a free web-based tool called Excalidraw...",
      "votes": null
    },
    {
      "id": "2317922",
      "postDate": "06/26/2023 05:04:15",
      "content": "<p>We (complex[::-1]) Team, thank competition host for conducting such a interesting completion. It is a very good learning for us. I thank all participants also for sharing your insights in discussion, which helped us a lot. </p>\n<p>Reading of various winning solutions giving me good knowledge and diversified approaches for the same problem. </p>\n<p>Finally, I thank my team <a href=\"https://www.kaggle.com/sambitmukherjee\" target=\"_blank\">@sambitmukherjee</a>, <a href=\"https://www.kaggle.com/aravind36\" target=\"_blank\">@aravind36</a> and <a href=\"https://www.kaggle.com/wasimmadha\" target=\"_blank\">@wasimmadha</a> for fantastic work.. </p>",
      "rawMarkdown": "We (complex[::-1]) Team, thank competition host for conducting such a interesting completion. It is a very good learning for us. I thank all participants also for sharing your insights in discussion, which helped us a lot. \n\nReading of various winning solutions giving me good knowledge and diversified approaches for the same problem. \n\nFinally, I thank my team @sambitmukherjee, @aravind36 and @wasimmadha for fantastic work..",
      "votes": null
    },
    {
      "id": "2319382",
      "postDate": "06/27/2023 05:24:44",
      "content": "<p><a href=\"https://www.kaggle.com/sambitmukherjee\" target=\"_blank\">@sambitmukherjee</a> thanks for sharing detailed topic! Very nice graphs!</p>",
      "rawMarkdown": "sambitmukherjee thanks for sharing detailed topic! Very nice graphs!",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 2313984,
      "author_name": "aravind36",
      "author_url": "",
      "post_date": "06/23/2023 05:16:49",
      "content": "<p>Nice!! We did our best and tried everything we could think of with what we knew. I learned a lot from this competition!! <a href=\"https://www.kaggle.com/sambitmukherjee\" target=\"_blank\">@sambitmukherjee</a> </p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 2317184,
      "author_name": "joek47",
      "author_url": "",
      "post_date": "06/25/2023 13:53:56",
      "content": "<p>nice pipeline graphs</p>",
      "votes": null,
      "replies": [
        {
          "id": 2317300,
          "author_name": "sambitmukherjee",
          "author_url": "",
          "post_date": "06/25/2023 15:26:28",
          "content": "<p>Thanks. I used a free web-based tool called Excalidraw…</p>",
          "votes": null,
          "replies": []
        }
      ]
    },
    {
      "id": 2317922,
      "author_name": "laskari",
      "author_url": "",
      "post_date": "06/26/2023 05:04:15",
      "content": "<p>We (complex[::-1]) Team, thank competition host for conducting such a interesting completion. It is a very good learning for us. I thank all participants also for sharing your insights in discussion, which helped us a lot. </p>\n<p>Reading of various winning solutions giving me good knowledge and diversified approaches for the same problem. </p>\n<p>Finally, I thank my team <a href=\"https://www.kaggle.com/sambitmukherjee\" target=\"_blank\">@sambitmukherjee</a>, <a href=\"https://www.kaggle.com/aravind36\" target=\"_blank\">@aravind36</a> and <a href=\"https://www.kaggle.com/wasimmadha\" target=\"_blank\">@wasimmadha</a> for fantastic work.. </p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 2319382,
      "author_name": "serangu",
      "author_url": "",
      "post_date": "06/27/2023 05:24:44",
      "content": "<p><a href=\"https://www.kaggle.com/sambitmukherjee\" target=\"_blank\">@sambitmukherjee</a> thanks for sharing detailed topic! Very nice graphs!</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "2312747": "First of all, we would like to thank Kaggle & Benetech for hosting this very interesting competition. It was great fun to participate, and we learned a tremendous amount from it. 😀\n\nWe used a combination of image classification, object detection, Donut, PaddleOCR, TrOCR, and lots of postprocessing! 😅\n\n---\n\n# Models\n\nWe trained models for the following tasks:\n\n1. Plot type classification - ResNet34\n2. Rotated vs non-rotated X tick label classification - ResNet34\n3. Horizontal bar detection - FasterRCNN with ResNet50-FPN backbone\n4. Vertical bar detection (used in the histogram pipeline as well) - FasterRCNN with ResNet50-FPN backbone\n5. Line point detection - FasterRCNN with ResNet50-FPN backbone\n6. Scatter point & dot detection (a single model for both) - FasterRCNN with ResNet50-FPN backbone\n7. Tick mark detection - FasterRCNN with ResNet50-FPN backbone\n8. X tick label detection (used only for detecting non-rotated X tick labels) - FasterRCNN with ResNet50-FPN backbone\n9. Y tick label detection - FasterRCNN with ResNet50-FPN backbone\n10. Donut (used only for recognizing rotated X tick labels) - <a href=\"https://huggingface.co/naver-clova-ix/donut-base\" target=\"_blank\">`'naver-clova-ix/donut-base'`</a>\n\nIn addition, we used the following models as-is (i.e., without any fine-tuning):\n\n1. PaddleOCR for multi-line text detection & conversion to single-line texts - <a href=\"https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.6/doc/doc_en/PP-OCRv3_introduction_en.md\" target=\"_blank\">PP-OCRv3</a>\n2. TrOCR for OCR of single-line texts - <a href=\"https://huggingface.co/microsoft/trocr-base-printed\" target=\"_blank\">`'microsoft/trocr-base-printed'`</a>\n\n**Note:** We used PaddleOCR because TrOCR can only read single-line texts. For single-line texts, we found TrOCR to be very accurate.\n\n---\n\n# Inference Examples\n\nThe following images are examples of inference using each of the above models:\n\n**Plot type classification:**\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Faf30206384b2f090c6fcbd0cb59bf959%2Fplot_type_inference.png?generation=1687424929176720&alt=media)\n\n**Rotated vs non-rotated X tick label classification:**\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F037c35db3590c5c1b67f85ab57fb36e2%2Frotation_inference.png?generation=1687422645141712&alt=media)\n\n**Horizontal bar detection:**\n\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Fd4d7e6bee836a68203a8b0a5a08f17d3%2Fhorizontal_bar_inference.png?generation=1687422676773859&alt=media\" width=500>\n\n**Vertical bar detection (used in the histogram pipeline as well):**\n\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F7746b8f7e88ee68b0d45729673d7a1ff%2Fvertical_bar_inference.png?generation=1687441005236360&alt=media\" width=500>\n\n**Line point detection:**\n\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F0ad448751c154024bf8f9bef757e8cc0%2Fline_inference.png?generation=1687422824609612&alt=media\" width=500>\n\n**Scatter point & dot detection (a single model for both):**\n\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F652aa1e31c4486cc05a0de0fc2a4b275%2Fscatter_inference.png?generation=1687422924497010&alt=media\" width=500>\n\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Ff8a45dce67f94bde15a6288b28ebef85%2Fdot_inference.png?generation=1687422948970505&alt=media\" width=500>\n\n**Tick mark detection:**\n\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F33f16e5a073df164463c026a48d40360%2Ftick_mark_inference.png?generation=1687422992117363&alt=media\" width=500>\n\n**X tick label detection (used only for detecting non-rotated X tick labels):**\n\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Fb793316f01d17ea577caa501d142591d%2Fx_tick_label_inference.png?generation=1687423056622492&alt=media\" width=500>\n\n**Y tick label detection:**\n\n<img src=\"https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F2b458db805a977b2c36447bdb6c53a31%2Fy_tick_label_inference.png?generation=1687423081364918&alt=media\" width=500>\n\n**Donut (used only for recognizing rotated X tick labels):**\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Ffbb5753a331e6cbb22fa19cc56a55a04%2Fdonut_inference.png?generation=1687429751410113&alt=media)\n\n**Note:** We trained our Donut model only on image patches below the X axis which contain rotated text.\n\n**PaddleOCR (for multi-line text detection & conversion to single-line texts):**\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Ff3647d71073644c6033c7116e1e33da2%2Fpaddle.png?generation=1687440095811819&alt=media)\n\n**TrOCR (for OCR of single-line texts):**\n\nImage snippet:\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F49734d8ecacdb174d1bfaf431d15be99%2Ftrocr_snippet.jpg?generation=1687429867440216&alt=media)\n\nOutput: `\"A. Total Genotoxic Potency\"`\n\n---\n\n# Deep Learning Frameworks\n\nWe used:\n\n- For image classification - <a href=\"https://docs.fast.ai/\" target=\"_blank\">fastai</a>\n- For object detection - <a href=\"https://airctic.github.io/icevision/0.12.0/\" target=\"_blank\">IceVision</a> + fastai\n- For Donut - Hugging Face Transformers <a href=\"https://huggingface.co/docs/transformers/main_classes/trainer\" target=\"_blank\">Trainer</a> API\n\n---\n\n# Data\n\nIn addition to the competition dataset, we used some additional images from the *ICPR 2022 CHART* dataset available at: https://chartinfo.github.io/toolsanddata.html\n\nBounding box annotations for the chart elements were added using either (i) custom Python scripts or (ii) manual annotation tools, viz. Make Sense (https://www.makesense.ai/) and Roboflow. The annotations were created in the PASCAL VOC format.\n\nFor line point detection, scatter point detection and tick mark detection, we had to convert the original point annotations to bounding box annotations. We noticed that the choice of bounding box size has a big impact on performance. Hence, we experimented with a few bounding box sizes, and found that the following sizes work well:\n\n| Line Point | Scatter Point | Tick Mark |\n|---|---|---|\n| 18px | 16px | 16px |\n\nFor X tick label detection and Y tick label detection, we noticed that adding a 2px margin to the provided bounding boxes improves performance.\n\nFinally, we found that in a tiny fraction of images, one or more bounding boxes overstep the bounds of the image. We deleted these images from our dataset.\n\n---\n\n# Model Validation Schemes\n\n**Plot type classification:**\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Fb0e8a053b3a9509a36b0a03b0935f248%2Fplot_type_val_scheme.png?generation=1689168901672895&alt=media)\n\n**Rotated vs non-rotated X tick label classification:**\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F7a1cdc221a5e10f875a76b9163888e21%2Frotation_val_scheme.png?generation=1689169392117974&alt=media)\n\n**Horizontal bar detection:**\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Fa866016d76730c38864c90c317fb89b7%2Fhorizontal_bar_val_scheme.png?generation=1689168936143640&alt=media)\n\n**Vertical bar detection (used in the histogram pipeline as well):**\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Fd27e058d0bb05846f5ea42eca69e101f%2Fvertical_bar_val_scheme.png?generation=1689168951683704&alt=media)\n\n**Line point detection:**\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Ffc25de18f4386ad8711b7953ddffc904%2Fline_val_scheme.png?generation=1689168967592482&alt=media)\n\n**Scatter point & dot detection (a single model for both):**\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F2411ee14867dda5e3b7aba79d7d234cf%2Fscatter_dot_val_scheme.png?generation=1689170209501077&alt=media)\n\n**Tick mark detection:**\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Fc3cc591f20cadb2cb59c53fa40ba9b0b%2Ftick_mark_val_scheme.png?generation=1689170225648108&alt=media)\n\n**X tick label detection (used only for detecting non-rotated X tick labels):**\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F2c1ee44e72bbea46fb8e3e514ad042d2%2Fx_tick_label_val_scheme.png?generation=1689170239312207&alt=media)\n\n**Y tick label detection:**\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F04a9bed0423c7c186b6b4a3a24b1fc8a%2Fy_tick_label_val_scheme.png?generation=1689170253004364&alt=media)\n\n**Donut (used only for recognizing rotated X tick labels):**\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Fce3009c4f44c3d1126e268840097779b%2Fdonut_val_scheme.png?generation=1689170268258727&alt=media)\n\n---\n\n# Pipelines\n\n## Image Classification\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F65ff8a8d4344bd4c111c8a1d595b740a%2Fdiagram_image_classifier.png?generation=1687437455837261&alt=media)\n\n## Horizontal Bar Pipeline\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Ff1c8ac7ea8ce27d36a9c8f21ad5a3112%2Fdiagram_horizontal_bar.png?generation=1687695397682069&alt=media)\n\n## Vertical Bar Pipeline\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F4b4ea6617dd3907c0a044474cc475fef%2Fdiagram_vertical_bar.png?generation=1687695428772800&alt=media)\n\n## Histogram Pipeline\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F717f752077d0b61d3f277aba0ab66877%2Fdiagram_histogram.png?generation=1687696678498713&alt=media)\n\n## Line Pipeline\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F2e1debd34468def631db044e287cb0f5%2Fdiagram_line.png?generation=1687696700722044&alt=media)\n\n## Scatter Pipeline\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2Fc9b7be151091d9a3cc030f8341d988bf%2Fdiagram_scatter.png?generation=1687518134085611&alt=media)\n\n## Dot Pipeline\n\n![](https://www.googleapis.com/download/storage/v1/b/kaggle-forum-message-attachments/o/inbox%2F1191272%2F8b79f1c390dff4b5c8a703767ee3a372%2Fdiagram_dot.png?generation=1687764390803909&alt=media)\n\n---\n\n# Results\n\n|   | Overall | Scatter | Dot | Line | Vertical Bar | Horizontal Bar |\n|---|---|---|---|---|---|---|\n| public | 0.66 | 0.06 | 0.00 | 0.26 | 0.33 | 0.01 |\n| private | 0.49 | 0.19 | 0.01 | 0.08 | 0.20 | 0.01 |\n\n---",
    "2313984": "Nice!! We did our best and tried everything we could think of with what we knew. I learned a lot from this competition!! @sambitmukherjee",
    "2317184": "nice pipeline graphs",
    "2317300": "Thanks. I used a free web-based tool called Excalidraw...",
    "2317922": "We (complex[::-1]) Team, thank competition host for conducting such a interesting completion. It is a very good learning for us. I thank all participants also for sharing your insights in discussion, which helped us a lot. \n\nReading of various winning solutions giving me good knowledge and diversified approaches for the same problem. \n\nFinally, I thank my team @sambitmukherjee, @aravind36 and @wasimmadha for fantastic work..",
    "2319382": "sambitmukherjee thanks for sharing detailed topic! Very nice graphs!"
  },
  "source": "meta"
}