SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2403.06462 · CVPR · 2024

Towards the Uncharted: Density-Descending Feature Perturbation for Semi-supervised Semantic Segmentation

Jimin Xiao, Yao Zhao, Huihui Bai, Xiaoyang Wang, Limin Yu, Xjtlu

arXiv · PDF · Open in the Atlas

Code that ran

7 of 9 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; 0 honoured the contract we drafted, 0 violated it and 1 has no contract verdict; 6 failures of our instrument; 2 no recorded run), measured 2026-11-23; 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/2403.06462.json · badge: /api/ran/2403.06462.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
gavinwxy/ddfp canonical (classifier label)
classifier basis: census
6 ran · 2 no recorded run
Gavinwxy/DDFP community
Papers with Code archive
1 ran · 0 no recorded run
FunctionStatusWhere it lives
FastGMM Ran
ran on a synthesized input
Gavinwxy/DDFP/model/flow/distributions.py
code served (permissive licence) · get_code("a70101abccd99ef3")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, class construct-then-call prompt, model not recorded) and returned Tensor, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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 torch
from torch import distributions
import torch.nn.functional as F
import math

# Remove .cuda() calls from the class for CPU compatibility
class FastGMM(torch.distributions.Distribution):

    def __init__(self, means, unlabeled=300):
        self.n_components, self.dim = means.shape
        self.means = means
        self.covs = torch.ones(self.n_components).unsqueeze(1)
        self.weights = torch.ones(self.n_components)
        self.unlabeled = unlabeled
        self.log_pi_const = torch.tensor(self.dim * math.log(2 * math.pi))

    def log_prob_base(self, x):
        covs_det = torch.prod(self.covs, dim=1)
        covs_inv = 1.0 / self.covs
        x_centered = x.unsqueeze(1).repeat(1, self.n_components, 1) - self.means.unsqueeze(0)
        mahala_dist = torch.sum(x_centered ** 2 * covs_inv.unsqueeze(0), dim=2)
        log_cov_det = covs_det.log().unsqueeze(0).repeat(x.size(0), 1)
        all_log_probs = -0.5 * (self.log_pi_const + mahala_dist + log_cov_det)
        return all_log_probs

    def log_prob(self, x, y=None):
        all_log_probs = self.log_prob_base(x)
        normalized_weights = F.softmax(self.weights, dim=0)
        mixture_log_probs = torch.logsumexp(all_log_probs + torch.log(normalized_weights), dim=1)
        if y is not None:
            log_probs = torch.zeros_like(mixture_log_probs)
            mask = y == self.unlabeled
            log_probs[mask] += mixture_log_probs[mask]
            for i in range(self.n_components):
                mask = y == i
                log_probs[mask] += all_log_probs[:, i][mask]
            return log_probs
        else:
            return mixture_log_probs

    @property
    def gaussians(self):
        gaussians = [distributions.MultivariateNormal(mean, cov * torch.eye(self.dim)) for mean, cov in zip(self.means, self.covs)]
        return gaussians

    def class_logits(self, x):
        log_probs = self.log_prob_base(x)
        log_probs_weighted = log_probs + torch.log(F.softmax(self.weights, dim=0))
        return log_probs_weighted

    def classify(self, x):
        log_probs = self.class_logits(x)
        return torch.argmax(log_probs, dim=1)

    def class_probs(self, x):
        log_probs = self.class_logits(x)
        return F.softmax(log_probs, dim=1)


INIT_ARGS = {
    'means': torch.randn(3, 4),
    'unlabeled': 300
}

ARGS = {
    'x': torch.randn(2, 4),
    'y': None
}

METHOD = 'log_prob'

if __name__ == '__main__':
    gmm = FastGMM(**INIT_ARGS)
    result = gmm.log_prob(**ARGS)
    print("log_prob result shape:", result.shape)
    print("log_prob result:", result)
Setup block drafted by
a language model, class construct-then-call prompt, model not recorded
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, ndim 1, dtype family float — no output shape is stated: observe_signature.py observed this class with its constructor sizes canonicalised where it could, which the node does not record, so its shape is not stated as this setup block's
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: torch and numpy seeded to 0 by the harness immediately before the class was constructed from INIT_ARGS (fixture_check.py)
compute_rce_loss Ran
ran; our contract draft was wrong, not the code
gavinwxy/ddfp/utils/loss_helper.py
code served (permissive licence) · get_code("ab90969959ef1daa")
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 Tensor, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. The code mentions cuda, and the harness aliases cuda to the CPU for every sample; whether this run needed that is 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 torch
from torch.nn import functional as F

