Manuscript Offprint

arXiv:2609.17308

Optical-Flow Wingbeat Counting in MuJoCo: A Comparison of Convolutional, Spiking, and Attention-Based Temporal Models

Zhang Nengbo

Abstract

Visual monitoring of flapping-wing vehicles requires distinguishing individual wingbeats from motion strength and average frequency. This paper presents a controlled MuJoCo evaluation of wingbeat counting from signed optical flow observed by virtual cameras mounted on Crazyflie vehicles. Three flapping-wing models were recorded at optical distances of 1.5 and 3.0 m, producing 1,440 clips from 240 paired scene configurations with a scene-level 3:1 training–test split. A common spatial convolutional encoder was combined with a causal temporal convolutional network, a recurrent leaky integrate-and-fire spiking network, or causal self-attention. Each model predicted phase and activity, followed by the same directed-crossing event counter. The six existing convolutional models were retained, and all twelve new models were frozen before their test predictions were generated. Exact-count accuracies at 1.5 m were 96.67%, 95.00%, and 96.67%, respectively; at 3.0 m they were 94.44%, 92.22%, and 95.00%. All paired scene-bootstrap intervals for differences in exact-count accuracy included zero. Seven far-distance spiking-model clips had correct totals despite event-timing mismatches, demonstrating why total-count and event-level measurements must be reported together. The results support the feasibility of causal optical-flow counting in the tested setting and identify boundary-sensitive errors. They do not establish an architecture ranking across repeated training, real-flight robustness, or hardware efficiency.

Keywords: wingbeat counting; optical flow; micro aerial vehicles; spiking neural networks; temporal convolution; causal attention; MuJoCo.

1 Introduction

Counting wingbeats from a camera stream provides a non-contact description of a flapping vehicle's motion. The desired output can be a cumulative number of completed repetitions, the time of each repetition, or an average frequency. These outputs impose different requirements. A frequency estimate can describe a steady oscillation while leaving individual events unresolved. A correct total can also conceal compensating missed and extra detections, or events localized at the wrong times. An observation system intended to react to individual movements therefore needs a declared event definition and an evaluation that preserves event timing.

Visual wingbeat analysis and repetition counting have established precedents. High-speed optical-flow analysis has been used to estimate the wingbeat frequency of freely flying bumblebees [1]. Neural repetition counting has been studied with online convolutional processing [2], temporal self-similarity [3], attention-based temporal correlation [4], and motion-feature learning [5]. These results motivate an application-specific evaluation rather than a claim that optical flow or a particular neural architecture introduces repetition counting itself.

For micro aerial vehicles (MAVs), visually reading another vehicle’s movement is also relevant to motion-mediated interaction. MoCom studied inter-MAV communication using event vision and spiking neural networks [6]. Wingbeat counting is a different perceptual task: the present output is an event sequence, not a decoded navigation message. The observer–target arrangement is useful because observation distance and target geometry can be controlled while keeping the sensor input and event labels explicit. Here, three independent observer–target pairs provide three target-specific tests; there is no cross-observer information fusion or communication protocol.

This study asks three bounded questions. Can a signed-optical-flow pipeline recover wingbeat events under a reproducible simulated observation protocol? How do convolutional, recurrent spiking, and attention-based temporal modules compare when the spatial encoder structure, training budget, and event counter are held fixed? Which disagreements remain when clip totals are correct? The study contributes an inspectable evaluation workflow, a paired comparison of three temporal designs, and an analysis of event-timing and window-boundary failures. It does not introduce a new general-purpose neural architecture or claim state-of-the-art repetition-counting performance. All reported observations come from completed experiments; untested extensions are identified in the discussion.

References (14)