SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 1807.06587 · 2018

Deep Exemplar-based Colorization

arXiv · PDF · Open in the Atlas

Code that ran

9 of 10 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; 1 honoured the contract we drafted, 0 violated it and 7 have no contract verdict; 1 failure of our instrument; 1 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/1807.06587.json · badge: /api/ran/1807.06587.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
msracver/Deep-Exemplar-based-Colorization canonical (classifier label)
classifier basis: census
9 ran · 1 no recorded run
FunctionStatusWhere it lives
CustomFunc Ran
ran on a synthesized input
msracver/Deep-Exemplar-based-Colorization/colorization_subnet/lib/TestTransform.py
code served (permissive licence) · get_code("677fa59128ae0750")
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 list. 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.

import torch
import torch.nn as nn

torch.manual_seed(0)

# Define a simple function that will be used as the `func` parameter
def simple_func(tensor, *args, **kwargs):
    """A simple function that processes tensors"""
    return tensor * 2

# Create small tensors for inputs
# inputs[0]: im_l
im_l = torch.randn(2, 4)

# inputs[1]: im_ab
im_ab = torch.randn(2, 4)

# inputs[2]: warp_ba
warp_ba = torch.randn(2, 4)

# inputs[3]: warp_aba
warp_aba = torch.randn(2, 4)

# inputs[4-8]: 5 layers, each containing [err_ba, err_ab]
layers = []
for _ in range(5):
    err_ba = torch.randn(2, 4)
    err_ab = torch.randn(2, 4)
    layers.append([err_ba, err_ab])

# Construct the inputs list
inputs = [im_l, im_ab, warp_ba, warp_aba] + layers

# Define additional args and kwargs that will be passed to func
additional_args = ()
additional_kwargs = {}

ARGS = {
    'inputs': inputs,
    'func': simple_func,
    'args': additional_args,
    'kwargs': additional_kwargs
}
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 list — a list 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
combo5_loader Ran
ran on a synthesized input
msracver/Deep-Exemplar-based-Colorization/colorization_subnet/lib/TestDataset.py
code served (permissive licence) · get_code("853eee8ab5e009f0")
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.

import struct
import numpy as np
import cv2
from PIL import Image
import tempfile
import os

# Create a temporary binary file in the format expected by combo5_loader
temp_fd, temp_path = tempfile.mkstemp(suffix='.bin')

try:
    with os.fdopen(temp_fd, 'wb') as f:
        # Write height (h = 10)
        f.write(struct.pack('i', 10))
        # Write width (w = 10)
        f.write(struct.pack('i', 10))
        
        # Write warp_ba image (color, 10x10)
        dummy_img_ba = np.zeros((10, 10, 3), dtype=np.uint8)
        dummy_img_ba[:, :] = [100, 150, 200]  # BGR format
        encoded_ba = cv2.imencode('.png', dummy_img_ba)[1]
        f.write(struct.pack('i', len(encoded_ba)))
        f.write(encoded_ba.tobytes())
        
        # Write warp_aba image (color, 10x10)
        dummy_img_aba = np.zeros((10, 10, 3), dtype=np.uint8)
        dummy_img_aba[:, :] = [50, 100, 150]  # BGR format
        encoded_aba = cv2.imencode('.png', dummy_img_aba)[1]
        f.write(struct.pack('i', len(encoded_aba)))
        f.write(encoded_aba.tobytes())
        
        # Write 5 pairs of error images (grayscale, 10x10)
        for l in range(5):
            # err_ba
            dummy_err_ba = np.full((10, 10), 50, dtype=np.uint8)
            encoded_err_ba = cv2.imencode('.png', dummy_err_ba)[1]
            f.write(struct.pack('i', len(encoded_err_ba)))
            f.write(encoded_err_ba.tobytes())
            
            # err_ab
            dummy_err_ab = np.full((10, 10), 100, dtype=np.uint8)
            encoded_err_ab = cv2.imencode('.png', dummy_err_ab)[1]
            f.write(struct.pack('i', len(encoded_err_ab)))
            f.write(encoded_err_ab.tobytes())
    
    ARGS = {
        'path': temp_path,
        'real_w': 10,
        'real_h': 10
    }
    