torch.manual_seed(0)

# Create small tensors for the function
batch_size = 2
num_classes = 4
height = 3
width = 5

# predict: shape (b, c, h, w) - logits before softmax
predict = torch.randn(batch_size, num_classes, height, width)

# target: shape (b, h, w) - class indices, with 255 as ignore index
target = torch.randint(0, num_classes, (batch_size, height, width))
# Add some 255 values to test the ignore index logic
target[0, 0, 0] = 255
target[1, 1, 1] = 255

ARGS = {
    "predict": predict,
    "target": target,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
einops, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, 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
compute_unsupervised_loss Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
gavinwxy/ddfp/utils/loss_helper.py
code served (permissive licence) · get_code("00f3224921ae6a19")
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) and returned Tensor, 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 torch
import numpy as np
import torch.nn.functional as F

torch.manual_seed(0)

# Create small tensors with distinct dimensions
batch_size = 2
num_class = 4
h = 3
w = 5

# predict: logits from model, shape (batch_size, num_class, h, w)
predict = torch.randn(batch_size, num_class, h, w)

# pred_teacher: teacher model predictions, shape (batch_size, num_class, h, w)
pred_teacher = torch.randn(batch_size, num_class, h, w)

# target: ground truth labels, shape (batch_size, h, w)
# Values should be class indices (0 to num_class-1) or 255 (ignore index)
target = torch.randint(0, num_class, (batch_size, h, w))
# Add some 255 values (ignore index)
target[0, 0, 0] = 255
target[1, 1, 1] = 255

# percent: percentile threshold for entropy filtering
percent = 50

