<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mosaab Muhammad on Medium]]></title>
        <description><![CDATA[Stories by Mosaab Muhammad on Medium]]></description>
        <link>https://medium.com/@mosaabmuhammed?source=rss-19599df287db------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*7aXghrlmYgzE-rdGRg8UdQ.jpeg</url>
            <title>Stories by Mosaab Muhammad on Medium</title>
            <link>https://medium.com/@mosaabmuhammed?source=rss-19599df287db------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 01:06:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mosaabmuhammed/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Stop Paying for GPT-4 to Place Text on Images: A Guide to Intelligent Dynamic Overlays]]></title>
            <link>https://medium.com/@mosaabmuhammed/stop-paying-for-gpt-4-to-place-text-on-images-a-guide-to-intelligent-dynamic-overlays-a30b368869b7?source=rss-19599df287db------2</link>
            <guid isPermaLink="false">https://medium.com/p/a30b368869b7</guid>
            <category><![CDATA[gpt]]></category>
            <category><![CDATA[yolo]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[genai]]></category>
            <category><![CDATA[computer-vision]]></category>
            <dc:creator><![CDATA[Mosaab Muhammad]]></dc:creator>
            <pubDate>Wed, 28 Jan 2026 12:36:10 GMT</pubDate>
            <atom:updated>2026-01-28T12:36:10.644Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-jEL7al95NtcT5jJMqpXbA.png" /></figure><p>Hey, I’m <strong>Mosaab,</strong> a senior AI Engineer who loves optimizing system architecture. In the age of AI hype, it is easy to throw a Large Language Model (LLM) at every problem. But as engineers, our job is to balance innovation with cost and speed.</p><p>In this article, I’m sharing a case study on how we moved away from expensive Generative AI calls to a smart, local computer vision approach for image layouts.</p><p>If you are building an app that generates social media posts, thumbnails, or dynamic marketing cards, you have likely hit the “Text Overlay Problem.”</p><p>The problem is simple: You have a random background image, and you need to place a text caption on it. The constraint is hard: <strong>Don’t cover the important stuff (like faces), and make sure the text is readable.</strong></p><p>For a quick prototype, many developers plug in a Multimodal LLM (like GPT-4 Vision) and ask it: <em>“Give me the x,y coordinates to place text on this image.”</em></p><p>It works, but it is <strong>slow (latency)</strong> and <strong>expensive (per-token cost)</strong>. If you are processing thousands of images, this approach is the engineering equivalent of using a flamethrower to light a candle.</p><p>Here are the four actual approaches to solving this problem, ranked from “Industry Standard” to “Smart Engineering.”</p><h3>1. The “Scrim” Method (The Netflix Approach)</h3><p><strong>Cost:</strong> Free | <strong>Speed:</strong> Instant | <strong>Complexity:</strong> Low</p><p>Open Netflix, YouTube, or Instagram Reels. Look at the text. Is it dodging the actors’ faces? No. It’s sitting at a fixed position (usually the bottom-left), but it is perfectly readable.</p><p>They use a <strong>Scrim</strong> — a gradient overlay that goes from transparent to black (or the dominant brand color).</p><h3>How it works:</h3><p>You don’t hunt for empty space. You <em>create</em> readable space.</p><ol><li>Define a fixed margin (e.g., bottom: 40px, left: 40px).</li><li>Programmatically draw a gradient rectangle behind the text area.</li><li>Place white text on top.</li></ol><p><strong>Why use it?</strong> It is reliable. No matter how chaotic the image is, the text will always be readable. <strong>Why avoid it?</strong> It can cover important details if the subject is in that specific corner.</p><h3>2. The “Blind” Heuristic (Entropy &amp; Edge Detection)</h3><p><strong>Cost:</strong> Free | <strong>Speed:</strong> Fast (&lt;50ms) | <strong>Complexity:</strong> Medium</p><p>If you don’t want to use AI models but want something smarter than a fixed box, you can use basic image processing algorithms to find the “quietest” part of the image.</p><h3>How it works:</h3><ol><li><strong>Slice the image:</strong> Mentally divide your image into potential text zones (e.g., Top-Left, Top-Right, Bottom-Left, Bottom-Right).</li><li><strong>Calculate Entropy:</strong> Use a library like OpenCV or Pillow to calculate the “Shannon Entropy” or “Edge Density” of each zone.</li></ol><ul><li>High Entropy = Lots of detail, edges, and noise (likely a face or complex object).</li><li>Low Entropy = Sky, wall, or out-of-focus background.</li></ul><p>3.<strong> Place Text:</strong> Pick the zone with the lowest score.</p><p><strong>The downside?</strong> A white wall and a white shirt both have low entropy, but placing white text on a white shirt is a disaster. You still need contrast checking.</p><h3>3. The “Smart” Layout (Object Detection / YOLO)</h3><p><strong>Cost:</strong> Low (CPU Inference) | <strong>Speed:</strong> Fast (~100–200ms) | <strong>Complexity:</strong> High</p><p>This is the sweet spot for modern engineering. You don’t need a model that <em>understands</em> the image (Generative AI); you just need a model that <em>locates</em> the subject.</p><h3>The Workflow:</h3><ol><li><strong>Detect the Subject:</strong> Use a lightweight, open-source model like <strong>YOLOv8 Nano</strong>. It is tiny enough to run on a standard CPU without expensive GPUs.</li><li><strong>Get the Bounding Box:</strong> The model returns coordinates: Person detected at [x, y, width, height].</li><li><strong>Apply Logic:</strong></li></ol><ul><li><em>Is the person on the Right?</em> → Place text on the <strong>Left</strong>.</li><li><em>Is the person on the Left?</em> → Place text on the <strong>Right</strong>.</li><li><em>Is the person centered?</em> → Place text at the <strong>Bottom</strong>.</li></ul><h3>Why this wins:</h3><p>It mimics how a human magazine editor thinks. It actively respects the subject of the photo, creating a “Negative Space” layout that looks professionally designed.</p><pre># Pseudo-code logic<br>if subject_center_x &gt; image_width / 2:<br>    print(&quot;Subject is on the Right. Align Text Left.&quot;)<br>else:<br>    print(&quot;Subject is on the Left. Align Text Right.&quot;)</pre><h3>4. The “Overkill” (Generative Vision Models)</h3><p><strong>Cost:</strong> High ($$$) | <strong>Speed:</strong> Slow (Seconds) | <strong>Complexity:</strong> Low (API call)</p><p>This is using GPT-4o, Claude 3.5 Sonnet, or Gemini Pro Vision. You send the image and ask: <em>“Where should I put the text?”</em></p><h3>When to actually use this?</h3><p>Only use this if the “content” of the text needs to interact with the image contextually.</p><ul><li><em>Example:</em> You want the text to be placed specifically on a coffee cup visible in the image.</li><li><em>Example:</em> You want the text color to match the subject’s eye color.</li></ul><p>For simple layout positioning, this is inefficient.</p><h3>Conclusion</h3><p>If you want to build a scalable, cost-effective solution, <strong>stop using LLMs for coordinates.</strong></p><p>Start with <strong>Approach 3 (YOLO)</strong>. It gives you that “Magic AI” feeling without the “Magic AI” bill. If that’s too complex for your current stage, <strong>Approach 1 (The Scrim)</strong> is a perfectly acceptable industry standard used by the biggest tech companies in the world.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a30b368869b7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[This Article will make YOU start a Data Science Project]]></title>
            <link>https://medium.com/@mosaabmuhammed/this-article-will-make-you-start-a-data-science-project-6c1167ef7e3d?source=rss-19599df287db------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c1167ef7e3d</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-wrangling]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Mosaab Muhammad]]></dc:creator>
            <pubDate>Fri, 26 Jul 2019 13:45:02 GMT</pubDate>
            <atom:updated>2019-07-26T13:45:02.897Z</atom:updated>
            <content:encoded><![CDATA[<h3>This Article will make YOU start a Data Science Project Easily.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sHcyNNlgb7ERZU1XjlXMFw.jpeg" /></figure><p>Let’s face it, at the first of any stage, we need some hands around us, to help us if we stuck on any phase.</p><p>These types of hands can take any shape, for example, it can be some article on Medium, or some video on YouTube, or a little search on Google.</p><p>I want you to consider this article, as one of those hands, that will help you get through the struggle, and overcome it by the following strategy.</p><p>What I’m going to show you, a strategy that is actually used by industry at the time of this article, and it’s the common process used to find many solutions in Data Science.</p><p>This process is known as the <strong>Cross-Industry Standard Process for Data Mining</strong>, or we can say for short, <strong>CRISP-DM</strong>.</p><p>Let me introduce you to the outlines of this process:</p><ol><li><strong>Business Understanding.</strong></li><li><strong>Data Understanding.</strong></li><li><strong>Data Preparation.</strong></li><li><strong>Data Modeling.</strong></li><li><strong>Evaluate the Results.</strong></li><li><strong>Deployment.</strong></li></ol><p>Now, let’s talk about them one by one.</p><h3>1. Business Understanding:</h3><p>At the early stage of finding a solution, there is a problem.</p><p>The best way to represent a problem by describing it with the <em>right</em> <em>questions</em>.</p><p>Questions are vital elements here, these questions are like a compass, that tell us where we should go and where we shouldn’t.</p><p>Understanding your business’s needs is very important, to identify the right inspiration for the questions.</p><p>Let me give you some questions, can be used for inspiration:</p><blockquote>Are new drugs better?</blockquote><blockquote>How to get new customers to the company?</blockquote><blockquote>How to get the most out of Travel? Communication? Information?</blockquote><h3>2. Data Understanding:</h3><p>In this stage, you need to gain an understanding of the data necessary to answer your questions.</p><p>But actually, businesses at first tend to collect a lot of data as much as possible, so they can later identify which data they need to use to find their insights.</p><p>Now, you need to know which features in your data, related to the questions you determined at the first stage.</p><p>Knowing that is going to be by <strong>EDA</strong> (<strong>Exploratory Data Analysis</strong>), meaning, you need to know some relationships, or some unique patterns in your data than can take a leap to answer your questions.</p><p>At the <strong>EDA</strong> stage, you get some insights through some visuals using the famous <strong>Python</strong> libraries, such as <strong>Matplotlib</strong> and <strong>Seaborn</strong>, to draw somethings like <em>heatmaps</em>, <em>histograms</em>, <em>scatter plots</em>, and so on.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/417/1*SX5vygXQzjoW41UDcRhKnA.png" /><figcaption>Scatter Plot for 2 quantitative variables, to see some pattern.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/420/1*4bXC_tyDldI55d_jP0QdzQ.png" /><figcaption>Heatmap for some features, and its correlation to the ‘Saleprice’.</figcaption></figure><h3>3. Data Wrangling:</h3><p>Now, after we collected our data, and get some insights from the visuals to know which features play the most role in predicting solutions for our questions.</p><p>Time to prepare our data, and to be truly honest with you, the wrangling process is the most time-consuming process, it roughly takes over 80% of the data analysis process.</p><p>In this stage, we prepare our data to fit well in the model, by checking the following scenarios:</p><ul><li><strong>Finding if there’re missing values (NaN values) or not.</strong></li><li><strong>Working with categorical variables.</strong></li><li><strong>Normalize or Standardize the quantitative variables (if necessary).</strong></li></ul><p>These 3 scenarios include a lot of talking or <em>writing as we’re here</em> because each one of these is an article by itself.</p><p>Maybe, I’ll post some articles regarding these 3 points.</p><h3>4. Data Modeling:</h3><p>Now, let’s showcase what we have here. My data is well-prepared, no missing values, no categorical variables.</p><p>Now, I need to fit this data to a bunch of models to see which one of them can get the best accuracy metrics.</p><p>By using<strong> </strong>some techniques like<strong> K-Folding</strong>, <strong>GridSearchCV</strong>, and even a <strong>Voting System</strong> to get the best accuracy.</p><p>After applying the data to <strong>ML</strong> or <strong>DL</strong> models, I got results, Right?</p><p>So we need to evaluate them, to see which one is better in predicting and answering my questions.</p><h3>5. Evaluation:</h3><p>We can choose a bunch of metrics to evaluate our model, but it actually depends on what type of problem do you have.</p><p>Whether it’s a <strong>regression</strong>, a <strong>classification</strong>, or even <strong>clustering</strong> problem.</p><p>There are a bunch of metrics, like <strong>R-Square</strong>, <strong>confusion-matrix</strong>, <strong>precision</strong>, <strong>recall</strong>, <strong>F1-Score</strong>, or even <strong>accuracy</strong>.</p><h3>6. Deployment:</h3><p>After checking &amp; evaluating our model, we need to utilize the results of our analysis, by deploying our model to automate tasks.</p><p>Those tasks might be serving an appropriate advertisement to a customer or recommending a movie, so on.</p><p>The second way to utilize the results of the analysis is to communicate your insights from your data to persuade others to make a decision or take a certain action.</p><p>Here, you need to know, which audience are you trying to communicate with.</p><p>To communicate with other programmers, it’s important to share your ideas and code, for this, you can use <strong>GitHub</strong>.</p><p>To communicate with managers and others within your company, you will need to persuade them with written ideas and visuals, for this, it’s common to use <strong>dashboards</strong> and <strong>emails</strong>.</p><h3>Conclusion:</h3><p>In the end, I hope this article helped you in any way, to start seeing any problem in a new way, a way that can lead you to the solution at the shortest amount of time.</p><p>Where are you know, are you still reading, GO to Kaggle, and START applying this process!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c1167ef7e3d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[3 Habits that’s necessary to undertake your new life]]></title>
            <link>https://medium.com/@mosaabmuhammed/3-habits-thats-necessary-to-undertake-your-new-life-6facff3992d6?source=rss-19599df287db------2</link>
            <guid isPermaLink="false">https://medium.com/p/6facff3992d6</guid>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[goals]]></category>
            <category><![CDATA[ideas]]></category>
            <category><![CDATA[life]]></category>
            <dc:creator><![CDATA[Mosaab Muhammad]]></dc:creator>
            <pubDate>Fri, 29 Jul 2016 12:47:33 GMT</pubDate>
            <atom:updated>2016-07-29T12:47:33.686Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bicC8smx_tOIFHR287U5lg.jpeg" /></figure><h4>How to genuinely change your life</h4><p>Since one year age , I found myself with a lot of bad habits such as going to bed lately , wasting my time on social media and on and on .</p><p>So i found that i need to change my life , to create my own schedule and surely to <em>feel </em>the difference in my life .</p><p>So i asked myself which important habits that i have to start with , that can help me to move on and keep moving on .</p><p>I have experience now with this habits and i have a lot of things to say .</p><p>so here we go :</p><blockquote>“ Enthusiasm moves the world “ Arthur Balfour</blockquote><h3>1) Enthusiastic and ambitious :</h3><p>That is first important one to start with , that can make you continue your path .</p><p>but question is how to make yourself totally enthusiastic and have a lot of power when you’re doing what you want to do :</p><ol><li>Watch motivational tapes in youtube , for example</li><li>Find people that can motivate you</li><li>Read books that you can get a lot of Power while you’re reading</li><li>Do work out that can motivate your body then your mind</li><li>Create your own one</li></ol><p>=================================</p><blockquote>“ Sleep is the best meditation ” Dalai Lama</blockquote><h3>2) Allocate a specific period of time to sleep :</h3><p>I think if you do this , I <strong>guarantee</strong> that what is the next is easier .</p><p>If you set aside a specific period of time , especially in the evening and wake in the early morning .</p><p>For instance , I used to sleep at 10 pm and get up at 4 am and can surely make me feel energetic .</p><p>Maybe that sounds <em>hard </em>in the beginning but after a while you’ll be<em> </em>capable of doing it , trust me</p><p>So create your own best period that your body and also your mind can have a full of relaxation that they need .</p><p>==================================</p><blockquote>“ I love that feeling of just finishing a workout and knowing I’m taking care of my body. It is such a good feeling ” Jenna Ushkowitz</blockquote><h3>3) Do workouts in the morning :</h3><p>I think i love this one a lot because i saw the result in my body and my mind .</p><p>I can now do a 70 push_ups and a lot of pull_ups and squats and on and on .</p><p>I can see the difference now between my body in the last year and this year and i can see the boosting in my mind .</p><p>So here’s the way to make it in your routine :</p><p>Firstly you have to start with 7 minute a day and after a month try to increase to 15 minutes and after 2 months try to increase to 30 minutes and continue to do workouts in 45 minutes .</p><p>You’ll see the difference !</p><p>============================</p><p>Finally you have just only one life , you have to live this life with best way</p><p>and you know , you’re the creator of this life .</p><p>My advice to you is if you wanna ideas to create your own life :</p><ol><li>You have to read a lot .</li><li>You should make a friendship with people who is smarter than you .</li><li>Try to think a lot about your details in your life because that’s gonna shape your life .</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6facff3992d6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>