Skip to content

Analysing and Comparing Tracks

Dave Walker edited this page Nov 2, 2026 · 1 revision

FishTrack doesn't just produce an annotated video. It also records the observations made by its tracking methods, allowing you to revisit a track, examine how it changes from frame to frame, and compare the results of conventional CV and SAM 2.

This is particularly useful when the two methods behave differently. A fish changing orientation, for example, may cause conventional CV to lose its track while SAM 2 continues following it. The Analysis window makes those differences easier to see and investigate, rather than relying on the finished videos alone.

Tracking data is collected during the normal processing pass, so no additional run of the tracking models is needed.

Opening the Analysis Window

Click Analysis near the FishTrack heading. FishTrack automatically opens the most recent successfully processed result, if available. Alternatively, click Open results to load a previously saved tracking-result JSON file.

The Analysis window works with saved tracking data: you don't need the original video or the tracking models to inspect trajectories and statistics. The original video is optional if you want to see the underlying frames.

For example, processing a video to produce:

clip-Manual-CV-tracked.mp4

also produces a tracking-data file alongside it:

clip-Manual-CV-tracked-tracking.json

FishTrack won't overwrite existing files. If processing is cancelled or fails, the observations collected so far can still be saved with a status of cancelled, failed or incomplete, as appropriate. A finished annotated video is only published after successful processing and encoding verification.

Exploring a Track

Select the Track you want to examine from the selector at the top of the Analysis window. Its trajectory appears over the frame area, with Start and End markers showing where the reported observations begin and finish.

FishTrack Analysis showing the trajectories and continuity of SAM 2 and conventional CV tracking

The same fish tracked using SAM 2 (green) and conventional CV (orange). Both methods initially follow the animal, but CV stops reporting observations while SAM 2 continues.

The trajectory is displayed in the original video's image coordinates:

  • The origin (0, 0) is at the top-left corner of the frame.
  • X increases towards the right; Y increases downwards.
  • Positions and distances are expressed in pixels, not metres.
  • Lines stop where observations are missing; FishTrack doesn't invent a path across a gap.

Move the source-frame slider to inspect an individual frame. The status beneath the viewer shows the current frame, its timestamp, and the position reported by each tracker — or no report if a position isn't available.

Click Locate source video to display actual source frames beneath the trajectory. FishTrack checks a sampled fingerprint of the selected file's contents rather than relying on its filename. This is a practical identity check, not a complete cryptographic verification of every byte.

A note about camera movement: The trajectory represents movement within the image. If the GoPro is moving, the same pixel position does not represent a fixed location in the underwater scene. Camera motion, perspective and the animal's changing orientation can all influence the displayed path.

Comparing Tracking Methods

One of the most interesting uses of Analysis is to examine how conventional CV and SAM 2 behave when given the same footage.

To compare two tracking runs:

  1. Click Open results to open the first tracking-result file.
  2. Click Open comparison to load the second result.
  3. Use the Track selectors to choose the corresponding animal in each run.
  4. Examine the trajectories and the Track continuity bars.
  5. Move the frame slider to inspect both results at the same point in the video.
  6. Expand Statistics and analysis settings for numerical details and reported events.

The two views share a synchronised source-frame timeline. Green represents SAM 2; orange represents conventional CV. In the continuity display, the coloured portion indicates frames with reported positions and the dark portion indicates unavailable observations.

Track numbers are local to each run. Track 1 in a CV result isn't automatically the same animal as Track 1 in SAM 2. You make that association explicitly using the selectors; FishTrack doesn't automatically match identities, score the methods or declare a winner.

Which Results can be Compared?

FishTrack checks that the two results relate to compatible source footage and processing timelines, including:

  • The source video's sampled content identity, dimensions and frame count.
  • Its frame rate (within numerical tolerance).
  • The processing range and frame-selection settings.
  • The coordinate convention used to record positions.

The tracking backends and their settings may differ — that's the point of the comparison. If results aren't compatible, FishTrack explains which property differs rather than presenting a misleading comparison. Partial processing runs can also be compared, provided their actually processed ranges match.

Understanding the Statistics

Expand Statistics and analysis settings to see the measurements and event lists associated with the selected tracks.

FishTrack Analysis with the tracking statistics and event lists expanded

The expanded analysis panel shows measurements for each run, including observed frames, coverage, track duration, displacement and reported or inferred events.

