-
Get Linux Bash Shell on Windows 10 (https://www.howtogeek.com/249966/how-to-install-and-use-the-linux-bash-shell-on-windows-10/)
- Open the Settings app and head to Update & Security > For Developers. Activate the "Developer Mode" switch here to enable Developer Mode.
- Next, open the Control Panel, click "Programs," and click "Turn Windows Features On or Off" under Programs and Features. Enable the "Windows Subsystem for Linux (Beta)" option in the list here and click "OK."
- After your computer restarts, click the Start button (or press the Windows key), type "bash", and press "Enter."
-
Install dependencies of vatic. The rest of this guide is based on the instruction at https://gitlab.com/EAVISE/publicwiki/wikis/install-vatic, but follow this guide here written for Windows 10's Ubuntu. I highlighted the necessary changes from the original guide in bold. 1. First install the needed packages, make sure that you leave the MySQL password empty (You will be asked to provide it this several times):
sudo apt-get install -y git g++ make python-setuptools python-dev libavcodec-dev libavformat-dev libjpeg62 libjpeg62-dev libfreetype6 libfreetype6-dev apache2 libapache2-mod-wsgi mysql-server-5.6 mysql-client-5.6 libmysqlclient-dev
-
Next, install these dependencies, this might take a while.
sudo easy_install pip
sudo pip install cython==0.20
sudo pip install SQLAlchemy wsgilog mysql-python munkres parsedatetime argparse
sudo pip install numpy
sudo pip install Pillow
-
Install ffmpeg, on Ubuntu 14.04 you need to add an additional ppa:
sudo add-apt-repository ppa:mc3man/trusty-media
sudo apt-get update
sudo apt-get install ffmpeg
-
Every time you call a command with 'sudo', you will get a warning similar to the following. This is ok.
sudo: unable to resolve host MININT-EH2KQSQ
-
-
Download and clone vatic. Vatic consists of three parts: turkic, pyvision and vatic itself:
-
Choose a folder to grab vatic library: (for this tutorial, it's C:\src\vatic)
cd /mnt/c/src
mkdir vatic
cd vatic
git clone https://github.com/cvondrick/turkic.git
git clone https://github.com/cvondrick/pyvision.git
git clone https://github.com/cvondrick/vatic.git
-
Vatic uses an older version of PIL, so some of the original code in vatic.git needs to be updated:
- Download my patch from https://raw.githubusercontent.com/Efreeto/vatic/master/patch.diff
- Then apply this patch:
cd vatic
git apply patch.diff
cd ..
-
First install turkic:
cd turkic
sudo python setup.py install
cd ..
-
Do the same for pyvision:
cd pyvision
sudo python setup.py install
cd ..
-
-
Setup Apache server. The client-side (annotation-side) GUI runs on a browser, so it's necessary to host this GUI server.
-
Now configure the webserver (Apache2). Replace the contents of the following file:
sudo nano /etc/apache2/sites-enabled/000-default.conf
WSGIDaemonProcess www-data WSGIProcessGroup www-data <VirtualHost *:80> ServerName localhost DocumentRoot /mnt/c/src/vatic/vatic/public WSGIScriptAlias /server /mnt/c/src/vatic/vatic/server.py CustomLog /var/log/apache2/access.log combined </VirtualHost>
-
Give Apache access to this directory by adding the following to the config file:
sudo nano /etc/apache2/apache2.conf
<Directory /mnt/c/src/vatic/vatic/> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory>
-
Restart Apache2:
sudo cp /etc/apache2/mods-available/headers.load /etc/apache2/mods-enabled
sudo apache2ctl graceful
i. You will get errors similar to the following. This is ok.
sudo: unable to resolve host MININT-EH2KQSQ
AH00557: apache2: apr_sockaddr_info_get() failed for MININT-EH2KQSQ
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
httpd not running, trying to start
[Thu Mar 09 14:14:34.395601 2017] [core:warn] [pid 797:tid 140033705052032] (22)Invalid argument: AH00076: Failed to enable APR_TCP_DEFER_ACCEPT -
Test Apache by going to 'localhost' on your browser on Windows
- If you see a blank page with the title 'vatic', Apache is running successfully. You can proceed to the next part.
- If you see a default Apache page, one of the file paths in your configuration is probably incorrect.
- If you don't see any web page, you might have to restart the whole process. :(
-
(Optional) Open your localhost for other people to annotate on your data
- Go to control panel > windows firewall > advance setting (on left sidebar)
- Right click on inbound rules -> add new rule -> port -> TCP (Specific port 80 - if your localhost wok on this port) -> Allow the connections -> Give a profile name -> ok
-
-
Prepare MySQL database for your server. This is only necessary once.
-
Edit the MySQL database:
sudo service mysql start
mysql -u root
create database vatic;
exit
1. You will get errors similar to the following. This is ok. sudo: unable to resolve host MININT-EH2KQSQ initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused /lib/lsb/init-functions.d/50-ubuntu-logging: line 5: 131 Aborted (core dumped) plymouth --ping > /dev/null 2>&1 * Starting MySQL database server mysqld No directory, logging in with HOME=/ /lib/lsb/init-functions.d/50-ubuntu-logging: line 5: 556 Aborted (core dumped) plymouth --ping > /dev/null 2>&1 [ OK ] * Checking for tables which need an upgrade, are corrupt or were not closed cleanly.
-
In the vatic/vatic directory:
cd vatic
cp config.py-example config.py
turkic setup --database
turkic setup --public-symlink
- Both turkic commands should run successfully.
-
Test if vatic is working, by surfing in a browser to localhost, and by testing this in the command line:
turkic status --verify
- Browser should show 'Welcome to vatic' page
- On the status command, an error is seen with Mechanical Turk, however, the other features should return ok.
-
Now give correct permissions for www-data:
sudo usermod -a -G administrator www-data
sudo mkdir /var/www/.python-eggs/
sudo chown www-data:www-data /var/www/.python-eggs/
sudo apache2ctl graceful
-
That's it! You can refer to 'Using vatic' in the next section to start using vatic.
-
If you believe you messed up somewhere and start over, this is how you nuke the whole Ubuntu and start again. From cmd in administrator mode:
lxrun /uninstall /full
lxrun /install
-
-
Using vatic (basic commands).
-
Make sure you are running Apache and MySQL. This is only needed once per session. This step is unnecessary if you already did these above. But you will need these next time you start Ubuntu.
sudo apache2ctl graceful
sudo service mysql start
-
Now, run the rest of the commands in the directory where you have vatic. For this tutorial this is:
cd /mnt/c/src/vatic/vatic
-
Convert video to frames:
export THIS_VIDEO=${THIS_VIDEO:-workshop}
turkic extract videos/raw/$THIS_VIDEO.avi videos/extracted/$THIS_VIDEO --no-resize
Or convert images to vatic format frames:
export THIS_VIDEO=${THIS_VIDEO:-building34}
mkdir videos/raw/$THIS_VIDEO
ffmpeg -i videos/raw/$THIS_VIDEO.mp4 -vf fps=2 videos/raw/$THIS_VIDEO/%d.jpg
turkic formatframes videos/raw/$THIS_VIDEO/ videos/extracted/$THIS_VIDEO
-
Add video for local annotation, identifier gives a unique name, the category is given at the end of the command (Person in this example):
turkic load identifier videos/extracted/video1 Person --offline --blow-radius=0
-
Request URL to perform annotation:
turkic publish --offline
- Goto the URL on the output from the above command and annotate! (For example, http://localhost/?id=1&hitId=offline)
- If you opened port 80 from the steps above, other people on your network can see your vatic site at your ip address. (For example, http://10.123.456.789/?id=1&hitId=offline)
-
To export the annotations:
turkic dump identifier -o output.txt
-
To visualise tracks (= create image files with the annotations):
turkic visualize identifier videos/visualized/video1 --merge --labels
-
To delete a video:
turkic delete identifier --force
-
Here is an example script of automatically preparing the annotation, and upon user input to finish annotation, export the annotations to a text file.
mkdir outputs
mkdir sqls
export THIS_VIDEO=${THIS_VIDEO:-building34}
turkic load $THIS_VIDEO videos/extracted/$THIS_VIDEO Jackhammer Saws Drill PipeWrench Hammer Person --offline --blow-radius=0
turkic publish --offline
read -p "Press Enter after annotation"
turkic dump $THIS_VIDEO -o outputs/$THIS_VIDEO.txt
mysqldump -u root -p vatic > sqls/$THIS_VIDEO.sql
-
-
Common errors
-
turkic.geolocation errors
- Make sure you are in the right vatic folder (e.g. C:/src/vatic/vatic)
- Make sure "mysql" works and "apache2" is running
-
no module named PIL
sudo pip install PIL
sudo pip install Pillow
You will need both PIL and Pillow (?) to install PIL correctly. pip version should be >9.0 too (not 1.6. or something). there may be two versions of pip installed, then you will need to uninstall one of them (i.e. sudo apt-get remove python-pip) -
Server Error (from Chrome screen) replace 'administrator' to your ubuntu bash id from following
sudo usermod -a -G administrator www-data
sudo mkdir /var/www/.python-eggs/
sudo chown www-data:www-data /var/www/.python-eggs/
sudo apache2ctl graceful
-
Video tearing
- Don't use Edge and Switch to Chrome 2 Try refreshing the page (Don't forget to save your annotations first!)
-
Last active
August 7, 2017 11:50
-
-
Save Efreeto/5219b9b1137465a58b9123623d1a14bc to your computer and use it in GitHub Desktop.
How to run Vatic on Windows 10 based Ubuntu
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment