SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1601.04589 · 2016

Combining Markov Random Fields and Convolutional Neural Networks for Image Synthesis

arXiv · PDF · Open in the Atlas

Code that ran

7 of 18 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 6 have no contract verdict; 1 failure of our instrument; 11 no recorded run), measured 2026-11-21; 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/1601.04589.json · badge: /api/ran/1601.04589.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
awentzonline/image-analogies community (classifier label)
classifier basis not recorded on the link
4 ran · 11 no recorded run
paulwarkentin/pytorch-neural-doodle community (classifier label)
classifier basis not recorded on the link
3 ran · 0 no recorded run
FunctionStatusWhere it lives
boolean_type Ran
ran on a synthesized input
paulwarkentin/pytorch-neural-doodle/src/utils/arguments.py
code served (permissive licence) · get_code("95fe0ccd141f9a4d")
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 bool, 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 argparse

def boolean_type(arg):
    """Check an argument for a boolean type.

	Arguments:
		arg: Argument value.

	Returns:
		Argument of valid type.
	"""
    if arg.lower() in ('yes', 'true', 't', 'y', '1'):
        return True
    if arg.lower() in ('no', 'false', 'f', 'n', '0'):
        return False
    raise argparse.ArgumentTypeError("invalid boolean value: '{}'".format(arg))


ARGS = {
    "arg": "true"
}
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 bool, 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
combine_patches Ran
ran on a synthesized input
awentzonline/image-analogies/image_analogy/losses/patches.py
code served (permissive licence) · get_code("3cc96f63d8a23bc8")
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 ndarray, ndim 3, dtype family float, shape (4, 4, 7) 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 numpy as np

# Analyze the function:
# combine_patches(patches, out_shape)
# - patches: needs .transpose() method, so numpy array
#   - shape should be (batch, channels, height, width) based on transpose(0, 2, 3, 1)
#   - after transpose becomes (batch, height, width, channels)
# - out_shape: passed to reconstruct_from_patches_2d
#   - used as image_size[:2] to get (i_h, i_w)
#   - should be a tuple/list with at least 2 elements
#   - patches will be extracted with shape (p_h, p_w) from patches.shape[1:3]
#   - n_h = i_h - p_h + 1, n_w = i_w - p_w + 1 (number of patches in each dim)
#   - number of patches in batch must equal n_h * n_w

# Setup: Create small patches and compatible output shape
batch_size = 6  # 2x3 grid of patches
channels = 4
patch_height = 3
patch_width = 5

# Create patches with shape (batch, channels, patch_height, patch_width)
patches = np.random.randn(batch_size, channels, patch_height, patch_width).astype(np.float32)

# Output image dimensions must satisfy:
# n_h = i_h - p_h + 1 = 2, so i_h = patch_height + 1 = 4
# n_w = i_w - p_w + 1 = 3, so i_w = patch_width + 2 = 7
# Total patches needed: 2 * 3 = 6 ✓
image_height = patch_height + 1  # 4
image_width = patch_width + 2    # 7
out_shape = (image_height, image_width, channels)

ARGS = {
    "patches": patches,
    "out_shape": out_shape,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 3, dtype family float, shape (4, 4, 7) — shape (4, 4, 7) 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
combine_patches_grid Ran
ran on a synthesized input
awentzonline/image-analogies/image_analogy/losses/patch_matcher.py
code served (permissive licence) · get_code("1cf53d19cc9bc2ce")
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 ndarray, ndim 3, dtype family float, shape (3, 12, 8) 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 numpy as np

# Create small test data for combine_patches_grid
# The function expects:
# - in_patches: shape (rows, cols, channels, patch_row, patch_col)
# - out_shape: tuple (height, width, channels) for output image

num_rows = 2
num_cols = 3
num_channels = 3
patch_size = 4

# Create in_patches with shape (2, 3, 3, 4, 4)
# This represents 2x3 grid of 3-channel 4x4 patches
in_patches = np.random.randn(num_rows, num_cols, num_channels, patch_size, patch_size).astype(np.float32)

# out_shape should be compatible with the patches
# For a 2x3 grid of 4x4 patches, output shape could be (8, 12, 3)
out_shape = (8, 12, num_channels)

ARGS = {
    "in_patches": in_patches,
    "out_shape": out_shape,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 3, dtype family float, shape (3, 12, 8) — shape (3, 12, 8) 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
exclusive_positive_int_type Ran
ran on a synthesized input
paulwarkentin/pytorch-neural-doodle/src/utils/arguments.py
code served (permissive licence) · get_code("a493be01e216c20b")
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 int, ndim 0, dtype family int, 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 argparse

def exclusive_positive_int_type(arg):
    """Check an argument for an exclusive positive integer type.

	Arguments:
		arg: Argument value.

	Returns:
		Argument of valid type.
	"""
    arg_int = int(arg)
    if arg_int <= 0:
        raise argparse.ArgumentTypeError("invalid positive_int_type value: '{}', must be exclusive positive".format(arg))
    return arg_int


ARGS = {
    "arg": "42"
}
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 int, ndim 0, dtype family int, 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
make_patch_grid Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
awentzonline/image-analogies/image_analogy/losses/patch_matcher.py
code served (permissive licence) · get_code("4273734e25e0e4ff")
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 ndarray, ndim 5, dtype family float, shape (5, 5, 3, 4, 4) 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 numpy as np
import torch

torch.manual_seed(0)

# The function expects:
# - x: a numpy array with shape (num_channels, rows, cols)
# - patch_size: an integer
# - patch_stride: an integer (default=1)

# Create a small test image array
# Shape: (num_channels, rows, cols)
# Using distinct sizes: 3 channels, 8 rows, 8 cols
x = np.random.rand(3, 8, 8).astype(np.float32)

# patch_size should be smaller than the image dimensions
patch_size = 4

# patch_stride controls the stride of patch extraction
patch_stride = 1

ARGS = {
    "x": x,
    "patch_size": patch_size,
    "patch_stride": patch_stride,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, sklearn, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 5, dtype family float, shape (5, 5, 3, 4, 4) — shape (5, 5, 3, 4, 4) 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
positive_int_type Ran
ran on a synthesized input
paulwarkentin/pytorch-neural-doodle/src/utils/arguments.py
code served (permissive licence) · get_code("52436113b72defd5")
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 int, ndim 0, dtype family int, 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 argparse

def positive_int_type(arg):
    """Check an argument for a positive integer type.

	Arguments:
		arg: Argument value.

	Returns:
		Argument of valid type.
	"""
    arg_int = int(arg)
    if arg_int < 0:
        raise argparse.ArgumentTypeError("invalid positive_int_type value: '{}', must be positive".format(arg))
    return arg_int

ARGS = {
    "arg": "42"
}
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 int, ndim 0, dtype family int, 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
reconstruct_from_patches_2d Ran
ran on a synthesized input
awentzonline/image-analogies/image_analogy/losses/patches.py
code served (permissive licence) · get_code("85e08c4bc4bb8c88")
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 ndarray, ndim 3, dtype family float, shape (4, 4, 3) 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 numpy as np
from itertools import product

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

# Create small test patches
# patches shape: (n_patches, patch_height, patch_width)
# n_patches should equal n_h * n_w where n_h and n_w are derived from image_size and patch size
patch_height = 3
patch_width = 3
n_patches = 4  # 2x2 grid of patches
patches = np.random.randn(n_patches, patch_height, patch_width).astype(np.float32)

# Create image_size
# For reconstruction to work: image_size must be compatible with patches
# n_h = i_h - p_h + 1, n_w = i_w - p_w + 1
# With p_h=3, p_w=3, and 2x2 patches: n_h=2, n_w=2
# So: i_h = 2 + 3 - 1 = 4, i_w = 2 + 3 - 1 = 4
image_size = (4, 4, 3)  # height, width, channels

ARGS = {
    "patches": patches,
    "image_size": image_size,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 3, dtype family float, shape (4, 4, 3) — shape (4, 4, 3) 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
analogy_loss Not yet run
unverified (harvested, no recorded run)
awentzonline/image-analogies/image_analogy/losses/analogy.py
code served (permissive licence) · get_code("27c89f24cb4c2f8f")
How it ran

no invocation recorded.

congrid Not yet run
unverified (harvested, no recorded run)
awentzonline/image-analogies/image_analogy/losses/patch_matcher.py
code served (permissive licence) · get_code("490851df054a1d04")
How it ran

no invocation recorded.

content_loss Not yet run
unverified (harvested, no recorded run)
awentzonline/image-analogies/image_analogy/losses/core.py
code served (permissive licence) · get_code("738e56c6591b3703")
How it ran

no invocation recorded.

find_analogy_patches Not yet run
unverified (harvested, no recorded run)
awentzonline/image-analogies/image_analogy/losses/analogy.py
code served (permissive licence) · get_code("e6b8078b45819b6b")
How it ran

no invocation recorded.

gram_matrix Not yet run
unverified (harvested, no recorded run)
awentzonline/image-analogies/image_analogy/losses/neural_style.py
code served (permissive licence) · get_code("ae51fe953e9fee1f")
How it ran

no invocation recorded.

make_patches Not yet run
unverified (harvested, no recorded run)
awentzonline/image-analogies/image_analogy/losses/patches.py
code served (permissive licence) · get_code("1887aaf7a4b28217")
How it ran

no invocation recorded.

make_patches_grid Not yet run
unverified (harvested, no recorded run)
awentzonline/image-analogies/image_analogy/losses/mrf.py
code served (permissive licence) · get_code("0d0c6274e1a3b4aa")
How it ran

no invocation recorded.

mrf_loss Not yet run
unverified (harvested, no recorded run)
awentzonline/image-analogies/image_analogy/losses/mrf.py
code served (permissive licence) · get_code("9a2091da24ac4611")
How it ran

no invocation recorded.

neural_style_loss Not yet run
unverified (harvested, no recorded run)
awentzonline/image-analogies/image_analogy/losses/neural_style.py
code served (permissive licence) · get_code("14043153cfcedf04")
How it ran

no invocation recorded.

nnf_analogy_loss Not yet run
unverified (harvested, no recorded run)
awentzonline/image-analogies/image_analogy/losses/nnf.py
code served (permissive licence) · get_code("c7da3b42c5e38c36")
How it ran

no invocation recorded.

total_variation_loss Not yet run
unverified (harvested, no recorded run)
awentzonline/image-analogies/image_analogy/losses/core.py
code served (permissive licence) · get_code("b2cde6a85dd994ae")
How it ran

no invocation recorded.

Also present in other papers' code

Of 18 samples lifted from this paper's linked repositories, 18 carry a function identity and 0 do not. Of the 18 distinct functions with an identity, 2 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 1 later) and 16 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
gram_matrix 1 other paper
1 later
2009.08679 (2020-09)
Face Sketch Synthesis with Style Transfer using Pyramid Column Feature
make_patch_grid 1 other paper
1 dated earlier
1509.08985 (2015-09)
Generalizing Pooling Functions in Convolutional Neural Networks: Mixed, Gated, and Tree

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

Repositories linked to this paper

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

Abstract

This paper studies a combination of generative Markov random field (MRF) models and discriminatively trained deep convolutional neural networks (dCNNs) for synthesizing 2D images. The generative MRF acts on higher-levels of a dCNN feature pyramid, controling the image layout at an abstract level. We apply the method to both photographic and non-photo-realistic (artwork) synthesis tasks. The MRF regularizer prevents over-excitation artifacts and reduces implausible feature mixtures common to previous dCNN inversion approaches, permitting synthezing photographic content with increased visual plausibility. Unlike standard MRF-based texture synthesis, the combined system can both match and adapt local features with considerable variability, yielding results far out of reach of classic generative MRF methods.

For agents

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

get_harvested_code_for_paper("1601.04589")
get_code_for_paper("1601.04589")
have("1601.04589")

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

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

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

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

Connect an agent — have() is free.