<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: jinghao-ai</title>
    <description>The latest articles on DEV Community by jinghao-ai (@jinghaoai).</description>
    <link>https://dev.to/jinghaoai</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3818411%2F179bcf80-0b52-4d21-9bfb-cd171316dbf3.jpeg</url>
      <title>DEV Community: jinghao-ai</title>
      <link>https://dev.to/jinghaoai</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jinghaoai"/>
    <language>en</language>
    <item>
      <title>Hunting Einstein Rings: Achieving 0.994 mAP in Deep-Space Detection with RT-DETR</title>
      <dc:creator>jinghao-ai</dc:creator>
      <pubDate>Wed, 11 Mar 2026 12:29:58 +0000</pubDate>
      <link>https://dev.to/jinghaoai/hunting-einstein-rings-achieving-0994-map-in-deep-space-detection-with-rt-detr-4j3j</link>
      <guid>https://dev.to/jinghaoai/hunting-einstein-rings-achieving-0994-map-in-deep-space-detection-with-rt-detr-4j3j</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk76493obxgkk7dwjkycx.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fk76493obxgkk7dwjkycx.jpg" alt=" " width="800" height="263"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1.Introduction: The Needle in a Haystack&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Detecting &lt;strong&gt;Strong Gravitational Lensing&lt;/strong&gt;(e.g., Einstein Rings) is a quintessential "needle-in-a-haystack" problem in astrophysics. Traditional methods are either computationally expensive or prone to high false-positive rates due to complex cosmic backgrounds.&lt;/p&gt;

&lt;p&gt;In this project, I deployed the &lt;strong&gt;RT-DETR (Real-Time Detection Transformer) **architecture to automate this process, achieving a near-perfect **0.994 mAP@50&lt;/strong&gt; and a &lt;strong&gt;1.00 Confusion Matrix score&lt;/strong&gt; across 1001 unseen deep-space samples.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5eovg7b67o88xpj54ajp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5eovg7b67o88xpj54ajp.png" alt=" " width="800" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2.Mathematical Optimization: GloU Loss&lt;/strong&gt;&lt;br&gt;
One major challenge was the sparity of lensing arcs. During early training, predicted anchors often had zero overlap with ground truth, leading to vanishing gradients in standard loU.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm83rkprxjzgcc681a18q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm83rkprxjzgcc681a18q.png" alt=" " width="800" height="329"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I implemented **Generalized loU(GloU) **to provide continuous gradients even for non-overlapping boxes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;GIoU = IoU - (|C &lt;span class="k"&gt;\ &lt;/span&gt;(A ∪ B)|) / |C|
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This geometric penalty was the cornerstone for stabilizing the regression loss at ~0.1.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3.Architectural Advantages: Global Self-Attention&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;why RT-DETR? Unlike traditional &lt;strong&gt;CNNs&lt;/strong&gt; with limited local receptive fields, the &lt;strong&gt;Hybrid Encoder&lt;/strong&gt; in RT-DETR utilizes &lt;strong&gt;Self-Attention&lt;/strong&gt; to captures long-range spatial dependencies.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tex"&gt;&lt;code&gt;Attention(Q, K, V) = Softmax( (QK&lt;span class="p"&gt;^&lt;/span&gt;T) / sqrt(d&lt;span class="p"&gt;_&lt;/span&gt;k) ) * V
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This allows the model to correlate the central lens galaxy with peripheral arcs simultaneously, ensuring robust detection even when the lensing signals are extremely faint.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4.Scaling to 1001 Samples&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To prove the model's reliability for actual sky surveys, I developed an automated pipeline to process &lt;strong&gt;1001 unseen samples&lt;/strong&gt;. The results were remarkable: zero false positives and a consistant detection confidence exceeding &lt;strong&gt;0.96&lt;/strong&gt;. This level of precision is critical for minimizing "ghost signals" in astronomical research.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F69pi1lvfkafn9jjxh41z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F69pi1lvfkafn9jjxh41z.png" alt=" " width="800" height="419"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Conclusion &amp;amp; Open Source&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This project bridges the gap between state-of-the-art Computer Vision and Astronomical Observation. I have open-sorced the full pipeline, including the mathmatical derivations and training logs, on my Github.&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;Github chain: &lt;a href="https://github.com/jinghao-ai/Lensing-Detection-RTDETR" rel="noopener noreferrer"&gt;https://github.com/jinghao-ai/Lensing-Detection-RTDETR&lt;/a&gt;&lt;br&gt;
*&lt;/em&gt;&lt;/p&gt;

</description>
      <category>deeplearning</category>
      <category>machinelearning</category>
      <category>science</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
