<?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: Muhammad Zubair</title>
    <description>The latest articles on DEV Community by Muhammad Zubair (@muhammadzubair796).</description>
    <link>https://dev.to/muhammadzubair796</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%2F4119123%2F92cefd1c-5d73-4d9a-909d-7b9bb9ced852.png</url>
      <title>DEV Community: Muhammad Zubair</title>
      <link>https://dev.to/muhammadzubair796</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/muhammadzubair796"/>
    <language>en</language>
    <item>
      <title>How I Built an Edge-to-Cloud AI Assistant for the Blind (Kotlin + Vertex AI)</title>
      <dc:creator>Muhammad Zubair</dc:creator>
      <pubDate>Thu, 10 Sep 2026 11:50:35 +0000</pubDate>
      <link>https://dev.to/muhammadzubair796/how-i-built-an-edge-to-cloud-ai-assistant-for-the-blind-kotlin-vertex-ai-c38</link>
      <guid>https://dev.to/muhammadzubair796/how-i-built-an-edge-to-cloud-ai-assistant-for-the-blind-kotlin-vertex-ai-c38</guid>
      <description>&lt;p&gt;Navigating complex physical environments is a daily challenge for the visually impaired. While standard GPS apps help with macro-navigation, they fail to detect immediate physical obstacles, read environmental text, or recognize faces in real-time.&lt;/p&gt;

&lt;p&gt;To bridge this gap, I engineered &lt;strong&gt;binAI&lt;/strong&gt;—a cutting-edge, voice-controlled Android application that acts as a real-time mobility instructor and visual assistant for the blind. &lt;/p&gt;

&lt;p&gt;By combining lightning-fast on-device sensors with powerful Google Vertex AI cloud models, binAI keeps users safe and aware of their surroundings with zero latency.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;(Note: You can read the original architectural breakdown on my &lt;a href="https://www.mzubair.online/projects/binai" rel="noopener noreferrer"&gt;Software Engineering Portfolio&lt;/a&gt;).&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🛠️ The Tech Stack: Android, FastAPI, and Vertex AI
&lt;/h2&gt;

&lt;p&gt;Building a real-time mobility radar requires a highly optimized, concurrent architecture. I designed binAI using a hybrid Edge-to-Cloud approach to ensure maximum speed and reliability.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
| Layer               | Technology Used               | Purpose                                               |
| :------------------ | :---------------------------- | :---------------------------------------------------- |
| **Frontend (Edge)** | Kotlin, Jetpack Compose       | Native Android UI and hardware integration            |
| **On-Device AI**    | Google ML Kit, CameraX        | Zero-latency object, face, and text detection         |
| **Backend (Cloud)** | Python 3, FastAPI             | High-performance API routing and data processing      |
| **Cloud AI**        | Google Vertex AI (Gemini 2.5) | Spatial reasoning and complex scene analysis          |
| **Infrastructure**  | Docker, Google Cloud Run      | Auto-scaling (scales to 0) with CI/CD via Cloud Build |
&lt;/code&gt;&lt;/pre&gt;




&lt;h2&gt;
  
  
  ⚡ The Hybrid Edge-to-Cloud Pipeline
&lt;/h2&gt;

&lt;p&gt;To provide the fastest and safest experience, an AI assistant for the blind cannot rely solely on the cloud (which introduces latency) or solely on the phone (which lacks deep reasoning). Here is how the hybrid architecture solves this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;1. The Edge (Phone):&lt;/strong&gt; The Android app uses &lt;strong&gt;Kotlin Coroutines&lt;/strong&gt; to process camera frames locally at high speeds, detecting bounding boxes, calculating obstacle distances in feet, and finding faces.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. The Cloud (Server):&lt;/strong&gt; The app injects this mathematical sensor data into a prompt alongside a compressed image and sends it to the &lt;strong&gt;FastAPI backend&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. The Brain (Vertex AI):&lt;/strong&gt; The Gemini model reads the image &lt;em&gt;and&lt;/em&gt; the exact sensor data to generate highly accurate, spatial, and urgent instructions (e.g., &lt;em&gt;"STOP! Stairs going down"&lt;/em&gt;).&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  💻 Code Spotlight: Solving Edge-Case Complexities
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Fixing Mobile Camera Rotation for Face Recognition
&lt;/h3&gt;

&lt;p&gt;A major issue with Android cameras is that they often send frames rotated by 90 degrees, causing standard face recognition libraries to fail on the backend. I engineered a fallback mechanism using NumPy to rotate the image matrix and fix the underlying C++ memory contiguity before re-scanning.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
# 1. Look for faces in the standard orientation
face_locations = face_recognition.face_locations(img)

# 2. THE ROTATION FIX (With C++ Memory Fix)
if not face_locations:
    # Rotate -90 degrees and fix memory layout for the C++ backend
    img_rotated = np.ascontiguousarray(np.rot90(img, k=-1))
    face_locations = face_recognition.face_locations(img_rotated)

    if face_locations:
        img = img_rotated
    else:
        # Fallback: Rotate +90 degrees
        img_rotated = np.ascontiguousarray(np.rot90(img, k=1))
        face_locations = face_recognition.face_locations(img_rotated)
        if face_locations:
            img = img_rotated
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;
  
  
  2. Sensor Data Injection into Vertex AI
