<?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: Niraj Kumar</title>
    <description>The latest articles on DEV Community by Niraj Kumar (@nirajcj).</description>
    <link>https://dev.to/nirajcj</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4016134%2F90b640bc-659e-494d-b1b8-b237e2a41841.jpg</url>
      <title>DEV Community: Niraj Kumar</title>
      <link>https://dev.to/nirajcj</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nirajcj"/>
    <language>en</language>
    <item>
      <title>Teaching an offline plant doctor to spot rust</title>
      <dc:creator>Niraj Kumar</dc:creator>
      <pubDate>Thu, 19 Nov 2026 05:07:01 +0000</pubDate>
      <link>https://dev.to/nirajcj/teaching-an-offline-plant-doctor-to-spot-rust-51d5</link>
      <guid>https://dev.to/nirajcj/teaching-an-offline-plant-doctor-to-spot-rust-51d5</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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0ks6q1goc441eo7o78vr.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0ks6q1goc441eo7o78vr.jpg" alt="Orange rust growth on a leaf, correctly labelled by the research classifier" width="500" height="333"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Rust, correctly labelled by the research classifier. Photo: &lt;a href="https://www.inaturalist.org/observations/40990811" rel="noopener noreferrer"&gt;iNaturalist observation 40990811&lt;/a&gt;, no rights reserved (CC0).&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;My wife looks after our plants with a long list of fixes: rice water, onion water, neem, peroxide, sulphur, compost, repotting, more sunlight, turning the pot when a plant starts leaning to one side, and plenty more. She doesn't choose by species, or by a name for the problem. She goes by what she feels is wrong with the plant. And it works, somewhat.&lt;/p&gt;

&lt;p&gt;Somewhere along the way of building SASYA, I took it upon my ego that I could suggest better. Not a feeling, but a diagnosis: the exact problem and the exact fix. A photo, an answer, right there on the phone, with the photo never leaving the device.&lt;/p&gt;

&lt;p&gt;My method didn't always win. When it failed, I went back to figuring out why. Sometimes I gave up and uploaded the photo to ChatGPT, which came back with something that more or less worked. Now I had two advisers who were somewhat right. That bothered me more than failing. I wanted more than somewhat. I wanted to one-up the chatbot, and my wife.&lt;/p&gt;

&lt;p&gt;Rust is where that ambition ran into the data.&lt;/p&gt;

&lt;h2&gt;
  
  
  Zero out of twenty-four
&lt;/h2&gt;

&lt;p&gt;Rust is about as visible as plant problems get: orange, powdery spots, like the ones in the photo at the top. I collected 24 rust photos from iNaturalist and ran them through my pipeline.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It named rust first on none of them.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here is what the pipeline did. An image encoder turned each photo into 512 numbers describing what it looks like. My system then squeezed those 512 numbers down to 34 scores, one for each description I had written: spots, powder, webbing, yellowing. Rules took those clues and named a problem.&lt;/p&gt;

&lt;p&gt;I liked that design because I could read it. Every answer came with its reasons. But staring at zero out of twenty-four, I started to believe rules would never work. Either I needed a much bigger classifier, or I would have to do the thing I had been avoiding: hand the photo to a large language model and let it work things out.&lt;/p&gt;

&lt;h2&gt;
  
  
  Letting the model see the whole picture
&lt;/h2&gt;

&lt;p&gt;Before giving in, I asked a smaller question. By squeezing 512 numbers into 34 descriptions, had I thrown away exactly what the rules needed?&lt;/p&gt;

&lt;p&gt;I kept the same image encoder and trained a small classifier on all 512 numbers instead. On PlantDoc, a public set of crop-disease photos, accuracy on a six-group test rose from &lt;strong&gt;68.6% to 80.1% across 236 photos&lt;/strong&gt;. It was a rough comparison (the caveats are in the &lt;a href="https://sasya.app/blog/debugging-offline-plant-doctor" rel="noopener noreferrer"&gt;methods section of the original post&lt;/a&gt;), but it was enough to keep going.&lt;/p&gt;

