Giter Club home page Giter Club logo

shadow_remover's Introduction

Shadow Remover

This script removes shadows from images using a pre-trained convolutional neural network model.

Usage

To use the shadow remover script, follow these steps:

  1. Prepare your image: Make sure your input image is in the same directory or provide the full path to the image.

  2. Run the script:

    Use the following command to run the script:

    python shadow_remover.py -i <input_image_path> -o <output_image_path>

    Replace <input_image_path> with the path to your input image and <output_image_path> with the desired path for the output image.

Script Details

The script consists of the following main components:

  1. ShadowModel Class:

    • A neural network model to remove shadows from images. The model contains several convolutional layers with ReLU activations.
  2. load_image Function:

    • Loads an RGBA image and splits it into RGB and alpha channels.
  3. save_image Function:

    • Combines the processed RGB image with the original alpha channel and saves it as an RGBA image.
  4. process_image Function:

    • Processes the input image using the ShadowModel and saves the output image.
  5. Main Execution:

    • The script uses argparse to handle command-line arguments, loads the pre-trained model, and processes the input image.

Examples

Before After Source
ex ex SD 3
ex ex Steam Game Screenshots FNAF 9 Ruin
ex ex Steam Game Screenshots FNAF 9 Ruin
ex ex Steam Game Screenshots FNAF 9 Ruin
ex ex Steam Game Screenshots FNAF 9 Ruin
ex ex Steam Game Screenshots FNAF 9 Ruin

Prerequisites

Make sure you have the following installed:

  • Python 3.x
  • PyTorch
  • torchvision
  • PIL (Python Imaging Library)
  • numpy

Installation

  1. Clone the repository:

    git clone <repository_url>
    cd <repository_name>
  2. Install the required packages: You can install the required packages using pip:

    pip install torch torchvision pillow numpy
  3. Place the model file: Ensure the pre-trained model file shadowRM2.pth is located in the same directory as the script.

Model

The pre-trained model shadowRM2.pth should be located in the same directory as the script. This model is loaded and used to process the input image to remove shadows.

shadow_remover's People

Contributors

ifmain avatar

Watchers

 avatar

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.