Feed Right Docs

Input Features

Complete reference for the 44-dimensional observation vector used by the FeedRight DQN agent.

The DQN agent observes the world through a 44-dimensional continuous state vector. Every feature is min-max normalised to the [0, 1] range before being fed into the neural network. This page documents every dimension, its physical meaning, units, and normalisation bounds.

Feature Layout Summary

GroupDimensionsIndex RangeCount
EnvironmentalDO, temperature, salinity, O₂ sat, cloud, wind, humidity, trends, time0 – 1213
Biomasstotal biomass, fish count, avg weight, growth rate, stocking age, growth stage13 – 186
Videomotion intensity, feeding frenzy, surface activity, pellet sink time, uneaten count19 – 235
Feeding Historytime since feed, last amount, consumption rate, daily avg, feeds today, interval, totals24 – 329
PerformanceFCR, SGR (7d/30d), waste rate, cost per kg growth33 – 375
Cagedepth, volume, stocking density, water flow, location, age38 – 436

Environmental Features (13 dimensions)

IndexFeatureUnitsMinMaxDescription
0dissolved_oxygenmg/L4.09.0Dissolved oxygen concentration at cage depth. Below 5.0 is dangerous.
1temperature°C22.032.0Water temperature. Optimal range is 26–29 °C for most tropical species.
2salinityPSU28.036.0Salinity level. Affects fish metabolism and feed palatability.
3oxygen_saturation%60.0100.0O₂ saturation percentage. Below 65% triggers a safety block.
4cloud_cover%0.0100.0Cloud cover percentage. Affects light penetration and fish behaviour.
5wind_speedm/s0.020.0Wind speed at cage site. Above 15 m/s triggers a safety block.
6wind_direction°0.0360.0Wind direction in degrees. Influences surface current and pellet drift.
7humidity%40.0100.0Relative humidity. Used as a weather-condition proxy.
8temp_change_1h°C/h−2.02.0Temperature change over the last hour. Rapid shifts (> 1.5 °C) stress fish.
9oxygen_trend_3hmg/L−1.01.03-hour dissolved oxygen trend. Negative values indicate declining O₂.
10temp_deviation_from_optimal°C−5.05.0Deviation from the species-specific optimal temperature.
11hour_of_dayh023Current hour (0–23). Encodes diurnal feeding patterns.
12is_daylightbool01Whether the sun is currently up. Fish feed primarily during daylight.

Biomass Features (6 dimensions)

These features are produced by the biomass estimation pipeline, which runs a fine-tuned YOLO fish-detection model on sampled video frames. Each detected bounding box is converted to a length / girth / weight estimate using the allometric relationship W = a × L^b × G^c, calibrated with a per-camera pixels_per_cm constant. Individual weights are averaged and scaled by the known stocking count to compute total cage biomass.

IndexFeatureUnitsMinMaxDescription
13current_total_biomasskg2 00015 000Estimated live biomass in the cage (stocking count × avg weight from YOLO detections).
14estimated_fish_countcount1 00015 000Stocking count (supplied externally; not derived from detection count since only a fraction of fish are visible per frame).
15average_fish_weightg2003 000Mean individual fish weight estimated from YOLO bounding-box morphometrics.
16biomass_growth_rate_7dg/week10150Weekly biomass growth rate per individual.
17days_since_stockingdays0365Number of days since fish were stocked into the cage.
18growth_stageenum02Discrete growth stage: 0 = Juvenile, 1 = Growing, 2 = Mature (derived from avg weight thresholds).

Video Features (5 dimensions)

These features are produced by the video behaviour analysis pipeline using two complementary signal sources:

  1. Farnebäck dense optical flow — computed between consecutive greyscale frames with spatial attention and temporal smoothing to quantify fish swimming dynamics.
  2. YOLO pellet-detection model (optional) — detects uneaten feed pellets for direct waste measurement with temporal consistency filtering. When unavailable, the pipeline falls back to motion-deficit heuristics.
IndexFeatureUnitsMinMaxHow it is derived
19motion_intensity0–1000.0100.075th-percentile of the Farnebäck optical-flow magnitude histogram, temporally smoothed with an EMA (α = 0.3). Isolates fish motion from static background.
20feeding_frenzy_score0–10.01.0Product of upward-flow surface convergence ratio and directional coherence (cosine similarity) in the top third of a 3×3 spatial grid. Filters out camera shake and turbulence — only coordinated upward rushes score high. This is the primary hunger signal for the DQN reward function.
21surface_activity0–10.01.0Vertical energy-profile skew: squared-magnitude energy in the top bands minus the uniform-distribution baseline. Captures fish redistribution toward the surface independent of overall activity level.
22pellet_sinking_timeseconds0.030.0With pellet model: median sinking time from depth-weighted pellet tracklets across consecutive frames. Without pellet model: inverse-activity proxy (low motion + high surface activity → longer sinking time).
23uneaten_pellet_countcount0500With pellet model: YOLO pellet count with NMS (IoU ≥ 0.5) and temporal consistency filtering (pellet must appear in ≥ 2 of 3 consecutive frames). Without pellet model: motion-deficit heuristic (current motion below trailing 60 s EMA).

Feeding History Features (9 dimensions)

IndexFeatureUnitsMinMaxDescription
24time_since_last_feedhours0.012.0Hours elapsed since the last feed event. The agent learns optimal feeding intervals.
25last_feed_amountgrams0.05 000Amount dispensed in the most recent feed event (stored in grams in state).
26last_feed_consumption_rate0–10.01.0Proportion of the last feed that was actually consumed.
27avg_daily_feed_7dgrams0.010 0007-day rolling average of daily total feed.
28feeds_todaycount08Number of feed events already executed today. The safety layer blocks feeds beyond 6.
29avg_interval_7dhours2.08.07-day average interval between consecutive feeds.
30total_feed_30dkg0.0300.0Cumulative feed dispensed over the last 30 days.
31feeding_efficiency_7d0–10.51.07-day rolling feed efficiency (consumed / dispensed).
32baseline_activity0–1000.0100.0Baseline pre-feed activity level for comparison with current motion.

Performance Features (5 dimensions)

IndexFeatureUnitsMinMaxDescription
33current_fcrratio0.83.0Feed Conversion Ratio. Lower is better (industry target < 1.5).
34sgr_7d%/day0.03.0Specific Growth Rate over the last 7 days.
35sgr_30d%/day0.03.0Specific Growth Rate over the last 30 days.
36feed_waste_rate0–0.50.00.5Fraction of feed wasted (not consumed). Above 0.3 triggers a safety reduction.
37cost_per_kg_growth$/kg1.05.0Economic cost of feed per kilogram of fish growth.

Cage Features (6 dimensions)

IndexFeatureUnitsMinMaxDescription
38cage_depthmetres5.020.0Depth of the net cage.
39cage_volume5005 000Total cage volume.
40stocking_densitykg/m³5.025.0Current stocking density.
41water_flow_ratem/s0.02.0Water current speed through the cage.
42cage_location_encodedint0100Encoded cage location identifier.
43cage_age_daysdays0365Days since the cage was deployed.

Normalisation

All 44 features are min-max normalised before being passed to the DQN:

normalised = (raw - min) / (max - min + ε)

where ε = 1e-8 prevents division by zero. The result is clipped to [0, 1].

The feature_mins and feature_maxs arrays in FishFeedingEnv.__init__ define the exact bounds. If a feature value falls outside these bounds at inference time it is clamped, so the agent always sees valid inputs.

Denormalisation (used internally for reward calculation and rendering) reverses the transformation:

raw = normalised × (max - min) + min

On this page