ARGS = {
    "predict": predict,
    "target": target,
    "percent": percent,
    "pred_teacher": pred_teacher,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, 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
compute_unsupervised_loss Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
gavinwxy/ddfp/utils/loss_helper.py
code served (permissive licence) · get_code("62a40800a97ad683")
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 Tensor, 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 torch
import torch.nn.functional as F

torch.manual_seed(0)

# Create small tensors with distinct dimensions
batch_size = 2
num_class = 4
h = 3
w = 5

# predict: logits from model, shape (batch_size, num_class, h, w)
predict = torch.randn(batch_size, num_class, h, w)

# target: ground truth labels, shape (batch_size, h, w)
# Use values 0-3 for valid classes, 255 for ignore
target = torch.randint(0, 4, (batch_size, h, w)).long()
# Add some 255 values (ignore index)
target[0, 0, 0] = 255
target[1, 1, 1] = 255

# percent: percentage threshold for entropy filtering
percent = 50.0

# pred_teacher: teacher model predictions, shape (batch_size, num_class, h, w)
pred_teacher = torch.randn(batch_size, num_class, h, w)

ARGS = {
    "predict": predict,
    "target": target,
    "percent": percent,
    "pred_teacher": pred_teacher,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Tensor, 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
crop Ran
ran; our contract draft was wrong, not the code
gavinwxy/ddfp/dataset/transform.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from wangshanwen001/SemiEarth, is pointer only (licence: NONE) · get_code("21e12abf73350be0")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from wangshanwen001/SemiEarth, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

crop_center Ran
ran; our contract draft was wrong, not the code
gavinwxy/ddfp/dataset/transform.py
code served (permissive licence) · get_code("6eb28f8d24da4c1d")
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. 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 numpy as np

# Create test images
# img: RGB image, smaller than target size
img_array = np.uint8(np.random.randint(0, 256, (10, 15, 3)))
img = Image.fromarray(img_array, mode='RGB')

# mask: grayscale image, same size as img
mask_array = np.uint8(np.random.randint(0, 256, (10, 15)))
mask = Image.fromarray(mask_array, mode='L')

# Target size for cropping/padding
size = 32

# ignore_value for mask padding
ignore_value = 255

ARGS = {
    'img': img,
    'mask': mask,
    'size': size,
    'ignore_value': ignore_value
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple — a tuple output has no array shape of its own; none is 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
hflip Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
gavinwxy/ddfp/dataset/transform.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from wangshanwen001/SemiEarth, is pointer only (licence: NONE) · get_code("9e96d1dddb1f71af")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from wangshanwen001/SemiEarth, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_loader Not yet run
unverified (harvested, no recorded run)
gavinwxy/ddfp/dataset/builder.py
code served (permissive licence) · get_code("c4a5f452f24a2ef0")
How it ran

no invocation recorded.

get_loader Not yet run
unverified (harvested, no recorded run)
gavinwxy/ddfp/dataset_city/builder.py
code served (permissive licence) · get_code("5469d8a1c4ce07cc")
How it ran

no invocation recorded.

Also present in other papers' code

Of 9 samples lifted from this paper's linked repositories, 9 carry a function identity and 0 do not. Of the 9 distinct functions with an identity, 4 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 0 the same month, 2 later) and 5 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.

FunctionAlso present inEarliest-datedOthers named
hflip 6 other papers
3 dated earlier, 3 later
2106.05095 (2021-06)
ST++: Make Self-training Work Better for Semi-supervised Semantic Segmentation
2208.09910 (2022-08)
Revisiting Weak-to-Strong Consistency in Semi-Supervised Semantic Segmentation
2308.09281 (2023-08)
Diverse Cotraining Makes Strong Semi-Supervised Segmentor
and 3 more not named here
crop 5 other papers
2 dated earlier, 3 later
2208.09910 (2022-08)
Revisiting Weak-to-Strong Consistency in Semi-Supervised Semantic Segmentation
2308.09281 (2023-08)
Diverse Cotraining Makes Strong Semi-Supervised Segmentor
2405.20610 (2024-05)
PrevMatch: Revisiting and Maximizing Temporal Knowledge in Semi-Supervised Semantic Segmentation
and 2 more not named here
compute_unsupervised_loss 3 other papers
3 dated earlier
2203.03884 (2022-03)
Semi-Supervised Semantic Segmentation Using Unreliable Pseudo-Labels
Wang_Hunting_Sparsity_Density-Guided_Contrastive_Learning_for_Semi-Supervised_Semantic_Segmentation_CVPR_2023_paper (2023 (year only))
Hunting Sparsity: Density-Guided Contrastive Learning for Semi-Supervised Semantic Segmentation
2301.07340 (2023-01)
Semi-Supervised Semantic Segmentation via Gentle Teaching Assistant
compute_rce_loss 2 other papers
2 dated earlier
Wang_Hunting_Sparsity_Density-Guided_Contrastive_Learning_for_Semi-Supervised_Semantic_Segmentation_CVPR_2023_paper (2023 (year only))
Hunting Sparsity: Density-Guided Contrastive Learning for Semi-Supervised Semantic Segmentation
2301.07340 (2023-01)
Semi-Supervised Semantic Segmentation via Gentle Teaching Assistant

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-23.

Repositories linked to this paper

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

Abstract

Semi-supervised semantic segmentation allows model to mine effective supervision from unlabeled data to complement label-guided training. Recent research has primarily focused on consistency regularization techniques, exploring perturbation-invariant training at both the image and feature levels. In this work, we proposed a novel feature-level consistency learning framework named Density-Descending Feature Perturbation (DDFP). Inspired by the low-density separation assumption in semisupervised learning, our key insight is that feature density can shed a light on the most promising direction for the segmentation classifier to explore, which is the regions with lower density. We propose to shift features with confident predictions towards lower-density regions by perturbation injection. The perturbed features are then supervised by the predictions on the original features, thereby compelling the classifier to explore less dense regions to effectively regularize the decision boundary. Central to our method is the estimation of feature density. To this end, we introduce a lightweight density estimator based on normalizing flow, allowing for efficient capture of the feature density distribution in an online manner. By extracting gradients from the density estimator, we can determine the direction towards less dense regions for each feature. The proposed DDFP outperforms other designs on feature-level perturbations and shows state of the art performances on both Pascal VOC and Cityscapes dataset under various partition protocols. The project is available at https://github.com/Gavinwxy/DDFP.

For agents

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

get_harvested_code_for_paper("2403.06462")
get_code_for_paper("2403.06462")
have("2403.06462")

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

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

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

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

Connect an agent — have() is free.