&lt;/h3&gt;

&lt;p&gt;To prevent the LLM from hallucinating distances, the backend dynamically injects the exact mathematical data calculated by the phone's edge sensors directly into the system prompt.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;
@app.post("/navigate")
async def navigate(image: UploadFile = File(...), on_device_data: Optional[str] = Form(None)):

    # Injecting Edge ML data into the Cloud LLM prompt
    sensor_injection = f"ON-DEVICE SENSOR DATA: {on_device_data}. Use these exact distances for your evasion commands." if on_device_data else ""

    prompt = f"""
    You are a real-time mobility radar for a blind person walking forward.
    {sensor_injection}

    CRITICAL CONSTRAINTS:
    - Do NOT use full sentences.
    - Do NOT be polite.
    - Prioritize distance (feet/steps) and directional commands (left/right).
    """

    result = call_vision_model(prompt, await image.read())
    return {"status": "success", "script": result}
&lt;/code&gt;&lt;/pre&gt;




&lt;h2&gt;
  
  
  💡 The Impact of AI for the Visually Impaired
&lt;/h2&gt;

&lt;p&gt;binAI demonstrates how modern AI infrastructure—when combined with thoughtful, accessibility-first mobile engineering—can directly improve human lives. By leveraging Google Cloud Run and Vertex AI, the application remains highly scalable, cost-effective, and incredibly fast.&lt;/p&gt;

&lt;p&gt;I'd love to hear your thoughts on Edge-to-Cloud architectures! Have you worked with CameraX or Vertex AI recently? Let me know in the comments. 👇&lt;/p&gt;




&lt;h3&gt;
  
  
  👨‍💻 About the Developer
&lt;/h3&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%2F7snf5zepfz4vmgvcmi5o.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%2F7snf5zepfz4vmgvcmi5o.png" alt="Muhammad Zubair - Software Engineer and AI Developer" width="800" height="1031"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I am &lt;strong&gt;Muhammad Zubair&lt;/strong&gt;, a &lt;strong&gt;Software, DevOps, and Platform Engineer&lt;/strong&gt; from Pakistan. I specialize in architecting scalable AI infrastructure, cloud platforms (AWS/Kubernetes), and full-stack systems. &lt;/p&gt;

&lt;p&gt;My passion lies in solving real-world problems through code, whether that's building real-time mobility radars for the visually impaired or preserving regional languages through AI.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔗 Let's Connect:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Portfolio &amp;amp; Case Studies:&lt;/strong&gt; &lt;a href="https://www.mzubair.online" rel="noopener noreferrer"&gt;mzubair.online&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub (76+ Repos):&lt;/strong&gt; &lt;a href="https://github.com/Muhammad-Zubair796" rel="noopener noreferrer"&gt;Muhammad-Zubair796&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LinkedIn:&lt;/strong&gt; &lt;a href="https://www.linkedin.com/in/muhammad-zubair-6230a1285/" rel="noopener noreferrer"&gt;Muhammad Zubair&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>showdev</category>
      <category>android</category>
      <category>ai</category>
      <category>python</category>
    </item>
    <item>
      <title>How I Engineered the World's First Khattak Pashto LLM (Qwen2 + LoRA)</title>
      <dc:creator>Muhammad Zubair</dc:creator>
      <pubDate>Thu, 10 Sep 2026 11:12:58 +0000</pubDate>
      <link>https://dev.to/muhammadzubair796/how-i-engineered-the-worlds-first-khattak-pashto-llm-qwen2-lora-5ai0</link>
      <guid>https://dev.to/muhammadzubair796/how-i-engineered-the-worlds-first-khattak-pashto-llm-qwen2-lora-5ai0</guid>
      <description>&lt;p&gt;Standard Large Language Models (LLMs) are incredible, but they have a massive blind spot: &lt;strong&gt;rural and regional dialects.&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;While standard Pashto is supported by some models, they completely fail to capture the rich, localized grammar of the Khattak dialect spoken in Karak, Nowshera, and Kohat (Pakistan). &lt;/p&gt;

&lt;p&gt;To solve this, I built &lt;strong&gt;Khatta-ka-LLM&lt;/strong&gt;—the world's first AI language model fine-tuned specifically for the Khattak (Khatak) dialect. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;(Note: You can read the original architectural breakdown on my &lt;a href="https://www.mzubair.online/projects/khattak-llm" rel="noopener noreferrer"&gt;Software Engineering Portfolio&lt;/a&gt; or test the model live below).&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Watch the Live Testing Video:&lt;/strong&gt;&lt;br&gt;
  &lt;iframe src="https://www.youtube.com/embed/gWUFWgE3gww" width="710" height="399"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;




&lt;h2&gt;
  
  
  🛠️ Technical Architecture
&lt;/h2&gt;