finally:
    pass
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, cv2, 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
load_gray_image Ran
ran on a synthesized input
msracver/Deep-Exemplar-based-Colorization/colorization_subnet/utils/util.py
code served (permissive licence) · get_code("6bcbb3173832cf2a")
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 2, dtype family int, shape (10, 10) 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 cv2
import numpy as np
import tempfile
import os

# Create a temporary grayscale image file for testing
def create_test_image():
    # Create a small 10x10 grayscale image
    img_array = np.random.randint(0, 256, (10, 10), dtype=np.uint8)
    
    # Write to a temporary file
    temp_dir = tempfile.gettempdir()
    img_path = os.path.join(temp_dir, 'test_gray_image.png')
    cv2.imwrite(img_path, img_array)
    
    return img_path

# Create the test image
test_image_path = create_test_image()

# Define ARGS dict with the image path parameter
ARGS = {
    'img_path': test_image_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
cv2, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 2, dtype family int, shape (10, 10) — shape (10, 10) 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
load_rgb_image Ran
ran on a synthesized input
msracver/Deep-Exemplar-based-Colorization/colorization_subnet/utils/util.py
code served (permissive licence) · get_code("0a3e160abed0f9ef")
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 int, shape (100, 150, 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 cv2
import numpy as np
import tempfile
import os

# Create a temporary image file for testing
temp_dir = tempfile.mkdtemp()
img_array = np.random.randint(0, 256, (100, 150, 3), dtype=np.uint8)
# Convert RGB to BGR for cv2.imwrite
img_bgr = cv2.cvtColor(img_array, cv2.COLOR_RGB2BGR)
temp_img_path = os.path.join(temp_dir, "test_image.jpg")
cv2.imwrite(temp_img_path, img_bgr)

ARGS = {
    "img_path": temp_img_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
cv2, 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 int, shape (100, 150, 3) — shape (100, 150, 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
parse_images Ran
ran on a synthesized input
msracver/Deep-Exemplar-based-Colorization/colorization_subnet/lib/TestDataset.py
code served (permissive licence) · get_code("c6af5f8d79d5fec3")
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 list, ndim 2, dtype family float; 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 os
import os.path as osp
import tempfile

# Create a temporary directory with a pairs.txt file
temp_dir = tempfile.mkdtemp()
pairs_file = osp.join(temp_dir, 'pairs.txt')

# Write sample image pairs to the file
with open(pairs_file, 'w') as f:
    f.write('image1.jpg image2.jpg\n')
    f.write('image3.png image4.png\n')
    f.write('image5.jpg image6.jpg extra_field\n')

ARGS = {
    'dir': temp_dir
}
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 list, ndim 2, dtype family float — a list 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
pil_loader Ran
ran, honoured the contract we drafted
msracver/Deep-Exemplar-based-Colorization/colorization_subnet/lib/TestDataset.py
pointer only (licence: MIT); the stored copy get_code serves, from YuemingJin/MTRCNet-CL, is pointer only (licence: NONE) · get_code("1df9a5ffd9b38c34")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (MIT), but get_code serves the stored copy, first harvested from YuemingJin/MTRCNet-CL, 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.

to_mytensor Ran
ran on a synthesized input
msracver/Deep-Exemplar-based-Colorization/colorization_subnet/lib/functional.py
code served (permissive licence) · get_code("e7147011e565d852")
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 3, dtype family float, shape (2, 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 torch
import numpy as np

torch.manual_seed(0)

# Create a small numpy array to use as input
# Using a 3D array (height=4, width=3, channels=2) to test the transpose operation
pic = np.random.randint(0, 256, size=(4, 3, 2), dtype=np.uint8)

ARGS = {
    "pic": pic
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
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 3, dtype family float, shape (2, 4, 3) — shape (2, 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
to_pil_image Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
msracver/Deep-Exemplar-based-Colorization/colorization_subnet/lib/functional.py
code served (permissive licence) · get_code("b454d979a50af8bb")
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.

import torch
import numpy as np
from PIL import Image

torch.manual_seed(0)

# Create a valid tensor image: 3D tensor with shape (C, H, W)
# Using uint8 values in range [0, 255]
tensor_pic = torch.randint(0, 256, (3, 4, 5), dtype=torch.uint8)

ARGS = {
    'pic': tensor_pic,
    'mode': None
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy, torch — 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
utf8_str Ran
ran on a synthesized input
msracver/Deep-Exemplar-based-Colorization/colorization_subnet/utils/util.py
code served (permissive licence) · get_code("51f99da316dddeec")
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 str. 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.

import torch

torch.manual_seed(0)

# The function utf8_str takes a single parameter: in_str
# It expects in_str to be either a string or bytes
# It tries to decode it as UTF-8, and if that fails, it encodes then decodes

# Test case 1: bytes input
test_bytes = b'Hello World'

# Test case 2: string input  
test_string = 'Hello World'

# We'll use the bytes version as the primary test
ARGS = {
    'in_str': test_bytes
}
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 str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float 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
to_tensor Not yet run
unverified (harvested, no recorded run)
msracver/Deep-Exemplar-based-Colorization/colorization_subnet/lib/functional.py
code served (permissive licence) · get_code("73af1511632ee8b4")
How it ran

no invocation recorded.

Also present in other papers' code

Of 10 samples lifted from this paper's linked repositories, 10 carry a function identity and 0 do not. Of the 10 distinct functions with an identity, 5 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 5 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
pil_loader 28 other papers
2 dated earlier, 26 later
1702.00758 (2017-02)
HashNet: Deep Learning to Hash by Continuation
1805.07932 (2018-05)
Bilinear Attention Networks
1902.09368 (2019-02)
Dual Attention Networks for Visual Reference Resolution in Visual Dialog
and 25 more not named here
to_pil_image 2 other papers
2 later
1906.09909 (2019-06)
Deep Exemplar-based Video Colorization
2502.05749 (2025-02)
UniDB: A Unified Diffusion Bridge Framework via Stochastic Optimal Control
to_tensor 2 other papers
2 later
1906.09909 (2019-06)
Deep Exemplar-based Video Colorization
2502.05749 (2025-02)
UniDB: A Unified Diffusion Bridge Framework via Stochastic Optimal Control
CustomFunc 1 other paper
1 later
1906.09909 (2019-06)
Deep Exemplar-based Video Colorization
to_mytensor 1 other paper
1 later
1906.09909 (2019-06)
Deep Exemplar-based Video Colorization

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

We propose the first deep learning approach for exemplar-based local colorization. Given a reference color image, our convolutional neural network directly maps a grayscale image to an output colorized image. Rather than using hand-crafted rules as in traditional exemplar-based methods, our end-to-end colorization network learns how to select, propagate, and predict colors from the large-scale data. The approach performs robustly and generalizes well even when using reference images that are unrelated to the input grayscale image. More importantly, as opposed to other learning-based colorization methods, our network allows the user to achieve customizable results by simply feeding different references. In order to further reduce manual effort in selecting the references, the system automatically recommends references with our proposed image retrieval algorithm, which considers both semantic and luminance information. The colorization can be performed fully automatically by simply picking the top reference suggestion. Our approach is validated through a user study and favorable quantitative comparisons to the-state-of-the-art methods. Furthermore, our approach can be naturally extended to video colorization. Our code and models will be freely available for public use.

For agents

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

get_harvested_code_for_paper("1807.06587")
get_code_for_paper("1807.06587")
have("1807.06587")

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

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

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

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

Connect an agent — have() is free.