Giter Site home page Giter Site logo

videorpca's Introduction

Robust PCA for Moving Object Detection in Video

This project demonstrates the use of Robust Principal Component Analysis (RPCA) for detecting and removing moving objects from a video sequence. The RPCA algorithm decomposes a video sequence into a low-rank background matrix and a sparse moving object matrix, allowing for the detection and removal of moving objects from the background.

Requirements

  • Python 3.x
  • OpenCV (version 4.x or later)
  • NumPy
  • Scikit-learn
  • Tensorboard (optional, for learning process visualization)
  • Matplotlib (optional, for result visualization)

Usage

  1. Clone or download the repository to your local machine.

  2. Install the required packages using pip or conda:

pip install opencv-python numpy scikit-learn tensorboard matplotlib
  1. Download the input video file shoppingmall.mat from the Google Drive link. Place it in the data folder.

  2. To use this project, simply run the main.py script with the desired command line arguments. The available command line arguments are:

  • --lambda: regularization parameter for the sparse component.
  • --mu: initial value of the penalty parameter in the Augmented Lagrangian Multiplier (ALM) algorithm.
  • --max_iter: maximum number of iterations for the optimization algorithm (default: 1000).
  • --eps_primal: threshold for the primal error in the convex optimization problem (default: 1e-7).
  • --eps_dual: theshold for the dual error in the convex optimzation problem (default: 1e-5).
  • --rho: ratio of the paramter mu between two successive iterations (default: 1.6).
  • --initial_sv: number of singular values to compute during the first iteration (default: 10).
  • --max_mu: maximum value that mu is allowed to take. (default: 1e6).
  • --verbose: whether output learning process, both printing and tensorboard (default: True).
  • --save_interval:number of iterations for which the result will be saved (default: 10).

For example, to run the script with a regularization parameter of 0.1 and the max iteration of 20, use the following command:

python main.py --lambda 0.1 --max_iter 20

or

nohup python -u main.py --lambda 0.1 --max_iter 20 > log.out &
  1. The resulting low-rank and sparse components will be saved as separate videos in the output folder.

Credits

This project is inspired by the papers:

  1. Candès, E. J., Li, X., Ma, Y., & Wright, J. (2011). Robust principal component analysis?. Journal of the ACM (JACM), 58(3), 1-37.

  2. Lin, Z., Chen, M., & Ma, Y. (2010). The augmented lagrange multiplier method for exact recovery of corrupted low-rank matrices. arXiv preprint arXiv:1009.5055.

License

This project is licensed under the MIT License.

videorpca's People

Contributors

cchrisnguyen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

surajbijjahalli

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.