/sach-ka-saamna

Primary LanguageJupyter NotebookMIT LicenseMIT

Contributors Forks Stargazers Issues LinkedIn


Sach Ka Saamna

An awesome website to detect image tampering. Made with Love.
Explore the docs »
· Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Roadmap
  5. Challenges
  6. License
  7. Contributing
  8. Issues
  9. Contact
  10. Acknowledgements

About The Project

Editing a real-world photo through computer software or mobile applications is one of the easiest things one can do today before sharing the doctored image on one’s social networking sites. Although most people do it for fun, it is suspectable if one concealed an object or changed someone’s face within the image. Before questioning the intention behind the editing operations, we need to first identify how and which part of the image has been manipulated. It therefore demands automatic tools for identifying the intrinsic difference between authentic images and tampered images. A great survey on this topic

To address the issue we try to solve the problem in 2 phases :

  1. Detecting whether image has been tampered with or not.
  2. Finding the exact tampered region of an image through various deep learning techniques.
  3. Making a real-world usable product out of the model we generated that can be used by anyone.
  4. This product has scope of being extended to a fully functional product which can be used by security agencies.

A list of commonly used resources that I find helpful are listed in the acknowledgements.

Built With

Getting Started

To get a local copy up and running follow these simple example steps.

Prerequisites

  • Python 3.7+

  • Make a bucket on Amazon AWS S3 and download the keys. Make sure your bucket is public.

  • Create an .env file with the following keys. (Please contact anyone from below contacts for S3 keys if there is a difficulty in using S3 or if you want to test with S3 without making an AWS account)

    export S3_BUCKET=<Bucket Name>
    export S3_SECRET_ACCESS_KEY=<AWSSecretKey>
    export S3_KEY=<AWSAccessKeyId>
    export S3_REGION=<AWS Region>
    
    
  • Make folder structure of the folder 'models' in the following way after downloading the models from and here and arrange them respectively

models
|--- segmentation
|    ├── model.json
|    └── model_for_json.h5
|     
|--- model.json
|--- model_weights.h5

Installation

  1. Clone the repo

    $ git clone https://github.com/killer4639/sach-ka-saamna.git
    $ cd sach-ka-saamna
    
  2. Activating virtual environment (optional)

    $ python -m venv venv
    $ venv\Scripts\activate
    
  3. Install requirements

    $ pip install -r requirements.txt
    
  4. Run Application

    $ python app.py
    
  5. Issues while running

     If you encounter an issue on your terminal like this
     KeyError: 'DATABASE_URL'
     It is because you don't have any  postresql online hosted database. Use the local one as given. Or uncomment it from scripts/tabledef.py
    
     Images get stored in the assets folder
     
     Slack bot will not run so that won't run. Contact us
    

Usage

We have developed a slackbot and will create a telegram bot for using it so that you can detect tampering with the easy of your phone without visiting any website. We eventually want to extend it to WhatsApp (the biggest platform) hence increase our ease of usability

Roadmap

  • Data preprocessing.
  • Perform error level analysis of pristine and tampered images.
  • Building the segmentation and classification model. We have used keras with tensorflow as backend to train and build the model.
  • Hyper parameter tuning (learning rate,callback parameters,custom loss function etc).
  • Creating the web app for actual usability of our idea and not just a script to watch
  • Finally creating a slackbot for ease of usability.

Challenges

The learning curve of our project was very steep. Limited computing resources was the biggest challenge we ran into. The image segmentation task is very expensive and thus we require a lot of computing resources to train the model effectively for a longer duration and bigger dataset. Because of that, we were only able to train the model on 3000 images for both the classification and image segmentation part. We had to devise a custom loss function for image segmentation to get good results. We were facing overfitting issues in the binary classification task and thus had to perform a lot of experimentation and fine-tuning to get good results. Deploying deep learning models is not easy because of the huge slug size of libraries like TensorFlow and Keras. Thus we were not able to deploy the model on Heroku. We were comparatively new to the Flask framework and thus debugging took more time than expected. We also developed a slack bot on the go after the suggestion of one of the mentors.

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated. Read our contributing guidelines

Issues

  • After resetting the password if we logout, then it doesn't login with the new credentials. This needs to be looked upon.
  • The compute timing on local machine is slow and hence we can use any cloud service for our model computations which will return a JSON object with image and result. This will also help us to deploy on Heroku with less slug size.
  • Better error handling and unit testing. Eg. error is encountered if without uploading any image, we click predict.
  • Email verification
  • Making it mobile responsive and UI additions.

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Acknowledgements