<?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 Wei May Chen on Medium]]></title>
        <description><![CDATA[Stories by Wei May Chen on Medium]]></description>
        <link>https://medium.com/@weimaychen2?source=rss-6a4ae7216ece------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Ef5yOtgtXvKEY123Kz2wVw.jpeg</url>
            <title>Stories by Wei May Chen on Medium</title>
            <link>https://medium.com/@weimaychen2?source=rss-6a4ae7216ece------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 07:22:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@weimaychen2/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[One Mug, Four Papers: Understanding the Agent Harness in LLM Systems]]></title>
            <link>https://medium.com/@weimaychen2/one-mug-four-papers-understanding-the-agent-harness-in-llm-systems-740a7283d4b1?source=rss-6a4ae7216ece------2</link>
            <guid isPermaLink="false">https://medium.com/p/740a7283d4b1</guid>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[agent-harness]]></category>
            <category><![CDATA[harness-engineering]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Wei May Chen]]></dc:creator>
            <pubDate>Sat, 03 Oct 2026 13:27:35 GMT</pubDate>
            <atom:updated>2026-10-03T13:27:35.489Z</atom:updated>
            <content:encoded><![CDATA[<h4>How the field is moving from building ever-more-elaborate harnesses toward minimising, symmetrising, and internalising them</h4><p>We’re three-quarters into 2026. If you’re still trying to wrap your head around harnesses in Agentic AI, you are not alone.</p><p>In this article, we’ll break down emerging harness concepts in LLM agent systems based on 4 recent papers:</p><ul><li><strong>Code as Agent Harness</strong> — Ning et al. (UIUC, Meta, Stanford), May 2026 (<a href="https://arxiv.org/abs/2605.18747">arXiv:2605.18747</a>)</li><li><strong>Harness as a Language: A Minimalist Agent Framework With Maximal Expressivity</strong> — Li et al. (MIT CSAIL), September 2026 (<a href="https://arxiv.org/abs/2609.26891">arXiv:2609.26891</a>)</li><li><strong>EnvHarness: Awakening Static Worlds for Agent Learning</strong> — Huang et al. (WashU, Google Cloud AI Research), August 2026 (<a href="https://arxiv.org/abs/2608.19880">arXiv:2608.19880</a>)</li><li><strong>Harness-Zero: Harness Distillation via Agent-as-Harness</strong> — Ye et al. (Peking University, Google, HKUST), September 2026 (<a href="https://arxiv.org/abs/2609.24974">arXiv:2609.24974</a>)</li></ul><p>The papers revolve around the concept of an <strong>agent harness</strong>, the software layer that wraps a language model with tools, memory, execution loops and feedback channels in order to turn stateless models into a functional agent. However, each paper takes the harness concept in a different direction.</p><h4>An Agent in a Simulated Household</h4><p>To keep this article engaging, let’s use a concrete example to ground the concepts across the different papers. The ALFWorld environment: a text-based household simulation.</p><p><strong>The setup:</strong> An LLM agent is placed in a virtual kitchen. Its task: “put a clean mug on the desk.”</p><p>The environment exposes a text interface. The agent can:</p><ol><li>Observe its surroundings (“You see a mug 1, a countertop, a drawer 1, a sink…”),</li><li>Take actions (“take mug 1”, “go to sink”, “clean mug 1”, “put mug 1 on desk”) and</li><li>Receives success/failure feedback.</li></ol><p>The mug starts on the counter, dirty.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jK92nyMvIENjE9Yh" /><figcaption>Photo by <a href="https://unsplash.com/@mharrisonphotography?utm_source=medium&amp;utm_medium=referral">Megs Harrison</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>Code as Agent Harness; Code is the Substrate through which Every Part of the Agent’s Operation Flows.</h4><p><strong>Code as Agent Harness</strong> (Ning et al., May 2026) is a comprehensive survey that establishes the foundational conceptual framework which presents that code is not only an output that LLMs generate but also the operational substrate through which agents reason, act and verify progress. (The other 3 papers can be read as specific responses to challenges identified by the survey including open problems around self-evolving harnesses, harness optimisation and the tension between specialised and general-purpose harnesses.)</p><p>The survey is presented in 3 connected layers:</p><ol><li><strong>Harness Interface</strong> where code serves as: (1)<strong> </strong>a <strong>reasoning substrate </strong>externalizing computation into executable programs, (2) an<strong> action interface</strong> translating intent into tool calls, robot commands or GUI actions and (3) an <strong>environment model</strong> tracking program states, repositories, execution traces, etc.</li><li><strong>Harness Mechanisms </strong>include:</li></ol><ul><li>planning — decomposition, structural grounding, search</li><li>memory — working, semantic, experiential, long-term</li><li>tool use — function-oriented, environment-interaction, verification-driven</li><li>feedback-driven control — debugging loops, test-based verification, human-in-loop</li></ul><p>3. <strong>Scaling the Harness</strong> which refers to multi-agent orchestration where shared code artifacts (repositories, tests, traces) serve as the common workspace for coordination, review, and collective verification across roles like manager, planner, coder, reviewer, and tester.</p><p>In the context of the task of putting a clean mug on the desk, instead of reasoning in nautral language (e.g. ‘I should find the mug, then clean it, then …’), the agent writes the executable code that externalises its reasoning, demonstrating <strong>Code for reasoning</strong>:</p><pre>plan = [<br>    &quot;find object: mug&quot;,<br>    &quot;navigate to: sink&quot;,<br>    &quot;clean: mug&quot;,<br>    &quot;navigate to: desk&quot;,<br>    &quot;place: mug on desk&quot;<br>]<br>for step in plan:<br>    result = execute(step)<br>    if not result.success:<br>        plan = replan(result.error)</pre><p>The harness can execute this, check intermediate states, and feed results back. If the agent&#39;s natural-language reasoning were wrong (&quot;clean the desk, then put the mug on it&quot;), the code execution would catch the error at runtime.</p><p><strong>Code for acting:</strong> The agent&#39;s actions are not free-text decisions but executable commands grounded in the environment&#39;s API. &quot;take mug 1&quot; is a function call with a typed signature. The harness enforces that only valid actions reach the environment.</p><p><strong>Code for environment modeling:</strong> The environment&#39;s state (where objects are, what&#39;s clean, what&#39;s open) is represented as program state the agent can inspect. The agent can query &quot;where is mug 1?&quot; and get a structured answer. Execution traces (the sequence of actions and observations) persist as inspectable logs, so the agent can review what it already tried.</p><p>By centering code, the harness makes reasoning <strong>executable</strong> (you can run it and check), <strong>inspectable</strong> (intermediate states are visible), and <strong>stateful</strong> (progress persists across steps rather than being lost in a text buffer).</p><h4>Harness as a Language Questions How Much Harness Is Needed by Pushing Expressivity into the Loop Itself</h4><p><strong>Harness as a Language</strong> (Li et al., September 2026) takes a more language-centric approach, advocating for minimalist harness. It questions the need for a rich and elaborate infrastructure of specialised harness mechanisms (comprising memory systems, planning modules, tool registries, verification loops) if the agent loop itself is expressive enough.</p><p>It proposes <strong>JAZ</strong>, a framework whose core primitive is an ‘invoke’ function whose implementation is generated by an LLM at call time.</p><p>The key insight presented by this paper is that many capabilities which traditionally require specialised external harness components (e.g. long-term memory systems, self-improvement loops) can emerge from a minimal harness that is little more than the agent loop itself provided the agent loop is sufficiently expressive.</p><p>The ‘invoke’ function’s defining properties include that:</p><p>(1) recursive subagents are the default and</p><p>(2) the LLM sees everything (all inputs and the REPL) as variables in the code environment.</p><p>The second property is what differentiates Harness as a Language from prior CodeAct-style agents which show history as messages, but do not let the agent programmatically manipulate it.</p><p>Together, these enable long-horizon memory and self-improvement to emerge from prompting alone, without harness mechanisms.</p><p>For our mug task, the top-level call might be:</p><pre>invoke(<br>    task=&quot;Put a clean mug on the desk.&quot;,<br>    env=environment_interface,  # the ALFWorld API<br>)</pre><p>The LLM fills in the body:</p><pre>def invoke(task, env):<br>    # Search for the mug<br>    mug_location = invoke(<br>        task=&quot;Find the mug in this environment.&quot;,<br>        env=env,<br>        rooms_seen=__history__,  # history is a variable!<br>    )<br>    # Navigate and pick up<br>    env.action(&quot;go to&quot;, mug_location)<br>    env.action(&quot;take&quot;, &quot;mug 1&quot;)<br>    # Clean it<br>    env.action(&quot;go to&quot;, &quot;sink&quot;)<br>    env.action(&quot;clean&quot;, &quot;mug 1&quot;)<br>    # Place it<br>    env.action(&quot;go to&quot;, &quot;desk&quot;)<br>    env.action(&quot;put&quot;, &quot;mug 1&quot;, &quot;on&quot;, &quot;desk&quot;)<br>    return env.check_success()</pre><p>Notice what happens here. The first sub-’invoke’ (&quot;find the mug&quot;) is a recursive subagent. The __history__ variable gives that subagent access to everything tried so far — no external memory system needed. If the agent&#39;s context window fills up (say the environment is large and the agent has explored many rooms), it can delegate the remainder to a sub-invoke while passing the full history by reference:</p><pre>return invoke(<br>    task=&quot;Continue: put clean mug on desk&quot;,<br>    env=env,<br>    prev_history=globals().get(&quot;prev_history&quot;, []) + __history__,<br>    progress_summary=&quot;Found mug in drawer 1. Picked it up. Need to clean and place.&quot;,<br>)</pre><h4>EnvHarness Extends the Harness Concept to Complete the Symmetry of the Agent-Environment Loop.</h4><p><strong>EnvHarness</strong> (Huang et al., August 2026) flips the harness concept to the other side of agent-environment interaction to answer the concern about environment quality being a bottleneck for agent learning. It invites readers to consider <em>harnessing the environment</em> instead of harnessing the agent, which is what most of the field seems to be focusing on so far.</p><p>Conventionally, an agent harness wraps a frozen LLM to make it more capable. Innovatively, EnvHarness adds customisability to a frozen environment. It wraps a frozen (static) environment to make it more adaptive for learning as a solution to the problem of hand-built environments being static, hence (1) unable to adapt to an agent’s weakness and additionally, (2) being bottleneck to the agent’s learning because once the agent solves a static environment, it has nothing left to teach.</p><p>EnvHarness introduces 3 plug-in components that wrap an environment through its standard interface:</p><ol><li><strong>Stage</strong>: modifies the internal state (e.g. hiding objects to force search behaviour, or pre-completing subgoals to shorten tasks)</li><li><strong>Contract</strong>: rewrites interaction by filtering actions, augmenting/masking observations or enforcing preconditions (e.g., blocking “clean mug” until the agent is holding it).</li><li><strong>Chain: </strong>connects multiple environments into a composite episode (e.g., appending a follow-up task to test goal persistence).</li></ol><p>The automation loop comes from <strong>EnvRigger</strong>, which treats the policy as a black box: it observes rollout trajectories, diagnoses weaknesses, synthesizes candidate harness components, and validates them via fresh rollouts (a four-stage Observe-Diagnose-Write-Validate loop). This echoes the Code as Agent Harness survey’s discussion about self-evolving harnesses, but applied to the environment rather than the agent.</p><p>In the task of putting a clean mug on the desk, the problem with having a static environrment is that the mug always starts on the counter, and once the agent learns to solve it, there’s nothing more to learn and the environment doesn’t adapt to the agent’s specific weakness. EnvHarness changes this. It wraps the frozen environment with plug-in components, and without touching its underlying logic or verifier:</p><p><strong>Stage: change the starting point.</strong> Instead of the mug sitting on the counter in plain sight, a Stage applies a sequence of actions to the initial state before the agent starts:</p><pre>reset() → [take mug 1, open drawer 1, put mug 1 in drawer 1, close drawer 1]</pre><p>Now the agent starts with the mug hidden in a closed drawer. It must learn to <strong>search, </strong>which is a skill the original environment never forced. Conversely, another Stage could pre-clean the mug, leaving only the placement step, to scaffold a struggling agent.</p><p><strong>Contract: rewrite the interaction.</strong> A Contract transforms the action, observation, or transition spaces. For example, the environment normally lets the agent say “clean mug 1” at any time. A Contract adds a precondition:</p><pre>def step(action):<br>    if action == &quot;clean mug 1&quot; and &quot;holding mug 1&quot; not in state:<br>        return &quot;You can&#39;t clean something you&#39;re not holding.&quot;<br>    return original_step(action)</pre><p>This forces the agent to learn the proper sequence: pick up before cleaning. Another Contract could truncate observations to two sentences, forcing the agent to build a spatial model across multiple steps rather than reading everything at once.</p><p><strong>Chain — extend the episode.</strong> A Chain connects this environment to a second one:</p><pre>g(E_mug, E_potato) = &quot;put clean mug on desk&quot; THEN &quot;heat potato and put on countertop&quot;</pre><p>Success requires both tasks. The agent must carry its goal past the point where it would normally stop, thus testing goal persistence.</p><p><strong>EnvRigger automates this.</strong> It runs the agent, observes it failing (e.g., repeatedly trying to “clean mug 1” without picking it up), diagnoses the weakness (“agent doesn’t understand object-grasping preconditions”), writes a Contract that blocks the shortcut and validates with fresh rollouts.</p><blockquote>The loop is: Observe → Diagnose → Write → Validate.</blockquote><p>The analogy to the agent harness: an agent harness wraps a frozen LLM with tools and memory. EnvHarness wraps a frozen environment with stages, contracts, and chains. Both add capability <em>externally</em>, without modifying the core system.</p><h4>Harness-Zero: Harness Distillation for Internalising Desired Useful Domain-Specific Behaviour into Model Weights</h4><p><strong>Harness-Zero</strong> (Ye et al., September 2026) addresses the deployment problem of harnesses. Practical tension exists between specialised and shared harnesses because of 2 main reasons:</p><ol><li>Harness optimisation improves external scaffolding rather than the model itself and</li><li>Maintaining many specialised harnesses is costly.</li></ol><p>The deployment problem of harnesses goes like this: optimised harnesses improve agent performance, but those gains remain tied to the specific harness at deployment time. And since what constitutes the ‘best’ harness varies across different domains, instances and models, a general-purpose agent must either settle for (1) a suboptimal shared harness or (2) manage a growing collection of specialised harnesses.</p><p>The proposed solution to this problem is a <strong>harness distillation</strong> approach which internalises harness-induced behaviours into the model weights so the specialised harness can be discarded. Specifically, agent harness distillation involves first using an optimised harness as training-time guidance and then transferring the behaviours it induces into model weights so that the specialised harness can be removed at deployment.</p><p>Its key innovation is the introduction of ‘agent-as-harness’ as an alternative to directly mounting the evolved harness around the student (which constitutes ‘code-as-harness’). By having a separate ‘harnessing agent’ which reviews each student proposal before execution, correcting the student when needed, using a private reference harness adapted from the evolved one, harness guidance is essentially translated into executable supervision in the student’s native action space.</p><p>What <strong>agent-as-harness </strong>looks like in the mug example:</p><p><strong>Step 1: Evolve and adapt.</strong> The specialized harness h* is adapted into a private reference harness K for a “harnessing agent.” The skill “search drawers first” becomes review guidance: “warn if the student tries to clean without searching.” The middleware rule becomes a review-time check rather than a runtime enforcement.</p><p><strong>Step 2: Trajectory collection.</strong> The student agent runs under the minimal harness h. At each turn, it proposes an action. The harnessing agent reviews it using K:</p><pre>Student proposes: &quot;clean mug 1&quot;<br>Harnessing agent reviews (using K): <br>  - K says: agent must be holding the object before cleaning<br>  - Student is not holding mug 1<br>  - Decision: REPLACE<br>  - Correction: &quot;take mug 1&quot; → then &quot;clean mug 1&quot;</pre><p>The corrected action is what actually executes. The student sees only the accepted response and its result — the review remains private.</p><pre>Turn 0: Student: &quot;go to counter&quot; → PASS (sound proposal)<br>Turn 1: Student: &quot;take mug 1&quot; → PASS<br>Turn 2: Student: &quot;clean mug 1&quot; → PASS (now holding it)<br>Turn 3: Student: &quot;put mug 1 on desk&quot; → PASS → Success!</pre><p>But if the student had proposed cleaning before taking:</p><pre>Turn 1: Student: &quot;clean mug 1&quot; → REPLACE → &quot;take mug 1, then clean mug 1&quot;</pre><p><strong>Step 3: Train and deploy.</strong> The accepted trajectories (including corrections) become SFT training data. The student is fine-tuned on them. After training, the distilled model <strong>knows</strong> to take before clean — not because middleware enforces it, but because the behavior is now in the weights. At deployment, you run the student under the minimal harness h alone. No h*, no K, no harnessing agent.</p><h4>Conclusion</h4><p>We’ve seen what the different harness concepts do to the mug task:</p><ol><li>In <strong>Code as Agent Harness, </strong>code structures reasoning, actions and state tracking. Intelligence lives in the code artifacts that are created and executed by the agent.</li><li><strong>EnvHarness </strong>wraps the environment: hides the mug, enforces preconditions, chains tasks. Intelligence lives in the environment-wrapping components (Stage, Contract, Chain)</li><li><strong>Harness as a Language</strong> replaces the harness with <em>invoke,</em> in which ercursive subagents find the mug and history is a variable<strong>. </strong>In this paradigm, intelligence lives in the agent loop itself and with no external systems.</li><li>With <strong>Harness-Zero, </strong>a harnessing agent corrects the student (‘take before clean’), then the behaviour is distilled into weights. Intelligence here lives in the model parameters, and the harness is removed at deployment.</li></ol><p>Collectively, these papers suggest that the field is moving from building ever-more-elaborate harnesses toward understanding when harnesses can be minimised, symmetrised or internalised.</p><h3>References</h3><ol><li>Ning, X., Tieu, K., Fu, D., Wei, T., et al. (2026). <em>Code as Agent Harness: Toward Executable, Verifiable, and Stateful Agent Systems.</em> arXiv:2605.18747. <a href="https://arxiv.org/abs/2605.18747">https://arxiv.org/abs/2605.18747</a> · Code: <a href="https://github.com/YennNing/Awesome-Code-as-Agent-Harness-Papers">github.com/YennNing/Awesome-Code-as-Agent-Harness-Papers</a></li><li>Li, Z., Liu, J., Vukelic, M., et al. (2026). <em>Harness as a Language: A Minimalist Agent Framework With Maximal Expressivity.</em> arXiv:2609.26891. <a href="https://arxiv.org/abs/2609.26891">https://arxiv.org/abs/2609.26891</a> · Code: <a href="https://github.com/jaz-lang/jaz">github.com/jaz-lang/jaz</a></li><li>Huang, C., Wang, Z., Han, R., et al. (2026). <em>EnvHarness: Awakening Static Worlds for Agent Learning.</em> arXiv:2608.19880. <a href="https://arxiv.org/abs/2608.19880">https://arxiv.org/abs/2608.19880</a> · Code: <a href="https://github.com/google-research/envharness">github.com/google-research/envharness</a> · Project page: <a href="https://www.envharness.com/">envharness.com</a></li><li>Ye, H., Lu, Y., Dong, H., Su, Z., Song, G. (2026). <em>Harness-Zero: Harness Distillation via Agent-as-Harness.</em> arXiv:2609.24974. <a href="https://arxiv.org/abs/2609.24974">https://arxiv.org/abs/2609.24974</a> · Code: <a href="https://github.com/metaevo-ai/harness-zero">github.com/metaevo-ai/harness-zero</a></li><li>Shridhar, M., Yuan, X., Cote, M., Bisk, Y., Chai, C., &amp; Thomason, J. (2020). <em>ALFWorld: Aligning Text and Embodied Environments for Interactive Learning.</em> arXiv:2010.03768. <a href="https://arxiv.org/abs/2010.03768">https://arxiv.org/abs/2010.03768</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=740a7283d4b1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Pixels to Pose: A Minimal, Physically-Grounded Robotics Perception Demo]]></title>
            <link>https://medium.com/@weimaychen2/from-pixels-to-pose-a-minimal-physically-grounded-robotics-perception-demo-f1aab9bf1531?source=rss-6a4ae7216ece------2</link>
            <guid isPermaLink="false">https://medium.com/p/f1aab9bf1531</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[perception-engineering]]></category>
            <category><![CDATA[computer-vision]]></category>
            <dc:creator><![CDATA[Wei May Chen]]></dc:creator>
            <pubDate>Sun, 08 Feb 2026 15:16:38 GMT</pubDate>
            <atom:updated>2026-02-08T15:17:58.302Z</atom:updated>
            <content:encoded><![CDATA[<h4>A minimal, physically-grounded guide to seeing in 3D.</h4><p>The full code can be found in the repo: <a href="https://github.com/solarspaceclouds/perception-demo">https://github.com/solarspaceclouds/perception-demo</a></p><p>Robotic perception often looks magical from the outside: a robot sees an object, understands where it is in 3D, and acts on it. But beneath that magic is a very specific, very physical pipeline.</p><p>This perception demo project is a learning-oriented robotics perception demo that walks through that pipeline end to end, using only the essential ideas needed to go from a raw RGB image of a plant to:</p><ul><li>a <strong>6-DoF object pose</strong> in the camera frame</li><li>a <strong>metric-scale 3D reconstruction</strong></li><li>and <strong>visual verification via reprojection</strong></li></ul><p>The goal here is not to demonstrate state-of-the-art performance, but instead to bring clarity on a particular niche of perception engineering within the broader field of computer vision.</p><p>This demo presents a high-level overview of the perception backbone behind robotic manipulation systems:<br> <strong>sense → segment → reconstruct → localise → verify</strong></p><h3>Why this project exists</h3><p><strong>This demo deliberately sits between:</strong></p><ul><li><strong>the perception projects which are too abstract</strong> with heavy math, no visuals and little intuition and</li><li>the perception projects that are too end-to-end. It’s clear that the deep models work, but it’s not quite clear <em>why they do.</em></li></ul><p>In this project, we see how coordinate frames actually move, how depth becomes geometry, how metric scale is recovered, how poses are represented and exported, and how you <em>verify</em> a pose instead of trusting it blindly.</p><p>Each file is meant to be runnable, visual, and educational.</p><h3>Who this demo is for</h3><p>This project is ideal for:</p><ul><li>robotics students learning perception fundamentals</li><li>computer vision engineers moving into robotics</li><li>researchers who want a clean geometric baseline</li><li>reviewers who want to <em>see</em> verification, not just metrics</li></ul><p>By understanding this repo, we can familiarise with the geometry layer that modern learning-based systems are built on top of.</p><h3>The perception pipeline at a glance</h3><p>The full pipeline demonstrated in this repo is:</p><ol><li><strong>Sense:</strong> Load RGB, depth, and a segmentation mask.</li><li><strong>Segment:</strong> Isolate object pixels (assumed given as this demo focuses on geometry, not segmentation models).</li><li><strong>Reconstruct: </strong>Back-project depth pixels into a 3D point cloud.</li><li><strong>Localise:</strong> Recover object pose in SE(3), aligned to the camera frame.</li><li><strong>Verify: </strong>Reproject the 3D model into the image and visually inspect alignment.</li></ol><p>Through the explanation and implementation of this pipeline, we can understand the core of classical robotic perception.</p><h3>What the project demonstrates (by concept)</h3><ul><li>SE(3) coordinate frames (world ↔ camera ↔ object)frames.py</li><li>Depth back-projection &amp; point cloudsrgbd_geometry.py</li><li>End-to-end RGB → mesh → reprojectionplant_pose_pipeline.py</li><li>Pose export/import, CAD reprojection, failure diagnosispose_representation_and_failure.py</li></ul><p>Each file is intentionally scoped to one mental model.</p><h3>Key files explained</h3><h4>Demo 1. frames.py explains SE(3) without the fog</h4><p>This script illustrates the core SE(3) math for converting between coordinate frames: defining poses, composing transformations, inverting them, and visually verifying the results, which is a prerequisite for everything else in the perception pipeline (projection, depth back-projection, pose estimation, etc.).</p><p>It demonstrates:</p><ul><li>homogeneous transforms</li><li>composing rotations and translations</li><li>transforming points between frames</li><li>visualising coordinate axes in 3D</li></ul><p>The entire file is now a <strong>5-step walkthrough</strong> instead of a sprawling math dump. All transform creation and drawing logic is imported from shared utilities for ease of focus on the concepts instead of boilerplate.</p><p>First, the poses are defined in the world frame. Two poses are set up in an arbitrary world coordinate system:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/926/1*gGgnKOobFfXmxN27AWY_6Q.png" /><figcaption>Camera pose and Object pose set up in the world coordinate system</figcaption></figure><p>Each pose is expressed as a rotation matrix <em>R</em>∈<em>SO</em>(3) (via scipy.spatial.transform.Rotation) and a translation vector <em>t</em>∈R3.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/569/1*gaEriCyV0qJNYpe527Yedw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/532/1*2nn1xVyVDCW09UkUZ67n0g.png" /></figure><p>The helper make_T(R, t) packs each (R,t)(<em>R</em>,<em>t</em>) pair into a 4×4 homogeneous transformation matrix:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/121/1*_2BaMGUVYXJVNMmhdNqkkw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/1*_kwvfI6K6gcHgB0582bv0A.png" /></figure><p>t_cam_obj gives the object’s pose as seen from the camera.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/566/1*0GT5vF4w0uDmiESu4IeAtw.png" /></figure><p>A 3D matplotlib plot is created showing three coordinate frames (World, Camera, Object) all expressed in the world frame. Each frame is drawn with RGB-coloured arrows (red = X, green = Y, blue = Z)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*6D4uDdrhw_nX66pUcMh_YA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*TOs1nL_ZFY8CfzA-SiJ2Ng.png" /></figure><h4>Demo 2. rgbd_geometry.py This file gets us from depth to metric 3D</h4><p>Depth images are often treated as magic tensors. But have no fear. We can demystify them with this file. This script demonstrates the full pipeline from 2D pixels to metrically-scaled 3D geometry: loading sensor data, aligning resolutions, applying the pinhole camera model to back-project depth into 3D, and resolving the inherent scale ambiguity of monocular depth with a known reference measurement. Basically, RGB + depth + segmentation mask data is taken as inputs and the 2D pixels are turned into 3D point cloud in the camera frame, producing metric-scale 3D geometry from a monocular depth estimate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*hXAlv6uM2Yltdc-3hlnGZw.png" /><figcaption>RGB plant.jpeg image</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/422/1*u7V3uJrUqVBm9q3eopRbKw.png" /><figcaption>depth map</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/751/1*TieJbviWOFvua9w6KkEiHA.png" /><figcaption>semantic segmentation mask</figcaption></figure><p>After running this script (rgbd_geometry.py), you can see where your point cloud came from and why scale errors happen.</p><p>In this first step, the RGB (plant.jpeg colour image loaded as H x W x uint8), depth (.npy monocular relative depth map from a depth estimator) and mask (.png binary segmentation mask isolating the plant from the background) data are loaded.</p><p>Then, the depth map and the mask are resized to the RGB image dimensions if there is resolution mismatch.</p><p>Then we define camera heuristics, a 3x3 intrinsic matrix K is constructed with reasonable defaults where <em>fx</em>​=<em>fy</em>​=500 and (<em>cx</em>​,<em>cy</em>​) is the image centre. This maps between pixel coordinates and camera-frame rays.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/180/1*LFlTDQHkZt55OEndvUkKSg.png" /><figcaption>The camera intrinsic matrix K is a 3x3 upper-triangular matrix that maps 3D camera coordinates to 2D pixel coordinates, defining a camera’s internal geometry. It models the relationship between the physical sensor (pixels) and the optical center. skew coefficient is 0 since X and Y axes are perpendicular.</figcaption></figure><p>This matrix maps between pixel coordinates and camera-frame rays.</p><p>Back-projection of depth to 3D points is then the core geometric step where, for every masked pixel (u,v) with depth Z, the 3D position in the camera frame is recovered using the pinhole camera model (OpenCV convention +X right, +Y down, +Z forward). The result is a point cloud of shape (N, 3)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/343/1*fKrag22XgQSlWZkSnQbjKA.png" /><figcaption>Equations for back-projection or inversion of the standard pinhole camera model. They allow calculation of the 3D coordinates (X,Y,Z) of a point in the scene, given its 2D projection (u,v) on an image plane and its depth Z along the optical axis.</figcaption></figure><h4>Equation Breakdown:</h4><p><strong>(X,Y,Z):</strong> The 3D coordinates of the point in the camera’s coordinate system (where Z is the distance along the optical axis, or depth).</p><p><strong>(u,v):</strong> The 2D coordinates of the point in the image plane (measured in pixels).</p><p><strong>(c_x,c_y):</strong> The principal point (image center), usually the pixel coordinates where the optical axis intersects the image plane.</p><p><strong>f_x,f_y:</strong> The focal length in pixel units. These are derived from the physical focal length F and the pixel sizes p_x,p_y</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/177/1*JQoka1sRdRQJMU9YUDsSag.png" /></figure><h4>Key Ideas:</h4><p><strong>Normalisation (u-c_x) and (v-c_y)</strong>: These shift the pixel coordinates so that the origin (0,0) is at the center of the image (principal point) rather than the top-left corner.</p><p><strong>Scaling by Z: </strong>Since a 2D image loses depth information, the backward projection depends on knowing or assuming a depth Z for the 3D point.</p><p><strong>Dividing by f_x,f_y</strong>: These convert pixel-space distances back into normalised camera-space units.</p><p>Then we compute the 3D centroid, (mean XYZ) of the point cloud which serves as the rough ‘centre’ estimate of the plant in camera coordinates and we check that the object is in front of the camera (Z &gt; 0) and depth hasn’t collapse to a flat plane.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/546/1*kWu184l6v7JCxpSanCN85A.png" /><figcaption>Raw point cloud (relative depth) with centroid</figcaption></figure><p>Finally, we have to scale to metric units because monocular depth is relative (unitless) and a known ground-truth measurement is used to recover real-world scale.</p><p>Given that the plant is ~25cm tall, scale_to_metric function computes a single scale factor by comparing the observed height span (5th — 95th percentile along Y) to 0.25m, then multiplies all coordinates. We can get the scale factor, metric extents (bounding box size in metres), centroid in metres, and it’s worthwhile to check that the resulting mean depth falls within a plausible range (0.2–5.0m).</p><h3>Demo 3. plant_pose_pipeline.py gives the full story</h3><p>This is the heart of the demo. This end-to-end pipeline chains together the concepts from Demos 1 (frames.py) and 2 (rgbd_geometry.py) to go all the way from a raw RGB image to a metric-scale 3D triangle mesh of a plant, then verifies the result by reprojecting it back onto the original image. It connects everything:</p><ul><li>load RGB / depth / mask</li><li>back-project masked depth</li><li>scale to metric units</li><li>build an Open3D mesh</li><li>reproject into the original image</li></ul><p>The output is a visual overlay that answers the only question that matters in pose estimation:</p><blockquote>Does this pose actually make sense?</blockquote><p>No accuracy metrics. No hidden assumptions. Just geometry and verification.</p><p>Same as Demo 2: First, the RGB image (plant.jpeg), monocular depth map (depth.npy), and segmentation mask (mask.png) are loaded. The depth and mask are resized to match the RGB resolution so all arrays are pixel-aligned.</p><h4>Camera intrinsics from field-of-view (FOV)</h4><p>Instead of manually specifying <em>fx</em>​,<em>fy</em>​ like Demo 2, here the intrinsic matrix <em>K</em> is derived from a horizontal field-of-view (60°) representing the total angular width of the image captured by the camera, from the far-left edge to the far-right edge, which is a moderate wide-angle view:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/247/1*08F6eCKHyLF-i_zD3tu7sg.png" /></figure><p>This is a common approach when the true calibration is unknown: pick a plausible FOV and compute consistent focal lengths.</p><p>Then it’s time to <strong>back-project depth</strong> and conduct <strong>metric scaling</strong>. Back-projection to convert every masked pixel into a 3D point in camera coordinates using the pinhole model, followed by metric scaling to resolve the monocular depth ambiguity by matching the observed Y-axis span to the known plant height (0.25 m), producing a single scale factor applied to all points.</p><p>Metric 3D points are then wrapped into an Open3D PointCloud object, where each point is assigned its original RGB colour (sampled from the image via the mask).</p><p>Normals are then estimated using a K-Nearest Neighbours (KNN) search (k=30) with each point’s normal being approximated from its local neighbourhood. The normals are oriented consistently via a tangent-plane propagation to ensure they all point outward (which is critical for the meshing step up next!)</p><p>The generated point cloud is triangulated into a surface mesh using the <a href="https://www.computer.org/csdl/journal/tg/1999/04/v0349/13rRUNvgz9y">Ball Pivoting Algorithm</a> and then the resulting mesh (saved as .obj) is reprojected onto the RGB image for a visual verification that the mesh is geometrically consistent with the original image.</p><ul><li>the mesh vertices (in camera frame) are projected back to 2D pixel coordinates using:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/314/1*5RWaHO_fAYLScmcvwVDMyQ.png" /><figcaption>Equations to reproject every mesh vertex to pixel coordinates</figcaption></figure><ul><li>only triangles whose all 3 vertices land within the image bounds are kept.</li><li>valid triangles are rendered as a semi-transparent overlay on top of the RGB image, and if the pipeline is working correctly, the mesh overlay should align tightly with the plant in the photograph to confirm that intrinsics, back-projection, scaling and meshing are consistent.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*RwMIMTPHDcgQTm0D0OfLMA.png" /><figcaption>Plant mesh reprojected onto RGB image as red semi-transparent overlay.</figcaption></figure><p>To summarise, this script (plant_pose_pipeline.py)is the bridge from 2D perception to 3D reconstruction. It takes the depth back-projection and metric scaling from Demo 2 (rgbd_geometry.py), adds surface reconstruction (normals + Ball Pivoting meshing), and closes the loop with a reprojection sanity check.</p><h3>Demo 4. pose_representation_and_failure.py</h3><p>This file explains how pose systems fail. It uses the saved .obj from plant_pose_pipeline.py for pose estimation and CAD reprojection tasks. It is split into three parts (A, B, C), each building on concepts from the earlier demos. It ties together pose representation, CAD model reprojection, and a full depth-to-mesh pipeline with diagnostic checks.</p><p><strong>Part A. Frame transforms &amp; pose JSON: to validate pose serialisation</strong></p><p>Using the exact same setup from Demo 1 (frames.py): a camera at 1.5 m height tilted 20° downward and an object on the ground rotated 45° about Z. SE(3) matrices are built and the object’s pose is transformed into the camera frame via:</p><blockquote>T_cam_obj = inv(T_world_cam) @ T_world_obj</blockquote><p>The computed pose matrix T_cam_obj is serialised to JSON (pose_cam_obj.json) using save_pose_json, then immediately loaded back and checked with np.allclose. Poses are often stored as JSON for interoperability between systems, and verifying a lossless round-trip is essential.</p><p><strong>Part B. CAD model loading &amp; reprojection: to test whether a pre-existing mesh reprojects correctly</strong></p><p>In this part, we load meshes, project CAD geometry into the image to understand alignment drift. The RGB image is loaded and the same FOV-based intrinsics used in Demo 3 (plant_pose_pipeline.py) are reconstructed. Using a consistent <em>K</em> is critical — back-projection and reprojection must share the same intrinsics for the pixel ↔ 3D round-trip to close.</p><p>The mesh saved by Demo 3 (plant_metric_mesh.obj) is loaded. Its vertices are already in the metric camera frame, so no additional pose transform is needed. We get extents, the centroid, and Z range, and the script asserts no vertices are behind the camera.</p><p>Every mesh vertex is projected to pixel coordinates. The projected points are scatter-plotted as red dots over the RGB image. If the pipeline is correct, they should land on the plant.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*-MJonWT15A1dLObphhYyQA.png" /><figcaption>CAD reprojection onto RGB</figcaption></figure><p>The same projection is rendered onto a black canvas with no RGB underneath. This isolates the geometric silhouette of the mesh and makes misalignments easier to spot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*O63IJtFCM-pvFvrMFUK5mA.png" /><figcaption>pure geometric reprojection (no RGB)</figcaption></figure><p><strong>Part C. Full depth → mesh pipeline: rebuild entire pipeline end-to-end with extra-diagnostic outputs</strong></p><ul><li>tying geometry back to perception</li><li>diagnosing scale, axis, and origin failures</li></ul><p>This part rebuilds the entire pipeline from scratch (independent of Demo 3’s saved mesh) with additional diagnostics.</p><p>RGB, depth, and mask are loaded and aligned. A masked depth map is created (zeroing out non-plant pixels) and saved as depth_plant.npy and depth_plant_values.npy for downstream analysis. The segmented depth is visualised with an inferno colourmap.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/765/1*PLAwyxIiZuz2dY9UgX27jA.png" /></figure><p>The full pipeline from Demo 3 is repeated:</p><ol><li>FOV-based intrinsics — same 60° FOV.</li><li>Back-projection — depth_mask_to_points converts masked pixels to 3D.</li><li>Metric scaling — scale_to_metric with the known 0.25 m plant height.</li><li>Open3D point cloud — with RGB colours and estimated normals.</li><li>Ball Pivoting meshing — same radii [0.005, 0.01, 0.02].</li></ol><p>Two mesh variants are saved according to different coordinate frames:</p><ul><li>plant_cam.obj: Camera frame (vertices at their metric camera-frame positions)</li><li>plant_centered.obj: Object-centred (centroid subtracted, hence, ready for pose estimation)</li></ul><p>The camera-frame mesh is reprojected onto the RGB image using the same <em>K</em>.</p><p>The reprojected vertices are painted red on an overlay. Finally, several diagnostic values are printed:</p><ul><li>Mesh extent in metres (physical size sanity check)</li><li>Z range (depth sanity check)</li><li>UV range (pixel-space bounds)</li><li>Projected centroid (should land near the plant’s centre in the image)</li></ul><h3>Final thoughts</h3><p>Deep models come and go. Architectures change. Benchmarks shift.</p><p>But the pipeline from <strong>pixels → geometry → pose → verification</strong> is permanent.</p><p>This demo is a reminder that before robots can act intelligently,<br> they must first understand where things are and prove it.</p><p>If you’re building manipulation systems, simulation pipelines, or synthetic-to-real perception stacks, this is the foundation.</p><p>Thanks for reading~ and hopefully reading it has helped you in some way.</p><p>Stay tuned for a follow-up article which will explain the spatial failure modes and pose-based failure diagnosis in the last (unexplained) script: failure_analysis.py</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f1aab9bf1531" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Discovering Emerging Multimedia Technologies for National Security at ACM Multimedia 2024 Part…]]></title>
            <link>https://medium.com/htx-s-s-coe/discovering-emerging-multimedia-technologies-for-national-security-at-acm-multimedia-2024-part-a6ac5ee78bec?source=rss-6a4ae7216ece------2</link>
            <guid isPermaLink="false">https://medium.com/p/a6ac5ee78bec</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[deblurring]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[image-restoration]]></category>
            <dc:creator><![CDATA[Wei May Chen]]></dc:creator>
            <pubDate>Thu, 11 Sep 2025 16:02:31 GMT</pubDate>
            <atom:updated>2025-09-12T06:41:43.299Z</atom:updated>
            <content:encoded><![CDATA[<h3>Discovering Emerging Multimedia Technologies for National Security at ACM Multimedia 2024 Part (4/4)</h3><h4>This is part 4 of the 4-part series about the experience attending the ACM MM 2024 conference, follow-up research explorations and technical takeaways.</h4><p>You can read <a href="https://medium.com/htx-s-s-coe/discovering-emerging-multimedia-technologies-for-national-security-at-acm-multimedia-2024-part-907b574730d5">Part 1 here</a>, <a href="https://medium.com/p/fe4a85940a92">Part 2 here</a>, and <a href="https://medium.com/p/82d2a2e833c0">Part 3 here</a>. The following research papers were explored for various operational use cases in home team departments:</p><ul><li>Part 1: The ACM MM 2024 Conference experience</li><li>Part 2: <a href="https://arxiv.org/abs/2408.05669">StealthDiffusion</a>, an adversarial attack method applied on deepfake images to reduce their detectability by deepfake detectors.</li><li>Part 3: <a href="https://arxiv.org/abs/2408.01276">Wave-Mamba</a> for Low-light image enhancement and deraining; <a href="https://arxiv.org/abs/2407.21773">RainMamba</a> for Video Deraining.</li><li>Part 4: <a href="https://arxiv.org/abs/2407.16993">Loformer</a> for Image Deblurring. (You’re here!)</li></ul><h3>LoFormer: Local Frequency Transformer for Image Deblurring</h3><p>The research titled <a href="https://arxiv.org/abs/2407.16993">LoFormer: Local Frequency Transformer for Image Deblurring</a> proposes the Loformer model whose lightweight and efficient transformer-based architecture makes it well-suited for real-time deblurring and other low-level vision tasks. Its ability to model both local and global dependencies using a frequency-aware attention mechanism enables superior restoration quality while maintaining computational efficiency.</p><p>The LoFormer architecture is built upon a UNet-style backbone with enhancements from Restormer. At its core is the Local Frequency Transformer (LoFT) block, which operates in the frequency domain through the Discrete Cosine Transform (DCT). This block incorporates several key components: a DCT-LayerNorm fusion to normalize frequency tokens, a Freq-LC attention mechanism that applies self-attention within local frequency windows, and an MGate module that uses gated MLPs to emphasize meaningful frequency signals. After frequency-domain processing, the model reverses the transformations and reconstructs the deblurred image via inverse DCT and transposed convolutions.</p><h4>Exploration Motivation and Set-up</h4><p>The motivation of this exploration was to assess the model’s real-world performance and determine if it could be realistically deployed in time-sensitive operational scenarios like urban surveillance where image clarity under motion is essential.</p><p>To put this to the test, the <a href="http://www.ok.ctrl.titech.ac.jp/~torii/project/247/"><strong>24/7 Tokyo</strong></a> query set was used, which includes street-level images taken during the day, sunset, and night. This dataset offered a diverse mix of lighting conditions and scene complexity, making it ideal for benchmarking deblurring models. Motion-blurred versions of these images were generated using the Albumentations library, applying both moderate and strong levels of motion blur. These synthetic blur degraded images were used as inputs for the LoFormer model, while the original <a href="http://www.ok.ctrl.titech.ac.jp/~torii/project/247/"><strong>24/7 Tokyo</strong></a> images served as clean ground truth references.</p><p>Three pretrained LoFormer checkpoints (each trained on a different dataset: GoPro, RealBlur-J, and RealBlur-R) were evaluated. These models were selected to cover a range of real-world blur characteristics — ranging from camera-induced motion to realistic hand-held blur. Experiments focused on how these models handled different lighting conditions and blur strengths within the <a href="http://www.ok.ctrl.titech.ac.jp/~torii/project/247/"><strong>24/7 Tokyo</strong></a> dataset.</p><h4>Model Performance Results</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i944D1mtQIhhHRCrfVpKKQ.png" /><figcaption>Fig. 1.1: Example 1, showing nighttime image from 24/7 Tokyo dataset with strong motion blur applied (left) and Loformer deblurred output image (right).</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q_9nn1JQiNBrsnDddhht7g.png" /><figcaption>Fig. 1.2: Example 2, showing nighttime image from 24/7 Tokyo dataset with strong motion blur applied (left) and Loformer deblurred output image (right).</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7lJJ6TbEQDlHZb9w8uCRVQ.png" /><figcaption>Fig. 1.3: Example 3, showing evening (sunset) image from 24/7 Tokyo dataset with strong motion blur applied (left) and Loformer deblurred output image (right).</figcaption></figure><p>It was found that moderate blur removal was generally subtle and often imperceptible, especially in daytime scenes. However, in the case of strong blur, LoFormer’s impact became much more visible. Night images benefited the most, with noticeable improvements in hair and person outlines, clearer building structures, and more legible text displays. Among the three models, the one trained on the GoPro dataset consistently delivered the best results quantitatively (having the highest PSNR and SSIM) and quantitatively (in terms of deblurring quality, particularly under low-light and strong blur conditions). The RealBlur-J model followed closely behind, while the RealBlur-R model underperformed — especially in well-lit daytime scenes, where it struggled to recover fine details.</p><p>The LoFormer model was benchmarked against other models with deblurring capabilities on the 24/7 Tokyo dataset. In Home Team use cases, it is crucial to consider universal restoration models alongside specialised restoration models because of the diversity of degradation types and combinations faced in real-world scenarios. Hence, we benchmark LoFormer (specialised for image deblurring) against generic restoration models like UHDFormer (AAAI 2024) and MoCE-IR-S (CVPR 2025).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ui1t-Zj1i-NX-_s5jxXhZg.png" /><figcaption>Table 1. Comparison of image restoration quality results across UHDFormer, LoFormer and MoCE-IR-S (AIO5) models.</figcaption></figure><p>In summary, LoFormer presents a highly effective approach to image deblurring, particularly in challenging conditions like nighttime motion blur, which commonly occurs when cameras increase their exposure time to compensate for low-light environments. Its frequency-domain processing and transformer architecture offer tangible benefits in restoration quality.</p><p>But despite its promising deblurring capabilities, LoFormer is not yet fast enough for real-time deployment without additional optimisation. Processing a single image at <strong>512×512</strong> resolution an NVIDIA A10 GPU yielded an inference speed of <strong>1.02 FPS</strong>. When compared against UHDFormer which achieves around <strong>14.48 FPS</strong> and MoCE-IR-S (AIO5) averages about <strong>2.84 FPS</strong>, LoFormer pales in comparison in terms of inference efficiency and falls short of what would be required for real-time streaming or edge deployment. This suggests that further work in model optimisation and compression — through techniques like pruning, quantization, or knowledge distillation — would be needed to make LoFormer practical for operational use cases.</p><p>In real-world applications with real-time requirements, efficiency and inference speed in particular is almost as important as performance for consideration. Thus, the decision of which model to deploy would hinge on the most suitable trade-off between model performance and efficiency.</p><p>Go back to: [<a href="https://medium.com/p/82d2a2e833c0">Part 3</a> — <a href="https://arxiv.org/abs/2408.01276">Wave-Mamba</a> for Low-light image enhancement and deraining and <a href="https://arxiv.org/abs/2407.21773">RainMamba</a> for Video Deraining]</p><p>Or go back to: [<a href="https://medium.com/htx-s-s-coe/discovering-emerging-multimedia-technologies-for-national-security-at-acm-multimedia-2024-part-907b574730d5">Part 1</a> — The ACM MM 2024 Conference experience]</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a6ac5ee78bec" width="1" height="1" alt=""><hr><p><a href="https://medium.com/htx-s-s-coe/discovering-emerging-multimedia-technologies-for-national-security-at-acm-multimedia-2024-part-a6ac5ee78bec">Discovering Emerging Multimedia Technologies for National Security at ACM Multimedia 2024 Part…</a> was originally published in <a href="https://medium.com/htx-s-s-coe">HTX S&amp;S COE</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Discovering Emerging Multimedia Technologies for National Security at ACM Multimedia 2024 (Part…]]></title>
            <link>https://medium.com/htx-s-s-coe/discovering-emerging-multimedia-technologies-for-national-security-at-acm-multimedia-2024-part-82d2a2e833c0?source=rss-6a4ae7216ece------2</link>
            <guid isPermaLink="false">https://medium.com/p/82d2a2e833c0</guid>
            <category><![CDATA[de-raining]]></category>
            <category><![CDATA[low-light-enhancement]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[image-restoration]]></category>
            <dc:creator><![CDATA[Wei May Chen]]></dc:creator>
            <pubDate>Thu, 04 Sep 2025 16:01:43 GMT</pubDate>
            <atom:updated>2025-09-12T06:42:51.817Z</atom:updated>
            <content:encoded><![CDATA[<h3>Discovering Emerging Multimedia Technologies for National Security at ACM Multimedia 2024 (Part 3/4)</h3><h4>This is part 3 of the 4-part series about the experience attending the ACM MM 2024 conference, follow-up research explorations and technical takeaways.</h4><p>You can read <a href="https://medium.com/htx-s-s-coe/discovering-emerging-multimedia-technologies-for-national-security-at-acm-multimedia-2024-part-907b574730d5">Part 1 here</a>, <a href="https://medium.com/p/fe4a85940a92">Part 2 here</a>, and <a href="https://medium.com/htx-s-s-coe/discovering-emerging-multimedia-technologies-for-national-security-at-acm-multimedia-2024-part-a6ac5ee78bec">Part 4 here</a>. The following research papers were explored for various operational use cases in home team departments:</p><ul><li>Part 1: The ACM MM 2024 Conference experience</li><li>Part 2: <a href="https://arxiv.org/abs/2408.05669">StealthDiffusion</a>, an adversarial attack method applied on deepfake images to reduce their detectability by deepfake detectors.</li><li>Part 3: <a href="https://arxiv.org/abs/2408.01276">Wave-Mamba</a> for Low-light image enhancement and deraining; <a href="https://arxiv.org/abs/2407.21773">RainMamba</a> for Video Deraining. (You’re here!)</li><li>Part 4: <a href="https://arxiv.org/abs/2407.16993">Loformer</a> for Image Deblurring.</li></ul><h3>Wave-Mamba</h3><p>Enhancing ultra-high-definition (UHD) images captured in low-light environments is no easy feat. Traditional low-light image enhancement (LLIE) methods often rely on aggressive downsampling to reduce computational overhead — but at the cost of fine detail and visual fidelity. Enter <a href="https://arxiv.org/abs/2408.01276">Wave-Mamba: Wavelet State Space Model for Ultra-High-Definition Low-Light Image Enhancement</a>, a novel approach that leverages wavelet-based state-space modeling (SSM) to bring clarity to the dark, quite literally. It addresses a critical gap in UHD low-light image enhancement: how to process long-sequence high-resolution images efficiently without losing spatial detail.</p><p>Wave-Mamba combines the wavelet transform with state space models (SSMs) to enable lossless downsampling to retain image fidelity and also separate structured content from high-frequency noise. The input data is decomposed into low- and high-frequency components via wavelet transforms while avoiding the introduction of artifacts or distortions that could degrade output quality. This is because the wavelet transforms inherently preserve multi-resolution details of the input data as opposed to conventional downsampling methods like pooling or Fourier-based techniques which may lose spatial detail or suffer from aliasing.</p><p>The solution hinges on two key insights from the wavelet domain: (1) most image content resides in the low-frequency component, with the high-frequency component contributing minimally to low-light enhancement; and (2) low-frequency information is critical for global content modeling.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ylakq7In6oZWIuppaylP7Q.png" /><figcaption>Fig 1. The overall architecture of the proposed Wave-Mamba. The Wave-Mamba performs up and down sampling by utilizing the wavelet transform, and feature extraction and enhancement by using Low-Frequency State Space Block (LFSSBlock) and High-Frequency Enhance Block (HFEBlock) for the low-frequency and high-frequency components, respectively (source: <a href="https://arxiv.org/abs/2408.01276">Wave-Mamba</a>).</figcaption></figure><p>To this end, Wave-Mamba employs a two-branch architecture comprising a Low-Frequency State Space Block (LFSSBlock) to restore low-frequency sub-band information and a High-Frequency Enhance Block (HFEBlock) to refine high-frequency details by leveraging enhanced low-frequency data, ensuring efficient and accurate UHD LLIE.</p><p>Why does it work?</p><p>Low-frequency components carry the bulk of semantic content — ideal for global structure modeling. High-frequency components, often containing noise, can be selectively enhanced using contextual information from the low-frequency path.</p><p>To fully exploit this, the authors designed:</p><ul><li><strong>Low-Frequency State Space Block (LFSSBlock)</strong> to model and restore the low-frequency sub-band information (i.e. the core image structure), and</li><li><strong>High-Frequency Enhance Block (HFEBlock)</strong> to refine high-frequency details (i.e. textures and sharpness) by leveraging enhanced low-frequency data.</li></ul><p>The result is: A highly efficient, detail-preserving pipeline for UHD LLIE and beyond.</p><h4>Experiment 1: Low-Light Enhancement</h4><p>Trained on synthetic datasets (like <a href="https://paperswithcode.com/dataset/lol">LOL</a>), Wave-Mamba’s performance was tested on real-world night images from the <a href="http://www.ok.ctrl.titech.ac.jp/~torii/project/247/"><strong>24/7 Tokyo</strong></a> dataset.</p><p>Here are a few visual comparisons:</p><p>Inference example results of deraining on <a href="http://www.ok.ctrl.titech.ac.jp/~torii/project/247/"><strong>24/7 Tokyo</strong></a> (real world; night images only) dataset:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2BoSuazKVacdSqQgxq2IwQ.png" /><figcaption>Fig. 2.1 Example 1: Original night image from <strong>24/7 Tokyo</strong> dataset (left), Wave-Mamba LLIE image (right).</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-xEInzpJZ7oMbZlwde0mlQ.png" /><figcaption>Fig. 2.2 Example 2: Original night image from <strong>24/7 Tokyo</strong> dataset (left), Wave-Mamba LLIE image (right).</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I9BPwZarDkaunZ5yU3v3pw.png" /><figcaption>Fig. 2.3 Example 3: Original night image from <strong>24/7 Tokyo</strong> dataset (left), Wave-Mamba LLIE image (right).</figcaption></figure><p>Despite being trained only on synthetic data, the model generalises impressively well to real-world settings. Low-light regions (varying degrees of darkness) are highly enhanced for greater clarity, with little to no oversaturation. There’s a general improvement in contrast, colour balance and noise suppression while maintaining sharpness.</p><p>However, further refinement is needed to address the instances of overexposure in the original image (digital screens) after the low-light enhancement, which thus impedes the readability of texts on electronic billboards and screens/signs in urban and metropolitan environments.</p><h4>Experiment 2: Deraining with <a href="https://openaccess.thecvf.com/content_CVPR_2019/papers/Wang_Spatial_Attentive_Single-Image_Deraining_With_a_High_Quality_Real_Rain_CVPR_2019_paper.pdf"><strong>SPANet</strong></a> Dataset</h4><p>To test Wave-Mamba’s generalisability for other low-level vision tasks, the model was trained for image deraining using the <a href="https://openaccess.thecvf.com/content_CVPR_2019/papers/Wang_Spatial_Attentive_Single-Image_Deraining_With_a_High_Quality_Real_Rain_CVPR_2019_paper.pdf"><strong>SPANet</strong></a> dataset (real-rain and clean image pairs). Training ran for ~100,000 iterations over 4 days on an NVIDIA A10 GPU.</p><p><em>Performance on Test Set:</em></p><ul><li><strong>PSNR</strong>: 38.36 dB — excellent pixel-level accuracy</li><li><strong>SSIM</strong>: 0.9805 — near-perfect structural similarity</li><li><strong>LPIPS</strong>: 0.1022 — strong perceptual similarity</li><li><strong>FPS</strong>: ~13.95 (0.0717s per image) — suitable for near real-time inference</li></ul><p><em>Note: This was achieved with an unoptimized model. With further optimization, real-time deployment (e.g., deraining live surveillance feeds) becomes entirely viable.</em></p><h4><em>Why This Matters for Real-World Deployment</em></h4><p>Low-light enhancement and deraining are key to improving surveillance footage, autonomous driving systems, and night-time photography. But speed and accuracy are paramount. Wave-Mamba demonstrates that you don’t have to trade off one for the other.</p><p>Its wavelet-powered SSM backbone allows for both lightweight computation and rich image restoration, making it a strong candidate for edge deployment in real-world vision systems.</p><h4><em>What’s Next?</em></h4><p>The exploration doesn’t stop at LLIE and deraining. The authors suggest that Wave-Mamba can be adapted to other image restoration tasks such as dehazing, deblurring, and even video enhancement, particularly where high resolution and real-time performance are critical.</p><p>Wave-Mamba is as much a promising academic model as it is a practical step toward smarter, faster, and more detail-preserving image enhancement in challenging visual conditions. By integrating signal processing insights with modern deep learning, it sets a new benchmark for what’s possible in low-light and weather-degraded imagery. It offers hope that real-time clarity may just be one wavelet away.</p><p>Visual examples of the derained test set image are shown below, with each of the 4 examples below organised in the following order: Wave-Mamba derained output image (<strong>left</strong>), ground truth clean image (<strong>middle</strong>), original rainy image (<strong>right</strong>) from the <a href="https://openaccess.thecvf.com/content_CVPR_2019/papers/Wang_Spatial_Attentive_Single-Image_Deraining_With_a_High_Quality_Real_Rain_CVPR_2019_paper.pdf"><strong>SPANet</strong></a> dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2rKcpxBDRvD1rSNLVwGrAA.png" /><figcaption>Fig. 3.1: Example 1, showing Wave-Mamba derained image (left), pseudo-ground truth (middle), original <strong>SPANet</strong> rainy image (right).</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LmbHeEMynZJ_Xo63AUezKA.png" /><figcaption>Fig. 3.2: Example 2, showing Wave-Mamba derained image (left), pseudo-ground truth (middle), original <strong>SPANet</strong> rainy image (right).</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GZI_DBucwKFjZvmiGqreMg.png" /><figcaption>Fig. 3.3: Example 3, showing Wave-Mamba derained image (left), pseudo-ground truth (middle), original <strong>SPANet</strong> rainy image (right).</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CMU328_epftyKWrqz9TIlg.png" /><figcaption>Fig. 3.4: Example 4, showing Wave-Mamba derained image (left), pseudo-ground truth (middle), original <strong>SPANet</strong> rainy image (right).</figcaption></figure><p>Derained results have most of the rain artifacts removed and exhibit high perceptual similarity with the pseudo-ground truth.</p><h3>RainMamba</h3><p>Besides image deraining, video deraining is also an essential task for restoring visibility in outdoor surveillance, multimedia, and navigation systems. Rain streaks and raindrops not only obscure visual information but also degrade the performance of AI systems that rely on clear frame-by-frame data. This is particularly crucial for real-world applications where temporal consistency and high-quality restoration are key.</p><p><a href="https://arxiv.org/abs/2407.21773"><strong>RainMamba</strong>: Enhanced Locality Learning with State Space Models for Video Deraining</a> is a model which tackles the challenges posed by rain streaks and raindrops, which degrade outdoor vision systems and multimedia applications. It addresses the limitations of optical flow-based and kernel-based approaches, which often have narrow receptive fields, and offers a more efficient alternative to transformer-based models that are typically computationally heavy. RainMamba is built on the Mamba architecture, leveraging state space models (SSMs) for long-term temporal understanding. It incorporates innovations like Hilbert scanning and difference-guided dynamic contrastive locality learning strategy to improve patch-level self-similarity so as to better model spatial-temporal correlations in video sequences.</p><p>RainMamba leverages the efficiency of SSMs for long-term temporal modeling while addressing their limitations in capturing spatio-temporal correlations. It introduces a Hilbert scanning mechanism to preserve sequence-level local information and a difference-guided dynamic contrastive locality learning strategy to improve patch-level self-similarity, enabling effective and efficient video deraining.</p><p>Our motivation was to assess whether this architecture could meet the demands of real-time or near real-time operational settings. We designed an exploratory experiment: retraining RainMamba on real rain videos from the <a href="https://openaccess.thecvf.com/content_cvpr_2018/papers/Chen_Robust_Video_Content_CVPR_2018_paper.pdf">NTU Rain Dataset</a> and evaluating its output quality, perceptual realism, and computational performance.</p><h4>Experimental Set-up and Dataset Preparation</h4><p>We focused exclusively on the real rain subset of the NTU Rain dataset. Each video sequence was split into subfolders containing consecutive frames, allowing the model to learn from temporal cues. The dataset was further partitioned into training, validation, and testing splits and ensured a clean and consistent directory structure for batch loading and processing.</p><p>Training was conducted over approximately 12 hours, amounting to 300,000 iterations on an NVIDIA A10 GPU. During training, losses and GPU memory usage were continuously monitored to track learning progress and resource utilisation. Importantly, while RainMamba doesn’t require fixed input resolutions, performance is optimal when input height and width are multiples of 8 — a result of its internal patch-based design. Temporal input defaults to 5 frames per clip, and the model uses mirrored padding (rather than zero-padding), flipping the edge pixels to reduce boundary artifacts.</p><h4>Model Performance on NTU Rain (Real Rain): Visual Quality Results and Observations</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-mUjccSro6InZIruv-dp6Q.png" /><figcaption>Fig. 4.1: Example 1, showing original <strong>NTU Rain</strong> rainy image (left), pseudo-ground truth (spac-CNN derained) (middle), RainMamba derained image (right).</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yuc5DlhlLJnWxbaOMB0Lgg.png" /><figcaption>Fig. 4.2: Example 2, showing original <strong>NTU Rain </strong>rainy image (left), pseudo-ground truth (spac-CNN derained) (middle), RainMamba derained image (right).</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UxpLr4FIllpP7lURF0-fHg.png" /><figcaption>Fig. 4.3: Example 3, showing original <strong>NTU Rain </strong>rainy image (left), pseudo-ground truth (spac-CNN derained) (middle), RainMamba derained image (right).</figcaption></figure><p>Qualitatively, RainMamba showed strong rain removal capabilities. Significant rain streaks and droplets were effectively eliminated, and the derained outputs were highly similar to those produced by <a href="https://openaccess.thecvf.com/content_cvpr_2018/papers/Chen_Robust_Video_Content_CVPR_2018_paper.pdf"><strong>spacCNN</strong></a>, which we used as pseudo-ground truth. In some test sequences, the RainMamba output was nearly indistinguishable from the reference, both structurally and perceptually.</p><p>However, certain limitations were observed. Some derained frames exhibited minor degradation around object edges, especially in scenes with complex textures or occlusions. Additionally, slight color distortions were noted in a few outputs, although these were not severe enough to affect the overall realism.</p><h4>Model Performance on NTU Rain (Real Rain): Quantitative Results and Implications</h4><p>RainMamba was evaluated on the NTU Rain test set using both objective metrics (PSNR, SSIM) and perceptual metrics (LPIPS). The average PSNR achieved was 32.71 dB, indicating that the derained images retained a high degree of pixel fidelity with minimal distortion from the clean reference. This level of performance is indicative of strong low-level restoration. The SSIM averaged at 0.922, suggesting that structural integrity and textural information were well preserved even after rain removal. Lastly, the LPIPS score of 0.0385 confirms that the perceptual difference between the derained output and pseudo-ground truth images was minimal — imperceptible to the human eye in many cases.</p><p>In terms of speed, RainMamba processed 512×512 images at 1.02 FPS, and 480×640 images at 0.72 FPS on the A10 GPU. The model contains approximately 34.75 million parameters.</p><p>Overall, RainMamba demonstrates strong deraining performance, particularly in post-processing or offline applications. Its high PSNR reflects minimal noise and faithful reconstruction at the pixel level. The SSIM score supports the conclusion that the model maintains object structure and edge sharpness well. Meanwhile, the low LPIPS confirms that the model achieves a high degree of visual realism.</p><p>However, the model’s inference speed limits its use in real-time systems. At less than one frame per second for mid-resolution videos, RainMamba falls short of the performance needed for real-time deraining in live surveillance or robotics. That said, its architecture is promising, and with further model pruning or lightweight adaptation, real-time capabilities could be within reach.</p><p>This experiment confirms the potential of the Mamba-based SSM architecture for video restoration tasks. RainMamba proves effective in removing real rain artifacts while preserving visual quality, but its current computational profile suggests it is better suited for post-hoc video enhancement rather than real-time deployment.</p><p>As research in state space models advances, RainMamba could serve as a robust backbone for future deraining systems — particularly in applications where accuracy and visual quality are paramount. For now, it stands as a compelling option for offline deraining tasks in surveillance video cleaning, traffic vision enhancement, and archival restoration.</p><p>Next up: [<a href="https://medium.com/htx-s-s-coe/discovering-emerging-multimedia-technologies-for-national-security-at-acm-multimedia-2024-part-a6ac5ee78bec">Part 4 </a>— <a href="https://arxiv.org/abs/2407.16993">Loformer</a> for Image Deblurring]</p><p>Or go back to: [<a href="https://medium.com/p/fe4a85940a92">Part 2</a> — <a href="https://arxiv.org/abs/2408.01276">Wave-Mamba</a> for Low-light image enhancement and deraining and <a href="https://arxiv.org/abs/2407.21773">RainMamba</a> for Video Deraining]</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=82d2a2e833c0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/htx-s-s-coe/discovering-emerging-multimedia-technologies-for-national-security-at-acm-multimedia-2024-part-82d2a2e833c0">Discovering Emerging Multimedia Technologies for National Security at ACM Multimedia 2024 (Part…</a> was originally published in <a href="https://medium.com/htx-s-s-coe">HTX S&amp;S COE</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Discovering Emerging Multimedia Technologies for National Security at ACM Multimedia 2024 (Part…]]></title>
            <link>https://medium.com/htx-s-s-coe/discovering-emerging-multimedia-technologies-for-national-security-at-acm-multimedia-2024-part-fe4a85940a92?source=rss-6a4ae7216ece------2</link>
            <guid isPermaLink="false">https://medium.com/p/fe4a85940a92</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[adversarial-attack]]></category>
            <category><![CDATA[conference]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[acm-mm]]></category>
            <dc:creator><![CDATA[Wei May Chen]]></dc:creator>
            <pubDate>Thu, 28 Aug 2025 16:01:38 GMT</pubDate>
            <atom:updated>2025-09-12T06:46:17.281Z</atom:updated>
            <content:encoded><![CDATA[<h3>Discovering Emerging Multimedia Technologies for National Security at ACM Multimedia 2024 (Part 2/4)</h3><h4>This is part 2 of the 4-part series about the experience attending the ACM MM 2024 conference, follow-up research explorations and technical takeaways.</h4><p>You can read <a href="https://medium.com/me/stats/post/907b574730d5">Part 1 here</a>, <a href="https://medium.com/htx-s-s-coe/discovering-emerging-multimedia-technologies-for-national-security-at-acm-multimedia-2024-part-82d2a2e833c0">Part 3 here</a>, and <a href="https://medium.com/htx-s-s-coe/discovering-emerging-multimedia-technologies-for-national-security-at-acm-multimedia-2024-part-a6ac5ee78bec">Part 4 here</a>. The following research papers were explored for various operational use cases in Home Team departments:</p><ul><li>Part 1: The ACM MM 2024 Conference experience</li><li>Part 2: <a href="https://arxiv.org/abs/2408.05669">StealthDiffusion</a>, an adversarial attack method applied on deepfake images to reduce their detectability by deepfake detectors. (You’re here!)</li><li>Part 3: <a href="https://arxiv.org/abs/2408.01276">Wave-Mamba</a> for Low-light image enhancement and deraining; <a href="https://arxiv.org/abs/2407.21773">RainMamba</a> for Video Deraining.</li><li>Part 4: <a href="https://arxiv.org/abs/2407.16993">Loformer</a> for Image Deblurring.</li></ul><h4>StealthDiffusion Hiding in Plain Sight with Undetectable AI-Generated Images</h4><p>AI-generated images are getting so convincing that not even deepfake detection algorithms can always tell them apart from the real thing. This gap between detection and deception is exactly what StealthDiffusion seeks to exploit — and it’s remarkably good at it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/0*INX4BBsviwgeNXrS" /><figcaption>Fig. 1. StealthDiffusion model workings: A small adversarial noise is introduced to the raw image using the Projected Gradient Descent (PGD) method, then proceed to the Adversarially Optimising on Latent Space step in Stable Diffusion, and the final output image is obtained by combining the outputs from the Control-VAE. These refined images are simultaneously difficult for algorithms to identify as fake and indistinguishable from genuine ones to the human eye. (source: <a href="https://arxiv.org/abs/2408.05669">StealthDiffusion</a>)</figcaption></figure><p>Where previous evasion methods often introduced visible distortions or failed across different systems, <a href="https://arxiv.org/abs/2408.05669">StealthDiffusion: Towards Evading Diffusion Forensic Detection through Diffusion Model</a> refines diffusion-generated images to be nearly indistinguishable from real ones, for both humans and algorithms. And it does so with surgical precision, thanks to two key innovations:</p><ol><li><strong>Latent Adversarial Optimisation (LAO)<br></strong>The LAO fine-tunes hidden representations in the diffusion pipeline, allowing for precise and detailed improvements without compromising image quality. Think of it like subtly rewriting the DNA of the image: keeping it looking the same, but with just enough change to sneak past detection models.</li><li><strong>Control-VAE Module<br></strong>This Variational Autoencoder aligns the underlying patterns of generated images with those of real ones, reducing the statistical signals that detectors rely on without sacrificing visual quality or generation control.</li></ol><p>The pipeline starts with a tiny injection of adversarial noise using <a href="https://arxiv.org/pdf/1706.06083">Projected Gradient Descent (PGD).</a> Then the system optimises within the latent space of Stable Diffusion, and finally harmonises the result using the Control-VAE. The output is a hyper-realistic image that resists both forensic tools and visual scrutiny.</p><h4><strong>Qualitative Model Performance of StealthDiffusion: A visual comparison between </strong><a href="https://arxiv.org/abs/2406.07547"><strong>MimicBrush</strong></a><strong> diffusion-inpainted images before and after StealthDiffusion</strong></h4><p>The following images show that the diffusion-inpainted images before and after Stealthdiffusion adversarial attack method has been applied to evade deepfake detection has imperceptible differences and the reconstructed images exhibit little to no visual distortions or artifacts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*4A-SMKhLspd4AmzufP0L_A.png" /><figcaption>Fig. 2.1. Example 1 of MimicBrush, diffusion-inpainted image (left), and the image after StealthDiffusion adversarial attack has been applied (right).</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*eWSCXe6HwTFUd0TXpRWKLQ.png" /><figcaption>Fig. 2.2. Example 2 of MimicBrush, diffusion-inpainted image (left), and the image after StealthDiffusion adversarial attack has been applied (right).</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*RVcl34he4wakAVsdQgOuDA.png" /><figcaption>Fig. 2.3. Example 3 of MimicBrush, diffusion-inpainted image (left), and the image after StealthDiffusion adversarial attack has been applied (right).</figcaption></figure><h4>Quantitative Results: It’s Not Just Visual</h4><p>To evaluate StealthDiffusion’s performance, we looked at both perceptual quality and detection evasion effectiveness.<br>PSNR (Peak Signal-to-Noise Ratio) of 35.21 dB achieved indicates strong pixel-level similarity to the original image with minimal distortion. SSIM (Structural Similarity Index) of 0.9087 means the structural and perceptual quality is almost indistinguishable from real images. Low variance in both metrics demonstrates consistency across a wide range of image inputs — including those with complex inpainting artifacts like those generated using MimicBrush.</p><p>These numbers confirm that StealthDiffusion produces consistently high-quality results, making it a reliable method for generating clean, hard-to-detect deepfakes.</p><h4>Testing Detection Robustness: Before vs After Attack</h4><p>We wanted to know: <strong>Can StealthDiffusion actually trick a real deepfake detection model?</strong></p><p>To find out, we used a <a href="https://arxiv.org/abs/2406.04932">Binary Neural Network (BNN) deepfake detector</a>, chosen for its efficiency and generalisation ability, to test for detection robustness before and after the adversarial attack was applied on generated images. Two types of datasets were used: (1) <strong>Diffusion inpainted faces</strong> generated using <em>MimicBrush</em> (source images from <a href="https://mmlab.ie.cuhk.edu.hk/projects/CelebA/CelebAMask_HQ.html">CelebAMask-HQ</a> dataset)<em> (2) </em><strong>Fully diffusion-synthesised face datasets</strong>: <a href="https://ieeexplore.ieee.org/document/10204758"><em>DCFace</em></a> and <a href="https://arxiv.org/abs/2212.13344"><em>DiffFace</em></a><em>.</em></p><p>Note: The recall was computed using <a href="https://scikit-learn.org/stable/modules/generated/sklearn.metrics.recall_score.html">scikit-learn’s recall_score</a> function with the binary predictions obtained from the fixed 0.5 threshold. The approach treats the deepfake detection task as a standard binary classification problem with a conventional 0.5 decision boundary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/1*jzs7fk1yI_ivSOOfLL487g.png" /><figcaption>Table 1. Recall score before and after Stealthdiffusion adversarial attack method was applied on partial diffusion inpainted image dataset (generated using MimicBrush diffusion model) and entire face synthesis (fully diffusion-generated) datasets (DCFace and DiffFace) respectively.</figcaption></figure><h4>Key Takeaways from the Results</h4><p><em>For diffusion-inpainted images generated using MimicBrush, </em>mixed performance was observed: For some facial regions (e.g., <em>hair</em> and <em>facer</em>), recall actually increased post-attack. This could mean that perturbations at region boundaries made fake areas <em>more</em> obvious.</p><p>Skin regions and irregular masks, however, showed decreased recall — suggesting that smoother areas or skin regions allow perturbations to blend in better, reducing detectability. Irregular masks, being broader or encompassing diverse regions, could dilute the detection model’s ability to focus on adversarial perturbations.<br>For <em>fully synthesised faces, a </em>clear drop in recall was observed after the StealthDiffusion attack. A 1–2% drop may look insignificant numerically, but it is actually critical in high-recall regimes — especially in security-sensitive deployments. The diffusion models used to generate the images in the two datasets (DCFace and DiffFace) rely heavily on global consistency, which makes StealthDiffusion’s full-image adjustments particularly effective.<br>These results suggest that StealthDiffusion is better tailored for fully synthesised faces, where it can uniformly adjust features across the entire image without introducing artifacts that might alert the detection model.</p><h4>Further Insights and Future Work</h4><p>The r<em>egion-specific vulnerabilities of Stealthdiffusion were uncovered through this exploration.</em></p><p>The success (or failure) of adversarial attacks may depend heavily on <em>where</em> the changes are applied. Future studies could explore the impact of mask size, shape, and region on detectability and combine multiple regions in composite attacks to maximize stealth. Comparisons could also be made with other detectors. I used BNN in this study for its competitive performance and high efficiency, but how would Xception, EfficientNet, or Vision Transformers fare? Comparing across models could help reveal model-agnostic weaknesses.</p><p>And what do the findings mean for <em>defensive research? Fine-grained detection is needed.</em></p><p>Countering adversarial attacks like StealthDiffusion will require stronger defenses:</p><ul><li>Adversarial training for deepfake detection models</li><li>Defensive distillation or feature-level perturbation filters</li><li>Ensemble models that cross-validate predictions using diverse architectures</li></ul><p>StealthDiffusion’s ability to evade detection (even slightly) raises real concerns. In domains like national security, law enforcement, and content verification, small gaps in detection performance can lead to large consequences. For example, bad actors could misuse tools like StealthDiffusion to trick facial recognition systems by uploading doctored images designed to fool the technology. Hence, adversarial evaluation should be a mandatory step in deploying any deepfake detection pipeline.</p><p>In conclusion, StealthDiffusion pushes the boundaries of image generation while challenging the very idea of what can be detected. As generative AI tools become more powerful and stealthy, it’s not enough to build detectors that work <em>today</em>. We need systems designed with tomorrow’s threats in mind, and StealthDiffusion offers a glimpse into the next frontier of generative deception.</p><p>Thanks for reading! If you enjoyed this article, look out for Parts 3 and 4 where I’ll be sharing the work done, outcomes and insights gained from follow-up explorations of Wave-Mamba, RainMamba and Loformer.</p><p>Next up: [<a href="https://medium.com/htx-s-s-coe/discovering-emerging-multimedia-technologies-for-national-security-at-acm-multimedia-2024-part-82d2a2e833c0">Part 3</a> — <a href="https://arxiv.org/abs/2408.01276">Wave-Mamba</a> for Low-light image enhancement and deraining and <a href="https://arxiv.org/abs/2407.21773">RainMamba</a> for Video Deraining]</p><p>Or go back to: [<a href="https://medium.com/me/stats/post/907b574730d5">Part 1 — The ACM MM 2024 Conference experience</a>]</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fe4a85940a92" width="1" height="1" alt=""><hr><p><a href="https://medium.com/htx-s-s-coe/discovering-emerging-multimedia-technologies-for-national-security-at-acm-multimedia-2024-part-fe4a85940a92">Discovering Emerging Multimedia Technologies for National Security at ACM Multimedia 2024 (Part…</a> was originally published in <a href="https://medium.com/htx-s-s-coe">HTX S&amp;S COE</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Discovering Emerging Multimedia Technologies for National Security at ACM Multimedia 2024 (Part…]]></title>
            <link>https://medium.com/htx-s-s-coe/discovering-emerging-multimedia-technologies-for-national-security-at-acm-multimedia-2024-part-907b574730d5?source=rss-6a4ae7216ece------2</link>
            <guid isPermaLink="false">https://medium.com/p/907b574730d5</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[multimedia]]></category>
            <dc:creator><![CDATA[Wei May Chen]]></dc:creator>
            <pubDate>Thu, 21 Aug 2025 16:01:34 GMT</pubDate>
            <atom:updated>2025-09-12T06:45:05.638Z</atom:updated>
            <content:encoded><![CDATA[<h3>Discovering Emerging Multimedia Technologies for National Security at ACM Multimedia 2024 (Part 1/4)</h3><h4>This is part 1 of the 4-part series about the experience attending the ACM MM 2024 conference, follow-up research explorations and technical takeaways.</h4><p>You can read <a href="https://medium.com/p/fe4a85940a92">Part 2 here</a>, <a href="https://medium.com/htx-s-s-coe/discovering-emerging-multimedia-technologies-for-national-security-at-acm-multimedia-2024-part-82d2a2e833c0">Part 3 here</a>, and <a href="https://medium.com/htx-s-s-coe/discovering-emerging-multimedia-technologies-for-national-security-at-acm-multimedia-2024-part-a6ac5ee78bec">Part 4 here</a>. The following research papers were explored for various operational use cases in home team departments:</p><ul><li>Part 1: The ACM MM 2024 Conference experience (You’re here!)</li><li>Part 2: <a href="https://arxiv.org/abs/2408.05669">StealthDiffusion</a>, an adversarial attack method applied on deepfake images to reduce their detectability by deepfake detectors.</li><li>Part 3: <a href="https://arxiv.org/abs/2408.01276">Wave-Mamba</a> for Low-light image enhancement and deraining; <a href="https://arxiv.org/abs/2407.21773">RainMamba</a> for Video Deraining.</li><li>Part 4: <a href="https://arxiv.org/abs/2407.16993">Loformer</a> for Image Deblurring.</li></ul><p>Imagine this: you’re at one of the biggest multimedia conferences of the year, surrounded by brilliant minds, cutting-edge research, and a buzzing atmosphere that’s equal parts inspiring and intimidating. That was my experience at ACM Multimedia 2024 — an unforgettable mix of learning, networking, and even a little adventure. Here’s the story of how it all unfolded.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cklHLY3x8sI1QM0f" /><figcaption>Wei May at ACM MM 2024</figcaption></figure><p><strong>Getting Ready: Trip Preparation</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*R8PMXw8GnG-STZWu" /><figcaption>Fig. 1. Overview of conference trip preparation planning strategies</figcaption></figure><p>Preparation is key for any big event. As I wanted to make the most of my time at the conference, preparation started weeks before the event. My first step? I began by combing through the conference program and list of accepted papers to shortlist papers that piqued my interest. It felt like building a personal treasure map — organising them by topics like deraining, low-light enhancement, deepfake detection, etc. which helped me focus on areas most relevant to my work.</p><p>Next up was planning my schedule. For oral presentations, I marked out the oral sessions I wanted to attend on each day of the event schedule and took note of their respective room numbers. I added room numbers and session timings to my Google Calendar and enabled reminders–a time-saver and lifesaver!</p><p>Poster sessions were a high priority too. I sorted them first by day of poster presentations and then by poster numbers. Then I highlighted the ones I wanted to visit and prepared questions for the authors. To stay efficient, I devised a tracking system — nothing too fancy, a simple page in the Notes app to note down which paper authors I engaged with, the mode of contacts exchanged (usually LinkedIn or Wechat), and whether a poster was available at the booth at the time I visited it and whether they were presenting in-person. This also helped me remember to revisit booths where authors were engaged with other conference participants at first or where posters had not been put up when I visited them earlier.</p><p>Overkill? Maybe.</p><p>Worth it? Absolutely.</p><p>Having everything organised made navigating the conference seamless.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0vEsLIlVsGkg8OEk" /><figcaption>Fig. 2. Example of oral session selections marked out on the program schedule</figcaption></figure><p>And because I can’t resist a little speculation, I browsed through the list of accepted papers to guess the next big AI trends, which set the stage for validating or invalidating those ideas during the conference through discussions with attendees and presenters. It happens that AI trend speculation happens to make for great conference conversation topics too.</p><p>Here are some of the identified potential AI trends apparent from the ACM MM 2024. Whether or not they will gain broader traction in the wider computer vision landscape shall be revealed in time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4TLENCtL24wr5yY7" /><figcaption>Fig. 3. Identified trends in AI (Computer Vision) from ACM MM 2024</figcaption></figure><h3>On the way to the Conference</h3><p>An unexpected moment came when I found a shortcut to the venue. Spotting attendees by their conference name tags on the way to the conference, I shared the tip. That sparked conversations and even a few friendships. It was quite astonishing how a single question blossomed into friendships, and how friends of friends effortlessly became part of the circle as well.</p><h3>People Make the Conference</h3><p>From the moment I stepped into the venue, I made a conscious effort to be present and open to every opportunity. The sessions were packed with insights, and the poster halls were a hub of excitement.</p><p>My strategy? Be present, stay curious, and remember to prioritise quality over quantity of connections to be made.</p><p>One of the best parts was meeting the authors at their poster booths. After a simple self-introduction, I’d start with something simple: “What’s your name? Where are you from? What is your research domain? Can you tell me more about your research?” And follow up with more detailed questions prepared earlier about their particular research paper published, research topic or related problems before moving on to other topics. I typically asked about their career aspirations — whether they planned to continue pursuing a career in academia or venture into industry, and other topics about their city of residence or hometown. Those conversations often flowed into deeper discussions about their inspirations, future plans, and even their favorite hobbies.</p><p>Getting to know people beyond their research papers naturally added a personal touch to our interactions. Asking about their city, hobbies and experiences made conversations more memorable and it’s amazing how much more memorable research becomes when you get to know the person and their motivations behind it.</p><p>At the conference, not everything went according to plan — and that was a good thing! One session I planned to attend had been unexpectedly cancelled, but I decided to stay for the replacement presentation whose timing had been swapped around. It turned out to be fascinating, and I made a note of the university and researcher. Later at lunch, I connected with someone from the presenting author’s university, hoping that she could pass on my compliment to the remote oral presenter for the session I had just attended. We hit it off so well that we went to the gala dinner together and had dinner and dessert together the day after. Funny how things work out.</p><p>Beyond the sessions and papers, it’s the people who make a conference memorable. The people I met were as diverse as their research. One PhD student who had once been an idol trainee for two years before pursuing academia. (Yes, really!) We bonded over dinner discussions about balancing research and personal passions. I also saw firsthand how hard researchers work — some were still attending meetings in the mornings in preparation for other conference paper submission deadlines and even late into the nights. Talk about dedication.</p><p>The cultural highlights added richness to the experience. The conference featured a performance by the Djirri Djirri dance group — an all-female Aboriginal Wurundjeri group. They performed extremely beautiful traditional dances and songs in the Woiwurrung language — a real treat in an increasingly urbanised and culturally-homogenised world. Their emphasis on leadership and cultural preservation was deeply moving.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MLHlSOgnl_4ff5fK" /><figcaption>Dance performance by members of the Djirri Djirri dance group at ACM MM 2024</figcaption></figure><p>It was heartwarming to see that the organisers of technical conferences like this one were willing to provide a platform for minority groups such as the Wurundjeri people to spread awareness about their rich culture, challenges and causes on an international stage.</p><h3>Post-Conference: The Adventure Continues</h3><p>Back home, the real work began. I reviewed my notes and highlighted notable research relevant to national security. These findings were integrated into a research report, alongside cross-checked hypotheses on emerging AI trends.</p><p>The best part? Taking what I learned and turning it into action. To make the most of what I learned, I’ve planned a series of exploration projects to test the applicability of these ideas in real-world scenarios. The insights shaped my short-term work plan.</p><p>To say that ACM Multimedia 2024 was a journey of discovery and connection would be an understatement. It’s an experience I’ll carry with me for years. From adapting to last-minute changes to forming unexpected friendships, the experience reinforced the importance of staying curious and open-minded. These lessons will continue to guide me as I explore the intersection of multimedia technologies and national security. If there’s one thing I’ve learned, it’s this: approach every opportunity with curiosity and an open mind, and you’ll find treasures in the most unexpected places.</p><h3>Follow-up Research Explorations and Technical Takeaways</h3><p>The following research papers were explored for various operational use cases in home team departments:</p><ol><li><a href="https://arxiv.org/abs/2408.05669">StealthDiffusion</a>, an adversarial attack method applied on deepfake images to reduce their detectability by deepfake detectors</li><li><a href="https://arxiv.org/abs/2408.01276">Wave-Mamba</a> for Low-light image enhancement and deraining</li><li><a href="https://arxiv.org/abs/2407.21773">RainMamba</a> for Video Deraining</li><li><a href="https://arxiv.org/abs/2407.16993">Loformer</a> for Image Deblurring</li></ol><p>Thanks for reading! If you enjoyed this article, stay tuned for Parts 2, 3 and 4 where I’ll be sharing the work done, outcomes and insights gained from follow-up explorations of StealthDiffusion, Wave-Mamba, RainMamba and Loformer.</p><p>Next up: [<a href="https://medium.com/p/fe4a85940a92">Part 2 — StealthDiffusion,</a> an adversarial attack method applied on deepfake images to reduce their detectability by deepfake detectors] (link to be updated)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=907b574730d5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/htx-s-s-coe/discovering-emerging-multimedia-technologies-for-national-security-at-acm-multimedia-2024-part-907b574730d5">Discovering Emerging Multimedia Technologies for National Security at ACM Multimedia 2024 (Part…</a> was originally published in <a href="https://medium.com/htx-s-s-coe">HTX S&amp;S COE</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Navigating a Reset from Accountancy to AI Engineering]]></title>
            <link>https://medium.com/htx-s-s-coe/navigating-a-reset-from-accountancy-to-ai-engineering-f8a956389dc0?source=rss-6a4ae7216ece------2</link>
            <guid isPermaLink="false">https://medium.com/p/f8a956389dc0</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[careers]]></category>
            <category><![CDATA[career-change]]></category>
            <category><![CDATA[projects]]></category>
            <category><![CDATA[computer-vision]]></category>
            <dc:creator><![CDATA[Wei May Chen]]></dc:creator>
            <pubDate>Fri, 27 Dec 2024 04:00:06 GMT</pubDate>
            <atom:updated>2024-12-27T08:27:24.112Z</atom:updated>
            <content:encoded><![CDATA[<h4>Making a Hard Switch was Easy</h4><h4>Introduction: Where I am and How I Got Here</h4><p>Hi, I’m <a href="https://www.linkedin.com/in/wei-may-chen/">Wei May</a>, a new AI Engineer at <a href="http://www.htx.gov.sg/">HTX</a>, <a href="https://www.htx.gov.sg/what-we-do/our-expertise/sense-making-surveillance">Sense-making and Surveillance</a> (S&amp;S) CoE.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*fzeneD9lRuTfqqtgPZjUXQ.jpeg" /><figcaption>Wei May at NTU Convocation 2024</figcaption></figure><p>Fresh out of university? Not quite. Pivoted from the industry? Not exactly. My career journey hasn’t followed a typical trajectory; it’s been a winding road that’s led me somewhere unexpected yet profoundly fulfilling.</p><p>Six years ago, with a degree in accountancy, I couldn’t have predicted I’d end up here at HTX, S&amp;S CoE. Back then, I was happily settled in a comfortable role I believed could carry me through life–one that offered a fulfilling work-life balance, meaningful projects and wonderful colleagues. But life had other plans. What started as a passion for writing evolved into a fascination with <a href="https://nautil.us/does-science-fiction-shape-the-future-543468/">science fiction</a> which sparked a curiosity for artificial intelligence (AI). Reading up on science and tech news as research material began as a pursuit for story inspiration. Before I knew it, this habit fanned the flames of curiosity which turned into an all-consuming interest–a realisation that I wanted to contribute to the world of AI.</p><p>Once I set foot on this journey, I never looked back.</p><h4><strong>My Current Vision AI Work #1: Deepfake generation via inpainting methods, inpainting detection and Image Manipulation Techniques for Dehazing and Low-light enhancement</strong></h4><p>There are many things which excite me about my day-to-day work at S&amp;S. Perhaps it was my earlier internships. I was exposed me to the rich field of computer vision that first sparked my interest in synthetic image generation. Later, the whitespace <a href="https://medium.com/@weimaychen2/video-translation-pipeline-project-bb187c38aba4">video translation pipeline</a> project I had the opportunity to work on brought me closer to deepfake research. The internship experience has given me a certainty towards contributing to the AI field in the public sector. Particularly in S&amp;S where the work is simultaneously exciting and meaningful–<em>well, don’t take my word for it just yet. Read the rest of the article to discover why this work drives me every day.</em></p><h4>Primer on Image Integrity Analysis</h4><p>Before we begin, there are some things to note about the field of image forensics.</p><p>The field of digital image forensics is marked by a perpetually ongoing battle between increasingly <a href="https://internationalpubls.com/index.php/anvi/article/view/1358/884">advanced forgery techniques</a> and the <a href="https://www.sciencedirect.com/science/article/abs/pii/S0031320323004764">evolving methods</a> designed to detect them. With each technological advancement, the pace of this intricate contest accelerates.</p><p>Where the genuineness of an image is in doubt, there can exist no such artefact which can serve as a proof of authenticity–only a lack of conclusive evidence of tampering. It is important to bear in mind that image forensics is evidence-based. The presence of signs of tampering does not necessarily imply that the image’s content is false. For instance, a contrast-enhanced image may accurately depict a real person, location, or situation, even though it exhibits modifications.</p><p>Does this mean there’s no point in the endeavour to detect deepfake images, given that the best assurance we can offer is a lack of conclusive evidence of manipulation? Quite the opposite. This challenge is precisely what makes deepfake generation and detection so fascinating. The pursuit lies in refining our ability to recognise subtle inconsistencies, making it possible to distinguish genuine images from forgeries with ever-greater precision.</p><p><em>Do you see why I’m so intrigued by the topic of deepfake generation and detection?</em></p><p>Today, my work involves exploring state-of-the-art (SoTA) AI technologies, with a primary focus on <a href="https://onlinelibrary.wiley.com/doi/10.1155/2022/9291971">inpainting for <strong>deepfake image generation </strong>and<strong> deepfake image detection</strong></a><strong> </strong>as well as other image manipulation techniques for applications like dehazing and low-light enhancement.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/1*8jPsGyB0CWwqP8VKomwjcQ.png" /><figcaption>Fig 1. A high-level overview of the steps typically involved in inpainting for deepfake generation.</figcaption></figure><p>Inpainting enables highly realistic yet localized manipulations, allowing subtle changes to facial features — such as the face, eyes, nose or mouth — without replacing entire sections. This manipulation is key in scams or identity theft, where only slight modifications to a person’s face are needed to achieve the desired effect while maintaining a high degree of believability. Whether creating a subtle expression change or modifying attributes like age or gender, inpainting techniques offer a powerful tool for generating realistically manipulated images.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XgVSq430ZeFI4NcNtJ_m3w.png" /><figcaption>Fig. 2(a). Source image, hair mask and face mask respectively of a sample from <a href="https://paperswithcode.com/dataset/celeba-hq">CelebA-HQ dataset.</a> The source image in was used as both the exemplar and ground truth images for the inpainted image generation.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7ws7DjEAxgv3bmedKfMN5A.png" /><figcaption>Fig. 2(b). Sample inpainted deepfake images generated using EXE-GAN and the <strong>hair</strong> mask in Fig 2(a).</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lOjwQayoWEMWJTXpUDnmNA.png" /><figcaption>Fig. 2(c). Sample inpainted deepfake images generated using EXE-GAN and the <strong>skin</strong> mask in Fig 2(a).</figcaption></figure><p>In my endeavour to create partial deepfakes using inpainting strategies, I am focusing on <strong>diffusion-based </strong>and <strong>GAN-based</strong> techniques amongst others. <a href="https://arxiv.org/abs/2406.07547"><strong>MimicBrush</strong></a> employs diffusion to iteratively refine the details of the altered facial components. With each diffusion step, the model transforms and reconstructs the missing or modified parts of the face, blending them seamlessly with the unaltered areas. This gradual and controlled approach allows for highly precise manipulations, pushing the boundaries of what can be achieved with partial deepfake generation. <br><a href="https://arxiv.org/abs/2202.06358"><strong>EXE-GAN</strong></a>, on the other hand, leverages on adversarial learning framework to create subtle alterations, thus being particularly effective for forgery generation. The <strong>generator</strong> within the GAN fills in or alters specific facial features, while the <strong>discriminator</strong> evaluates whether the modifications are detectable. Through this adversarial process, EXE-GAN can produce strikingly realistic alterations with minimal artefacts, allowing for subtle inpainting of facial features that can convincingly mimic real-life appearances. This reference-guided method is especially significant for forgery generation, where the goal is to manipulate specific parts of the face in a way that the changes go unnoticed.</p><h4>Detecting Deepfake Inpainting: A Key Defence against Scams</h4><p>The rise of inpainting-based forgeries necessitates the development of detection techniques to defend against such attacks. My focus is on inpainting detection, where subtle facial alterations make spotting fakes more challenging. Identifying these subtle manipulations — whether through pixel-level inconsistencies or lighting mismatches — is critical to maintaining trust in digital media. I’m working to enhance detection algorithms to catch even the smallest deviations, balancing Recall rates with low False Positive rates.</p><h4>My Current Vision AI Work #2: An Exploration of Efficient Dehazing and Low-Light Enhancement for Real-Time Applications</h4><p>Style transfer is often associated with transforming images into artistic renditions. But what about non-artistic domains? Could style transfer be suitable for any Home Team use cases?</p><p>The answer is yes!</p><p>Style transfer’s potential for Home Team operations lie in its potential for enhancing visibility in low-light or foggy conditions. I’m current exploring <a href="https://ieeexplore.ieee.org/document/10495365/keywords">style transfer as a viable tool for dehazing</a> and low-light enhancement.</p><ul><li><strong>Dehazing: </strong>Maritime operations often struggle with reduced visibility due to fog or haze. Dehazing is a solution to issue where visibility is hindered by fog/haze, hence impedes maritime operations</li><li><strong>Low-light enhancement: </strong>Surveillance footage often suffers from poor visibility in low-light conditions. By using style transfer, we can transform day images into night and vice versa, potentially creating clearer visuals during night-time operations. (Check out <a href="https://medium.com/htx-s-s-coe/breaking-through-the-darkness-how-to-enhance-low-light-images-with-deep-learning-techniques-257c98daf96f">this article</a> we have published earlier.)</li></ul><p>Traditional dehazing and low-light enhancement algorithms, though effective in many cases, are often burdened by high computational costs. This makes them inefficient for real-time use — especially when fast responses and situational awareness are paramount for operations like those carried out by the Home Team Departments. In a dynamic and fast-paced environment, even slight delays due to slow processing times can impact decision-making and overall effectiveness. Efficient style transfer offers a promising alternative that could make maritime and surveillance operations more effective.</p><p>In operations that require immediate action, real-time dehazing and low-light enhancement can offer a significant advantage. Clear visibility in foggy or low-light conditions can mean the difference between success and failure during a mission. But achieving this level of clarity, especially on edge devices with limited computational resources, is no easy task. The typical architectures for dehazing and low-light enhancement are not only computationally intensive but also slow — unsuitable for use cases where every second counts.</p><h4><strong>Exploring Efficient Alternatives</strong></h4><p>To overcome these limitations, I am actively experimenting with more computationally light techniques which involve <strong>codebook priors </strong>such as<strong> </strong><a href="https://arxiv.org/abs/2304.03994"><strong>RIDCP</strong></a>, <a href="https://arxiv.org/abs/2409.03231"><strong>Mamba state space models</strong></a> and <strong>3D Look-Up Tables (LUTs)</strong> such as<strong> </strong><a href="https://arxiv.org/pdf/2303.09170"><strong>NLUT</strong></a><strong> </strong>for real-time dehazing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/536/1*gtqqEKIjSY0wR-zDWjBAkQ.png" /><figcaption>Fig. 3(a): Style image used as a reference for the photorealistic style transfer.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*KqL-r6Idn7lyadvNHwmSHw.png" /><figcaption>Fig. 3(b): Source image from the <a href="https://github.com/yeyekurong/defogging-for-sea-fog-images-TIP2020">Sea-Fog</a> dataset prior to dehazing.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*tNyl6_0GBStHxCSp9CG8jw.png" /><figcaption>Fig. 3(c): Dehazed image generated via NLUT (super-fast photorealistic) style transfer, demonstrating significant clarity improvement.</figcaption></figure><p>In the example (Fig. 3) above, the “No Smoking” text is obscured in the original hazy image (Fig. 3(b)) but becomes clear and legible in the dehazed image (Fig. 3(c)).</p><p>LUTs leverage pre-defined transformations, allowing for fast and effective image enhancements with significantly reduced computational overhead. By applying LUTs, we can enhance image clarity in real-time, even under adverse weather conditions like haze, fog, or smoke — making it highly practical for maritime operations where clear visuals are essential for navigation and threat detection. When prioritising clarity in dehazing, the potential for colour distortions is deemed inconsequential.</p><p>Codebook priors can provide a more structured and efficient framework for processing images, helping to achieve the necessary enhancements while minimising computational load. By integrating this method, there’s potential to process visual data faster and more effectively, paving the way for real-time dehazing on edge devices deployed in the field. Click the links in the image captions to see the video.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*guUUhZEAyjp40G6CFOqx7A.png" /><figcaption>Fig 4(a). <a href="https://hometeamsnt-my.sharepoint.com/:v:/g/personal/may_chen_hometeamsnt_onmicrosoft_com/EVb07ELLWr5Ej_eTtaOIdyABgps5YfGmxkWirUkwF7qGEw?nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJPbmVEcml2ZUZvckJ1c2luZXNzIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXciLCJyZWZlcnJhbFZpZXciOiJNeUZpbGVzTGlua0NvcHkifX0&amp;e=jZfmjc">Side-by-side comparison</a> of dehazed drone-view video (left) using RIDCP and the <a href="https://www.youtube.com/watch?v=nTFTBSEO9_A">original drone-view video</a> (right).</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*psq_lstJ6YL6FuVa_ia6Rw.png" /><figcaption>Fig 4b. <a href="https://hometeamsnt-my.sharepoint.com/:v:/g/personal/may_chen_hometeamsnt_onmicrosoft_com/ERZ4Rf3iPJNHmRnrWTyAymUByi_INHejux8TFvLOWNKU7g?nav=eyJyZWZlcnJhbEluZm8iOnsicmVmZXJyYWxBcHAiOiJPbmVEcml2ZUZvckJ1c2luZXNzIiwicmVmZXJyYWxBcHBQbGF0Zm9ybSI6IldlYiIsInJlZmVycmFsTW9kZSI6InZpZXciLCJyZWZlcnJhbFZpZXciOiJNeUZpbGVzTGlua0NvcHkifX0&amp;e=yXQhlY">Side-by-side comparison</a> of dehazed street-view video (left) using RIDCP and the original hazy video (right).</figcaption></figure><p>RIDCP utilizes a VQGAN (Vector Quantized Generative Adversarial Network) pre-trained on high-quality images to obtain a discrete codebook encapsulating high-quality priors (HQPs). These HQPs are then integrated into the dehazing network to guide the restoration process. The VQGAN’s role is to provide robust priors rather than to generate images adversarially, distinguishing RIDCP from traditional GAN-based dehazing methods. Furthermore, in video-based applications, these image-based dehazing methods can result in frame-to-frame inconsistencies, causing a flickering effect due to the lack of temporal awareness in the models. Addressing this challenge requires a de-flickering post-processing step, such as the one proposed in the <a href="https://github.com/ChenyangLEI/All-in-one-Deflicker">All-in-One Deflicker</a> method, which aligns the temporal coherence of video frames without compromising their enhanced clarity. By dehazing methods with effective deflickering techniques, it is possible to achieve both high-quality and temporally stable outputs, crucial for dynamic maritime operations where environmental clarity must be both accurate and reliable.</p><p>Additionally, Mamba state-space models seem to perform well and efficiently on downstream tasks like <a href="https://arxiv.org/abs/2409.10385">style transfer</a>, image dehazing, <a href="https://arxiv.org/pdf/2407.21773">deraining</a>, <a href="https://arxiv.org/pdf/2408.01276">low-light enhancement</a> and super-resolution among others. Hence, they are also worth future exploration as they could present significant computational and time savings due to their high efficiency.</p><h4>Early Exploration and Future Benchmarking</h4><p>The above explorations are still in the experimental phase. While the initial results seem promising, there is more work to be done. The next step will involve rigorous benchmarking against existing state-of-the-art algorithms to determine their true efficiency and viability for real-time applications.</p><p>By comparing these methods with more traditional approaches, I hope to evaluate their performance in real-world use cases, ensuring they not only meet the computational requirements but also deliver the speed and accuracy necessary for Home Team operations. Should these methods prove effective, they could offer a game-changing solution for improving visibility in crucial, high-stakes environments, while keeping computational costs low enough for deployment on the edge. We will then look into ‘productising’ these methods for use by our Home Team colleagues.</p><p>In essence, these explorations into efficient dehazing and low-light enhancement are part of a larger effort to develop practical, real-time solutions that enhance the operational effectiveness of Home Team departments — pushing the boundaries of what AI can achieve beyond artistic applications.</p><h4>Reflection on my career switch</h4><p>Six years ago, I only had a Bachelor of Accountancy under my belt. A teaching job for about two years, and a second degree in Data Science and Artificial Intelligence later, I’m an AI Engineer at S&amp;S CoE, HTX.</p><p>Do I regret enrolling in my first degree? No, it helped me develop interpersonal skills that would serve me well in years to come and it enabled me to discover my passion for writing fiction.</p><p>Do I regret my teaching job? No, it helped me develop skills to summarise and express key learning points in a succinct manner and provided the space and time to explore what I really wanted to write about–science fiction, which ultimately led me down the path to becoming a direct contributor of AI applications.</p><p>Given the chance for a do-over, would I have chosen to enrol myself in university a second time? Yes. Though I recognise it’s not the only path to become an AI Engineer, I felt it was the option that best suited me. I knew what I wanted to do with my degree — gather as much hands-on experience through multiple internship opportunities. Make no mistake, these past few years have not been easy, but they have been just as rewarding as they have been challenging.</p><p>Over the course of 3.5 years, I actively participated in hackathons, internships, and various projects — both assigned and self-initiated such as <a href="https://medium.com/@weimaychen2/unlocking-the-secrets-of-skincare-navigating-the-labyrinth-of-product-interactions-through-an-c3987d090a18">this</a> and <a href="https://medium.com/@weimaychen2/revolutionizing-digital-creativity-harnessing-lora-adapted-stable-diffusion-within-docker-for-3f0419c6612e">this</a> — beyond my curriculum. I took on diverse internships, working with startups, private companies, and statutory boards across the public and private sectors. These experiences allowed me to explore different domains, refine my skills, and uncover specific areas of interest in AI. Through this journey, I gained a clearer understanding of how I wanted to apply my newfound expertise to make a meaningful contribution to society.</p><h4><strong>Lessons from My Own Career Shift and Advice for Career Switchers/Fresh Graduates</strong></h4><p>When I chose to pivot toward AI, I faced fears and doubts — fear of lacking the expertise, fear of starting over. But everyone starts somewhere, and it’s always better late than never. The longer we put off our ambitions, the further we fall behind.</p><p>The decision to change careers wasn’t made lightly. University fees, the commitment of time — they were not small considerations. But the pursuit of something meaningful far outweighed the costs. I’ve come to understand that it’s unproductive to get caught up in the idea of a “right” or “wrong” career path. The true challenge is whether we have the courage to follow our curiosity and accept that uncertainty is part of the journey.</p><p><a href="https://economictimes.indiatimes.com/jobs/mid-career/can-a-mid-career-professional-switch-to-ai-yes-and-heres-how/articleshow/99685819.cms?from=mdr">This Economic Times article</a> provides a curated list of tips to navigate a career transition into AI.</p><h4>Conclusion: A Journey Worth Taking</h4><p>I am only at the beginning of this journey. Though I am far from reaching the pinnacle of my career, I can confidently say that the journey thus far has been very worthwhile. If you’re unsure about making a change, I encourage you to take that step. The road might be challenging, but every step you take brings you closer to where you’re meant to be.</p><p>If that step happens to lead you to the public service and/or tech, HTX could be the place for you. Explore <a href="https://www.htx.gov.sg/join-us">this page</a> for more information about careers, associate programmes, internships and scholarships.</p><blockquote>“Courage doesn’t mean you don’t get afraid. Courage means you don’t let fear stop you.” — Bethany Hamilton.</blockquote><p>A career switch isn’t easy. But it’s the hard choices that often yield the greatest growth. Knowing your “why” makes all the difference — once you know your purpose, the path to achieving it, no matter how challenging, becomes clearer. You have to want it enough to be willing to work for it even when achieving it doesn’t seem possible.</p><p>The road might be harder, but that might just help you. If you start on a path feeling a bit behind, use it to your advantage, let it be your motivation to put in extra hours, extra effort. How do you find the energy? You find a purpose. If motivation doesn’t get you to work, let your habits lead you there.</p><p>In the book <em>From Strength to Strength </em>by Arthur C. Brooks, there is a notable quotation I really appreciate:</p><blockquote>“The nexus between enjoyment and effort is interest: the more interested you are in something, the more effort you put in, and the more enjoyment you derive from the effort.”</blockquote><p>The above quotation emphasises the idea that interest is the bridge between effort and enjoyment, meaning that passion or curiosity in an activity leads to both greater effort and greater satisfaction. Interest has fuelled my effort, and effort has made the journey endlessly rewarding. I hope we give in to our curiosity more frequently and get excited about where it will lead us.</p><p><em>Side advice to young people still in university who are unsure of their career path: Take on as many internships as possible. Talk to people outside your circle. Be open to new experiences. Do more internships. Switching tracks while still in university could be easier than changing careers after you’ve started work — you have less capital (time and money) invested and cheaper opportunity costs.</em></p><p><em>Side advice to people who are hesitant to pursue a career in a different field: Don’t let your fear hold you back. Don’t let yourself hold you back. I believe your curiosity can help you find your passion.</em></p><p>Quote from Winnie the Pooh by A. A. Milne:</p><blockquote>You are braver than you believe, stronger than you seem and smarter than you think.</blockquote><p>In other news, I was given the valuable opportunity to attend the ACM MM 2024 conference. It was an extremely positive eye-opening event where I was able to broaden my knowledge on cutting-edge AI research in multimedia and computer vision. If you enjoyed reading this article and are interested to find out about how I prepared for the trip and my experience attending the conference, stay tuned and follow the <a href="https://medium.com/htx-s-s-coe">S&amp;S blog</a> to get notified when the article comes out in about a month’s time! (Will update the link here once it’s published.)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f8a956389dc0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/htx-s-s-coe/navigating-a-reset-from-accountancy-to-ai-engineering-f8a956389dc0">Navigating a Reset from Accountancy to AI Engineering</a> was originally published in <a href="https://medium.com/htx-s-s-coe">HTX S&amp;S COE</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Revolutionizing Digital Creativity: Harnessing LoRA-Adapted Stable Diffusion within Docker for…]]></title>
            <link>https://medium.com/@weimaychen2/revolutionizing-digital-creativity-harnessing-lora-adapted-stable-diffusion-within-docker-for-3f0419c6612e?source=rss-6a4ae7216ece------2</link>
            <guid isPermaLink="false">https://medium.com/p/3f0419c6612e</guid>
            <category><![CDATA[stable-diffusion]]></category>
            <category><![CDATA[ai-art]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[lora]]></category>
            <category><![CDATA[image-generation]]></category>
            <dc:creator><![CDATA[Wei May Chen]]></dc:creator>
            <pubDate>Fri, 23 Feb 2024 03:59:29 GMT</pubDate>
            <atom:updated>2026-02-21T08:25:52.280Z</atom:updated>
            <content:encoded><![CDATA[<h3>Revolutionizing Digital Creativity: Harnessing LoRA-Adapted Stable Diffusion within Docker for Next-Gen Image Generation</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*mDxe_yuAOVU8Fb6TtyseyA.png" /><figcaption>Image generated by Stable Diffusion v1.5 base model by runwayml with the prompt: a beautiful sky</figcaption></figure><p>In the rapidly evolving domain of artificial intelligence and deep learning, the integration of LoRA (Low-Rank Adaptation) with the Stable Diffusion model presents a groundbreaking advancement, especially within creative fields such as game development and digital art creation. This article explores the transformative potential of using LoRA adaptation for the Stable Diffusion model to enhance and streamline the process of image generation.</p><p>This project aims to harness the power of Stable Diffusion, a state-of-the-art image generation model, and refine it with LoRA to cater to specific needs, thereby unlocking new possibilities for creators and developers alike. Here, we present the intricacies of this project, exploring its technical foundation, practical applications, and the groundbreaking potential it holds.</p><p>The code for this project can be found at <a href="https://github.com/solarspaceclouds/StableDiffusion-with-LoRA-integration/">https://github.com/solarspaceclouds/StableDiffusion-with-LoRA-integration/</a></p><p>Detailed documentation available at: <a href="https://github.com/solarspaceclouds/StableDiffusion-with-LoRA-integration/blob/master/Documentation_Stable_Diffusion_LoRA_Project.pdf">https://github.com/solarspaceclouds/StableDiffusion-with-LoRA-integration/blob/master/Documentation_Stable_Diffusion_LoRA_Project.pdf</a></p><h3>Unveiling the LoRA Adaptation for Stable Diffusion</h3><p>The LoRA adaptation for Stable Diffusion is a sophisticated technique designed to fine-tune pre-trained models for specific tasks without the need to retrain the entire model. This approach significantly reduces computational costs and time, making it an invaluable tool for artists, developers, and researchers. By integrating LoRA with Stable Diffusion, users can achieve tailored image outputs that are more aligned with their unique requirements or creative visions.</p><p>The LoRA (Low-Rank Adaptation) for the Stable Diffusion model, encapsulated within a Docker container, stands at the forefront of cutting-edge advancements in artificial intelligence (AI) and deep learning for creative applications.</p><h3>Technical Foundation and Setup</h3><p>At its core, the project leverages the Stable Diffusion model v1.5 <a href="https://huggingface.co/runwayml/stable-diffusion-v1-5">(https://huggingface.co/runwayml/stable-diffusion-v1-5)</a>, renowned for its ability to generate highly detailed and diverse images from textual prompts.</p><p>The introduction of LoRA allows for targeted adjustments to the model’s behavior without the need for extensive retraining. This technique involves modifying only the weights of certain layers within the model, significantly reducing computational resources and time requirements.</p><p>The project’s architecture is meticulously organized, comprising several key components:</p><ul><li><strong>Configuration File</strong> (<a href="https://github.com/solarspaceclouds/StableDiffusion-with-LoRA-integration/blob/master/config.yaml">config.yaml</a>): Specifies the base model and LoRA settings, serving as the project&#39;s backbone by guiding the adaptation process.</li><li><strong>Dockerfile</strong>: Facilitates the creation of a Docker image, ensuring the project’s environment is easily replicable and deployable across various platforms.</li><li><strong>Python Demo Notebooks</strong> (<a href="https://github.com/solarspaceclouds/StableDiffusion-with-LoRA-integration/blob/master/landscape.ipynb">landscape.ipynb</a> and <a href="https://github.com/solarspaceclouds/StableDiffusion-with-LoRA-integration/blob/master/single_object.ipynb">single_object.ipynb</a>): Provide practical demonstrations of generating landscape and object images, respectively, showcasing the model&#39;s versatility.</li><li><strong>Evaluation Notebook</strong> (<a href="https://github.com/solarspaceclouds/StableDiffusion-with-LoRA-integration/blob/master/evaluate_img_generation.ipynb">evaluation_img_generation.ipynb</a>): Outlines the strategy for assessing the quality, diversity, and consistency of generated images using the Inception Score metric.</li></ul><h3>Application in Game Creation</h3><p>A particularly exciting application of this adapted model is in the realm of game development, where it can dramatically streamline asset creation. The Stable Diffusion model with LoRA weights enables the conversion of text descriptions into stylized 2D images (styled according to the respective LoRA or combinations of LoRAs)</p><p>By converting text descriptions into 2D images, developers can then quickly generate assets that can then be transformed into 3D models or voxel art via other 2D-to-3D generation models. This not only accelerates the development cycle but also encourages creative experimentation with visual themes and concepts.</p><h3>Integration Process and Image Generation</h3><p>Integrating LoRA with the Stable Diffusion model involves a sequence of steps designed to tailor the image generation process:</p><ol><li><strong>Model Selection and Loading:</strong> The pre-trained Stable Diffusion model is selected and loaded, setting the stage for adaptation.</li><li><strong>LoRA Weights Loading:</strong> LoRA weights are downloaded and integrated into the model, adjusting its behavior based on the specific requirements of the task.</li><li><strong>Image Generation: </strong>Images are generated by inputting text prompts into the pipeline, with parameters such as the number of inference steps and guidance scale finely tuned to influence the output.</li></ol><pre>class SD:<br>    def __init__(self, model_name=&quot;runwayml/stable-diffusion-v1-5&quot;, device=&quot;cuda&quot;, torch_dtype=torch.float16):<br>        self.pipeline = AutoPipelineForText2Image.from_pretrained(model_name, torch_dtype=torch_dtype).to(device)<br><br>    def generate_and_save_image(self, prompt, height, width, num_inference_steps, guidance_scale, lora_weights, lora_scale, seed, num_imgs, tag):<br>        self.pipeline.unfuse_lora()  # Reset any previously applied LoRA modifications<br>        self.pipeline.unload_lora_weights()  # Ensure the model starts without any LoRA weights<br><br>        generator = torch.Generator(device=&quot;cuda&quot;).manual_seed(seed)<br><br>        # lora_weights is a list of paths to LoRA weights and <br>        # lora_scale is a corresponding list of scales for fuse_lora&#39;s lora_scale parameter<br>        if lora_weights:<br>            print(&quot;lora weights:&quot;, lora_weights)<br>            print(&quot;lora scale&quot;, lora_scale)<br>            for weight_path, scale in zip(lora_weights, lora_scale):<br>                # Load and apply each LoRA modification in sequence<br>                self.pipeline.load_lora_weights(weight_path)<br>                self.pipeline.fuse_lora(scale)<br><br>        # Generate images with potentially modified model<br>        images = self.pipeline(prompt, generator=generator, num_inference_steps=num_inference_steps, guidance_scale=guidance_scale, height=height, width=width, num_images_per_prompt=num_imgs).images</pre><h3>The Integration Process and Image Generation</h3><p>The integration of LoRA with the Stable Diffusion model involves selecting and loading the pre-trained Stable Diffusion model, downloading and loading LoRA weights, and finally generating images through a detailed process.</p><p>This process allows for the combination of multiple LoRAs, offering users the ability to experiment with different stylistic and conceptual modifications. Furthermore, the project provides mechanisms for addressing potential NSFW content generation, ensuring the model’s applicability in diverse contexts.</p><h3>Image Results</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*cgXd6IFNLTz9d1vKWM6W7w.png" /><figcaption>Image generated by Stable Diffusion v1.5 model by runwayml with basepixel LoRA using the prompt: a beautiful sky</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*Dd3QHlvtDoELpt19xSJZsg.png" /><figcaption>Image generated by Stable Diffusion v1.5 model by runwayml with wanostyle LoRA using the prompt: a beautiful sky</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*6CxzGZeUFZ-0dil0ZHUJOQ.png" /><figcaption>Image generated by Stable Diffusion v1.5 model by runwayml with basepixel and wanostyle LoRAs using the prompt: a beautiful sky</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*ro2clczU5FYbT2vm8dJIjg.png" /><figcaption>Image generated by Stable Diffusion v1.5 model by runwayml with jellyfish forest style LoRA using the prompt: a beautiful sky</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*EiWzM3gip4AWF9Xp8JH_7Q.png" /><figcaption>Image generated by Stable Diffusion v1.5 model by runwayml with easteregg and jellyfish forest LoRAs using the prompt: a beautiful sky</figcaption></figure><h3>Docker Containerization</h3><p>Docker plays a pivotal role in the project by encapsulating the model and its dependencies in a container, simplifying distribution and execution. This approach democratizes access to the model, allowing users with varying levels of technical expertise to leverage its capabilities. Detailed instructions can be found in the <a href="https://github.com/solarspaceclouds/StableDiffusion-with-LoRA-integration/blob/master/README.md">README.md</a></p><h3>Evaluation Strategy</h3><p>The project adopts a comprehensive evaluation strategy that encompasses both qualitative and quantitative assessments:</p><ul><li><strong>Qualitative Evaluation:</strong> Involves human judgment to assess (1) visual quality, (2) creativity, and (3) alignment with prompts.</li><li><strong>Quantitative Evaluation: </strong>Utilizes automated metrics such as the (1) Inception Score and (2) Fréchet Inception Distance to objectively evaluate image quality and diversity. For this project, no real images were available. Hence (2) is not suitable for reference-based quantitative evaluation. The Evaluation Notebook (evaluation_img_generation.ipynb) outlines the quantitative evaluation using Inception Score mean and variance to interpret the level of clarity and diversity of the generated images.</li></ul><h3>Insights and Future Directions</h3><p>The project’s findings underscore the effectiveness of LoRA in enhancing the Stable Diffusion model, offering nuanced insights into the potential for creating more personalized and diverse digital content. The successful integration of LoRA not only demonstrates the project’s technical feasibility but also paves the way for future innovations in AI-driven creative processes.</p><p>In conclusion, the LoRA adaptation for the Stable Diffusion model represents a significant leap forward in the field of AI and creative technology. By combining the generative power of Stable Diffusion with the precision of LoRA, this project offers an unparalleled toolkit for creators and developers, promising to revolutionize the way we conceive and produce digital art and game assets. As we continue to explore the capabilities and applications of this technology, we can expect to see even more creative, efficient, and personalized solutions emerge, reshaping the landscape of digital creativity.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3f0419c6612e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unlocking the Secrets of Skincare: Navigating the Labyrinth of Product Interactions Through an…]]></title>
            <link>https://medium.com/@weimaychen2/unlocking-the-secrets-of-skincare-navigating-the-labyrinth-of-product-interactions-through-an-c3987d090a18?source=rss-6a4ae7216ece------2</link>
            <guid isPermaLink="false">https://medium.com/p/c3987d090a18</guid>
            <category><![CDATA[knowledge-graph]]></category>
            <category><![CDATA[ai-art]]></category>
            <category><![CDATA[skincare]]></category>
            <category><![CDATA[web-scraping]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Wei May Chen]]></dc:creator>
            <pubDate>Wed, 31 Jan 2024 17:33:47 GMT</pubDate>
            <atom:updated>2024-01-31T17:33:47.557Z</atom:updated>
            <content:encoded><![CDATA[<h3>Unlocking the Secrets of Skincare: Navigating the Labyrinth of Product Interactions Through an Innovative Knowledge Graph</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3X-FmTyeCPWcOLmXuP5i7w.png" /><figcaption>Dall-E generated image of an aesthetically pleasing thumbnail for a skincare knowledge graph project.</figcaption></figure><h3>The Enlightening Journey: A Voyage into the Heart of Skincare Mastery</h3><p>Imagine embarking on a captivating journey through the intricate maze of skincare, where each product and ingredient holds secrets waiting to be unveiled.</p><p>Welcome to our visionary project, where we dive deep into the intricate world of skincare, unearthing the mysterious interactions between various products and their active ingredients. Picture this: a dynamic, user-friendly, interactive knowledge graph, meticulously crafted to illuminate the the synergies and conflicts in your skincare regime. This isn’t just a digital tool; it’s your personal skincare concierge, a beacon of enlightenment in the complex world of skincare, empowering you with knowledge to make informed, skin-loving decisions.</p><p>(Full code in github repository: <a href="https://github.com/solarspaceclouds/Skincare-Knowledge-Graph/tree/master">https://github.com/solarspaceclouds/Skincare-Knowledge-Graph/tree/master</a>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RFyfzI3bjnLhU7pMP_-6qA.gif" /><figcaption>Skincare Knowledge Graph</figcaption></figure><h4>The Essence of This Project: Crafting Your Personal Skincare Symphony</h4><p>Why does this matter, you ask? Envision sculpting your skincare routine with the confidence of a maestro, harmonizing products for maximum benefit, and skillfully avoiding combinations that could lead to unwanted reactions. This project transcends the boundaries of a mere informational resource; it’s a key to unlocking a world where each product you choose sings in perfect harmony with your skin. It’s a pathway to empower your skincare journey, ensuring each product you use is a step towards radiant, healthy skin.</p><h4>A Personal Quest for Skincare Wisdom: The Seed of Inspiration</h4><p>Our journey to this innovation was sparked by a personal revelation. It’s about time I started on anti-aging, and ever since I embarked on an anti-aging quest, experimenting with a myriad of skincare potions, compliments on my glowing skin were frequent, but so were the occasional, unsettling skin reactions. This sparked a realization: my face had become a testing ground for chemical interactions, some beneficial, others not so much. This personal story illuminated the need for a comprehensive tool like this one to serve as a guide through the enchanting yet often bewildering landscape of skincare, to be a beacon in the often murky waters of skincare choices.</p><h4>Disclaimer: A Project Rooted in Passion and Curiosity:</h4><p>It’s crucial to note that this project is born from personal curiosity and a desire to delve into the creation of a knowledge graph in the skincare domain. While the information has been gathered diligently, it’s important to remember that this tool was developed without any direct input or verification from skincare professionals. Thus, the insights offered are rooted in extensive online research and should be used as a guide, not a professional consultation. (i.e. The insights offered should be embraced as a guiding star, illuminating your path, but not as a substitute for professional consultation.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iHza37VeCDR1R3iqx2lX2g.png" /><figcaption>Dall-E generated image of an aesthetically pleasing thumbnail for a skincare knowledge graph project.</figcaption></figure><h3>Knowledge Graph Construction</h3><p>Now, for the part we have all been waiting for: Building the Knowledge Graph!</p><h4>The basic knowledge graph:</h4><ul><li>nodes</li><li>undirected or directed edges</li></ul><h4>The basic skincare knowledge graph:</h4><ul><li>product nodes</li><li>ingredient nodes</li><li>edges for the relation: product ‘contains’ ingredient</li></ul><h4>The full skincare knowledge graph</h4><ul><li>BLUE product nodes</li><li>ORANGE ingredient nodes</li><li>BLACK edges for the relation: product ‘contains’ ingredient:</li><li>GREEN edges with text for the relation: ingredient 1 and ingredient 2 result in ‘beneficial’ interaction effects</li><li>RED edges with text for the relation: ingredient 1 and ingredient 2 result in ‘adverse’ interaction effects</li><li>NAVY edges with text box for the relation: product 1 and product 2 consolidated (beneficial and adverse) interaction effects</li></ul><p>These beneficial_combis and adverse_combis were then used to construct the edges between the relevant ingredients with text displayed.</p><p>Full code is provided in the github repository: <a href="https://github.com/solarspaceclouds/Skincare-Knowledge-Graph/tree/master">https://github.com/solarspaceclouds/Skincare-Knowledge-Graph/tree/master</a></p><h4>The Backbone of Our Project: Sourcing Data with Precision:</h4><p>Our journey to construct this marvel began with the careful selection of data from incidecoder.com, a trusted repository of comprehensive skincare product and ingredient information. We handpicked a diverse array of brands, ensuring our graph reflects a rich tapestry of the skincare landscape.</p><p>The chosen brand names scraped for the purpose of this project were:</p><p>“Kiehl’s”, “Clarins”, “Sulwhasoo”, “Hera”, “La Mer”, “Clinique”, “Lancome”, “Elizabeth Arden”,”Skin Inc”, “Decorte”, “Fresh”, “Sk ii”, “Sum 37”, “Givenchy”, “Loreal”, “Guerlain”,”Vichy”,”The Ordinary”</p><p>(Additional notes: Initially, I planned to obtain active ingredients interaction information via extracting insights from the transcripts of the videos made by the popular dermatologist youtube channel: Doctorly. However, this endeavour which involved various steps such as transcript scraping, named entity recognition and (active ingredients interaction effects) insights extraction proved to be fairly challenging. It posed a significant distraction to the main focus of this project, which was to understand how to create a knowledge graph. Hence, I settled on the method of gathering information from online articles to identify the active ingredients and draft up <strong>predefined interaction rules</strong> to the best of my knowledge and understanding. In future, it would be beneficial to verify the information in this portion.)</p><p>Pre-defined ingredient interaction effects</p><p>The initial list of predefined effects was as follows:</p><pre>[&#39;Avoid Retinol and Vitamin C: cancel out effects&#39;,<br>&#39;Hyaluronic Acid and Polyglutamic Acid: better hydration&#39;,<br>&#39;Antioxidant and SPF: better UV protection&#39;,<br>&#39;Retinol and Niacinamide: improve the appearance of skin blemishes, help diminish the appearance of ageing, help to even out skin tone&#39;,<br>&#39;Retinol and Peptides: produce collagen and hyaluronic acid in the skin, and can help reduce inflammation and increase cell turnover rate&#39;,<br>&#39;Avoid Retinol and AHA: cancel out effects, cause irritation&#39;, <br>&#39;Avoid Retinol and BHA: may cause breakouts, dry skin, irritation&#39;,<br>&#39;Avoid Retinol and Citric Acid: excessive dryness, redness, sensitivity, or a rash&#39;,<br>&#39;Avoid AHA/BHA and Niacinamide: redness&#39;,<br>&#39;Avoid Retinol and Benzoyl Peroxide: too harsh for skin.&#39;,<br>&#39;Avoid AHA and Vitamin C: irritation&#39;,<br>&#39;Avoid BHA and Vitamin C: irritation&#39;,<br>&#39;Vitamin C and Vitamin E: can help prevent photodamage&#39;,<br>&#39;Vitamin C and Ferulic Acid: Ferulic acid, used to fend off free radicals, helps to stabilize vitamin C&#39;,<br>&#39;Avoid Salicylic acid and Benzoyl Peroxide: skin irritation&#39;,<br>&#39;Avoid Benzoyl Peroxide and Retinol: cancel out effects&#39;]</pre><p>As some ingredients have a number of alternative names, the list of predefined rules were further refined to include all the combinations of the interaction effects between two ingredients for every possible alternative name. For example,</p><pre>[&#39;Avoid Retinol and Vitamin C: cancel out effects&#39;]<br># would be turned into</pre><p>[‘Avoid Retinol and Vitamin C: cancel out effects’]</p><p>would be turned into</p><p>[‘Avoid Retinol 0.5% and Vitamin C: cancel out effects’, ‘Avoid Retinol 1.0% and Vitamin C: cancel out effects’, ‘Avoid Retinol and Vitamin C: cancel out effects’, ‘Avoid Retinol 0.2% and Vitamin C: cancel out effects’, ‘Avoid Retinol and 3-O-Ethyl-L-Ascorbic Acid: cancel out effects’, ‘Avoid Retinol and Ascorbic Acid: cancel out effects’, ‘Avoid Retinol and Tetrahexyldecyl Ascorbate (Vitamin C): cancel out effects’, ‘Avoid Retinol and Vitamin C: cancel out effects’, ‘Avoid Retinol and Magnesium Ascorbyl Phosphate (Vitamin C): cancel out effects’, ‘Avoid Retinol and Ascorbyl Palmitate (Vitamin C Liposome): cancel out effects’, ‘Avoid Retinol and Ascorbic Acid (Vitamin C): cancel out effects’, ‘Avoid Retinol and Sodium Ascorbyl Phosphate (Vitamin C): cancel out effects’, ‘Avoid Retinol and Ethyl Ascorbic Acid (Vitamin C): cancel out effects’]</p><p>because Retinol ingredient is referred to by the elements in the list: [‘Retinol 0.5%’, ‘Retinol 1.0%’, ‘Retinol’, ‘Retinol 0.2%’] and Vitamin C is referred to by the elements in the list: [‘3-O-Ethyl-L-Ascorbic Acid’, ‘Ascorbic Acid’, ‘Tetrahexyldecyl Ascorbate (Vitamin C)’, ‘Vitamin C’, ‘Magnesium Ascorbyl Phosphate (Vitamin C)’, ‘Ascorbyl Palmitate (Vitamin C Liposome)’, ‘Ascorbic Acid (Vitamin C)’, ‘Sodium Ascorbyl Phosphate (Vitamin C)’, ‘Ethyl Ascorbic Acid (Vitamin C)’]</p><p>This list of predefined rules were then differentiated based on the type of interaction effects: beneficial or adverse.</p><p>What results is then beneficial_combis and adverse_combis which are dictionaries of key: (ingredient1, ingredient2) and value: “string text of interaction effect” for beneficial and adverse interaction effects respectively.</p><pre># An example item in the beneficial_combis dictionary: <br>(&#39;Sodium Ascorbyl Phosphate (Vitamin C)&#39;, &#39;Ferulic Acid&#39;): &#39;Ferulic acid, used to fend off free radicals, helps to stabilize vitamin C&#39;</pre><pre># An example item in the adverse_combis dictionary: <br>(&#39;Retinol 0.5%&#39;, &#39;Vitamin C&#39;): &#39;cancel out effects&#39;</pre><h4>Constructing the Knowledge Graph: A Visual Odyssey:</h4><p>This is where the magic happens. The creation of our knowledge graph happens at an intersection where creativity meets science. Our knowledge graph isn’t just a collection of data; it’s a visual narrative of skincare. With nodes representing products and ingredients, and edges illustrating their relationships, the graph is a vibrant tapestry of blues, oranges, greens, reds, and navies. Each color tells a story — from the basic ingredients contained in a product to the complex interactions between them, whether beneficial or adverse.</p><p>The knowledge graph was constructed using the dash, pandas and networkx python libraries.</p><h3>The Final Product</h3><pre>- Can take multiple product inputs selected from dropdown list<br>- Product (BLUE) and Ingredient (ORANGE) nodes shown with names;<br>- Beneficial (GREEN) and Adverse (RED) Interaction effects text BETWEEN INGREDIENTS displayed<br>- Beneficial (GREEN) and Adverse (RED) Interaction effects edges BETWEEN INGREDIENTS displayed<br>- Consolidation of Beneficial and Adverse Interaction effects text BETWEEN PRODUCTS displayed in NAVY<br>- with grey box outline around the text<br>- Text Box at the side which also shows<br>- Consolidation of Beneficial and Adverse Interaction effects text BETWEEN PRODUCTS [PAIRWISE COMPARISON]<br>- Interaction effects among the selected products<br>- Beneficial<br>- Adverse<br>- Overall<br>(Text Box for easier reading in case the knowledge graph is too messy)Looking Ahead: The Continuous Evolution of Skincare Understanding:</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ovg2jr-BXvyQ6iIWBV5WFg.gif" /><figcaption>Skincare Knowledge Graph with Summary Text Box</figcaption></figure><h4>User Experience: Navigating the Graph with Intuitive Grace</h4><p>Using our knowledge graph is a breeze. Simply type in a product, brand, or ingredient, and let our intelligent search bar guide you. Whether you’re exploring potential product pairings or investigating the interactions between ingredients, our graph is an interactive, engaging tool that brings the world of skincare to your fingertips.</p><p>While the current insights are gleaned from a thorough exploration of available online resources, I dream of a future where these insights are further enriched and validated by professional expertise. The project is not static; it’s a living, growing, evolving entity, poised to continually enhance our collective understanding of skincare interactions.</p><h4>How to use the Knowledge Graph:</h4><p>In the search bar, type in the search term (brand name/ingredient name/specific product name). A drop-down list of possible selections will be constantly updated according to your typed input. Select your desired ingredient. Then in the search bar, continue to search and select your next.</p><h4>Conclusion: A Journey Beyond a Knowledge Graph</h4><p>In conclusion, this project is more than a knowledge graph; it’s a journey into the heart of skincare, a companion that empowers you to make choices that are kind to your skin and resonate with your spirit.</p><p>Join me on this enlightening path, and let’s navigate the fascinating world of skincare together! Let’s unravel the secrets of skincare together, transforming the way we perceive and interact with our skincare routines. Let this be your invitation to a world where knowledge leads to beauty, and beauty is born from understanding.</p><figure><img alt="Fairy-themed skincare by DallE" src="https://cdn-images-1.medium.com/max/1024/1*eUx0q74Y0X3hV69pXU9WZQ.png" /><figcaption>Source: Dall-E; Fairy-themed skincare packaging</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c3987d090a18" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Book Review: Love Yourself Like Your Life Depends On It by Kamal Ravikant (Part 1)]]></title>
            <link>https://medium.com/@weimaychen2/book-review-love-yourself-like-your-life-depends-on-it-by-kamal-ravikant-part-1-29922457fd45?source=rss-6a4ae7216ece------2</link>
            <guid isPermaLink="false">https://medium.com/p/29922457fd45</guid>
            <category><![CDATA[book-review]]></category>
            <category><![CDATA[healing]]></category>
            <category><![CDATA[reflections]]></category>
            <category><![CDATA[love]]></category>
            <category><![CDATA[self-love]]></category>
            <dc:creator><![CDATA[Wei May Chen]]></dc:creator>
            <pubDate>Wed, 02 Aug 2023 01:46:16 GMT</pubDate>
            <atom:updated>2024-12-31T16:56:25.936Z</atom:updated>
            <content:encoded><![CDATA[<p>Everyone has their own unique human experience but we are all connected by the common human experience.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/0*Jp_KqckpGVBq-PUG.png" /></figure><p>Here are a few snippets of the book <em>Love Yourself Like Your Life Depends On It </em>by <em>Kamal Ravikant</em> which resonate with me, supplemented with my reflections and ponderings which I hope will help me whenever I revisit, and hopefully help any readers who may be going through a tough time or who enjoy exploring what goes on in another person’s mind:</p><blockquote><em>Life begins from the inside out. Focus on what’s within. The rest will resolve itself.</em></blockquote><p>From reading this quote, it suddenly becomes apparent that the internal locus of control is the only control we have. Though counterintuitive, it implies that all you can do to influence your external circumstances is to only attempt to affect the things within your reach; anything else that is out of your control is not worth your time and attention.</p><p>I am still on the fence about the last sentence though. “The rest will resolve itself.” In a way, it depends on one’s mindset. I believe people have an extraordinary ability to reason anything in any way they want — that’s why lawyers and therapists are so highly paid… for different reasons (but that is to be discussed in a different article).</p><p>If problems get resolved in the natural sense of having any negative aspect removed, leaving behind only neutral or positive outcomes, then that’s great. But even if challenges persist, even if situations take a turn for the worse, problems could get resolved by:</p><ol><li>accepting the fact that the current situation is the best that it can be,</li><li>coming to terms with the fact that it is impossible/improbable that change will happen to the current outcome,</li><li>having an epiphany and realising that the problem they were facing hadn’t actually been the problem at all, or</li><li>opening their eyes to see the bright side and choosing to believe that things are happening for them and not to them.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/0*10_UGY3lALsRgRlK.png" /><figcaption>Photo by <a href="https://unsplash.com/@eugene_golovesov">Eugene Golovesov</a> on <a href="https://unsplash.com/">Unsplash</a></figcaption></figure><p>I think the author has given us a gold nugget of a question, one that will bring many benefits to anyone for as long as they hold it in their minds:</p><blockquote><em>If I love myself truly and deeply, what would I do? Who would I be?</em></blockquote><p>The reason why I appreciate this question so much is because it’s simple and has the singular focus of loving yourself — which is the most important (and arguably the only) aspect that one should consider in making decisions.</p><p>Too often, people make decisions for the sake of others, thinking that their actions will affect another in some way. To a certain extent, that may be true, but I personally don’t think much of that because of three reasons (so far):</p><ol><li>People are autonomous beings; it would be kind of narcissistic of me to think that anything I do could so radically influence their actions and decisions. People have the ability to think for themselves. They choose what they do.</li><li>If things are meant to happen, they will happen regardless of my actions; I can’t claim to be a significant force that has the power to change the course of history, nor of the future. I believe everything that happens is meant to happen.</li><li>This third reason will take a while to explain: I believe in the karmic cycle, and that everybody happens to each other. The karmic cycle has been going on for who knows how long and we are all stuck in the cycle of debt. Challenges supposedly present opportunities for people to repay the debt, or accumulate more of it. No one knows for sure whether suffering will truly end after enlightenment is attained (not to mention whether it is possible to attain enlightenment in the first place). But as it is, life is good. It’s not all bad. For most people, fragments of good and bad parts decorate their lives. It only seems good or bad depending on the parts people focus on more.</li></ol><p>An additional note:</p><p>Making decisions for others instead of for one’s own sake rests upon the assumptions that you know what they would prefer/choose and that they would be fine with having you make that decision for them. We can think what we like, but we’ll never know whether these assumptions hold true unless we let them know the whole truth and actually confer the decision-making power onto them.</p><p>There’s an uncolloquial Chinese saying I really like: 子非鱼，安知鱼之乐？which means: You are not the fish, so how do you know whether the fish is happy or not? How can you assume to know what the fish is thinking? Usually, I like to think of it as a nice reminder to show empathy towards others. But in this context, it’s a helpful prompt to get one to consider whether we really know what’s best for others, to contemplate if it is possible that we know others even better than they do themselves, to wonder whether we are fully justified in making decisions for their sake.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/0*yN6f-0ZmkaGR-cNy.png" /><figcaption>Photo by <a href="https://unsplash.com/@tangzhengtao">zhengtao tang</a> on U<a href="http://unsplash.com/">nsplash</a></figcaption></figure><p>After the author presents the above question, he presents an answer that anyone can interpret in the way they prefer:</p><blockquote><em>Be excellent.</em></blockquote><p>Everyone has a different definition of what constitutes being excellent, just as how everyone has their own idea of what an ideal life constitutes and what their greatest self (the version of themselves that has reached their highest potential) looks like.</p><p>And even better, the author most generously provides the readers with the prerequisite/method to achieve that goal:</p><blockquote><em>Love myself fiercely.</em></blockquote><p>Love yourself the way you want others to love you. In doing that, you teach the world how to treat you.</p><blockquote><em>Decide who you want to be instead of what you want to achieve.</em></blockquote><p>This is an interesting point worthy of debate. I think the basis of it might have come from the reflections upon the general qualities discussed in eulogies. People are remembered most by the kind of person they were, how they made other people feel, rather than the accomplishments they have made. It’s funny how people tend to forget to appreciate others for the former qualities after someone is gone but pay more attention to them only when it’s too late to show any more gratitude towards them, yet people are consistently lauded for their accolades every day.</p><p>When people decide who they want to be and focus on that clear goal, there’s a high chance they’ll end up at their destination eventually. But if people decide on what they want to achieve, there’s a chance they might end up becoming a person that they don’t like or no longer recognise, and that is such a frightening possibility.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/0*UZL7-VJo9DmcDYNn.png" /><figcaption>Photo by <a href="https://unsplash.com/@24ameer">Ameer Basheer</a> on <a href="http://unsplash.com/">Unsplash</a></figcaption></figure><p>Another thing that the author brought up, which is pretty useful/practical advice for getting out of a rut:</p><blockquote><em>The proactive rather than reactive mind helps with healing.</em></blockquote><p>I agree. It pays to be busy when you are hurting. Immerse yourself in activities, go out with old friends, meet new ones, revisit old projects, start new ones, go to therapy, engage in retail therapy, think of ways to earn more money, eat food that satisfies your tastebuds, sing or dance if you like, do anything you can to try to get yourself together again, just don’t stay still.</p><p>The following points describe my general approach to healing:</p><ol><li>Keep busy</li><li>Spend time with people — so you spend less time in your own head and more time focusing on the external world, on the people you care about. Doing so can help you appreciate life more and realise that there are so many more aspects of life worth celebrating even if things aren’t going well in one or two.</li><li>Know that the pain shall pass — there are no good days without the bad, so be thankful for the bad days too. Tomorrow presents new opportunities, new possibilities. Change happens, whether or not you want it to.</li><li>Know that whatever pain you may be going through, at least one other person in this world exists (or has existed in history) who has survived, and even thrived. (This must hold true statistically, given the number of possible variations of the human experience.) And know that it is possible for you to do so, too.</li><li>Write. Because writing helps you become aware of your thoughts, and writing brings your mind to places you never thought it could go. (This could go both ways, but I choose to be hopeful that it will go in the positive direction eventually) (Note: This may work better if you already have the habit of writing in your free time.)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/0*Rm0o534EZaXzbA6t.png" /><figcaption>Photo by <a href="https://unsplash.com/@joshhild">Josh Hild</a> on <a href="http://unsplash.com/">Unsplash</a></figcaption></figure><p>The most important thing to develop is one’s personal philosophy. In doing so, you create a spiritual manual or guidebook which you use to govern your everyday decisions, regardless of the magnitude. If you do, you’ll find the courage to do what feels good to you, even if it seems wrong to everyone else, even if it seems wrong in theory. You don’t have to answer to anyone else but yourself, first and foremost.</p><p>Take care of your own spirit before you have the capacity to take care of anybody else.</p><p>Make decisions, take actions that will put your mind and heart at ease. No matter what difficulties you’re facing, it’s probably not worth suppressing feelings.</p><p>I think the author sums it up quite nicely:</p><blockquote><em>Do whatever it takes to feel powerful from the inside out, to feel in control, to feel that I happen to things. Decide that I and only I am responsible for my feelings and emotions and ultimately, my life.</em></blockquote><p>I am lucky because I love the way I think. I am lucky to be a fully autonomous being.</p><p>There is a quote I love that I saw on a jewellery card holder:</p><blockquote><em>Lucky is believing you are lucky.</em></blockquote><p>If you can control your mind, you can conquer anything. The mind is that powerful. Believe in the power of believing. Reference: the law of attraction.</p><blockquote>You can’t love someone into loving you, <br>but you can love yourself into <br>a new reality where you can be happy.</blockquote><p>2 ways to change (your perceived) reality (that have worked for me):</p><ol><li>Revisit the things you value, relate them with the things you are upset about. Confirm whether or not the things that are making you upset are actually the things that you value in the first place. If you can do this, you’ll realise that a lot of the times, we’re upset because we think we should be upset, and not because we actually are. We are upset by the things that we don’t even actually care about in the first place, so it doesn’t make sense to spend time and energy being upset over them.</li><li>Focus on taking on the next step. as long as you can see that, just take the next step. Who knows, once you do, sometimes you may find that your destination is right there.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/0*Thln-C8ifY0bwPrX.png" /><figcaption>Photo by <a href="https://unsplash.com/@mygallery">KS Kyung</a> on <a href="http://unsplash.com/">Unsplash</a></figcaption></figure><blockquote><em>We suffer most in our imagined realities</em></blockquote><p>Stoic philosopher Seneca said, “<em>We suffer more</em> in <em>imagination</em> than in <em>reality</em>.” This may be true, but we also live in our imagined realities because we tell ourselves what we want to hear. We are the stories we tell ourselves. We spend the most time inside our own minds, so it is so important to make sure it’s a great place to be in.</p><p>Perhaps my logic is flawed in some way, but I cannot see it; and for as long as I am unable to see the blind spots of my thinking, this is my truth.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=29922457fd45" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>