<?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 Maria Llain on Medium]]></title>
        <description><![CDATA[Stories by Maria Llain on Medium]]></description>
        <link>https://medium.com/@mariallain?source=rss-13f9dcb332b1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dWp0EE4TNTKejGKN4nP6Bw.jpeg</url>
            <title>Stories by Maria Llain on Medium</title>
            <link>https://medium.com/@mariallain?source=rss-13f9dcb332b1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 14:49:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mariallain/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[Earn $491 a day with this $29,260 Crypto Mining Rig]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@mariallain/earn-491-a-day-with-this-29-260-crypto-mining-rig-9259b7f4a9e9?source=rss-13f9dcb332b1------2"><img src="https://cdn-images-1.medium.com/max/1280/1*Lq5_fe90tYoX_BVmxvNBFw.jpeg" width="1280"></a></p><p class="medium-feed-snippet">Bitmain Antminer AL1 Is Challenging the Crypto Mining Space With Its New Technology. Get Started Here.</p><p class="medium-feed-link"><a href="https://medium.com/@mariallain/earn-491-a-day-with-this-29-260-crypto-mining-rig-9259b7f4a9e9?source=rss-13f9dcb332b1------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@mariallain/earn-491-a-day-with-this-29-260-crypto-mining-rig-9259b7f4a9e9?source=rss-13f9dcb332b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/9259b7f4a9e9</guid>
            <category><![CDATA[trading]]></category>
            <category><![CDATA[crypto]]></category>
            <category><![CDATA[crypto-trading]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[finance]]></category>
            <dc:creator><![CDATA[Maria Llain]]></dc:creator>
            <pubDate>Thu, 22 Aug 2024 16:11:38 GMT</pubDate>
            <atom:updated>2024-08-22T16:11:38.436Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Restoring Image Quality With AI using Real-ESRGAN and SwinIR]]></title>
            <link>https://medium.com/@mariallain/restoring-image-quality-with-ai-using-real-esrgan-and-swinir-20d54c483e39?source=rss-13f9dcb332b1------2</link>
            <guid isPermaLink="false">https://medium.com/p/20d54c483e39</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[photography]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[image-processing]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Maria Llain]]></dc:creator>
            <pubDate>Tue, 20 Aug 2024 21:31:40 GMT</pubDate>
            <atom:updated>2024-08-20T21:31:40.897Z</atom:updated>
            <content:encoded><![CDATA[<h4>A Step-by-Step Guide to Enhancing Images with Advanced AI Models</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0d4UglVUii8V91wZaHZCsA.jpeg" /><figcaption><a href="https://entreprenerdly.com/restoring-image-quality-with-ai-using-real-esrgan-and-swinir/">Image Created by Author</a> using using Real-ESRGAN, SwinIR and BSRGAN Image Restoration Models.</figcaption></figure><p>Recent AI advancements in photography have significantly improved image restoration tasks which achieve results that seemed unimaginable 5 years ago.</p><p>We will explore how to use three AI models — Real-ESRGAN, SwinIR, and BSRGAN — to restore image quality. We will compare their effectiveness and highlight their strengths.</p><p>A Google Colab Notebook will be provided for you to apply these technologies to your own images. Having this in your toolkit will be beneficial if you ever need to improve the quality of your photos.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GvrJNiHXMuR3kR4jXKiSJw.gif" /><figcaption>Notebook Created by Author to Automate the Process of Restoring Image Quality Using AI models. Source: <a href="https://entreprenerdly.com/">https://entreprenerdly.com</a></figcaption></figure><h3>1. Understanding Image Quality Restoration</h3><p>In general, AI-based image restoration improves the quality of degraded images affected by noise, blur, or compression artifacts. We discuss how 3 of the strongest AI models address these challenges.</p><h3>Real-ESRGAN</h3><p><a href="https://github.com/xinntao/Real-ESRGAN?tab=readme-ov-file">Real-ESRGAN</a> builds on the <a href="https://github.com/xinntao/ESRGAN">ESRGAN</a> model, but optimizes it for real-world image restoration tasks. This model improves resolution and includes a mode specifically for facial enhancement, which is very impressive.</p><p>It is especially useful for restoring degraded photos that need quality improvements in both faces and backgrounds.</p><p>Additionally, Real-ESRGAN offers specialized models for anime video up-scaling and restoration. This models as been fine-tuned on anime videos during its training process. See example below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pJYbzpJqtAxpKTX36PJALA.gif" /><figcaption><strong>Figure 1. </strong>Low-quality anime video on the left and the right video shows the result after Real-ESRGAN inference. Source: <a href="https://github.com/xinntao/Real-ESRGAN">https://github.com/xinntao/Real-ESRGAN</a></figcaption></figure><p>For more details on the Real-ESRGAN, visit the following resources:</p><ul><li><a href="https://github.com/xinntao/Real-ESRGAN?tab=readme-ov-file">GitHub Repository</a></li><li>ArXiv Paper: <a href="https://doi.org/10.48550/arXiv.2107.10833">https://doi.org/10.48550/arXiv.2107.10833</a></li></ul><h3>SwinIR</h3><p><a href="https://github.com/JingyunLiang/SwinIR">SwinIR</a>, built on the Swin Transformer architecture, brings a new level of sophistication for restoring image quality.</p><p>Unlike traditional convolutional models, SwinIR uses a hierarchical structure with shifted windows to capture both local and global image features.</p><p>This approach makes it effective in tasks such as super-resolution, denoising, and JPEG artifact removal.</p><p>SwinIR excels at modeling long-range dependencies within images. Its architecture is well-suited for high-quality image reconstruction tasks.</p><p>This model is especially effective in improving backgrounds, handling complex degradations, and maintaining overall image coherence.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aQaUP2WxNnf7Cl15.png" /><figcaption><strong>Figure. 2:</strong> SwinIR architecture with a hierarchical structure and shifted windows. This design captures local and global image features for superior image restoration. Source: <a href="https://github.com/JingyunLiang/SwinIR">https://github.com/JingyunLiang/SwinIR</a></figcaption></figure><p>For more details on SwinIR, visit the following resources:</p><ul><li><a href="https://github.com/JingyunLiang/SwinIR">GitHub Repository</a></li><li>ArXiv Paper: <a href="https://doi.org/10.48550/arXiv.2108.10257">https://doi.org/10.48550/arXiv.2108.10257</a></li></ul><h3>BSRGAN</h3><p><a href="https://github.com/cszn/BSRGAN">BSRGAN</a> focuses on blind super-resolution. This method restores images without needing details of the degradation process. It uses a GANs to enhance image details while maintaining a natural appearance.</p><p>BSRGAN adapts to various real-world scenarios without prior information. This offers flexibility in situations where image quality varies significantly.</p><p>Although BSRGAN is a bit older and less sophisticated than Real-ESRGAN and SwinIR, it remains a strong option worth trying for many image restoration tasks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/0*-FfTP9m-lvU5JDey" /><figcaption><strong>Figure. 3:</strong> Comparison between low-resolution images and BSRGAN-enhanced images (x4). Source: <a href="https://github.com/cszn/BSRGAN">https://github.com/cszn/BSRGAN</a></figcaption></figure><p>For more details on BSRGAN, visit the following resources:</p><ul><li><a href="https://github.com/cszn/BSRGAN">GitHub Repository</a></li><li>ArXiv Paper: <a href="https://doi.org/10.48550/arXiv.2103.14006">https://doi.org/10.48550/arXiv.2103.14006</a></li></ul><h3>Training Code</h3><p>If you want to train your own model, you can use the <a href="https://github.com/cszn/KAIR">KAIR Repository.</a> The repo includes the necessary training and testing scriptis for a range of image restoration models, including USRNet, DnCNN, FFDNet, SRMD, DPSR, MSRResNet, ESRGAN, BSRGAN, SwinIR, VRT, and RVRT.</p><p>The repository allows you to configure training settings like GPU usage and data paths through JSON files. It supports both <a href="https://github.com/pytorch/tutorials/blob/main/beginner_source/blitz/data_parallel_tutorial.py">DataParallel</a> and <a href="https://github.com/pytorch/examples/blob/main/distributed/ddp/README.md">DistributedDataParallel</a> training methods.</p><p>However, in this article, we will focus on inference and application rather than training.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*TeNPeCA4d3cDGJNfFFCCYA.gif" /><figcaption><strong>Figure. 4:</strong> KAIR Respository for Training Custom Image Restoriation AI Models. Source: <a href="https://github.com/cszn/KAIR">https://github.com/cszn/KAIR</a></figcaption></figure><h3>3. Python Implementation</h3><p>Let’s now implement the models for inference. You’ll need a few images to improve their quality.</p><p>You can also just use the sample images included when cloning the repositories.</p><h4>3.1 Setting Up the Environment</h4><p>You’ll also need a strong computing environment with NVIDIA GPU (at least 4GB VRAM).</p><p>Alternatively, just run the Google Notebook below in a T4 compute environment and it should work.</p><p>Start by cloning the repositories and downloading the models:</p><pre># Clone realESRGAN<br>!git clone https://github.com/xinntao/Real-ESRGAN.git<br>%cd Real-ESRGAN<br># Set up the environment<br>!pip install basicsr<br>!pip install facexlib<br>!pip install gfpgan<br>!pip install -r requirements.txt<br>!python setup.py develop<br><br># Clone BSRGAN<br>!git clone https://github.com/cszn/BSRGAN.git<br><br>!rm -r SwinIR<br># Clone SwinIR<br>!git clone https://github.com/JingyunLiang/SwinIR.git<br>!pip install timm<br><br># Download the pre-trained models<br>!wget https://github.com/cszn/KAIR/releases/download/v1.0/BSRGAN.pth -P BSRGAN/model_zoo<br>!wget https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth -P experiments/pretrained_models<br>!wget https://github.com/JingyunLiang/SwinIR/releases/download/v0.0/003_realSR_BSRGAN_DFOWMFC_s64w8_SwinIR-L_x4_GAN.pth -P experiments/pretrained_models</pre><h3>3.2 Upload Images</h3><p>Next, upload the images for restoration. All the images uploaded to “Upload Folder” will be processed by all the models later on.</p><p>You can use the sample images included in many of the cloned repositories. For example, in the ‘REAL-ESRGAN/inputs’, you can find some images that you can use.</p><p>In this code, we’ll use the sample images included in &#39;Real-ESRGAN/BSRGAN/testsets/BSRGAN&#39;</p><pre>import os<br>import glob<br>from google.colab import files<br>import shutil<br>print(&#39; Note1: You can find an image on the web or download images from the RealSRSet (proposed in BSRGAN, ICCV2021) at https://github.com/JingyunLiang/SwinIR/releases/download/v0.0/RealSRSet+5images.zip.\n Note2: You may need Chrome to enable file uploading!\n Note3: If out-of-memory, set test_patch_wise = True. This will process the image in smaller patches and then stitch them back together.\n&#39;)<br><br># If your system runs out of memory, set test_patch_wise = True to process images in smaller patches.<br># This helps avoid out-of-memory errors by handling each patch independently.<br>test_patch_wise = False<br><br># Clean up existing directories to avoid conflicts with BSRGAN<br>!rm -r BSRGAN/testsets/RealSRSet<br>upload_folder = &#39;BSRGAN/testsets/RealSRSet&#39;<br>result_folder = &#39;results&#39;<br><br># Check if the upload and result directories exist, and remove them if they do.<br>if os.path.isdir(upload_folder):<br>    shutil.rmtree(upload_folder)  # Clear the upload directory to start fresh.<br>if os.path.isdir(result_folder):<br>    shutil.rmtree(result_folder)  # Clear the result directory to avoid conflicts.<br><br># Create new directories for the uploaded images and results.<br>os.mkdir(upload_folder)<br>os.mkdir(result_folder)<br><br># Upload images for testing. You can select multiple images for batch processing.<br>uploaded = files.upload()<br><br># Move each uploaded image to the designated folder for processing.<br>for filename in uploaded.keys():<br>  dst_path = os.path.join(upload_folder, filename)<br>  print(f&#39;Moving {filename} to {dst_path}&#39;)<br>  shutil.move(filename, dst_path)</pre><p>Sometimes, you may run out of GPU memory in Google Colabs. Use the code below to empty the cache.</p><p>This is especially needed when you are re-running the inference process on more images.</p><pre># empty cache with torch<br>import torch<br>torch.cuda.empty_cache()</pre><h3>3.3 Adjust Problematic Code in the Source</h3><p>When running the source code as it is, you’ll encounter the following issue when trying to make inferences:</p><pre>rm: cannot remove &#39;results&#39;: No such file or directory<br>---------------------------------------------------------------------------<br>NameError                                 Traceback (most recent call last)<br>&lt;ipython-input-3-d461a2419392&gt; in &lt;cell line: 3&gt;()<br>      1 # BSRGAN<br>      2 get_ipython().system(&#39;rm -r results&#39;)<br>----&gt; 3 if not test_patch_wise:<br>      4   get_ipython().run_line_magic(&#39;cd&#39;, &#39;BSRGAN&#39;)<br>      5   get_ipython().system(&#39;python main_test_bsrgan.py&#39;)<br><br>NameError: name &#39;test_patch_wise&#39; is not defined</pre><p>This error occurs because the test_patch_wise variable is not defined in the scope where it is used.</p><p>To resolve this, we need to update the source code in the degradations.py file. Specifically, we will adjust an import statement that has changed in recent versions of torchvision.</p><p>The following code will modify the problematic part of the degradations.py file:</p><pre>import os<br><br># Use IPython magic command to get the package location<br>file_paths = !pip show basicsr | grep &quot;Location&quot;<br>if file_paths:<br>    file_path = os.path.join(file_paths[0].split(&quot;: &quot;)[1], &quot;basicsr/data/degradations.py&quot;)<br><br>    # Check if the file exists<br>    if os.path.exists(file_path):<br>        # Open the file for reading<br>        with open(file_path, &quot;r&quot;) as file:<br>            file_content = file.read()<br><br>        # Replace the problematic import statement<br>        new_content = file_content.replace(<br>            &quot;from torchvision.transforms.functional_tensor import rgb_to_grayscale&quot;,<br>            &quot;from torchvision.transforms._functional_tensor import rgb_to_grayscale&quot;<br>        )<br><br>        # Open the file for writing and overwrite its content with the modified content<br>        with open(file_path, &quot;w&quot;) as file:<br>            file.write(new_content)<br><br>        print(&quot;The file has been updated successfully.&quot;)<br>    else:<br>        print(&quot;The specified file does not exist:&quot;, file_path)<br>else:<br>    print(&quot;Failed to find the installation location for &#39;basicsr&#39;. Please check the package installation.&quot;)</pre><p><em>For this type of project, as well as a range of other innovative, data-driven initiatives in AI, data science, and Finance, We encourage readers to explore the wealth of resources and tools available at </em><a href="http://www.entreprenerdly.com./"><strong><em>www.entreprenerdly.com</em></strong><em>.</em></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/0*3HoY9BZ1ha2QgZk8.png" /><figcaption><a href="https://entreprenerdly.com/">https://entreprenerdly.com</a></figcaption></figure><p><strong>The entire end-to-end workflow can be found on the following </strong><a href="https://colab.research.google.com/drive/1Re38JEh69Sg-3bklFwbJ2ChCfNXV0t9B?usp=sharing"><strong>Google Colab Notebook</strong></a><strong>:</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4c7015adc69d3a77dfeb38a8570befab/href">https://medium.com/media/4c7015adc69d3a77dfeb38a8570befab/href</a></iframe><h3>3.4 Inference with all Models</h3><p>Now that everything is set up, let’s execute each model and restore the images uploaded earlier on:</p><h4>Running BSRGAN</h4><pre># BSRGAN<br>!rm -r results<br>if not test_patch_wise:<br>  %cd BSRGAN<br>  !python main_test_bsrgan.py<br>  %cd ..<br>  shutil.move(&#39;BSRGAN/testsets/RealSRSet_results_x4&#39;, &#39;results/BSRGAN&#39;)</pre><p>This commands do the following:</p><ul><li><strong>Remove Results Directory:</strong> !rm -r results clears any existing results to prevent conflicts with previous runs.</li><li><strong>Check </strong><strong>test_patch_wise:</strong> If False, the model processes the entire image at once. If True, it handles the image in patches.</li><li><strong>Change Directory:</strong> %cd BSRGAN navigates to the BSRGAN directory where the model’s script is located.</li><li><strong>Run BSRGAN:</strong> !python main_test_bsrgan.py executes the BSRGAN model script to process the images.</li><li><strong>Return to Previous Directory:</strong> %cd .. navigates back to the original directory after processing.</li><li><strong>Move Results:</strong> shutil.move(&#39;BSRGAN/testsets/RealSRSet_results_x4&#39;, &#39;results/BSRGAN&#39;) transfers the output to the designated results directory.</li></ul><h4>Running Real-ESRGAN</h4><pre># realESRGAN<br>if test_patch_wise:<br>  !python inference_realesrgan.py -n RealESRGAN_x4plus --input BSRGAN/testsets/RealSRSet -s 4 --output results/realESRGAN --tile 800 --face_enhance<br>else:<br>  !python inference_realesrgan.py -n RealESRGAN_x4plus --input BSRGAN/testsets/RealSRSet -s 4 --output results/realESRGAN --face_enhance</pre><p>These commands do the following:</p><ul><li><strong>Tile Mode (</strong><strong>--tile 800)</strong>: Processes the image in 800×800 tiles to manage memory. --face_enhance flag focusing on improving facial features.</li><li><strong>Full Image Processing</strong>: If test_patch_wise is False, processes the entire image at once, still applying facial enhancement.</li></ul><h4>Running SwinIR</h4><pre># SwinIR-Large<br>if test_patch_wise:<br>  !python SwinIR/main_test_swinir.py --task real_sr --model_path experiments/pretrained_models/003_realSR_BSRGAN_DFOWMFC_s64w8_SwinIR-L_x4_GAN.pth --folder_lq BSRGAN/testsets/RealSRSet --scale 4 --large_model --tile 640<br>else:<br>  !python SwinIR/main_test_swinir.py --task real_sr --model_path experiments/pretrained_models/003_realSR_BSRGAN_DFOWMFC_s64w8_SwinIR-L_x4_GAN.pth --folder_lq BSRGAN/testsets/RealSRSet --scale 4 --large_model<br>shutil.move(&#39;results/swinir_real_sr_x4_large&#39;, &#39;results/SwinIR_large&#39;)<br>for path in sorted(glob.glob(os.path.join(&#39;results/SwinIR_large&#39;, &#39;*.png&#39;))):<br>  os.rename(path, path.replace(&#39;SwinIR.png&#39;, &#39;SwinIR_large.png&#39;)) # here is a bug in Colab file downloading: no same-name files</pre><ul><li><strong>Tile Mode (</strong><strong>--tile 640)</strong>: Runs the SwinIR model using 640×640 patches to manage memory. --large_model flag indicates a more complex version of the model.</li><li><strong>Full Image Processing:</strong> If test_patch_wise is False, processes the entire image at once using the large SwinIR model.</li><li><strong>Move Results:</strong> shutil.move(&#39;results/swinir_real_sr_x4_large&#39;, &#39;results/SwinIR_large&#39;) transfers the output files to the SwinIR results directory.</li><li><strong>Rename Files:</strong> A loop renames the output files, appending _large to distinguish them and address potential naming issues.</li></ul><h3>3.5 Visualize Results</h3><p>Finally, you can visualize the restored images to compare the outputs from each model.</p><p>The following code will display the original image alongside the results from BSRGAN, Real-ESRGAN, and SwinIR-Large.</p><pre>import cv2<br>import matplotlib.pyplot as plt<br><br># Utility function to display images side by side for comparison<br>def display(img1, img2):<br>    fig = plt.figure(figsize=(48, 14))  # Set the figure size<br>    ax1 = fig.add_subplot(1, 4, 1)  # Subplot for the input image<br>    plt.title(&#39;Input Image&#39;, fontsize=30)<br>    ax1.axis(&#39;off&#39;)<br>    ax1.imshow(img1)<br><br>    ax2 = fig.add_subplot(1, 4, 2)  # Subplot for the BSRGAN output<br>    plt.title(&#39;BSRGAN Output&#39;, fontsize=30)<br>    ax2.axis(&#39;off&#39;)<br>    ax2.imshow(img2[&#39;BSRGAN&#39;])<br><br>    ax3 = fig.add_subplot(1, 4, 3)  # Subplot for the Real-ESRGAN output<br>    plt.title(&#39;Real-ESRGAN Output&#39;, fontsize=30)<br>    ax3.axis(&#39;off&#39;)<br>    ax3.imshow(img2[&#39;realESRGAN&#39;])<br><br>    ax4 = fig.add_subplot(1, 4, 4)  # Subplot for the SwinIR-Large output<br>    plt.title(&#39;SwinIR-Large Output&#39;, fontsize=30)<br>    ax4.axis(&#39;off&#39;)<br>    ax4.imshow(img2[&#39;SwinIR-L&#39;])<br><br>    plt.show()  # Display the figure<br><br># Utility function to read images using OpenCV<br>def imread(img_path):<br>    img = cv2.imread(img_path)<br>    img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)  # Convert from BGR to RGB<br>    return img<br><br># Inform the user about BSRGAN&#39;s performance on different types of images<br>print(&#39;Note: BSRGAN may excel at face restoration but may not perform as well on building restoration due to different training datasets.&#39;)<br><br>if test_patch_wise:<br>    print(&#39;BSRGAN does not support &quot;test_patch_wise&quot; mode. Set test_patch_wise = False to view its results.\n&#39;)<br>else:<br>    print(&#39;\n&#39;)<br><br># Prepare the input and output image paths<br>input_folder = upload_folder<br>result_folder = &#39;results/SwinIR_large&#39;<br>input_list = sorted(glob.glob(os.path.join(input_folder, &#39;*&#39;)))<br>output_list = sorted(glob.glob(os.path.join(result_folder, &#39;*&#39;)))<br><br># Loop through each input image and its corresponding outputs<br>for input_path, output_path in zip(input_list, output_list):<br>    img_input = imread(input_path)<br>    img_output = {}<br><br>    # Load the SwinIR-Large output<br>    img_output[&#39;SwinIR-L&#39;] = imread(output_path)<br><br>    # Handle BSRGAN&#39;s output, checking if patch-wise testing was used<br>    if test_patch_wise:<br>        img_output[&#39;BSRGAN&#39;] = img_output[&#39;SwinIR-L&#39;] * 0 + 255  # Display a white placeholder if patch-wise is not supported<br>    else:<br>        img_output[&#39;BSRGAN&#39;] = imread(output_path.replace(&#39;SwinIR_large&#39;, &#39;BSRGAN&#39;))<br><br>    # Load the Real-ESRGAN output<br>    path = output_path.replace(&#39;/SwinIR_large/&#39;, &#39;/realESRGAN/&#39;).replace(&#39;_SwinIR_large.png&#39;, &#39;_out{}&#39;.format(os.path.splitext(input_path)[1]))<br>    if os.path.exists(path):<br>        shutil.move(path, path.replace(&#39;_out.&#39;, &#39;_realESRGAN.&#39;))<br>    img_output[&#39;realESRGAN&#39;] = imread(path.replace(&#39;_out.&#39;, &#39;_realESRGAN.&#39;))<br><br>    # Display the images side by side for comparison<br>    display(img_input, img_output)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GvrJNiHXMuR3kR4jXKiSJw.gif" /><figcaption><strong>Figure. 5:</strong> Inference Results with BSRGAN, Real-ESRGAN and SwinIR.</figcaption></figure><h3>3.5 Saving Results</h3><p>You can also use the code below to save the inference results as a zip:</p><pre># Download the results<br>zip_filename = &#39;Real-ESRGAN_result.zip&#39;<br>if os.path.exists(zip_filename):<br>  os.remove(zip_filename)<br>os.system(f&quot;zip -r -j {zip_filename} results/*&quot;)<br>files.download(zip_filename)</pre><h3>4. Use Cases</h3><ul><li><strong>Up-scaling and Restoration</strong>: Photographers can use these models to upscale low-resolution images or restore old photos.</li><li><strong>Product Image Enhancement in E-commerce</strong>: E-commerce platforms and sellers can improve the visual appeal of products.</li><li><strong>Property Visualizations in Real Estate</strong>: Real estate firms can enhance property images to improve listings and showcase properties more effectively.</li><li><strong>Photo Editing Features in Apps and Platforms</strong>: These models can be integrated into photo editing apps or social media platforms.</li></ul><h3>Conclusion</h3><p>Recent developments, such as modular pipelines and content-aware methods highlighted at <a href="https://github.com/Amazingren/NTIRE2024_ESR">NTIRE 2024</a>, further refine these technologies by offering users more control over the restoration process.</p><p>As AI evolves, tools that integrate user-configurable pipelines and advanced restoration techniques will expand practical applications. This guide offers a starting point, but continuous adaptation is advised.</p><p><strong><em>Thank you for taking the time to read. If you found the article insightful, please consider clapping to support future content.</em></strong><em>👏</em></p><h3>More articles worth reading:</h3><ul><li><a href="https://entreprenerdly.com/customizing-realistic-human-photos-using-ai-with-photomaker/">Customizing Realistic Human Photos Using AI with PhotoMaker - Entreprenerdly</a></li><li><a href="https://entreprenerdly.com/ai-face-restoration-in-images-with-codeformer/">AI Face Restoration in Images with CodeFormer - Entreprenerdly</a></li><li><a href="https://entreprenerdly.com/using-photomaker-for-stylized-image-customization/">Using PhotoMaker for Stylized Image Customization - Entreprenerdly</a></li></ul><p><a href="https://entreprenerdly.com/"><em>Entreprenerdly.com</em></a><em> hosts the full suite of tech, finance, data science &amp; AI tutorials, code, and strategies designed to empower you with actionable knowledge.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/0*KFBrRd1OSjyqsFnd.png" /><figcaption><a href="https://entreprenerdly.com/">https://entreprenerdly.com</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=20d54c483e39" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>