DeepFoids: Adaptive Bio-Inspired Fish Simulation with Deep Reinforcement Learning

Yuko Ishiwaka, Xiao S. Zeng, Shun Ogawa, Donovan Westwater, Tadayuki Tone, Masaki NakadaNeurIPS 2022

Introduction

In the aquaculture industry, precise fish counting is essential for optimizing feeding operations. Accurate counts prevent both fish malnutrition from under-feeding and environmental contamination from over-feeding. While deep learning and computer vision offer promising solutions, obtaining the necessary training data is notoriously difficult. Underwater environments are challenging to film, and manually labeling thousands of frames is prohibitively expensive and time-consuming.

Existing simulations, such as "Boids" or "Foids," attempt to generate synthetic data but rely heavily on manual parameter tuning for every new species, cage size, or environmental condition. To overcome this bottleneck, researchers introduce DeepFoids, an adaptive simulation where fish agents "learn" how to behave through reinforcement learning. This approach allows the system to scale across different species and environments without constant manual intervention, generating high-fidelity synthetic datasets to train real-world computer vision models.

Methodology: Multi-Agent Reinforcement Learning

The authors frame fish behavior as a Multi-Agent Reinforcement Learning (MARL) problem, moving beyond simple flocking algorithms by grounding the simulation in real biological rules.

Decision-making cycle of the fish agents, incorporating biological observations and environmental factors into the DRL control module.
  • The Brain: The simulation utilizes Proximal Policy Optimization (PPO) with Generalized Advantage Estimation (GAE) to train the fish agents.
  • Biological Priors: Reward functions are based on biological realities, including preferred light intensity, temperature, hydrostatic pressure (depth), and "personal space" (inter-fish distance).
  • Social Hierarchy: The model incorporates a dominance hierarchy. "Dominant" fish occasionally initiate chases, forcing "subordinate" fish to learn realistic escape behaviors.
  • The Environment: Built in Unity using the ML-Agents toolkit, the simulation integrates the Crest Ocean System for physically-based rendering. This enables the simulation of complex optical properties like light attenuation, scattering, and turbidity based on chlorophyll and sediment levels.
  • Transfer Learning: To handle diverse cage environments, the researchers employ a two-step training scheme: pre-training in a default scene followed by fine-tuning for specific cage geometries and population densities.

Synthetic Datasets and Real-World Validation

The primary output of DeepFoids is a high-fidelity synthetic dataset containing 2D/3D bounding boxes and silhouettes for various species, including Coho Salmon, Yellowtail, and Red Seabream, across diverse environmental conditions.

Synthetic data generation in the Unity environment, showcasing automated 3D bounding box annotations for simulated fish.

To validate the simulation's behavioral accuracy and test the final counting model, the team collected real-world video footage from actual fish farms in Onmaehama and Nishiki, Japan. Existing public datasets like OzFish and Deepfish were deemed unsuitable for this specific aquaculture application due to a lack of farm-specific environments and target species.

Key Results

  • Behavioral Fidelity: Quantitative analysis using polar order parameters ($P$) and angular momentum ($M$) demonstrated that the simulated trajectories closely mirrored the movement patterns of real fish in both sparse and dense schools.
  • Counting Performance: A YOLOv4 model trained exclusively on the DeepFoids synthetic data was tested on real-world footage with impressive results:
  • Coho Salmon: Estimated 69 vs. 61 actual.
  • Yellowtail: Estimated 22 vs. 32 actual.
  • Red Seabream: Estimated 7 vs. 7 actual.
  • Training Efficiency: Despite the environmental complexity, training millions of steps for 1,000 agents took roughly 1.5 to 2 hours on a standard consumer-grade laptop GPU (RTX 3080).

Key Insights and Future Directions

The DeepFoids simulation revealed several fascinating insights into artificial agent behavior and reinforcement learning dynamics:

  • Emergent Schooling: Distinct collective behaviors—such as swarming (high density, low polarization) and milling (circular rotation around an axis)—emerged naturally from the DRL agents as population density increased, perfectly matching real-world biological observations.
  • PPO vs. SAC: PPO outperformed Soft Actor-Critic (SAC) in this specific environment. The authors hypothesize that because the environment is highly constrained by collisions and boundaries, SAC’s off-policy nature caused it to struggle with overwhelming penalties, whereas PPO’s on-policy updates remained stable.
  • Visual-Biological Coupling: By linking the simulation's visual parameters (like turbidity and light) to the agents' biological preferences (like depth based on light), the synthetic data captures the underlying reasons for fish distribution, rather than just mimicking their appearance.

Limitations

While highly effective, the current system has limitations. The weights for the reward functions (e.g., balancing collision penalties against neighbor alignment rewards) are still set manually. Future work will explore automated weight adjustment. Additionally, the physics engine currently excludes the effects of tidal currents and the influence of water temperature on internal metabolism. Finally, accuracy drops in extremely high-density scenarios due to occlusion; future iterations aim to extend the system to more robust 3D detection and pixel-wise segmentation to handle crowded scenes.

Summary updated

BibTeX
@inproceedings{ishiwaka2022deepfoids,
  author = {Yuko Ishiwaka and Xiao S. Zeng and Shun Ogawa and Donovan Westwater and Tadayuki Tone and Masaki Nakada},
  title = {{DeepFoids: Adaptive Bio-Inspired Fish Simulation with Deep Reinforcement Learning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2022},
}
Figure