&lt;p&gt;The real test had to look like a phone in a garden, not a dataset. I went through 445 iNaturalist photos by hand and kept 286 that look like what a grower actually sees: damaged leaves, pests on plants, and 25 plants that appeared healthy.&lt;/p&gt;

&lt;p&gt;Rust went from &lt;strong&gt;0 to 7 out of 24&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The better score made things worse
&lt;/h2&gt;

&lt;p&gt;Then I checked the healthy plants. Before, the system had raised a false alarm on 2 of the 25. Now it raised one on &lt;strong&gt;6&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;That stopped me. If my wife had pointed it at a healthy plant, roughly one time in four it would have told her something was wrong.&lt;/p&gt;

&lt;p&gt;I had been chasing the score. The score went up, and the app became more alarming. Recognising rust mattered, but so did knowing when to leave a plant alone.&lt;/p&gt;

&lt;h2&gt;
  
  
  More real photos, fewer false alarms
&lt;/h2&gt;

&lt;p&gt;The fix was better teaching material. I retrained the classifier on &lt;strong&gt;2,970 iNaturalist photos plus PlantDoc&lt;/strong&gt;, with the same image encoder.&lt;/p&gt;

&lt;p&gt;Rust rose to &lt;strong&gt;15 out of 24&lt;/strong&gt;. False alarms fell to &lt;strong&gt;3 of the 25&lt;/strong&gt; healthy plants: better than the first classifier, though still one more than rules alone.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fb1fis4itzvz5pbo1f46k.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fb1fis4itzvz5pbo1f46k.png" alt="Recorded pipeline results across 286 reviewed photos" width="800" height="738"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Recorded replays: matching first labels for issues; no alarm for provisional healthy controls. Labels come from observation taxa and visual review, without lab confirmation. "Guided" in the table means the first suggestion only.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Nine rust photos still went unmatched.&lt;/strong&gt; And aphids stayed at &lt;strong&gt;0 out of 19&lt;/strong&gt;. One aphid photo was called thrips with a score of 97.4%. That number is how strongly the model leaned, not the chance it was right. It was wrong.&lt;/p&gt;

&lt;h2&gt;
  
  
  Six photos, and what the classifier said
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Leaf miner → leaf miner&lt;/strong&gt; (88.0%)&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F47y1vkmnjtia199xl39z.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F47y1vkmnjtia199xl39z.jpg" alt="Leaf miner trails on a leaf" width="500" height="375"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Phyllocnistis vitifoliella. Photo: (c) Mary Krieger, some rights reserved (CC BY), &lt;a href="https://www.inaturalist.org/observations/86846329" rel="noopener noreferrer"&gt;iNaturalist&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Rust → rust&lt;/strong&gt; (99.9%)&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0ks6q1goc441eo7o78vr.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0ks6q1goc441eo7o78vr.jpg" alt="Orange rust growth" width="500" height="333"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Gymnosporangium juniperi-virginianae. Photo: no rights reserved (CC0), &lt;a href="https://www.inaturalist.org/observations/40990811" rel="noopener noreferrer"&gt;iNaturalist&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Aphids → thrips&lt;/strong&gt; (97.4%, wrong)&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fw0famskqp790n2ovkdke.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fw0famskqp790n2ovkdke.jpg" alt="Aphids on a plant" width="500" height="333"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Rhopalosiphum nymphaeae. Photo: no rights reserved (CC0), &lt;a href="https://www.inaturalist.org/observations/30443521" rel="noopener noreferrer"&gt;iNaturalist&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Anthracnose → rust&lt;/strong&gt; (83.4%, wrong)&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6tifbfbrq3ukj33c7mnl.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6tifbfbrq3ukj33c7mnl.jpg" alt="Anthracnose lesions on an agave" width="500" height="333"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Colletotrichum agaves. Photo: (c) Alan Rockefeller, some rights reserved (CC BY), &lt;a href="https://www.inaturalist.org/observations/4747086" rel="noopener noreferrer"&gt;iNaturalist&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Healthy → rust&lt;/strong&gt; (64.9%, a false alarm)&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fs5onj65bmce57qdfsh82.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fs5onj65bmce57qdfsh82.jpg" alt="A healthy spider plant" width="333" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Chlorophytum comosum. Photo: (c) Karen Eichholz, some rights reserved (CC BY), &lt;a href="https://www.inaturalist.org/observations/44163224" rel="noopener noreferrer"&gt;iNaturalist&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Downy mildew → no answer&lt;/strong&gt; (top guess downy mildew, 74.8%, threshold disabled)&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fu59uan0hmai1p2io89ec.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fu59uan0hmai1p2io89ec.jpg" alt="Downy mildew on a leaf" width="500" height="333"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Peronospora galegae. Photo: (c) Alex Press, some rights reserved (CC BY), &lt;a href="https://www.inaturalist.org/observations/285961162" rel="noopener noreferrer"&gt;iNaturalist&lt;/a&gt;.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What a plant pathologist taught me
&lt;/h2&gt;

