SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2104.14964 · 2021

Deep learning with self-supervision and uncertainty regularization to count fish in underwater images

arXiv · PDF · Open in the Atlas

Code that ran

5 of 7 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 2 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 3 failures of our instrument; 2 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2104.14964.json · badge: /api/ran/2104.14964.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
ptarling/DeepLearningFishCounting canonical (classifier label)
classifier basis: census
5 ran · 2 no recorded run
FunctionStatusWhere it lives
MAE Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
ptarling/DeepLearningFishCounting/lossfunctions_metrics.py
code served (permissive licence) · get_code("e6c42930be66ecec")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned EagerTensor, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import tensorflow as tf

# Create sample tensors for y_true and y_pred
# The function expects 4D tensors with shape [batch, height, width, channels]
# It reduces over dimensions 1 and 2, then takes the first channel (index 0)

batch_size = 2
height = 4
width = 3
channels = 1

# Create y_pred: shape [2, 4, 3, 1]
y_pred = tf.constant([
    [[[1.0], [2.0], [3.0]], [[4.0], [5.0], [6.0]], [[7.0], [8.0], [9.0]], [[10.0], [11.0], [12.0]]],
    [[[2.0], [3.0], [4.0]], [[5.0], [6.0], [7.0]], [[8.0], [9.0], [10.0]], [[11.0], [12.0], [13.0]]]
], dtype=tf.float32)

# Create y_true: shape [2, 4, 3, 1]
y_true = tf.constant([
    [[[1.5], [2.5], [3.5]], [[4.5], [5.5], [6.5]], [[7.5], [8.5], [9.5]], [[10.5], [11.5], [12.5]]],
    [[[2.5], [3.5], [4.5]], [[5.5], [6.5], [7.5]], [[8.5], [9.5], [10.5]], [[11.5], [12.5], [13.5]]]
], dtype=tf.float32)

ARGS = {
    'y_true': y_true,
    'y_pred': y_pred
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
au_absolute_loss Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
ptarling/DeepLearningFishCounting/lossfunctions_metrics.py
code served (permissive licence) · get_code("ceb4aa179cb3707e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned EagerTensor, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import tensorflow as tf
import numpy as np

# Set seed for reproducibility
tf.random.set_seed(0)

# Create tiny tensors matching the function's expected shape
# Function expects 4D tensors: [batch, height, width, channels]
# It reduces over dimensions [1, 2] and accesses [:, :, :, 0] and [:, :, :, 1]
# So we need at least 2 channels

batch_size = 2
height = 4
width = 3
channels = 2

# y_pred: [batch, height, width, 2] - two channels (predictions and log_var)
y_pred = tf.constant(np.random.randn(batch_size, height, width, channels), dtype=tf.float32)

# y_true: [batch, height, width, 2] - same shape as y_pred
y_true = tf.constant(np.random.randn(batch_size, height, width, channels), dtype=tf.float32)

ARGS = {
    "y_true": y_true,
    "y_pred": y_pred,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
hinge_loss Ran
ran, honoured the contract we drafted
ptarling/DeepLearningFishCounting/lossfunctions_metrics.py
code served (permissive licence) · get_code("6400df5309b45c25")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned EagerTensor, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import tensorflow as tf
import numpy as np

# Set seed for reproducibility
tf.random.set_seed(0)
np.random.seed(0)

# Create y_true: shape (2, 1) - batch size 2
y_true = tf.constant([[1.0], [0.5]], dtype=tf.float32)

# Create y_pred: shape (2, 1) - batch size 2, needs at least 1 column for indexing [:, 0]
y_pred = tf.constant([[0.3], [0.8]], dtype=tf.float32)

ARGS = {
    "y_true": y_true,
    "y_pred": y_pred
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, tensorflow — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type EagerTensor, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
random_translation Ran
ran, honoured the contract we drafted
ptarling/DeepLearningFishCounting/Unlabelled_data_preprocessing/unlabelled_data_preprocessing.py
code served (permissive licence) · get_code("d1264829518f6087")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import random

random.seed(0)

# Analyze the function:
# - random_translation takes two parameters: width and height
# - Both are used in random.randint() calls and arithmetic operations
# - They represent dimensions that should be smaller than std_width (320) and std_height (576)

# Valid arguments: width and height must be positive integers less than std_width and std_height respectively
width = 100
height = 200

ARGS = {
    "width": width,
    "height": height,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family int — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
three_quarters Ran
ran; our contract draft was wrong, not the code
ptarling/DeepLearningFishCounting/Unlabelled_data_preprocessing/unlabelled_data_preprocessing.py
code served (permissive licence) · get_code("57faa0c0f32b5b96")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Image. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

from PIL import Image
import random

random.seed(0)

# Create a valid PIL Image object for testing
# The function expects an image and calls .crop() and .transpose() on it
# std_width = 320, std_height = 576
img = Image.new('RGB', (320, 576), color='red')

ARGS = {
    'img': img
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Image — a Image output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Image output the recorded ndim 3 and dtype family int describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_bounding_box Not yet run
unverified (harvested, no recorded run)
ptarling/DeepLearningFishCounting/Unlabelled_data_preprocessing/unlabelled_data_preprocessing.py
code served (permissive licence) · get_code("6f5c2fbb20c86082")
How it ran

no invocation recorded.

multitask_au Not yet run
unverified (harvested, no recorded run)
ptarling/DeepLearningFishCounting/model.py
code served (permissive licence) · get_code("23bc6fc70d867250")
How it ran

no invocation recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 7 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Effective conservation actions require effective population monitoring. However, accurately counting animals in the wild to inform conservation decision-making is difficult. Monitoring populations through image sampling has made data collection cheaper, wide-reaching and less intrusive but created a need to process and analyse this data efficiently. Counting animals from such data is challenging, particularly when densely packed in noisy images. Attempting this manually is slow and expensive, while traditional computer vision methods are limited in their generalisability. Deep learning is the state-of-the-art method for many computer vision tasks, but it has yet to be properly explored to count animals. To this end, we employ deep learning, with a density-based regression approach, to count fish in low-resolution sonar images. We introduce a large dataset of sonar videos, deployed to record wild mullet schools (Mugil liza), with a subset of 500 labelled images. We utilise abundant unlabelled data in a self-supervised task to improve the supervised counting task. For the first time in this context, by introducing uncertainty quantification, we improve model training and provide an accompanying measure of prediction uncertainty for more informed biological decision-making. Finally, we demonstrate the generalisability of our proposed counting framework through testing it on a recent benchmark dataset of high-resolution annotated underwater images from varying habitats (DeepFish). From experiments on both contrasting datasets, we demonstrate our network outperforms the few other deep learning models implemented for solving this task. By providing an open-source framework along with training data, our study puts forth an efficient deep learning template for crowd counting aquatic animals thereby contributing effective methods to assess natural populations from the ever-increasing visual data.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2104.14964")
get_code_for_paper("2104.14964")
have("2104.14964")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2104.14964.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2104.14964.svg)](https://syntology.ai/paper/2104.14964)

Connect an agent — have() is free.