SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2402.15504 · 2024

Gen4Gen: Generative Data Pipeline for Generative Multi-Concept Composition

arXiv · PDF · Open in the Atlas

Code that ran

8 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 0 have no contract verdict; 7 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/2402.15504.json · badge: /api/ran/2402.15504.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
louisYen/Gen4Gen canonical (classifier label)
classifier basis: census
8 ran · 2 no recorded run
FunctionStatusWhere it lives
approximate_RDP Ran
ran; our contract draft was wrong, not the code
louisYen/Gen4Gen/gen4gen/saliency_models/DIS/hce_metric_main.py
code served (permissive licence) · get_code("729599a34939c1bf")
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 cv2 as cv
import numpy as np

# Create sample boundary contours as numpy arrays
# cv.approxPolyDP expects contours in the format of numpy arrays with shape (n, 1, 2)
boundary1 = np.array([
    [[10, 10]],
    [[20, 10]],
    [[20, 20]],
    [[10, 20]]
], dtype=np.int32)

boundary2 = np.array([
    [[30, 30]],
    [[50, 30]],
    [[50, 50]],
    [[40, 60]],
    [[30, 50]]
], dtype=np.int32)

boundaries = [boundary1, boundary2]

ARGS = {
    'boundaries': boundaries,
    'epsilon': 1.0
}
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 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
f1score_torch Ran
ran; our contract draft was wrong, not the code
louisYen/Gen4Gen/gen4gen/saliency_models/DIS/basics.py
code served (permissive licence) · get_code("ccf648472bf97751")
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 3, 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 torch
import torch.nn as nn

torch.manual_seed(0)

# pd: prediction tensor - needs to be a 1D tensor of values in range [0, 255]
# gt: ground truth tensor - needs to be a 1D tensor of values, some > 128, some <= 128
# Both should have the same shape

# Create small tensors with distinct sizes
pd = torch.tensor([10.0, 50.0, 100.0, 150.0, 200.0, 250.0, 30.0, 180.0], dtype=torch.float32)
gt = torch.tensor([50.0, 75.0, 200.0, 220.0, 100.0, 180.0, 60.0, 240.0], dtype=torch.float32)

ARGS = {
    "pd": pd,
    "gt": gt
}
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 tuple, ndim 3, dtype family float — 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
filter_bdy_cond Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
louisYen/Gen4Gen/gen4gen/saliency_models/DIS/hce_metric_main.py
code served (permissive licence) · get_code("b1f805b5d053ac0d")
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 numpy as np
import cv2 as cv
from skimage.morphology import disk
from skimage.measure import label

# Create small test data
h, w = 10, 12
mask = np.zeros((h, w), dtype=np.uint8)
mask[2:8, 3:9] = 1
mask[1:3, 1:4] = 1

cond = np.zeros((h, w), dtype=np.uint8)
cond[2:7, 4:8] = 1

# Create contours using OpenCV
# Contours are lists of arrays with shape (n_points, 1, 2) where each point is [x, y]
contour1 = np.array([
    [[4, 2]],
    [[5, 2]],
    [[6, 2]],
    [[6, 3]],
    [[5, 3]],
    [[4, 3]],
], dtype=np.int32)

contour2 = np.array([
    [[7, 4]],
    [[8, 4]],
    [[8, 5]],
    [[7, 5]],
], dtype=np.int32)

contour3 = np.array([
    [[2, 6]],
    [[3, 6]],
    [[3, 7]],
    [[2, 7]],
], dtype=np.int32)

bdy_ = [contour1, contour2, contour3]