Measurement What it means
First / last frame The first and last frames with available position measurements, using zero-based source-frame numbers.
First / last timestamp The corresponding times, in seconds from the start of the source video.
Observed frames How many frames have an actual reported position. Lost identities or absent/tiny SAM 2 masks aren't counted as observed positions.
Span seconds Time between the first and last available observations.
Coverage The fraction of frames between the first and last observations that contain a measured position. 1.0 means complete coverage of that span.
Interruptions Gaps between available observations within the track's observed span. Absence before the first or after the last observation isn't counted as an internal interruption.
Mean box area Average area of the available bounding boxes, in square pixels.
Displacement pixels Straight-line distance between the first and last observed positions.
Path length pixels Sum of movement distances between consecutive observed frames. Gaps aren't bridged by imaginary measurements.

A track represented by only one observation has zero span, displacement and path length, with coverage 1.0. Where no measured positions exist, quantities that cannot be calculated are shown as Unavailable, rather than zero. This matters: a measured distance of zero is not the same as having no distance measurement.

Why CV and SAM 2 Positions May Differ

The two methods don't necessarily define an animal's position in exactly the same way:

  • Conventional CV uses its reported object centroid and current bounding box, including accepted visual-following observations. Stale predicted positions for lost tracks aren't treated as measurements
  • SAM 2 uses the centre of the current segmentation mask's bounding box and the mask's own area is recorded separately

Consequently, even when both methods follow the same animal correctly, their trajectories and reported areas may differ slightly.

Discontinuities and Tracking Events

FishTrack identifies events that may help explain what happened during tracking. Some events come directly from the tracking backend, such as a reported loss; others are inferred possibilities, such as an unusually large change in position.

The event lists distinguish these categories. They can include first and last observations, reported loss or reappearance, gaps, and possible changes in position or bounding-box area. When observations stop before processing ends, FishTrack may report an inferred end of observations. That doesn't necessarily mean the tracker failed: the animal might have left the frame or become occluded.

Two settings control the thresholds for possible discontinuities:

Setting Default Interpretation
Possible position jump (px) 100 Flag an adjacent observed-frame position change that exceeds 100 pixels.
Possible box-area change (ratio) 2.0 Flag an adjacent observed-frame area change whose ratio exceeds a factor of two.

Changing these thresholds updates the analysis display. Missing frames are never treated as measured jumps. Saved JSON includes the original observations, allowing the event calculations to be repeated with different thresholds; its saved event list uses the documented defaults.

Continuity isn't accuracy - a tracker may confidently follow the wrong object. Equally, a track can end because the animal has swum out of view. FishTrack's measurements describe what the tracking system reported, not independently verified animal movements or behaviours

Exporting the Results

Each loaded run has its own Export CSV and Export JSON buttons. These export the run's data, not a permanent association between the two tracks selected for comparison. FishTrack asks for a new destination and refuses to overwrite an existing file.

CSV — for Spreadsheets and Further Analysis

CSV contains one row per observation, with a consistent set of columns:

run_id,backend,frame,timestamp,track_id,x,y,bbox_x,bbox_y,bbox_width,bbox_height,status,mask_area

Frame numbers refer to the original source video, timestamps are in seconds, positions and bounding boxes are in source-frame pixels, and mask areas are in square pixels. Unavailable measurements appear as empty fields, not invented zeroes or confidence scores.

The CSV can be opened in a spreadsheet or analysed independently using Python, R or other tools.

JSON — for Saving and Reopening Analysis

JSON is FishTrack's native tracking-result format. It preserves the information needed to reopen and reproduce the analysis, including:

  • Source-video identity and properties
  • Processing and detection configuration, including accepted regions of interest
  • Tracking backend, application and schema versions
  • Completion status (complete, incomplete, cancelled or failed)
  • Individual observations and track identifiers
  • Derived statistics and tracking events

The current data format is tracking-result schema version 1. When a JSON result is reopened, FishTrack validates its structure, coordinates and timeline, and recalculates statistics and events from the original observations rather than blindly trusting previously saved summaries.

A Little More About the Underlying Data

The tracking-data format is intentionally independent of the tracking algorithms. Both backends feed lightweight observations into a common analysis layer, without keeping entire video frames or segmentation masks in memory for this purpose. Each observation records its frame, timestamp, track ID and status, together with the position, bounding box and mask area where available. A bounding box is represented as [x, y, width, height]. Missing measurements remain null.

This separation lets FishTrack perform comparisons and recalculate measurements without rerunning CV or SAM 2, and provides a useful foundation for future developments.