<?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 S M Minhazul Islam on Medium]]></title>
        <description><![CDATA[Stories by S M Minhazul Islam on Medium]]></description>
        <link>https://medium.com/@riyamminhaz15?source=rss-097bc8191ef6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*fXo-bXibjDjsSwFv</url>
            <title>Stories by S M Minhazul Islam on Medium</title>
            <link>https://medium.com/@riyamminhaz15?source=rss-097bc8191ef6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 14:50:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@riyamminhaz15/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[Streamlining Machine Learning Workflows with n8n: A Game Changer for Engineers]]></title>
            <link>https://medium.com/@riyamminhaz15/streamlining-machine-learning-workflows-with-n8n-a-game-changer-for-engineers-41ab6270e17b?source=rss-097bc8191ef6------2</link>
            <guid isPermaLink="false">https://medium.com/p/41ab6270e17b</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[rag-pipeline]]></category>
            <category><![CDATA[n8n]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[automation]]></category>
            <dc:creator><![CDATA[S M Minhazul Islam]]></dc:creator>
            <pubDate>Sun, 20 Jul 2025 23:57:05 GMT</pubDate>
            <atom:updated>2025-07-20T23:57:05.619Z</atom:updated>
            <content:encoded><![CDATA[<p>A few months ago, my screen was an overwhelming mess. Jupyter notebooks were scattered all over, command lines blinked endlessly, and notifications piled up like a never-ending to-do list. One window was pulling raw data, another was triggering training jobs, and yet another was reporting errors I had no time to fix.I wasn’t focused on building AI models anymore. I was stuck managing a mess of scripts and tools that didn’t connect.</p><p>If you’re a machine learning engineer, you’ve probably faced this. You need to switch between tools constantly, running scripts and jumping from one app to the next. Each step in your workflow needs a different tool, from collecting data to training models to deployment. It can feel overwhelming. You spend more time managing these tools than actually improving your models.</p><p>That’s where <strong>n8n</strong> comes in. It’s an open-source automation tool that lets you create workflows by connecting apps, scripts, and services. Instead of juggling multiple tools, you build a visual flow where everything connects automatically. It’s like having a single dashboard to control your entire ML pipeline.</p><h4>Automating Repetitive Tasks</h4><p>n8n can automate key parts of your workflow. For example, you can set it up to pull data from APIs or databases, clean and preprocess that data, and trigger model training when new data arrives. You can also get alerts if something goes wrong, and even handle deployment — all without lifting a finger.</p><p>Here’s an example of how n8n can automate a simple workflow: Imagine you want to fetch daily sales data, run a prediction model, and get a Slack update with the results. In n8n, you start with a <strong>Cron node</strong> to schedule the task, use an <strong>HTTP Request node</strong> to pull the latest sales data, then run a <strong>Python node</strong> to execute your prediction script. Finally, a <strong>Slack node</strong> sends you the forecast summary.</p><pre>import json<br><br># Assume input data is in items[0][&#39;json&#39;][&#39;sales&#39;]<br>sales_data = items[0][&#39;json&#39;][&#39;sales&#39;]<br># Simple prediction: average sales + 10%<br>prediction = sum(sales_data) / len(sales_data) * 1.1<br><br>return [{<br>    &quot;json&quot;: {<br>        &quot;prediction&quot;: prediction<br>    }<br>}]</pre><p>No extra scripts needed. No clicking buttons. n8n handles it all for you.</p><h4>Handling Complex AI Workflows</h4><p>n8n isn’t just for simple tasks. It can handle complex workflows too. For example, if your model is live, you can use n8n to monitor its performance. It can check for <strong>data drift</strong> — when new input data looks different from what your model was trained on. If there’s a change, n8n can send you an alert, or even trigger a retraining pipeline automatically.</p><p>This means your model stays accurate without you having to manually intervene. n8n lets you set up workflows that keep your system running smoothly while you focus on improving the model.</p><h4>Building Smart Pipelines with Retrieval-Augmented Generation (RAG)</h4><p>n8n also shines when it comes to <strong>retrieval-augmented generation (RAG)</strong> workflows. This is where AI tools help you create more intelligent systems, like chatbots that can process documents or run queries. With n8n, you can collect documents, create embeddings, store vectors in a database, and run AI queries — all in one flow.</p><p>For instance, you could automate the process of collecting documents, converting them into AI-readable vectors, and using them to answer questions. It’s all visual, so no need to write tons of code. You just build the flow once, and n8n takes care of the rest.</p><h4>Real-World Examples: Continuous Retraining and Chatbots</h4><p>Let’s look at some real-world examples. Imagine you want to set up continuous <strong>model retraining</strong>. With n8n, you can create a flow that pulls fresh data, cleans it, trains a new model, and deploys it — all automatically. The whole process runs on its own, so your model stays current without extra work.</p><p>Another example is building a chatbot using RAG. You could set up a flow that collects documents, creates embeddings with OpenAI or Hugging Face, stores them in a database, and serves up answers to questions — all without writing much code.</p><h4>Easy to Use and Scalable</h4><p>n8n isn’t just for simple tasks. It’s designed to scale with your needs. You can use it to monitor your models in production, set up complex data pipelines, or integrate with other AI services. It connects to tools like OpenAI and Hugging Face, making it easy to automate AI tasks like text classification, summarization, or sentiment analysis.</p><p>Because everything is visual, you can also make updates or changes quickly. Instead of rewriting scripts, you just edit the flow and let n8n handle the rest. This flexibility makes it easy to build, maintain, and scale your workflows.</p><h4>Team Collaboration and DevOps Integration</h4><p>n8n also improves team collaboration. With reusable workflow templates, it’s easy to share processes with teammates. Everyone can see and understand the entire pipeline, which makes onboarding faster and reduces errors.</p><p>For DevOps, n8n supports continuous integration and deployment. You can trigger workflows based on code changes, automatically validate models, and approve deployments — all within one tool. It helps ensure smooth operations and reduces the manual overhead of managing machine learning systems.</p><h4>Monitoring and Reporting Made Simple</h4><p>n8n is great for <strong>monitoring</strong>. If your model is running live, you can set up checks for things like unusual data patterns or drops in performance. If anything goes wrong, n8n can notify you via Slack, email, or custom dashboards. You can even trigger automated retraining to fix any issues.</p><p>You can also automate <strong>AI research and reporting</strong>. For example, you could set up a flow that scrapes the web, analyzes data, and produces reports — all automatically. These reports can be sent to tools like Google Sheets or Notion, saving hours of manual work.</p><h4>Conclusion: Automate, Scale, and Innovate</h4><p>If you’re tired of manually managing your machine learning workflows, n8n is a powerful solution. It connects your apps, automates tasks, and simplifies your processes. Whether you’re automating data collection, model training, deployment, or monitoring, n8n makes it easier to keep everything running smoothly.</p><p>Instead of spending time on repetitive tasks and manual interventions, n8n lets you focus on what really matters — building and improving your AI models. If you want to boost your productivity and make your ML workflows more efficient, give n8n a try. It’s a tool that’ll help you scale your projects while saving you time and effort.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=41ab6270e17b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Deep Learning Approach to Skin Lesion Detection: One Model, Two Tasks]]></title>
            <link>https://medium.com/@riyamminhaz15/a-deep-learning-approach-to-skin-lesion-detection-one-model-two-tasks-1ce2fbad34c4?source=rss-097bc8191ef6------2</link>
            <guid isPermaLink="false">https://medium.com/p/1ce2fbad34c4</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[medical-image-analysis]]></category>
            <category><![CDATA[multi-task-learning]]></category>
            <category><![CDATA[skin-cancer]]></category>
            <category><![CDATA[computer-vision]]></category>
            <dc:creator><![CDATA[S M Minhazul Islam]]></dc:creator>
            <pubDate>Sat, 12 Jul 2025 23:40:19 GMT</pubDate>
            <atom:updated>2025-07-12T23:50:02.453Z</atom:updated>
            <content:encoded><![CDATA[<p>Skin cancer is one of the most common and dangerous types of cancer. Catching it early can save lives. But even now, doctors mostly rely on how something <em>looks, </em>checking it with their eyes or a dermatoscope. That can be slow, subjective, and easy to get wrong.</p><p>As someone into deep learning, I started thinking:<br> Can a single model both <strong>find</strong> the lesion and <strong>guess</strong> what kind of cancer it is?</p><p>That’s what I tried in this project.</p><p>Using the popular HAM10000 dataset, I built a model that does both <strong>segmentation</strong> and <strong>classification</strong> at once. It uses <strong>ResNet-18</strong> to learn features, a <strong>UNet-style decoder</strong> to draw the lesion, and a <strong>fully connected head</strong> to predict the class ; all trained together in one loop.</p><p>In this blog, I’ll show you how I built it, the stuff that worked, what didn’t, and how multitask learning helped this model do both jobs better.</p><h4>What’s in the dataset? (HAM10000)</h4><p>To train this model, I used the <strong>HAM10000</strong> dataset — short for <em>Human Against Machine with 10,000 images</em>. It’s one of the most used datasets for skin lesion analysis.</p><p>It has <strong>10,015 dermatoscopic images</strong>, each labeled with one of <strong>seven skin cancer types</strong>:</p><ul><li><strong>MEL</strong> — Melanoma</li><li><strong>NV</strong> — Melanocytic nevi</li><li><strong>BCC</strong> — Basal cell carcinoma</li><li><strong>AKIEC</strong> — Actinic keratoses</li><li><strong>BKL</strong> — Benign keratosis-like lesions</li><li><strong>DF</strong> — Dermatofibroma</li><li><strong>VASC</strong> — Vascular lesions</li></ul><p>Each image also comes with a <strong>segmentation mask</strong> that shows exactly where the lesion is. That made it perfect for training a model to do both tasks: <strong>classify the lesion type</strong> and <strong>draw the lesion boundary</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*pHdSioEyzwjmSHU9cGKv1w.png" /><figcaption>Skin Lesion with its Corresponding Mask</figcaption></figure><h4>Model Architecture: One Encoder, Two Heads</h4><p>The idea was simple: <strong>build one model that does two jobs</strong>.</p><p>I started with a <strong>ResNet-18</strong> as the shared encoder. It’s lightweight, fast, and pre-trained on ImageNet, so it already knows how to spot useful patterns in images. I removed its final classification layer and kept the feature maps.</p><p>Then I added two separate branches:</p><h4>🔹 Segmentation Head (UNet-style)</h4><p>To draw the lesion area, I used a <strong>UNet-style decoder</strong>. It upsamples the feature maps from the encoder back to the image size. I also added <strong>skip connections</strong> from the encoder to the decoder to help the model recover fine details. The output is a binary mask ; 1 for lesion, 0 for background.</p><h4>🔸 Classification Head</h4><p>For classification, I applied <strong>global average pooling</strong> to the encoder output, then passed it through a <strong>fully connected layer</strong> with 7 outputs ; one for each lesion class. The final activation is softmax, so it gives a probability for each class.</p><p>This way, the model shares the same backbone but learns both tasks in parallel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YHqUGibBxPRqC2Xt4iNpIQ.jpeg" /><figcaption>Model Architecture</figcaption></figure><h4>How I Preprocessed the Data</h4><p>Before feeding images into the model, I had to clean things up.</p><p>Here’s what I did:</p><h4>Resized everything</h4><p>All images and masks were resized to <strong>224x224 pixels</strong>. This keeps things consistent and fits well with ResNet-18 input size.</p><h4>Normalized pixel values</h4><p>I scaled the image pixel values to be between <strong>0 and 1</strong>. This helps the model train faster and keeps things stable.</p><h4>Encoded the labels</h4><p>The diagnosis labels (like MEL, NV, etc.) were converted into numbers (0 to 6). This way, the classification head could learn them as a <strong>multiclass problem</strong>.</p><h4>Binarized the masks</h4><p>The segmentation masks were converted to binary:</p><ul><li>1 for lesion</li><li>0 for everything else</li></ul><p>This helped the model focus only on the actual lesion area during training.</p><h4>Split the dataset</h4><p>I divided the dataset into three parts:</p><ul><li><strong>70% for training</strong></li><li><strong>15% for validation</strong></li><li><strong>15% for testing</strong></li></ul><p>I also made sure the class distribution stayed balanced across all three sets. That way, the model didn’t overfit on one type of lesion.</p><h4>Training the Model: One Loop, Two Losses</h4><p>Since this model does two things , <strong>segment</strong> and <strong>classify</strong> ; I needed to train it to learn both at once. That meant building a training loop that could handle both tasks in one go.</p><h4>Loss Functions</h4><p>I used a <strong>combined loss</strong> to train the model. Basically, it adds up two different losses:</p><ul><li><strong>Binary Cross Entropy (BCE)</strong> for segmentation</li><li><strong>Categorical Cross Entropy (CE)</strong> for classification</li></ul><p>So the total loss looked like this:</p><pre>Total Loss = α * BCE + β * CE</pre><p>I set both α and β to <strong>1</strong>, giving equal weight to both tasks. This way, the model didn’t favor one task over the other.</p><h4>Training Setup</h4><ul><li><strong>Framework</strong>: PyTorch</li><li><strong>Optimizer</strong>: Adam</li><li><strong>Learning rate</strong>: 1e-4</li><li><strong>Batch size</strong>: 16</li><li><strong>Epochs</strong>: 5</li><li><strong>Environment</strong>: Google Colab (with a free T4 GPU)</li></ul><h4>Multitask Training Loop</h4><p>For each batch:</p><ol><li>The model takes one input image.</li><li>It predicts both the segmentation mask and the class label.</li><li>Losses for both are calculated.</li><li>The combined loss is backpropagated.</li><li>Weights get updated.</li></ol><p>To avoid errors, I matched batch sizes across loaders and reset iterators every epoch. It worked smoothly after that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rt8bnUdVfp3ViTTtepxrpw.png" /><figcaption>Training Curves</figcaption></figure><h4>How Well Did It Perform?</h4><p>After 5 epochs, the model gave solid results on both tasks.</p><h4>Classification Accuracy</h4><p>It reached around <strong>67% accuracy</strong> when predicting the lesion type across seven classes. That may not sound huge, but keep in mind that some of the classes are hard to tell apart, and the dataset is imbalanced.</p><p>Common lesion types like <strong>NV</strong> and <strong>BKL</strong> were classified more accurately. Rare ones like <strong>DF</strong> or <strong>VASC</strong> were harder. That’s expected when there’s less training data for them.</p><h4>Segmentation Dice Score</h4><p>The model got a <strong>Dice score of 0.91</strong> on the segmentation task. That’s very good. It means the predicted masks matched the ground truth quite closely.</p><p>The model could outline lesion boundaries with high accuracy, even in tricky cases with fuzzy edges or low contrast.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-NrVnzkr9pWElhBS268saA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ufpPH2-_-gy5zhGhZPHp4Q.png" /><figcaption>Model’s Prediction</figcaption></figure><h4>Why Multitask Learning Helped</h4><p>At first, I thought training for both segmentation and classification in one model might confuse it. But the opposite happened.</p><p>Here’s why multitask learning helped:</p><h4>Shared Features, Better Learning</h4><p>Both tasks use the same input , the skin image. So, letting the model learn <strong>shared features</strong> from one encoder gave it more context.<br> Segmentation forced the model to understand <em>where</em> the lesion is.<br> Classification helped it learn <em>what</em> it is.</p><p>This combo made the encoder stronger overall.</p><h4>Faster, Smaller, Smarter</h4><p>Instead of running two separate models, this one does everything in one go. That means:</p><ul><li>Less memory use</li><li>Faster training</li><li>Easier to deploy</li></ul><p>On Colab’s free GPU, it handled both tasks just fine. Even with a batch size of 16, memory wasn’t an issue.</p><h4>Challenges I Faced (and Fixed)</h4><p>Building a multitask model sounds nice in theory. In practice, I ran into a few issues that I had to solve on the fly.</p><h4>1. ️Loss Balance Was Tricky</h4><p>At first, one loss would dominate the other. Sometimes segmentation loss dropped fast while classification stayed stuck. I fixed it by giving <strong>equal weight</strong> to both losses (α = β = 1). That brought balance and kept both tasks learning together.</p><h4>2. Mismatch Between Loaders</h4><p>The segmentation and classification datasets weren’t always aligned. Batch sizes didn’t match perfectly. To fix this, I wrote a sync step that:</p><ul><li>Truncated the larger batch</li><li>Reset iterators at every epoch that stopped shape errors during training.</li></ul><h4>3. Handling Rare Classes</h4><p>Some lesion types had very few samples (like DF and VASC). The model struggled with them. I didn’t fix this completely, but I plan to try <strong>class-weighted loss</strong> or <strong>data augmentation</strong> next time.</p><h4>4. Model Got Complex, Fast</h4><p>With two heads, skip connections, and custom loss ; the model grew big quickly. Managing GPU memory was key. I kept batch sizes low and used efficient layers to stay within limits on Colab.</p><p>These challenges taught me a lot. Most of them were <strong>not coding errors</strong>, but more about <strong>data handling</strong> and <strong>model stability</strong>. That’s where real deep learning work happens.</p><h4>Final Thoughts + What’s Next</h4><p>This project showed me what multitask deep learning is really capable of. With one shared model, I was able to <strong>segment skin lesions</strong> and <strong>predict their class</strong> and it worked well on both fronts.</p><p>Here’s what I liked:</p><ul><li>The model reached a <strong>Dice score of 0.91</strong>, which means it could outline lesions very accurately.</li><li>It got around <strong>67% accuracy</strong> on a <strong>7-class classification task</strong>, despite class imbalance and visual similarity.</li></ul><p>That’s not perfect, but it’s a solid start , especially for a single pipeline doing both tasks at once.</p><h4>What I’d Improve Next</h4><p>If I revisit this project, here’s what I’ll try:</p><ul><li>Add <strong>Grad-CAM</strong> to visualize what part of the image led to each prediction</li><li>Use <strong>class weighting</strong> or <strong>oversampling</strong> to improve performance on rare classes</li><li>Try a stronger encoder, like <strong>EfficientNet</strong></li><li>Test on other datasets to check <strong>generalization</strong></li></ul><p>Multitask learning isn’t magic, but when it works, it’s super efficient ; less compute, less memory, and sometimes even better accuracy.</p><p>This was my first deep dive into multitask modeling. Definitely won’t be the last.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1ce2fbad34c4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>