ARGS = {
    'bdy_': bdy_,
    'mask': mask,
    'cond': cond,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
cv2, numpy, skimage — 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
get_im_gt_name_dict Ran
ran; our contract draft was wrong, not the code
louisYen/Gen4Gen/gen4gen/saliency_models/DIS/data_loader_cache.py
code served (permissive licence) · get_code("c3c043344336bb0b")
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 1, 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 tempfile
from pathlib import Path

# Create temporary directories with test image files
temp_dir = tempfile.mkdtemp()
dataset1_im_dir = os.path.join(temp_dir, 'dataset1', 'images')
dataset1_gt_dir = os.path.join(temp_dir, 'dataset1', 'masks')
dataset1_cache_dir = os.path.join(temp_dir, 'dataset1', 'cache')

dataset2_im_dir = os.path.join(temp_dir, 'dataset2', 'images')
dataset2_gt_dir = os.path.join(temp_dir, 'dataset2', 'masks')
dataset2_cache_dir = os.path.join(temp_dir, 'dataset2', 'cache')

# Create directories
os.makedirs(dataset1_im_dir, exist_ok=True)
os.makedirs(dataset1_gt_dir, exist_ok=True)
os.makedirs(dataset1_cache_dir, exist_ok=True)
os.makedirs(dataset2_im_dir, exist_ok=True)
os.makedirs(dataset2_gt_dir, exist_ok=True)
os.makedirs(dataset2_cache_dir, exist_ok=True)

# Create dummy image and mask files
for i in range(2):
    with open(os.path.join(dataset1_im_dir, f'image_{i}.jpg'), 'w') as f:
        f.write('dummy image')
    with open(os.path.join(dataset1_gt_dir, f'image_{i}.png'), 'w') as f:
        f.write('dummy mask')
    with open(os.path.join(dataset2_im_dir, f'photo_{i}.jpg'), 'w') as f:
        f.write('dummy image')
    with open(os.path.join(dataset2_gt_dir, f'photo_{i}.png'), 'w') as f:
        f.write('dummy mask')

# Define datasets configuration
datasets = [
    {
        'name': 'dataset1',
        'im_dir': dataset1_im_dir,
        'gt_dir': dataset1_gt_dir,
        'im_ext': '.jpg',
        'gt_ext': '.png',
        'cache_dir': dataset1_cache_dir
    },
    {
        'name': 'dataset2',
        'im_dir': dataset2_im_dir,
        'gt_dir': dataset2_gt_dir,
        'im_ext': '.jpg',
        'gt_ext': '.png',
        'cache_dir': dataset2_cache_dir
    }
]

ARGS = {
    'datasets': datasets,
    'flag': 'valid'
}
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 1, 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
get_objects Ran
ran; our contract draft was wrong, not the code
louisYen/Gen4Gen/gen4gen/s2_llm_guided_object_composition.py
code served (permissive licence) · get_code("2ebc4e2ea773d416")
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 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 torch

torch.manual_seed(0)

# The function takes a dict `d` and uses:
# - max(d, key=d.get) to find the key with max value
# - min(d, key=d.get) to find the key with min value
# So we need a dict with comparable values

d = {
    'key_a': 10,
    'key_b': 5,
    'key_c': 20,
    'key_d': 3
}

ARGS = {
    'd': d
}
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 tuple, ndim 1, dtype family float — 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
im_reader Ran
ran, honoured the contract we drafted
louisYen/Gen4Gen/gen4gen/saliency_models/DIS/data_loader_cache.py
code served (permissive licence) · get_code("a761df1609ffb30b")
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 (10, 10, 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 tempfile
import numpy as np
from PIL import Image
import os

# Create a temporary directory and a simple test image
temp_dir = tempfile.mkdtemp()
temp_image_path = os.path.join(temp_dir, "test_image.png")

# Create a simple RGB image using PIL
img_array = np.random.randint(0, 256, (10, 10, 3), dtype=np.uint8)
img = Image.fromarray(img_array, 'RGB')
img.save(temp_image_path)

ARGS = {
    "im_path": temp_image_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
PIL, numpy, skimage — 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 (10, 10, 3) — shape (10, 10, 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
mae_torch Ran
ran; our contract draft was wrong, not the code
louisYen/Gen4Gen/gen4gen/saliency_models/DIS/basics.py
code served (permissive licence) · get_code("1ad7043f7cda3831")
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

torch.manual_seed(0)

# Create small tensors with distinct dimensions
# h=2, w=4 to make shapes unambiguous
pred = torch.randn(2, 4, dtype=torch.float32)
gt = torch.randn(2, 4, dtype=torch.float32)

ARGS = {
    "pred": pred,
    "gt": gt,
}
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
relax_HCE Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
louisYen/Gen4Gen/gen4gen/saliency_models/DIS/hce_metric_main.py
code served (permissive licence) · get_code("de8843c32f8cfda5")
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 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 numpy as np
import cv2 as cv
from skimage.morphology import disk

# Create small test images
np.random.seed(0)

# gt: ground truth binary image
gt = np.random.randint(0, 256, (32, 32, 3), dtype=np.uint8)

# rs: result/prediction binary image
rs = np.random.randint(0, 256, (32, 32, 3), dtype=np.uint8)

# gt_ske: ground truth skeleton (binary image)
gt_ske = np.random.randint(0, 2, (32, 32), dtype=np.uint8)

# relax: relaxation parameter
relax = 2

# epsilon: approximation parameter for RDP
epsilon = 2.0

ARGS = {
    "gt": gt,
    "rs": rs,
    "gt_ske": gt_ske,
    "relax": relax,
    "epsilon": epsilon
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
cv2, numpy, skimage — 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 float — 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
create_dataloaders Not yet run
unverified (harvested, no recorded run)
louisYen/Gen4Gen/gen4gen/saliency_models/DIS/data_loader_cache.py
code served (permissive licence) · get_code("5cd2aa75a7b0c6ec")
How it ran

no invocation recorded.

f1_mae_torch Not yet run
unverified (harvested, no recorded run)
louisYen/Gen4Gen/gen4gen/saliency_models/DIS/basics.py
code served (permissive licence) · get_code("7d13248918a66377")
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, 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 10 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

Recent text-to-image diffusion models are able to learn and synthesize images containing novel, personalized concepts (e.g., their own pets or specific items) with just a few examples for training. This paper tackles two interconnected issues within this realm of personalizing text-to-image diffusion models. First, current personalization techniques fail to reliably extend to multiple concepts -- we hypothesize this to be due to the mismatch between complex scenes and simple text descriptions in the pre-training dataset (e.g., LAION). Second, given an image containing multiple personalized concepts, there lacks a holistic metric that evaluates performance on not just the degree of resemblance of personalized concepts, but also whether all concepts are present in the image and whether the image accurately reflects the overall text description. To address these issues, we introduce Gen4Gen, a semi-automated dataset creation pipeline utilizing generative models to combine personalized concepts into complex compositions along with text-descriptions. Using this, we create a dataset called MyCanvas, that can be used to benchmark the task of multi-concept personalization. In addition, we design a comprehensive metric comprising two scores (CP-CLIP and TI-CLIP) for better quantifying the performance of multi-concept, personalized text-to-image diffusion methods. We provide a simple baseline built on top of Custom Diffusion with empirical prompting strategies for future researchers to evaluate on MyCanvas. We show that by improving data quality and prompting strategies, we can significantly increase multi-concept personalized image generation quality, without requiring any modifications to model architecture or training algorithms.

For agents

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

get_harvested_code_for_paper("2402.15504")
get_code_for_paper("2402.15504")
have("2402.15504")

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

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

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

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

Connect an agent — have() is free.