&lt;p&gt;What changed my thinking was an old lecture. In 2002, &lt;a href="https://www.uctv.tv/shows/Plant-Disease-Part-I-6679" rel="noopener noreferrer"&gt;Bob Raabe&lt;/a&gt;, a plant pathologist at UC Berkeley, taught a class of Master Gardener students how to diagnose plant problems. He doesn't look at a leaf and name a fungus. He works through the causes, from watering and soil to bacteria and fungi, and rules them out one by one. Even brown leaf tips can have several causes, as &lt;a href="https://ipm.ucanr.edu/home-and-landscape/houseplant-problems/" rel="noopener noreferrer"&gt;UC IPM's houseplant guide&lt;/a&gt; shows.&lt;/p&gt;

&lt;p&gt;That was the humbling part. I had been trying to beat my wife and a chatbot at naming the problem in one shot. The expert doesn't even try.&lt;/p&gt;

&lt;p&gt;SASYA already asks questions like his. After the photo, a step-by-step check asks things like "How recently was this plant watered?", "Has it been repotted in the last few weeks?" and "Check another leaf. Do you see it there too?" Asking helps. But the way it asks today isn't very intuitive, and that can steer it towards the wrong disease, or a generic one.&lt;/p&gt;

&lt;p&gt;So that's what I'm working on now: getting the phone to do more of that looking itself, instead of leaning on a questionnaire.&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1quy6bh8iwzits3qk4ge.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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1quy6bh8iwzits3qk4ge.png" alt="Proposed evidence-gathering sequence: validate, observe, ask, then re-rank or abstain" width="800" height="523"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;My test set needs work too. Some photographers appear in both the training and test photos, and the downy-mildew group contains the wrong organisms. Those get fixed before I claim any accuracy number.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where this leaves me
&lt;/h2&gt;

&lt;p&gt;I set out to one-up my wife and ChatGPT. I haven't, not yet. What I have is a plant doctor that recognises rust far better than it did, worries less about healthy plants, and is clearer about what it can't see.&lt;/p&gt;

&lt;p&gt;And I have a better question to ask of every change: &lt;strong&gt;does this help the person looking at the plant?&lt;/strong&gt; Sometimes that person is my wife. She was never really the competition.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published on &lt;a href="https://sasya.app/blog/debugging-offline-plant-doctor" rel="noopener noreferrer"&gt;sasya.app&lt;/a&gt;, with the full methods, data sources and limits. SASYA is an offline plant identification app for Indian flora: no account, and photos never leave the phone.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>computervision</category>
      <category>ai</category>
      <category>mobile</category>
    </item>
  </channel>
</rss>
