- [Oct 2020 – Present]
Code: https://github.com/ec888/motion-tracker
I’ve always been fascinated by ants. I spent hours and hours staring at them as a kid, with infinite questions
1. Experimental questions
This year, ants invaded my house, which was a great opportunity to start studying them formally. Having done image processing-related work over the summer, I knew a pretty solid path to this project was within reach. It’s challenging to distill all the abstract ideas and questions floating around in my head into experimentable questions, but I ultimately decided on these four primary goals to address:
- Can we quantify/graph ant communication?
- How do ant trails form? How do they respond when their normal foraging paths are blocked?
- If we can AI to simulate each individual ant, will the resulting collective intelligence be the most robust and efficient? Or can we improve on it? Why does emergent intelligence form?
- What is the fractal dimension of an ant’s foraging path? Can “confusion” be robustly quantified with fractal dimension?
2. Setup & Code

This image shows the simple setup I used to record ant videos. The black rectangle is a magnet ring (I observed ants walking in less directed patterns when walking on the ring, so wanted to quantify it). Then, I performed other analyses as well with other materials instead of magnets: citrus, toothpaste, spider silk.
The first step is to build a tool to analyze ants video and collect ants path data. There is no widely used open source tools for this purpose. I forked and modified this project in Github, and was able to collect path data. I plan to use it for future research on ant behaviors. 
Luckily, Hunt et. al (2018) did the heavy-lifting for this so I didn’t have to repeat it:
“The paths of ants were traced out manually from the recorded videos by following a navigating ant with the computer mouse cursor …”
Challenges:
- The code was written in Python 2. I ran it on Python 3 after a few syntax fixes. However, it did not work as all the ant paths were dropped. With internet search, I found the culprit: in Python 3, the map() function return an “map” object, which is an iterator instead of a real list object. Once you iterated through it, it changed to empty and subsequent use would yield empty list. I followed a python migration guide to convert the map object into a real list and solved the problem.
- The code uses OpenCV and functional programming style, which I was not originally familiar with. I studied each line of the code and added documentation.
Next blog post will probably be about results. To be continued!