<?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 Ahlam Yusuf on Medium]]></title>
        <description><![CDATA[Stories by Ahlam Yusuf on Medium]]></description>
        <link>https://medium.com/@ahlamyusuf?source=rss-801a0238a96------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*MZg7ZCQepQSENmJU.jpg</url>
            <title>Stories by Ahlam Yusuf on Medium</title>
            <link>https://medium.com/@ahlamyusuf?source=rss-801a0238a96------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 23:06:23 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ahlamyusuf/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[Netflix Is Secretly Altering Your Favorite 80s Shows — And You Won’t Believe the Difference]]></title>
            <link>https://medium.com/@ahlamyusuf/netflix-is-secretly-altering-your-favorite-80s-shows-and-you-wont-believe-the-difference-3e9fe777a0ee?source=rss-801a0238a96------2</link>
            <guid isPermaLink="false">https://medium.com/p/3e9fe777a0ee</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[image-enhancement]]></category>
            <category><![CDATA[image-processing]]></category>
            <dc:creator><![CDATA[Ahlam Yusuf]]></dc:creator>
            <pubDate>Thu, 03 Apr 2025 14:18:43 GMT</pubDate>
            <atom:updated>2025-05-18T20:02:25.321Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Netflix Using AI to Enhance Shows from The 90s</strong></h3><p>Let me start off by saying this is no secret: if you watched A Different World which was launched on Netflix a month or so ago, you’d get an eerie feeling from watching the show, some things just not right. Well, your spidey senses are right!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jZjp1AzlpnnnszF3LFuw1A.png" /><figcaption>Opening Credits</figcaption></figure><h3>How Is This Done?</h3><p>The process of enhancing a video is similar to how an image would get improved. Here are the main techniques used for quality enhancement</p><ol><li>Upscaling</li><li>Color Correction</li><li>Noise Reduction</li><li>Adjusting lighting, Contrast, and Saturation</li><li>Reconstructing missing information like (colors, degraded images, etc)</li><li>Addition of a filter</li></ol><h3>What Is Upscaling and Color Enhancement?</h3><p>Many classic TV shows were shot on film or early video formats that had much lower resolutions than today’s 4K (or even HD) standards. Upscaling is the process of <strong>increasing the resolution</strong> of an image using algorithms (or AI) to fill in missing details. In the past, upscaling would stretch the image, often making it blurry. <strong>AI upscaling</strong> will analyze patterns in the video and reconstruct edges, textures, and details to create a cleaner, more defined picture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d8mHpA_ovXjDuKteivWztA.png" /><figcaption>Opening Credits</figcaption></figure><h3>Color Enhancement: Bringing Faded Colors Back to Life</h3><p>Over time, film and tape degrade, causing colors to lose their original vibrancy. Additionally, older TV shows were mastered with the limitations of CRT televisions in mind — colors weren’t as rich as they are on modern OLED or LED screens. <strong>AI color enhancement</strong> adjusts saturation, contrast, and balance to make the image look more natural and vibrant without appearing artificially boosted.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p5NyC7rixgDNZLbSwCZ1Gw.png" /><figcaption>Season 4 Episode 4</figcaption></figure><h3>Noise, Grains, and Light Adjustments</h3><p>Older shows have issues with grains, visible noise, and lighting inconsistency. AI is really good at detecting things that are not supposed to be there, like <strong>Noise in an Image</strong>. When done right, the removal of grains and noise in an image can significantly increase image quality, coupled with light adjustments, saturation, and contrast to bring back color vibrancy like it was shot … well, not in the actual year it was shot.</p><h3><strong>Reconstructing Missing Information</strong></h3><p>Quality degradation does cause information loss and to fill in the gap, AI is able to take neighboring points (or pixels) and come up with a prediction of what’s missing and creating a smooth image.</p><h3><strong>Addition of a Filter</strong></h3><p>When restoring something to a decent quality of content, the purpose is not to create something perfect without flaws; the purpose is to create something that’s realistic and add a grain filter back to the image creates that realistic feel to it. If you’re interested in adding Noise and Blur to an image, have a <a href="https://medium.com/@ahlamyusuf/how-to-generating-low-resolution-images-with-noise-and-blur-a-practical-guide-for-any-cv-project-822e2aae8162">read</a>.</p><h3>Why is this happening?</h3><p>People want to watch their childhood TV shows from the comfort of their living room using their Ultra OLED screens and enjoy the finer details how can they achieve that with 128 pixels.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8ildD4GB9cgowAyYNz48Tw.png" /></figure><h3>When will this become an issue?</h3><p>At the moment the risk is low with augmenting TV show resolution for better viewing, but the better it gets the more content can be altered and false information can be shared with the public. We are not too far from being able to alter live footage in real time.</p><p>I am in the process of building an image enhancement tool for fun :) if interested follow here and here my Github <a href="https://github.com/Lumi1717/image_upscaling/tree/main">repo</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e9fe777a0ee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Generating Low-Resolution Images with Noise and Blur: A Practical Guide for any CV Project]]></title>
            <link>https://medium.com/@ahlamyusuf/how-to-generating-low-resolution-images-with-noise-and-blur-a-practical-guide-for-any-cv-project-822e2aae8162?source=rss-801a0238a96------2</link>
            <guid isPermaLink="false">https://medium.com/p/822e2aae8162</guid>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[opencv-python]]></category>
            <category><![CDATA[image-processing]]></category>
            <dc:creator><![CDATA[Ahlam Yusuf]]></dc:creator>
            <pubDate>Thu, 03 Apr 2025 13:46:53 GMT</pubDate>
            <atom:updated>2025-04-03T13:47:15.600Z</atom:updated>
            <content:encoded><![CDATA[<p>This solution is part of a larger project that I am currently developing. As of April 3rd, 2025, 2:20 AM GMT +4, I decided to release this quick tutorial for anyone who still likes to learn from searching through blog posts to find solutions. Don’t get twisted; some of this code was generated using an LLM. I’m not shaming… Let’s get into it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1020/1*ppr5sg5pk2pYDBWIfBLAWw.png" /></figure><p>Depending on the computer vision project, there might be a need to generate low resolution images from high resolution ones for training and stuff. The code is less than 100 lines of code and is streightforward, each section will explain a function in the code.</p><h3>1. Adding Noise and Blur</h3><pre>def add_noise_and_blur(img, blur_ksize=5, noise_var= 10):<br>    &quot;&quot;&quot; Add Gaussian Blue and Gaussian Noise &quot;&quot;&quot;<br><br>    # blur kernal size is 5 because documention put 5<br>    blurry_img = cv2.GaussianBlur(img, (blur_ksize, blur_ksize), 0 )<br><br>    #Generate Gaussian Noise<br>    gauss_noise = np.random.normal(0, noise_var ** 0.5, img.shape).astype(np.uint8)<br><br>    # Add Blur and noise to image<br><br>    img_blur_noise = cv2.add(blurry_img, gauss_noise)<br><br>    return img_blur_noise</pre><p>if you’re reading this then you’re familiar with OpenCV library. We will use <strong>GaussianBlur</strong> to generate a blurry image</p><ul><li><strong>img</strong>: image that you want to create the effect on</li><li><strong>blur_ksize</strong>: think of the kernel as a sliding window that moves across the image. The kernel size tells you how big that window is. A larger window = more pixels are averaged together = more blur. Kernel sizes are odd numbers</li><li><strong>0</strong>: SigmaX, allows you to specify the standard deviation of the Gaussian kernel in the x-direction. if set to 0 it’ll calculate automatically from kernal size.</li></ul><p><strong>Gaussian Noise</strong></p><ul><li><strong>np.random.normal(…)</strong>: Generates random numbers following a Gaussian (normal) distribution.</li><li><strong>0</strong>: The mean (center) of the noise is 0, meaning it&#39;s centered around the original pixel values.</li><li><strong>noise_var</strong>: controlling noise intensity.</li><li><strong>img_shape</strong>: Creates the random noise based on image size</li><li><strong>astype(np.uint8)</strong>: Converts the noise values to 8-bit unsigned integers (0-255), matching image pixel data.</li></ul><h3>2. Downscaling Images</h3><pre>def downscale_image (hr_path,lr_dir, scale_factor=4, blur_ksize=5, noise_var=10):<br>    &quot;&quot;&quot; Reduce HR images sizing and add noise and blur&quot;&quot;&quot;<br><br>    hr_img = cv2.imread(hr_path)<br>    if hr_img is None:<br>        print(f&quot;DID NOT READ {hr_path} fix yo shit&quot;)<br>        return<br>    <br>    #create LR imgsss<br>    h, w = hr_img.shape[:2]<br>    lr_img = cv2.resize(hr_img, (w//scale_factor, h//scale_factor), interpolation= cv2.INTER_CUBIC )<br><br>    lr_img = add_noise_and_blur(lr_img, blur_ksize, noise_var=noise_var)<br><br>    #save imgs<br>    file_name = os.path.basename(hr_path)<br>    lr_path = os.path.join(lr_dir, file_name)<br>    cv2.imwrite(lr_path, lr_img)</pre><ul><li>Validate and read the path to our image</li><li>Downsamples by integer scale_factor of 4 as default</li><li>Uses bicubic interpolation (calculating pixel values based on the surrounding pixels)</li><li>Applies our noise and blur functions</li><li>Saves the result with the same filename in the LR directory</li></ul><h3>3. Parallel Processing</h3><pre>def generate_lr_imgs(hr_dir, lr_dir, scale_factor=4, num_workers=4, blur_ksize=5, noise_var=10):<br>    &quot;&quot;&quot; Generate LR imaged from HR images &quot;&quot;&quot;<br>    os.makedirs(lr_dir, exist_ok=True)<br><br>    hr_img = [os.path.join(hr_dir, f) for f in os.listdir(hr_dir)<br>                if f.lower().endswith((&#39;.png&#39;, &#39;.jpeg&#39;, &#39;jpg&#39;))]<br>    <br>    task_args = [(hr_path, lr_dir, scale_factor, blur_ksize, noise_var) for hr_path in hr_img]<br><br>        # Process with multiprocessing<br>    with Pool(processes=num_workers) as pool:<br>        list(tqdm(pool.imap(process_args, task_args), <br>                total=len(hr_img), <br>                desc=&quot;Generating LR images&quot;))<br>    <br>    print(f&quot;Generated {len(hr_img)} LR images in {lr_dir}&quot;)</pre><ul><li>Find all images in the directory and include the listed file extension</li><li>Uses multiprocessing (Pool) to parallelize the work</li><li>Includes a progress bar (tqdm) for monitoring</li></ul><h3>4. Configuration Management</h3><pre>if __name__ == &#39;__main__&#39;:<br><br>    project_root = get_project_root()<br>    with open(os.path.join(project_root, &quot;level_2/configs/train_config.yaml&quot;), &#39;r&#39;) as f:<br>        config = yaml.safe_load(f)<br>    <br>    hr_dir = os.path.join(project_root, config[&#39;data&#39;][&#39;train_hr_dir&#39;])<br>    lr_dir = os.path.join(project_root, config[&#39;data&#39;][&#39;train_lr_dir&#39;])<br>    scale = config[&#39;data&#39;][&#39;scale_factor&#39;]<br>    workers = config[&#39;data&#39;][&#39;num_workers&#39;]<br>    kern_size = config[&#39;data&#39;][&#39;blur_ksize&#39;]<br>    noise_var = config[&#39;data&#39;][&#39;noise_var&#39;]<br><br>    print(f&quot;Processing images from: {hr_dir}&quot;)<br>    print(f&quot;Saving results to: {lr_dir}&quot;)<br>  <br>    generate_lr_imgs(hr_dir=hr_dir, lr_dir=lr_dir, scale_factor=scale, num_workers=workers, blur_ksize=kern_size, noise_var=noise_var)</pre><p>I am learning to implement new things and one of them is a .yaml basically instead of writing all the args on your terminal every time you run the script you store all the variables in a yaml file and just call them. Groundbreaking like florals for spring</p><h3>5. Final Note</h3><p>The dataset that I used was DIV2K <a href="https://data.vision.ee.ethz.ch/cvl/DIV2K/">dataset</a> and if you want to skip the whole tutorial and get the low-resolution images you can find them <a href="https://www.kaggle.com/datasets/sulavtimilsina/div2k-low-resolution-data">here</a>.</p><p>My GitHub project repo you can find it <a href="https://github.com/Lumi1717/image_upscaling/tree/main/level_2/scripts">here</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=822e2aae8162" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Run Any Language Model Locally with Ollama: A Beginner’s Guide]]></title>
            <link>https://medium.com/@ahlamyusuf/how-to-run-any-language-model-locally-with-ollama-a-beginners-guide-bc68f7c270ed?source=rss-801a0238a96------2</link>
            <guid isPermaLink="false">https://medium.com/p/bc68f7c270ed</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[how-to]]></category>
            <category><![CDATA[ollama]]></category>
            <dc:creator><![CDATA[Ahlam Yusuf]]></dc:creator>
            <pubDate>Mon, 24 Feb 2025 19:01:00 GMT</pubDate>
            <atom:updated>2025-02-24T19:01:00.376Z</atom:updated>
            <content:encoded><![CDATA[<p>Running large language models (LLMs) locally has never been easier, thanks to tools like <strong>Ollama</strong>. Ollama is a lightweight, user-friendly platform designed to simplify the process of running open-source language models on your own machine. Whether you’re a developer, researcher, or just curious about AI, Ollama makes it accessible to everyone. In this guide, I’ll walk you through the steps to run any language model locally using Ollama.</p><h3>Why Use Ollama?</h3><p>Ollama is a game-changer for running LLMs locally. Here’s why:</p><ol><li><strong>Simplicity</strong>: Ollama abstracts away the complexity of setting up and managing language models.</li><li><strong>Cross-Platform</strong>: It works on macOS, Linux, and Windows.</li><li><strong>Pre-Built Models</strong>: Ollama provides pre-configured models like LLaMA, Mistral, and more, so you don’t have to worry about downloading weights or setting up environments.</li><li><strong>Efficiency</strong>: It’s optimized for local inference, making it faster and more resource-efficient.</li><li><strong>Extensibility</strong>: You can easily add custom models or fine-tune existing ones</li></ol><h3>What You’ll Need</h3><p>Before we start, make sure you have:</p><ul><li>A computer with at least 8GB of RAM (16GB or more recommended for larger models).</li><li>A decent CPU (a GPU is optional but recommended for faster performance).</li><li>Basic familiarity with the command line.</li><li>Ollama installed (we’ll cover this in the next step).</li></ul><h3>Step 1: Install Ollama</h3><p>Ollama is incredibly easy to install. Follow these steps:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*siuc9mMM55Ni6lMg9UVdrw.png" /></figure><p><strong>1.Download Ollama</strong>:</p><ul><li>Visit the official <a href="https://github.com/ollama/ollama">Ollama GitHub repository</a> or website.</li><li>Download the installer for your operating system (macOS, Linux, or Windows).</li></ul><p><strong>2. Install Ollama</strong>:</p><ul><li>For macOS: Open the downloaded .dmg file and drag Ollama to your Applications folder.</li><li>For Linux: Run the provided .sh script to install Ollama.</li><li>For Windows: Run the .exe installer and follow the prompts.</li></ul><p><strong>3. Verify Installation</strong>:<br>Open a terminal or command prompt and type:</p><pre>ollama --version</pre><p>If you see a version number, you’re good to go!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6bC-HAexPQ77lHAczPYp6g.jpeg" /></figure><h3>Step 2: Pull a Pre-Built Model</h3><p>Ollama comes with a library of pre-configured models. To get started, you can pull a model from their repository. For example, let’s use <strong>LLaMA 2</strong>:</p><ol><li>Pull the model:</li></ol><pre>ollama pull llama2</pre><p>2. Verify the model:</p><pre>ollama list</pre><p>You should see llama2 listed as an available model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mMZKwMnhY8dvbd_qVG3N2g.png" /></figure><h3>Step 3: Run the Model</h3><p>Once the model is downloaded, you can start using it right away. Ollama provides an interactive command-line interface for running models.</p><ol><li>Start the model:</li></ol><pre>ollama run llama2</pre><p>2. Interact with the model:</p><p>You’ll see a prompt where you can type in your input. For example:</p><pre>&gt;&gt;&gt; Whats the weather like in Oman ?</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YJzBdZmxlbeWPIelhz5I5g.png" /></figure><h3>Step 4: Use Ollama as a Server (Optional)</h3><p>Ollama can also run as a local server, allowing you to interact with the model via API calls. This is useful if you want to integrate the model into your own applications.</p><ol><li>Start the Ollama server:</li></ol><pre>ollama serve</pre><p>2. Send a request to the server:</p><p>2. Send a request to the server:</p><pre>curl -X POST http://localhost:11434/api/generate -d &#39;{<br>  &quot;model&quot;: &quot;llama2&quot;,<br>  &quot;prompt&quot;: &quot;Why is the sky blue?&quot;<br>}&#39;</pre><h3>Step 5: Add Custom Models (Optional)</h3><p>Ollama supports custom models, so you’re not limited to the pre-built ones. Here’s how to add your own:</p><ol><li>Create a Modelfile:<br>A Modelfile is a configuration file that defines your custom model. Here’s an example:</li></ol><pre>FROM llama2<br>PARAMETER temperature 0.7<br>PARAMETER top_p 0.9</pre><p>2. Build the model:</p><pre>ollama create my-custom-model -f ./Modelfile</pre><p>3. Run your custom model:</p><pre>ollama run my-custom-model</pre><h3>Step 6: Optimize Performance</h3><p>Running LLMs locally can be resource-intensive. Here are some tips to optimize performance:</p><ol><li><strong>Use a GPU</strong>: If you have a compatible GPU, Ollama will automatically leverage it for faster inference.</li><li><strong>Choose Smaller Models</strong>: If your hardware is limited, try smaller models like llama2-7b instead of llama2-13b.</li><li><strong>Adjust Parameters</strong>: Use parameters like temperature and top_p to control the model’s behavior and improve efficiency.</li></ol><h3>Step 7: Build Your Application</h3><p>With Ollama, you can easily integrate language models into your own projects. Here are a few ideas:</p><ul><li>Build a chatbot using Ollama’s API.</li><li>Create a content generation tool for writers.</li><li>Use the model for data analysis or research.</li></ul><p>For example, here’s how you can use Python to interact with Ollama’s API:</p><pre>import requests<br><br>response = requests.post(<br>    &quot;http://localhost:11434/api/generate&quot;,<br>    json={<br>        &quot;model&quot;: &quot;llama2&quot;,<br>        &quot;prompt&quot;: &quot;Explain quantum computing in simple terms.&quot;<br>    }<br>)<br><br>for line in response.iter_lines():<br>    if line:<br>        print(line.decode(&quot;utf-8&quot;))</pre><h3>Challenges and Considerations</h3><ol><li><strong>Hardware Requirements</strong>: Running large models requires a decent machine. A GPU is recommended for optimal performance.</li><li><strong>Storage Space</strong>: Model weights can take up significant storage (e.g., LLaMA 2–13B is around 10GB).</li><li><strong>Licensing</strong>: Ensure you comply with the licensing terms of the model you’re using.</li></ol><h3>Conclusion</h3><p>Ollama is a powerful tool that makes running language models locally accessible to everyone. Whether you’re experimenting with AI, building applications, or just curious, Ollama simplifies the process and removes the barriers to entry. With just a few commands, you can have a state-of-the-art language model running on your own machine.</p><p>Shout out to my friend Mahmood for letting me ab(use) his machine for me to provide the screenshots</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bc68f7c270ed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Metaphysic.ai is De-Aging Hollywood: The Future of Filmmaking Explained from Data Scientist]]></title>
            <link>https://medium.com/@ahlamyusuf/how-metaphysic-ai-is-de-aging-hollywood-the-future-of-filmmaking-explained-from-data-scientist-6ef22fe10448?source=rss-801a0238a96------2</link>
            <guid isPermaLink="false">https://medium.com/p/6ef22fe10448</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[metaphysics]]></category>
            <dc:creator><![CDATA[Ahlam Yusuf]]></dc:creator>
            <pubDate>Wed, 19 Feb 2025 22:14:32 GMT</pubDate>
            <atom:updated>2025-02-19T22:14:32.158Z</atom:updated>
            <content:encoded><![CDATA[<iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FUBc38VjI7NU%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DUBc38VjI7NU&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FUBc38VjI7NU%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/bc989b2b37979229fac02b49cfd88ca9/href">https://medium.com/media/bc989b2b37979229fac02b49cfd88ca9/href</a></iframe><p>I was scrolling through YouTube recently when a Vox video title caught my eye: <em>“How de-aging in movies got so good.” </em>after watching the video, I couldn&#39;t not post about it.</p><p>A lot of the information written here is gathered from the Vox video at this moment Metaphysic.ai did not publish any paper for us to consume an disucss, so let’s hypothesize on our own</p><h3>The Old Way: A Tedious and Long Process</h3><p>Before Metaphysic.ai, de-aging actors was a <strong>labor-intensive, time-consuming endeavor</strong>. Here’s how it used to work:</p><p>1️⃣ <strong>3D Scanning and Modeling</strong>: Actors would be 3D scanned, and a digital version of their head would be created. Artists would then manually build every muscle, wrinkle, skin layer, and even the peach fuzz on their face to simulate how it moves and ages.</p><p>2️⃣ <strong>Months of Post-Production</strong>: Every frame of the actor’s performance had to be adjusted in post-production, often taking months or even years to complete. The results were impressive but not always seamless.</p><p>3️⃣ <strong>Disconnect Between Performance and Final Product</strong>: Because de-aging happened after filming, actors couldn’t see their younger selves on set. This sometimes led to mismatches between their physicality and their digitally altered appearance.</p><h3>The New Way: Metaphysic.ai’s Genius Solution</h3><p>The solution is simple yet genius: Metaphysic.ai trains its AI on a dataset of images and videos of the actor throughout their life. Instead of stitching together different facial features to create a younger face, it <strong>generates a completely new face</strong> based on the dataset. It’s like teaching the AI to “imagine” what the actor looked like at a younger age.</p><p>This is why the solution is so smart and innovative. Think about your company’s chatbot: it uses a language model trained on a limited dataset (your company’s data) and generates content based on your requirements. Metaphysic’s approach is the same — just with images instead of text.</p><p>If you’ve watched the 2024 movie <em>Here</em>, you’ve seen this technology in action. The results are seamless, realistic, and incredibly impressive.</p><h3>How Does Metaphysic.ai Achieve This? A Technical Deep-Dive for the non Technical</h3><p>Here’s a glimpse into the technical magic behind Metaphysic’s solution, we will not get into the data collection and quality part as you know you’re model is only as good as your data. you can quote me on that 👀</p><p>1️⃣ <strong>Feature Extraction</strong>:</p><ul><li>The AI identifies key facial features (eyes, nose, jawline) using algorithms like <strong>OpenCV</strong> and <strong>Mediapipe</strong>.</li><li><strong>OpenCV</strong>: Used for general-purpose computer vision tasks, such as detecting facial landmarks and performing basic image processing.</li><li><strong>Mediapipe</strong>: Specifically designed for real-time facial tracking, it provides highly accurate facial landmarks and is optimized for performance on edge devices.</li><li>Then conducting Facial Skin classification (skin texture, wrinkles, and expressions) using <strong>convolutional neural networks (CNNs)</strong>.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xGNbTZ3XQffqeQMAERn93Q.jpeg" /></figure><p>Try out feature extracting <a href="https://github.com/Lumi1717/medium_facial_landmark">here</a></p><p>2️⃣ <strong>Generative Models</strong>:</p><ul><li><strong>Generative Adversarial Networks (GANs)</strong> is used to create new faces. The generator builds the face, while the discriminator ensures it looks realistic.</li><li>By training on thousands of images, the AI learns to “imagine” what the actor looked like at different ages.</li></ul><p>3️⃣ <strong>Facial Segmentation and Meshing</strong>:</p><ul><li>Once the new face is generated, <strong>facial segmentation</strong> is used to isolate specific regions of the face (e.g., eyes, nose, mouth, skin).</li><li>A <strong>3D facial mesh</strong> is then created to map the generated face onto the actor’s actual face. This mesh ensures the new face aligns perfectly with the actor’s expressions and movements.</li><li>The mesh acts as a bridge, allowing the AI to blend the generated face seamlessly with the actor’s body and surroundings</li></ul><p>4️⃣ <strong>Real-Time Processing</strong>:</p><ul><li>The AI generates de-aged faces in <strong>milliseconds</strong>, allowing actors to see their younger selves on set and adjust their performance in real-time.</li><li>This is powered by <strong>neural rendering</strong> and high-performance GPUs.</li></ul><p>5️⃣ <strong>Post-Processing Refinement</strong>:</p><ul><li>In post-production, the AI refines the results with higher fidelity, blending the generated face seamlessly with the actor’s body and surroundings.</li><li>Techniques like <strong>Poisson blending</strong> and <strong>alpha matting</strong> are used to ensure the final result is flawless.</li></ul><p>This is my high level analysis of how they are achieving their results for anyone who doesn&#39;t know anything about it but wants to learn. I could be right, i could be wrong but it was a fun exercise to test my knowledge on the matter.</p><p>This isn’t just about making actors look younger — it’s about <strong>enhancing storytelling</strong> by removing technical barriers and letting filmmakers focus on emotion and performance.</p><p>What are your thoughts on AI in filmmaking? Game-changer or ethical minefield? Let’s discuss! 👇</p><p>#AI #MachineLearning #Filmmaking #VFX #Innovation #Metaphysic #DeAging #Hollywood #TechDeepDive</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6ef22fe10448" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Detailed Explanation of DSPy with Code]]></title>
            <link>https://medium.com/@ahlamyusuf/detailed-explanation-of-dspy-with-code-d75ff3de76cb?source=rss-801a0238a96------2</link>
            <guid isPermaLink="false">https://medium.com/p/d75ff3de76cb</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[dspy]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Ahlam Yusuf]]></dc:creator>
            <pubDate>Sun, 09 Feb 2025 08:06:37 GMT</pubDate>
            <atom:updated>2025-02-09T08:06:37.692Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/609/1*ftJwCnXF4bbH7zxKyVUJhg.png" /></figure><h3>What is DSPy? A Deep Dive into the Future of Language Model Programming</h3><p>Language models (LMs) like GPT-3.5 and LLaMA have revolutionized AI, but working with them can be challenging. Writing prompts, fine-tuning models, and optimizing pipelines often require significant effort and expertise. Enter <strong>DSPy</strong> — a framework that simplifies and supercharges how we build systems with LMs.</p><p>In this post, we’ll explore what DSPy is, how it works, and why it’s a game-changer for AI developers. We’ll also walk through code examples to show you how to get started.</p><h3>What is DSPy?</h3><p>DSPy is a programming model for <strong>building and optimizing pipelines with language models</strong>. Instead of manually crafting prompts or fine-tuning models, DSPy uses <strong>natural language signatures</strong> to define tasks. These signatures tell the LM <em>what</em> to do (e.g., “answer questions”) without specifying <em>how</em> to do it.</p><p>For example, instead of writing a detailed prompt like:</p><pre>&quot;Answer the following question step by step. Question: What is the capital of France? Answer: Paris&quot;</pre><p>You can simply define a signature:</p><pre>question -&gt; answer</pre><p>DSPy handles the rest, automatically generating prompts, fine-tuning models, and improving performance over time.</p><h3>Key Features of DSPy</h3><ol><li><strong>Natural Language Signatures</strong>: Define tasks in plain English.</li><li><strong>Self-Improving Pipelines</strong>: DSPy can bootstrap examples and optimize itself.</li><li><strong>Modular Design</strong>: Combine modules like Predict, ChainOfThought, and Retrieve to build complex systems.</li><li><strong>Automatic Prompting and Fine-Tuning</strong>: DSPy generates prompts and fine-tunes models for you.</li></ol><h3>How Does DSPy Work?</h3><p>DSPy programs are built using <strong>modules</strong> and <strong>signatures</strong>. Let’s break this down with code examples.</p><h4>1. Simple Predict Module</h4><p>The Predict module is the simplest way to use DSPy. It takes a signature and generates predictions.</p><pre>import dspy<br># Define a signature: question -&gt; answer<br>qa_system = dspy.Predict(&quot;question -&gt; answer&quot;)<br># Use the system to answer a question<br>response = qa_system(question=&quot;What is the capital of France?&quot;)<br>print(response.answer)  # Output: Paris</pre><h4>2. ChainOfThought Module</h4><p>The ChainOfThought module makes the LM think step-by-step before generating an answer.</p><pre>cot_system = dspy.ChainOfThought(&quot;question -&gt; answer&quot;)<br># Use the system to answer a question<br>response = cot_system(question=&quot;What is 12 - 5?&quot;)<br>print(response.answer)  # Output: 7</pre><h4>3. Multi-Stage ThoughtReflection Module</h4><p>For more complex tasks, you can use the ThoughtReflection module, which generates multiple reasoning chains and picks the best answer.</p><pre>class ThoughtReflection(dspy.Module):<br>    def __init__(self, num_attempts=3):<br>        self.predict = dspy.ChainOfThought(&quot;question -&gt; answer&quot;, n=num_attempts)<br>        self.compare = dspy.MultiChainComparison(&quot;question -&gt; answer&quot;, M=num_attempts)<br>    def forward(self, question):<br>            completions = self.predict(question=question).completions<br>            return self.compare(question=question, completions=completions)<br>reflection_system = ThoughtReflection(num_attempts=3)<br>response = reflection_system(question=&quot;What is 12 - 5?&quot;)<br>print(response.answer)  # Output: 7</pre><h3>Compiling and Optimizing DSPy Programs</h3><p>DSPy programs can be <strong>compiled</strong> to improve their performance. Here’s how:</p><h4>1. Bootstrapping with Random Search</h4><p>Bootstrapping generates examples to teach the program how to solve tasks.</p><pre>from dspy.teleprompt import BootstrapFewShotWithRandomSearch<br># Define a compiler<br>tp = BootstrapFewShotWithRandomSearch(metric=gsm8k_accuracy)<br># Compile the program<br>compiled_program = tp.compile(program, trainset=trainset, valset=devset)</pre><h4>2. Ensembling</h4><p>Ensembling combines multiple programs to make the final output more reliable.</p><pre>from dspy.teleprompt import Ensemble<br># Create an ensemble of the top 7 programs<br>ensemble = Ensemble(reduce_fn=dspy.majority).compile(bootstrap.programs[:7])</pre><h3>Why Use DSPy?</h3><ol><li><strong>Efficiency</strong>: No more manual prompt engineering.</li><li><strong>Flexibility</strong>: Build complex pipelines with reusable modules.</li><li><strong>Self-Improvement</strong>: DSPy optimizes itself over time.</li><li><strong>Scalability</strong>: Works with any LM, from GPT-3.5 to LLaMA.</li></ol><h3>Getting Started with DSPy</h3><p>Ready to try DSPy? Check out the <a href="https://github.com/stanfordnlp/dspy">DSPy GitHub repo</a> for installation instructions and tutorials.</p><p>Whether you’re building chatbots, retrieval systems, or reasoning pipelines, DSPy makes it faster, easier, and more reliable.</p><h3>Conclusion</h3><p>DSPy is a powerful framework that simplifies how we work with language models. By automating prompting, fine-tuning, and optimization, DSPy empowers developers to build smarter AI systems with less effort.</p><p>Give it a try and let me know what you think!</p><p>#AI #MachineLearning #LanguageModels #DSPy #NLP #ArtificialIntelligence #TechInnovation</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d75ff3de76cb" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>