Git Product home page Git Product logo

image-compression-svd's Introduction

Cover-Image

Introduction

In a rapidly evolving digital landscape, where images are at the heart of communication and information sharing, we present ImageSVD โ€“ a cutting-edge image compression solution powered by singular value decomposition (SVD). This project demonstrates the fusion of data science and mathematical techniques to address a critical challenge in the digital age: efficient image storage and transmission.

The Business Challenge

In today's data-driven world, the demand for efficient image compression techniques is ever-growing. High-quality images can consume substantial storage space and bandwidth, leading to slower web performance and increased costs. ImageSVD is our response to this challenge, offering an innovative approach to compressing images while preserving their essential visual information.

The Tech Stack

Our journey began with a careful selection of technologies that would enable us to tackle this problem effectively. Python, with its robust libraries and versatile ecosystem, emerged as the primary language for this project. We leveraged the power of Python to implement singular value decomposition, a mathematical technique that forms the core of our image compression solution.

Objective

ImageSVD aims to provide a practical and intuitive solution for image compression. At its core, the project revolves around the singular value decomposition, which breaks down an image into three key components: $U$ (Left Singular Vectors), $S$ (Singular Values), and $V^T$ (Right Singular Vectors). These components form the foundation for our compression algorithm.

Finding the Optimal Rank

The heart of ImageSVD is the quest to find the optimal rank. By experimenting with different rank values, we determine the right balance between image compression and quality preservation. The higher the rank, the closer the approximated image is to the original, and our project empowers users to explore this trade-off.

Results

ImageSVD doesn't stop at compression; it's about visualizing the transformation. We provide users with insights into the compression process:

Visualizing Singular Values

Our platform generates a logarithmic scale graph of singular values $\sigma_j$ vs. the index of singular values $j$. This graph offers a compelling visual representation of the relative importance of each singular value, allowing users to grasp how the compression process affects the image's information content.

Understanding Variance and Energy

Another graph showcases the cumulative sum vs. the index of singular values $j$. This visualization illuminates the contribution of each singular value to the total variance or energy of the image. Users can gauge how much of the image's essence is retained by including specific singular values in the compression process.

Real-world Applications

Beyond the technical intricacies, ImageSVD has real-world applications. As data scientists, we understand the practicality of image compression in industries such as:

  • Web Development: Optimize web page load times by reducing image sizes.
  • Storage Solutions: Efficiently store and transmit large collections of images.
  • Data Transfer: Minimize bandwidth usage in image-heavy applications.

Try ImageSVD

We invite you to experience ImageSVD firsthand through our web service, hosted on the Streamlit Community Cloud. Click the button below to access this innovative image compression tool:

Launch ImageSVD

ImageSVD represents the synergy of data science, mathematics, and real-world problem-solving. Join us on this journey to make image compression smarter, more accessible, and more efficient.

image-compression-svd's People

Contributors

shre-db avatar

Watchers

 avatar

image-compression-svd's Issues

Error when setting Rank to Maximum Value on ImageSVD Web App (Grayscale Images)

@shre-db

Issue Summary

When using the ImageSVD web app on Streamlit Community Cloud and setting the rank slider to its maximum value, I encountered the following error:

IndexError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you're on Streamlit Cloud, click on 'Manage app' in the lower right of your app).
Traceback:
File "/home/adminuser/venv/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 541, in _run_script
    exec(code, module.__dict__)
File "/mount/src/image-compression-svd/app.py", line 115, in <module>
    ax.vlines(x=decomposer.rank, ymin=0, ymax=np.cumsum(S/np.sum(S))[decomposer.rank], color='magenta', linestyle='--')

Steps to Reproduce

  1. Go to the ImageSVD web app on Streamlit Community Cloud.
  2. Upload a grayscale Image.
  3. Set the rank slider to its maximum value.
  4. Toggle the "Advanced Info" switch to ON.
  5. Observe the error message.

Expected Behavior

I expected the web app to handle the maximum rank value without encountering an error.

Environment

  • Browser: Google Chrome (Version 117.0.5938.150 (Official Build) (64-bit))
  • Operating System: Microsoft Windows 10 Education (Version 10.0.17134 Build 17134)

Screenshots

ImageSVD-IndexError-Grayscale

Error when setting Rank to Maximum Value on ImageSVD Web App (Colored Images)

@shre-db

Issue Summary

When using the ImageSVD web app on Streamlit Community Cloud and setting the rank slider to its maximum value, I encountered the following error:

IndexError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you're on Streamlit Cloud, click on 'Manage app' in the lower right of your app).
Traceback:
File "/home/adminuser/venv/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 541, in _run_script
    exec(code, module.__dict__)
File "/mount/src/image-compression-svd/app.py", line 173, in <module>
    ax[0].vlines(x=decomposer.rank, ymin=0, ymax=np.cumsum(r[1]/np.sum(r[1]))[decomposer.rank], color='magenta', linestyle='--')

Steps to Reproduce

  1. Go to the ImageSVD web app on Streamlit Community Cloud.
  2. Upload a colored Image.
  3. Set the rank slider to its maximum value.
  4. Toggle the "Advanced Info" switch to ON.
  5. Observe the error message.

Expected Behavior

I expected the web app to handle the maximum rank value without encountering an error.

Environment

  • Browser: Google Chrome (Version 117.0.5938.150 (Official Build) (64-bit))
  • Operating System: Microsoft Windows 10 Education (Version 10.0.17134 Build 17134)

Screenshots

ImageSVD-IndexError

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.