# FlockAI: A Testing Suite for ML-Driven Drone Applications
## 2 Machine Learning for Drones  
Machine Learning is the application of Artificial Intelligence capable of _training_ machines with data collected from past experience, to _learn_ how to perform data-driven tasks. ML algorithms in their most simplistic form feature a training and testing phase. During training, the ML algorithm receives labeled data as input and the output is a model representing a desired real-world process. During model application, the model is used to infer the outcome of the real-world process based on unlabeled input. The complexity of the ML model, along with the data given for training, significantly impact the algorithm accuracy for the applied task. It comes as no surprise that a recent McKinsey report denotes that the largest stake of the funding for commercial drone technology (in the US) is for on-board data management and analysis services empowered by ML and AI in general [14]. Hence, ML is now heavily examined by the research community as a driver to improve the level of autonomy of drones. Towards this, we are now witnessing the penetration of ML in drone navigation. This includes drone autopilots [15], mission planning [16], and collision avoidance [12]. The latter is drawing significant attention for two reasons: (i) drone-to-drone collisions due to the vast deployment of drones for several applications; and (ii) the use of drones in small and dense areas to aid in search and rescue missions (e.g., buildings on fire) [17]. On another level, ML is heavily used for both object detection and tracking [18]. Object detection is a specialization of the classification problem, where images from the on-board camera are passed to the ML algorithm to pinpoint the presence of (un-)desired objects. In turn, object tracking is usually enabled after detection, where object movement is tracked to remain in the scope of the drones' viewpoint. The domains of agriculture, critical infrastructure monitoring, and cinematography have benefited by the ability of drones to perform object detection and tracking. For example, drones are deployed to aid farmers in monitoring the quality of crop growth [4], and aid energy infrastructure companies survey quality degradation problems with powerlines, roads, and even photovoltaic panels [19]. Interestingly, ML-driven drones are recently being examined to detect crowded urban areas when social distancing must be enforced [20]. Despite the great potential of ML algorithms, these are usually not optimal for dealing with drones out-of-the-box. The constrained battery and modest compute capabilities of drones are considered significant inhibitors impacting the deployment of ML-driven applications [21]. At this point, one may argue that upgrading to a more powerful processor is a  
Figure 1: Screenshot from FlockAI with a drone deployed to perform object detection. \"quick fix\" solution. However, stronger processors require more power and hence compute still ends up impacting flight time. Another, may argue that no on-board processing is needed and that the data should just be streamed to the base-station (or cloud) for analysis. However, communication is also a significant energy drain, not to mention that waiting for a remote answer can lead to catastrophic results for the task assigned to the drone (e.g., collision). Hence, a ML practitioner developing a new drone application is left puzzled with the following questions in mind:  
* **Q1**. _Can my ML algorithm run in time when deployed on the desired resource-constraint drone?_
* **Q2**. _How does the ML algorithm affect the drones' energy consumption and overall battery autonomy?_
* **Q3**. _If the time and energy constraints permit, what is the trade-off between on-board ML inference vs. using a remote service through an open communication link?_
* **Q4**.