{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "You can read an overview of this Numerical Linear Algebra course in [this blog post](http://www.fast.ai/2017/07/17/num-lin-alg/). The course was originally taught in the [University of San Francisco MS in Analytics](https://www.usfca.edu/arts-sciences/graduate-programs/analytics) graduate program. Course lecture videos are [available on YouTube](https://www.youtube.com/playlist?list=PLtmWHNX-gukIc92m1K0P6bIOnZb-mg0hY) (note that the notebook numbers and video numbers do not line up, since some notebooks took longer than 1 video to cover).\n", "\n", "You can ask questions about the course on [our fast.ai forums](http://forums.fast.ai/c/lin-alg)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# 3. Background Removal with Robust PCA" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Our goal today**: ![background removal](images/surveillance3.png)" ] }, { "cell_type": "markdown", "metadata": { "heading_collapsed": true }, "source": [ "## Getting Started" ] }, { "cell_type": "markdown", "metadata": { "hidden": true }, "source": [ "Let's use the real video 003 dataset from [BMC 2012 Background Models Challenge Dataset](http://bmc.iut-auvergne.com/?page_id=24)\n", "\n", "Other sources of datasets:\n", "- [Human Activity Video Datasets](https://www.cs.utexas.edu/~chaoyeh/web_action_data/dataset_list.html)\n", "- [Background Subtraction Website](https://sites.google.com/site/backgroundsubtraction/test-sequences) (a few links on this site are broken/outdated, but many work)" ] }, { "cell_type": "markdown", "metadata": { "hidden": true }, "source": [ "Import needed libraries:" ] }, { "cell_type": "code", "execution_count": 31, "metadata": { "collapsed": true, "hidden": true }, "outputs": [], "source": [ "import moviepy.editor as mpe\n", "# from IPython.display import display\n", "from glob import glob" ] }, { "cell_type": "code", "execution_count": 32, "metadata": { "collapsed": true, "hidden": true }, "outputs": [], "source": [ "import sys, os\n", "import numpy as np\n", "import scipy" ] }, { "cell_type": "code", "execution_count": 33, "metadata": { "collapsed": true, "hidden": true }, "outputs": [], "source": [ "%matplotlib inline\n", "import matplotlib.pyplot as plt" ] }, { "cell_type": "code", "execution_count": 34, "metadata": { "collapsed": true, "hidden": true }, "outputs": [], "source": [ "# MAX_ITERS = 10\n", "TOL = 1.0e-8" ] }, { "cell_type": "code", "execution_count": 35, "metadata": { "collapsed": true, "hidden": true }, "outputs": [], "source": [ "video = mpe.VideoFileClip(\"data/Video_003.avi\")" ] }, { "cell_type": "code", "execution_count": 179, "metadata": { "hidden": true }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "100%|█████████▉| 350/351 [00:00<00:00, 1258.81it/s]\n" ] }, { "data": { "text/html": [ "
" ], "text/plain": [ "