&lt;p&gt;As a Software Engineer specializing in AI Infrastructure, my focus was on creating a clean, scalable, and reproducible pipeline for low-resource languages. Here is how I built it:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. The Custom Dataset
&lt;/h3&gt;

&lt;p&gt;Because no dataset existed for this dialect, I curated a custom dataset of 2,000+ English-to-Khattak pairs. This represents the first digitized collection of Khattak linguistic markers, focusing heavily on the unique grammar used in the Karak and Kohat regions.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. The Fine-Tuning Pipeline
&lt;/h3&gt;

&lt;p&gt;To achieve high performance on consumer-grade hardware, I utilized the following stack:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Base Model:&lt;/strong&gt; Qwen2 Architecture&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Framework:&lt;/strong&gt; Unsloth (for highly optimized, faster training)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Technique:&lt;/strong&gt; LoRA (Low-Rank Adaptation)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Performance:&lt;/strong&gt; Through careful hyperparameter tuning, the training loss dropped significantly from &lt;strong&gt;3.44 to 0.22&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  📘 The Linguistic Engineering (Rulebook)
&lt;/h2&gt;

&lt;p&gt;To ensure the AI didn't just speak "standard Pashto with a Khattak accent," I had to engineer specific linguistic rules into the model's training weights. &lt;/p&gt;

&lt;p&gt;Here are a few of the core rules the model learned:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Pronouns &amp;amp; Possession
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;My / Mine:&lt;/strong&gt; The model uses &lt;strong&gt;مو والا (Mo wala)&lt;/strong&gt; instead of the standard &lt;em&gt;Zama&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;To me:&lt;/strong&gt; Uses &lt;strong&gt;موته (Mota)&lt;/strong&gt; instead of standard &lt;em&gt;Mala&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;We:&lt;/strong&gt; Uses &lt;strong&gt;موخ (Moxh)&lt;/strong&gt; instead of standard &lt;em&gt;Mung&lt;/em&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  2. The "Noon Ghunna" (ں) Rule
&lt;/h3&gt;

&lt;p&gt;In the Khattak dialect, first-person verbs end in a nasal &lt;strong&gt;Noon Ghunna (ں)&lt;/strong&gt; rather than the standard "M".&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Standard:&lt;/em&gt; Za Kar Kawom (I do work)&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Khattak AI:&lt;/em&gt; &lt;strong&gt;زه چار کاوں (Za char kaon)&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Phonetic "O" Shifts
&lt;/h3&gt;

&lt;p&gt;The model successfully converts standard "A" sounds to the deep Khattak "O":&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Asmaan ➡️ &lt;strong&gt;Asmon (اسمون)&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Baraan ➡️ &lt;strong&gt;Baron (بارون)&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Bazaar ➡️ &lt;strong&gt;Bazor (بازور)&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  💡 Why This Matters
&lt;/h2&gt;

&lt;p&gt;By focusing on high-quality, localized data, &lt;strong&gt;Khatta-ka-LLM&lt;/strong&gt; successfully translates English into pure Khattak Pashto. As a Software Engineer from Pakistan, my goal is to bridge the gap between modern AI infrastructure and regional linguistic heritage. We shouldn't have to lose our dialects to use modern technology.&lt;/p&gt;

&lt;p&gt;I would love to hear your thoughts on fine-tuning models for low-resource languages! Have you worked with Unsloth or LoRA recently? Let me know in the comments. 👇&lt;/p&gt;




&lt;h3&gt;
  
  
  👨‍💻 About the Developer
&lt;/h3&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%2F7snf5zepfz4vmgvcmi5o.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%2F7snf5zepfz4vmgvcmi5o.png" alt="Muhammad Zubair - Software Engineer and AI Developer" width="800" height="1031"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I am &lt;strong&gt;Muhammad Zubair&lt;/strong&gt;, a &lt;strong&gt;Software, DevOps, and Platform Engineer&lt;/strong&gt; from Pakistan. I specialize in architecting scalable AI infrastructure, cloud platforms (AWS/Kubernetes), and full-stack systems. &lt;/p&gt;

&lt;p&gt;My passion lies in solving real-world problems through code, whether that's building real-time mobility radars for the visually impaired or preserving regional languages through AI.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;🔗 Let's Connect:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Portfolio &amp;amp; Case Studies:&lt;/strong&gt; &lt;a href="https://www.mzubair.online" rel="noopener noreferrer"&gt;mzubair.online&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GitHub (76+ Repos):&lt;/strong&gt; &lt;a href="https://github.com/Muhammad-Zubair796" rel="noopener noreferrer"&gt;Muhammad-Zubair796&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LinkedIn:&lt;/strong&gt; &lt;a href="https://www.linkedin.com/in/muhammad-zubair-6230a1285/" rel="noopener noreferrer"&gt;Muhammad Zubair&lt;/a&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%2F67ra76qfxld25695efjt.png" alt=" " width="800" height="800"&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>showdev</category>
      <category>ai</category>
      <category>machinelearning</category>
      <category>nlp</category>
    </item>
  </channel>
</rss>
