<?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 Nathan Jacob on Medium]]></title>
        <description><![CDATA[Stories by Nathan Jacob on Medium]]></description>
        <link>https://medium.com/@nathanjjacob?source=rss-da16f4eb4c4d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by Nathan Jacob on Medium</title>
            <link>https://medium.com/@nathanjjacob?source=rss-da16f4eb4c4d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 17:40:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nathanjjacob/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[Gifting Behavior as a Common False Positive in RTO Fraud Models]]></title>
            <link>https://medium.com/@nathanjjacob/gifting-behavior-as-a-common-false-positive-in-rto-fraud-models-88f3091de3c8?source=rss-da16f4eb4c4d------2</link>
            <guid isPermaLink="false">https://medium.com/p/88f3091de3c8</guid>
            <category><![CDATA[ecommerce]]></category>
            <category><![CDATA[mls]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[fraud-prevention]]></category>
            <category><![CDATA[fraud-detection]]></category>
            <dc:creator><![CDATA[Nathan Jacob]]></dc:creator>
            <pubDate>Sat, 28 Feb 2026 09:46:48 GMT</pubDate>
            <atom:updated>2026-02-28T09:46:48.287Z</atom:updated>
            <content:encoded><![CDATA[<p>So let’s say you want to order a gift for a friend, you log onto Amazon, select the gift, click buy now and add your friend’s address with your name and a note saying — <strong>Happy Birthday, may this order actually reach you and not get stolen by the 3PL network :p</strong></p><p>So the order reached your friends locality, now there are a few possible scenarios:</p><ul><li>The delivery guy rings the door bell of a neighbour</li><li>The delivery guy rings the right door bell, but your friend doesn’t answer it, perhaps a relative who doesn’t know you and thinks it’s delivered to the wrong address</li><li>Rings a door bell but no one answers</li><li>The delivery guy never rings any door bell</li></ul><p>In all these cases, the order is never really delivered but since the delivery guy is in the locality, he is not restricted by a geo-fence and has full freedom to mark the delivery as delivered. (For those of you that do not know what a geo-fence is, it’s simply a virtual barrier that uses GPS tracking to make sure the delivery agent marks the order as delivered in the vicinity of the user’s address, any attempt outside the fence and the request will not be accepted. This is done to prevent fraud that can happen within the Last Mile hub.)</p><p>Now, the if the delivery partner is malicious, he could go through any of the above scenarios and by-pass the geo-fence check and steal the package.</p><p>Well, this has happened to me twice personally so, it’s certainly not a one off problem.</p><p>On the contrary, It’s equally likely that the parcel was actually delivered but the user claims it was never delivered, right?</p><p><strong>So how does an Ecommerce platform keep it’s integrity and penialise the right person?</strong></p><h3>Distinguishing Legitimate Gifting from Malicious RTO Exploitation</h3><p>To maintain integrity in an e-commerce ecosystem, the platform must balance trust between customers, sellers, and third-party logistics (3PL) providers. Most RTO (Return to Origin) fraud detection models rely heavily on a combination of geo-fencing, delivery timestamps, and basic customer feedback loops. However, these mechanisms create significant blind spots, especially in gifting scenarios, where the recipient isn’t the account holder and may not be expecting the package. This leads to false positives — flagging genuine non-deliveries as fraud — or worse, allowing actual fraud to slip through.</p><p>In a typical flow, once a delivery agent marks an order as “delivered” within the geo-fence (usually a 100–500 meter radius around the address), The system logs it as successful. If the customer (or in this case, the recipient) disputes it and initiates a refund or replacement process, but only after a cursory investigation. This often involves checking the agent’s GPS data and any optional photo uploads. The problem? GPS can be spoofed using apps or VPNs, and photos can be faked or recycled from previous deliveries. Moreover, 3PL partners like Blue Dart, Delhivery have varying levels of oversight, leading to inconsistent enforcement.</p><p>From my personal encounters (and countless Reddit threads and Twitter complaints), this system disproportionately penalizes honest customers. If a gift doesn’t reach the friend, due to a malicious agent — the sender might get blacklisted for “excessive refunds,” while the 3PL escapes with minimal repercussions. Conversely, scammers exploit this by placing bulk orders to fake addresses in their locality, marking them delivered, and reselling the goods on platforms like OLX or Facebook Marketplace. RTO fraud models, powered by machine learning, flag patterns like high RTO rates per PIN code or user, but they often misclassify gifting as suspicious because the delivery address differs from the billing one, triggering unnecessary holds or cancellations.</p><h3>Exposing the Gaps in Amazon’s Current Model</h3><p>Amazon’s logistics model while able to handle scale is riddled with vulnerabilities that enable RTO fraud:</p><ol><li><strong>Over-Reliance on Geo-Fencing Without Multi-Factor Verification</strong>: Geo-fencing ensures the agent is nearby, but it doesn’t confirm actual handover. Agents can loiter in the area, mark the delivery, and abscond with the package. There’s no mandatory real-time proof like biometric scans or recipient OTPs for all orders — only for high-value ones, leaving mid-tier items (e.g., electronics under $100) exposed.</li><li><strong>Decoupled Accountability Between Amazon and 3PLs</strong>: Amazon outsources last-mile delivery to 3PLs, but contracts often lack stringent SLAs (Service Level Agreements) for fraud prevention. 3PLs self-report metrics, and audits are reactive rather than proactive. This creates a principal-agent problem: 3PLs prioritize speed and volume over accuracy to meet incentives, while Amazon bears the refund costs.</li><li><strong>Inadequate Handling of Gifting Scenarios</strong>: Gifting amplifies false positives because the system assumes the recipient is aware and available. No dedicated workflow exists for gifts — e.g., no option to notify the recipient via SMS/email beforehand or require sender confirmation post-delivery. Fraud models treat address mismatches as red flags, but without context, this punishes legitimate users.</li><li><strong>Weak Data Integration and Analytics</strong>: Amazon collects vast data (GPS, timestamps, customer ratings), but integration with 3PL systems is patchy. ML models detect anomalies, but they lack granularity for edge cases like gifting. For instance, if a user has multiple RTOs from different addresses, it’s flagged as fraud without cross-referencing purchase history or social signals.</li><li><strong>Economic Incentives Misaligned</strong>: Delivery agents earn per delivery, not per successful handover, encouraging shortcuts. RTOs cost Ecommerce platforms dearly (estimated at 5–10% of orders in India), but penalties on 3PLs are often capped, leading to repeated offenses.</li></ol><p>These gaps aren’t just theoretical — reports from sources like the Indian Consumer Complaints Forum and internal leaks suggest RTO fraud costs e-commerce giants billions annually, with ecommerce platforms seeing spikes during festive seasons.</p><h3>How Ecom-Platforms Should Revamp Its Model to Mitigate RTO Risks</h3><p>To close these loopholes, we need a multi-layered, tech-driven overhaul that shifts from reactive detection to preventive design. Here’s a technically sound blueprint, drawing from best practices in logistics (e.g., UPS’s ORION system) and fraud prevention (e.g., banking’s KYC):</p><ol><li><strong>Enhance Delivery Verification with Multi-Factor Authentication (MFA)</strong>:</li></ol><ul><li>Mandate OTP-based confirmation for all deliveries, sent to the recipient’s phone (provided optionally during checkout for gifts). For gifting, allow the sender to share a secondary contact or generate a QR code for the recipient to scan upon receipt.</li><li>Integrate computer vision AI: Require agents to upload a real-time photo of the handover, analyzed by ML models to verify faces, addresses, and timestamps. Spoofing attempts could trigger immediate agent suspension.</li><li>Upgrade geo-fencing to “smart fencing” using IoT beacons or Bluetooth Low Energy (BLE) tags in packages, ensuring the agent’s device pings the package at the exact doorstep.</li></ul><p><strong>1. Introduce a Dedicated Gifting Workflow</strong>:</p><ul><li>Create a “Gift Mode” at checkout: This flags the order as a surprise, auto-sends a neutral notification to the recipient (e.g., “A package is en route — expect it soon”) without spoiling the surprise. Post-delivery, prompt the sender for confirmation via app push (e.g., “Did your friend receive it?”).</li><li>Adjust fraud models to whitelist gifting patterns: Use graph-based ML (e.g., via Neo4j or Amazon Neptune) to map user networks — e.g., if the recipient’s address links to the sender’s past contacts or social data (with consent), reduce suspicion scores.</li></ul><p><strong>2. Strengthen 3PL Partnerships with Blockchain and Auditing</strong>:</p><ul><li>Implement blockchain for immutable delivery logs: Each step (pickup, transit, delivery) is recorded on a shared ledger, verifiable by Amazon, 3PLs, and even customers. This prevents tampering and enables smart contracts for automatic penalties (e.g., deduct agent pay if RTO exceeds 2%).</li><li>Shift to performance-based incentives: Pay 3PLs based on verified success rates, using AI audits that randomly sample deliveries with drone footage or customer surveys. Integrate APIs for real-time data sharing, flagging high-risk agents via predictive analytics.</li></ul><p><strong>3. Leverage Advanced ML for Proactive Fraud Detection</strong>:</p><ul><li>Build hybrid models combining supervised learning (e.g., XGBoost for pattern recognition) with unsupervised anomaly detection (e.g., autoencoders to spot unusual RTO clusters by PIN code or agent ID).</li><li>Incorporate external signals: Partner with credit bureaus or use federated learning to cross-reference user behavior across platforms, distinguishing genuine gifters from fraud rings.</li><li>For RTO disputes, use NLP to analyze customer claims and agent notes, escalating to human review only for edge cases.</li></ul><p><strong>4. Customer Education and Transparency Tools</strong>:</p><ul><li>Launch an “Order Integrity Dashboard” in the app, showing real-time tracking with geo-data and proof uploads. This empowers users to flag issues early.</li><li>Educate via in-app tutorials: Explain geo-fencing and how to avoid common pitfalls, like providing alternate contacts for gifts.</li></ul><p>Implementing these changes would require upfront investment — perhaps 1–2% of logistics spend — but the ROI is massive: Reduced RTO rates could save Ecom-platforms hundreds of millions, while boosting customer trust. Competitors like Flipkart and Meesho are already experimenting with AI-verified deliveries; Amazon risks falling behind if it doesn’t evolve.</p><p>In closing, RTO fraud isn’t just a logistics glitch — it’s a systemic flaw eroding e-commerce’s foundation. By addressing these gaps with tech-forward solutions, Ecom-platforms can protect honest users (like gifters) and penalize the real culprits. Until then, next time you send a gift, maybe add a tracker yourself. What are your RTO horror stories? Share in the comments — let’s crowdsource more fixes!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=88f3091de3c8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to build a Logo Detection + Recognition system (at scale)]]></title>
            <link>https://medium.com/@nathanjjacob/how-to-build-a-logo-detection-recognition-system-at-scale-c2b094ae4fd2?source=rss-da16f4eb4c4d------2</link>
            <guid isPermaLink="false">https://medium.com/p/c2b094ae4fd2</guid>
            <category><![CDATA[logo-detection]]></category>
            <category><![CDATA[brandinfringement]]></category>
            <category><![CDATA[object-detection]]></category>
            <category><![CDATA[counterfiet]]></category>
            <dc:creator><![CDATA[Nathan Jacob]]></dc:creator>
            <pubDate>Thu, 03 Aug 2023 13:12:51 GMT</pubDate>
            <atom:updated>2023-08-03T13:12:51.476Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi folks,<br>I’m Nathan and in this blog I’ll walk you down the steps I took to create a production level logo detection + recognition model. My use case was to help Meesho (India’s fastest🚀 growing E-commerce company with over 500k products uploaded everyday), to detect Brand Infringements on catalog images uploaded on the platform.</p><p>This project realised significant gains in terms of reducing brand counterfeits compared to the existing models. The project stemmed from an earlier survey suggested that over 80% of the counterfeits that were missed by the older models and could be captured by some sort of Logo based model.</p><p>So as an initiative, the task at hand was to build a highly accurate system that detects if an image has a logo from a select list of brand logos. Here is how I approached the problem in 2 steps:</p><ol><li><strong>Logo Detection:</strong> So I trained a model that can create a bounding box on an image around potential logos, a universal logo detection system if you will.</li><li><strong>Logo Recognition:</strong> I then made a Logo recognition system (using image similarity techniques) to label the bounding boxes(bbox) I created from step 1.</li></ol><h3>So breaking down step 1, Logo Detection:</h3><ul><li>I Ran YoloV7 Model on an open source <a href="https://github.com/Wangjing1551/LogoDet-3K-Dataset">dataset</a> with over 3K logos (150k images and 200k annotations) to detect Logos. This was to build a universal logo detector (however, false positives are expected, since the model will detect any part of an image it thinks is a logo).</li><li>This model gave mAP@0.5 of 83.6% after training for 20 epochs, (mAP0.5 is the benchmark metric for any object detection algorithm)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*auoF7nW2xsOfqgOy.png" /></figure><p>And these are some of the results after applying the bbox:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*9tupQ3rb3DF_PyeH2lKa_A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*BZ8oHPOI49GGwy53QKiPBA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/1*ICv-lIE0P40GnrXeDvZbOw.png" /></figure><p>Pretty cool huh?</p><p>It’s also interesting to note that none of these brands were part of the training dataset, the model assumes that these could be potential logos and puts a bbox around them.</p><blockquote><strong>Try it out for yourself on my Hugging face repo</strong>:<br><a href="https://huggingface.co/spaces/nathanjc/Logo_detection_YoloV7">https://huggingface.co/spaces/nathanjc/Logo_detection_YoloV7</a><br>(You can find the pre-trained model here as well!)</blockquote><p>But as you can see in the 2nd image, there seems to be some false positives that are also detected as potential logos, how do we solve for this? Also how do we label a bbox to a certain brand?<br>That’s where step 2 kicks in!</p><h3>Breaking down step 2, Logo Recognition:</h3><ul><li>For this part I created a small dataset of images with logos on them and sorted them by brand/class into separate folders. (Even a few images will do the job, but more the merrier)</li><li>Then I applied the Logo detection model on these images to create bboxes and saved the cut-out “logos” as saved them in, “Logo_dataset_RAW” folder (again separated by brand/class). This folder may have False “Logos” and needs to be cleaned up.</li><li>Once you have a cleaned up Logo Dataset for the brands/classes you require, you need to save it in a folder. This will be your ground truth for Logo Recognition.</li></ul><p>Cool, now you have a Logo Dataset, but how do you find if an image has logos similar to the ones in the dataset?</p><p>There can be many approaches to this problem, if you have a large enough Logo dataset you could build an Image classifier of sorts or maybe adopt a triplet network but the method that I adopted here was using an Image similarity approach (using BEiT image embeddings) with:</p><ol><li>cosine similarity, coupled with</li><li>SVM’s(Support Vector Machines) similarity</li></ol><p>The Logo Recognition task can be done using the following steps:</p><p><strong>Cosine similarity :</strong></p><ul><li>I created BEiT Image Embeddings(you can find how to create them <a href="https://huggingface.co/docs/transformers/model_doc/beit">here</a>) of the Logo dataset, let’s call this <em>vector X</em> (shape will be (n,768) where n is the number of images in the Logo dataset)</li><li>I passed the image in question through the Logo detection model and got the cutout logos, created Image Embeddings of these cutout images also, calling this <em>vector Y</em> (shape will be (m,768) where m is the number of images/bboxes created by the Logo detection model on that image)</li><li>Then I measured the cosine similarity(you could experiment with other ones too) between all m*n images and saw which one gave the maximum similarity score. (You could apply FAISS indexing here to make it faster although it won’t be 100% accurate, but usually will do the job)</li><li>Then I applied some thresholding logic using the cosine similarity score to ensure that the score is high enough. If it passes the threshold, I simply label it as the same class I calculated the similarity score against. (For ease you can use something between 0.8–0.9). Now you have a binary decision using the cosine similarity score.</li></ul><p><strong>SVM similarity :</strong></p><ul><li>Next I fit a SVM with <em>vector X</em> (shape will be (n,768)) and a encoded version <em>vector Y</em> (shape will be (m,768)) using sklearn’s LabelEncoder using svm.fit(X,Y)</li><li>After that, I predict the the encoded brand label using svm.predict() and also get my similarity score using svm.decision_function()</li><li>I then found which similarity score threshold works best.(For ease you can use any positive value, which works well in most cases). Now you have a binary decision using the SVM similarity score.</li></ul><p><strong>Combining the two:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CjQ08UDcccR1jmlq" /></figure><p>Now that I have the 2 similarity scores, their thresholds, each with their prediction, question is how did I use it?</p><p>Well, this part came from observation and experimentation but I saw that using the intersection of both the positive classes from both the similarity methods resulted in the best f1 scores. While using an intersection may reduce the recall marginally(&lt;1–2% drop), but the precision highly improved(&gt;20–30%). But if you’re going for highest recall and don’t mind precision ~60–70% then you can go for just one of the similarity score decisions i.e cosine score or svm score or maybe even a union of the two.(Have fun experimenting!)</p><h3>And this is how I’m able to point out if a Logo is a Starbucks logo or a Nike logo!!</h3><h4>That’s all folks!</h4><blockquote><em>If you liked the post or have some queries, feel free to connect with me on </em><a href="https://www.linkedin.com/in/nathan-jacob-811399185/"><em>Linkedin</em></a><em> or </em><a href="https://twitter.com/nathanjjacob"><em>Twitter</em></a></blockquote><blockquote>I would like to thank the author of the YoloV7 <a href="https://github.com/WongKinYiu/yolov7">repo</a> for all their contributions to the open source community and in helping make this possible!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c2b094ae4fd2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>