— How to set up the iMotion annotator on your Mac

Red Hen is working with a computer science team at the University of Basel in Switzerland on a sketch-based visual search engine called iMotion. You can contribute to creating the training data for this project with the iMotion annotator, which is a simple java application that allows you to draw a rectangle on an image to indicate the location of an event or entity, such as a gesture or a person.

Related pages

Installation instructions

Here's the full 10-step recipe to get you going with the iMotion annotator. It assumes you have access to a mac or linux computer.

    1. Open Terminal and check that you have at least Java 7 -- if not, update your Java:
    2. java -version
    3. Create the directory ~/Documents/redhen/images with this command:
    4. mkdir -p ~/Documents/redhen/images
    5. Browse to http://vrnewsscape.ucla.edu/pdf/vrNewsScape/annotator.jar and download the file to ~/Documents/redhen
    6. This is our tagging utility, used to create bounding boxes on images. The syntax for this utility is:
    7. java -jar annotator.jar <input folder> <output file>
    8. To test that this works, place some random images (png, jpg) in the ~/Documents/redhen/images folder.
    9. Back in Terminal, change directory to redhen, verify the program is there, and run the annotator:
    10. cd ~/Documents/redhen
    11. ls -l (you should see annotator.jar)
    12. java -jar annotator.jar images test.iMotion
    13. You should see the first image. Use your mouse to mark a bounding box (in red) on the image, and press the Spacebar. That should call up the next image.
    14. Browse to this page and install MacPorts: https://www.macports.org/install.php (linux users can skip this step).
    15. Select your version of OS X. Note that you also need XCode and the command-line developer tools, see the instructions.
    16. It's a bit complicated, but it works!
    17. MacPorts lets you install various open-source programs Red Hen routinely uses. Give these commands:
    18. sudo port selfupdate
    19. sudo port install ffmpeg-devel +gpl2 +gpl3 +nonfree
    20. When you type the sudo command, you'll be asked for a password -- that's the regular password you use to log into your own laptop.
    21. If that goes well (it will take a while), continue with
    22. sudo port install coreutils gsed bash findutils wget mp4v2 ossp-uuid dos2unix alpine moreutils autossh
    23. (Linux users instead install these packages: ffmpeg wget mp4v2-utils uuid dos2unix alpine moreutils autossh)
    24. Protect the machine from attacks
    25. The macports package fail2ban is useful for blocking attackers; see Configure fail2ban.
    26. Create a folder to hold the videos and download the first video (assuming you are a turnerstudent):
    27. mkdir ~/Documents/redhen/videos
    28. cd ~/Documents/redhen/videos
    29. rsync turnerstudents@ ./ -av
    30. Next, let's get the Red Hen script that extracts frames from the video at one-second intervals and place it in your local script folder:
    31. rsync turnerstudents@ /tmp -av
    32. sudo mkdir -p /usr/local/bin
    33. sudo mv /tmp/extract-frames-ffmpeg.sh /usr/local/bin
    34. Verify you have the script in place
    35. which extract-frames-ffmpeg.sh
    36. If you get a response, you can cd to the folder where you have the mp4 file (if you're not there already) and issue the frame-extraction command:
    37. cd ~/Documents/redhen/videos
    38. extract-frames-ffmpeg.sh 2015-07-03_2300_US_WKYC_Channel_3_News_at_7.mp4
    39. This should extract frames at one-second intervals into a folder called 2015-07-03_2300_US_WKYC_Channel_3_News_at_7.hq
    40. If that works, move that folder into images and try the annotator tool on it; see if you can call up one image after the other by using the spacebar:
    41. mv 2015-07-03_2300_US_WKYC_Channel_3_News_at_7.hq ../images/
    42. cd ~/Documents/redhen/
    43. java -jar annotator.jar images/2015-07-03_2300_US_WKYC_Channel_3_News_at_7.hq 2015-07-03_2300_US_WKYC_Channel_3_News_at_7.iMotion

Congratulations! Let us know you have the iMotion annotator working!