Coder Social home page Coder Social logo

leon-lcc / robustpca-python Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 33.79 MB

Python Implementation of Robust PCA

License: Apache License 2.0

Python 100.00%
anomaly-detection foreground-detection foreground-extraction robust-pca rpca video-denoising

robustpca-python's Introduction

Python Implementation of Robust PCA

Quick Start

Install numpy and you're good to go! The functions are implemented in RobustPCA.py.

# Robust PCA via the Exact ALM Method
Low_Rank_M, Sparse_M = RPCA(Data, Lambda, mu, rho)
# Robust PCA via the Inexact ALM Method
Low_Rank_M, Sparse_M = RPCA_inexact(Data, Lambda, mu, rho)

Application

If you're interested in the details of these applications, please refer to the report.

  • Part 1: Video Denoising
    • Extract the noise from a noisy video.
    • Separate the foreground (moving objects) and background (stationary objects) from a video.
  • Part 2: Anomaly Detection
    • Use robust PCA to detect anomalies in a dataset of images.

Requirements

  • numpy
  • pandas
  • scikit-video
  • tqdm

Part 1: Video Denoising

  • Data
-- dataset
  |-- Part1
     |-- boat_GT.jpg       'Ground truth of boat.mp4'
     |-- boat.mp4          'Boat video'
     |-- flower_GT.mp4     'Ground truth of flower.mp4'
     |-- flower.mp4        'Flower video'
     |-- TrainStation.mp4  'Train station video'
  • Usage
python Part1.py --i input_video_path \
               --o output_video_path \
               --l lambda (optional) \
               --r rho (optional) \
               --save_noise (optional) \
               --all (optional)

E.g., python Part1.py --i ./dataset/Part1/boat.mp4 \
                      --o ./boat_denoised.mp4 \
                      --l 0.1 \
                      --save_noise

Part 2: Anomaly Detection

  • Data
-- dataset
  |-- Part2
     |-- train_data.npy    'MNIST Images'
     |-- train_label.npy   'Labels (0: normal, 1: anomaly)'
  • Usage
python Part2.py --i input_data_path \
                --g input_label_path \
                --o output_csv_path \
                --l lambda (optional) \
                --r rho (optional) \
                --t threshold (optional) \

E.g., python Part2.py --i ./dataset/Part2/train_data.npy \
                      --g ./dataset/Part2/train_label.npy \
                      --o ./detection_result.csv \
                      --l 0.053 \
                      --t 0.999999

robustpca-python's People

Contributors

leon-lcc avatar

Stargazers

 avatar  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.