SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2409.20353 · NeurIPS · 2024

CableInspect-AD: An Expert-Annotated Anomaly Detection Dataset

Ge Li, Akshatha Arodi, Margaux Luck, Jean-Luc Bedwani, Aldo Zaimi, Nicolas Pouliot, Julien Beaudry, Gaétan Caron

arXiv · PDF · Open in the Atlas

Code that ran

21 of 22 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 2 have no contract verdict; 18 failures 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/2409.20353.json · badge: /api/ran/2409.20353.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
mila-iqia/cableinspect-ad-code canonical (classifier label)
classifier basis: census
21 ran · 1 no recorded run
FunctionStatusWhere it lives
add_anomalous_label Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
mila-iqia/cableinspect-ad-code/src/enhanced-patchcore/src/anomalib/post_processing/post_process.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from sukanyapatra1997/ulsad-2024, is pointer only (licence: NONE) · get_code("943f15268bdd462e")
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 sukanyapatra1997/ulsad-2024, 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.

add_class_description Ran
ran; our contract draft was wrong, not the code
mila-iqia/cableinspect-ad-code/src/anomaly_detector/base_anomaly_detector_inference.py
code served (permissive licence) · get_code("bf01bf57f7eee8c7")
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 os
from pathlib import Path
import yaml
import tempfile

# Create a temporary directory and YAML file for the test
temp_dir = tempfile.mkdtemp()
yaml_path = os.path.join(temp_dir, 'mvtec_descriptions.yaml')

# Create a sample YAML file with class descriptions
mvtec_descriptions = {
    'bottle': 'A glass or plastic container used for storing liquids',
    'cable': 'Electrical cable with connectors',
    'carpet': 'A woven floor covering',
    'grid': 'A rectangular mesh pattern',
    'leather': 'Animal hide material',
    'metal_nut': 'A hexagonal fastening component',
    'pill': 'A small medical tablet',
    'screw': 'A threaded fastening device',
    'tile': 'A square ceramic or stone piece',
    'transistor': 'An electronic semiconductor component',
    'wood': 'Natural timber material',
    'zipper': 'A mechanical fastening device'
}

with open(yaml_path, 'w') as f:
    yaml.dump(mvtec_descriptions, f)

# Create a mock image path that follows the MVTec AD directory structure
# The function extracts class_name from split(os.sep)[-4]
# So we need: .../class_name/.../.../.../image.jpg
img_path = Path(temp_dir) / 'bottle' / 'train' / 'good' / 'image_001.png'
img_path.parent.mkdir(parents=True, exist_ok=True)
img_path.touch()

# Create input prompt with placeholder
in_prompt = 'This is a defective <class_description> in the image.'

ARGS = {
    'img_path': img_path,
    'in_prompt': in_prompt,
    'yaml_path': yaml_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
yaml — 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
add_class_name Ran
ran; our contract draft was wrong, not the code
mila-iqia/cableinspect-ad-code/src/anomaly_detector/base_anomaly_detector_inference.py
code served (permissive licence) · get_code("d7c35998ffe39b5d")
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 os
from pathlib import Path

# The function expects:
# 1. img_path: Path - should be a Path object whose string representation contains class name at -4 position
# 2. in_prompt: str - a prompt string that may contain '<class>' placeholder

# Create a mock directory structure path
# When split by os.sep, we need the -4 element to be a class name
# Example path structure: /some/path/classname/subdir/subdir/image.jpg
img_path = Path("root") / "dataset" / "leather" / "images" / "sample.jpg"

# Input prompt with placeholder
in_prompt = "a photo of <class> on the table"

ARGS = {
    "img_path": img_path,
    "in_prompt": in_prompt,
}
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 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
add_label Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
mila-iqia/cableinspect-ad-code/src/enhanced-patchcore/src/anomalib/post_processing/post_process.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from sukanyapatra1997/ulsad-2024, is pointer only (licence: NONE) · get_code("4447ac929ca7ab0c")
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 sukanyapatra1997/ulsad-2024, 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.

add_normal_label Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
mila-iqia/cableinspect-ad-code/src/enhanced-patchcore/src/anomalib/post_processing/post_process.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from sukanyapatra1997/ulsad-2024, is pointer only (licence: NONE) · get_code("fe1771d45fa5b75a")
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 sukanyapatra1997/ulsad-2024, 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.

build_data_rows_from_data_dict Ran
ran on a synthesized input
mila-iqia/cableinspect-ad-code/dataset/generate_labels.py
code served (permissive licence) · get_code("07fa7d6e6f042906")
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 copy
import numpy as np

# Construct a minimal data_dict that satisfies the function's requirements
data_dict = {
    'images': [
        {
            'id': 1,
            'file_name': 'cable_01_A1_frame_001.jpg'
        },
        {
            'id': 2,
            'file_name': 'cable_02_B2_frame_002.jpg'
        }
    ],
    'annotations': [
        {
            'image_id': 1,
            'category_id': 10,
            'area': 150.5,
            'bbox': [10, 20, 30, 40],
            'attributes': {
                'rotation': 45,
                'anomaly_id': 1,
                'gradation': 0.8
            }
        },
        {
            'image_id': 1,
            'category_id': 11,
            'area': 200.3,
            'bbox': [50, 60, 70, 80],
            'attributes': {
                'rotation': 90,
                'anomaly_id': 2,
                'gradation': 0.5
            }
        }
    ],
    'categories': [
        {'id': 10, 'name': 'defect_type_1'},
        {'id': 11, 'name': 'defect_type_2'}
    ]
}

ARGS = {
    'data_dict': data_dict
}
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 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
build_labels_dataframe_from_annotations Ran
ran on a synthesized input
mila-iqia/cableinspect-ad-code/dataset/generate_labels.py
code served (permissive licence) · get_code("ce8d2afe5c019df9")
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 DataFrame. 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 json
import tempfile
import os
import numpy as np

# Create temporary JSON files with valid annotation data
temp_dir = tempfile.mkdtemp()

# Create first JSON file
json_data_1 = {
    "images": [
        {
            "id": 1,
            "file_name": "cable_001/L01_image_0001.jpg"
        },
        {
            "id": 2,
            "file_name": "cable_001/L02_image_0002.jpg"
        }
    ],
    "annotations": [
        {
            "id": 1,
            "image_id": 1,
            "category_id": 1,
            "area": 150.5,
            "bbox": [10.0, 20.0, 30.0, 40.0],
            "attributes": {
                "rotation": 45.0,
                "anomaly_id": "anom_001",
                "gradation": "high"
            }
        },
        {
            "id": 2,
            "image_id": 2,
            "category_id": 2,
            "area": 200.0,
            "bbox": [5.0, 15.0, 50.0, 60.0],
            "attributes": {
                "rotation": 30.0,
                "anomaly_id": "anom_002",
                "gradation": "medium"
            }
        }
    ],
    "categories": [
        {"id": 1, "name": "crack"},
        {"id": 2, "name": "corrosion"}
    ]
}

# Create second JSON file
json_data_2 = {
    "images": [
        {
            "id": 3,
            "file_name": "cable_002/R03_image_0003.jpg"
        }
    ],
    "annotations": [
        {
            "id": 3,
            "image_id": 3,
            "category_id": 1,
            "area": 175.0,
            "bbox": [12.0, 22.0, 35.0, 45.0],
            "attributes": {
                "rotation": 60.0,
                "anomaly_id": "anom_003",
                "gradation": "low"
            }
        }
    ],
    "categories": [
        {"id": 1, "name": "crack"},
        {"id": 2, "name": "corrosion"}
    ]
}

# Write JSON files
json_file_1 = os.path.join(temp_dir, "annotations_1.json")
json_file_2 = os.path.join(temp_dir, "annotations_2.json")

with open(json_file_1, 'w') as f:
    json.dump(json_data_1, f)

with open(json_file_2, 'w') as f:
    json.dump(json_data_2, f)

ARGS = {
    "json_files": [json_file_1, json_file_2]
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DataFrame — a DataFrame output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataFrame output the recorded ndim 2 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
build_labels_dataframe_from_data_rows Ran
ran; our contract draft was wrong, not the code
mila-iqia/cableinspect-ad-code/dataset/generate_labels.py
code served (permissive licence) · get_code("0fcc22a29c7ed53f")
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 DataFrame. 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
from pandas import DataFrame

# Construct sample data_rows with all required columns
# Each row should have 15 elements corresponding to the 15 column names
data_rows = [
    [
        '/path/to/image1.jpg',           # image_path
        'cable_001',                      # cable_id
        'left',                           # side_id
        'pass_01',                        # pass_id
        'frame_001',                      # frame_id
        1.0,                              # anomaly_type_id
        'crack',                          # anomaly_type
        150.5,                            # bbox_area
        10.0,                             # bbox_x
        20.0,                             # bbox_y
        15.0,                             # bbox_width
        10.0,                             # bbox_height
        0.5,                              # bbox_rotation
        'anomaly_001',                    # anomaly_id
        'high'                            # anomaly_grade
    ],
    [
        '/path/to/image2.jpg',
        'cable_002',
        'right',
        'pass_02',
        'frame_002',
        2.0,
        'corrosion',
        200.3,
        25.0,
        30.0,
        20.0,
        10.0,
        1.2,
        'nan',
        'low'
    ]
]

ARGS = {
    'data_rows': data_rows
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DataFrame — a DataFrame output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataFrame output the recorded ndim 2 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
check_df_cable_side_pass Ran
ran; our contract draft was wrong, not the code
mila-iqia/cableinspect-ad-code/dataset/utils.py
code served (permissive licence) · get_code("4b46ad44d8b56051")
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 pandas as pd
import numpy as np

# Create a simple valid DataFrame with consistent cable_id and side_id
df_valid = pd.DataFrame({
    'cable_id': [1, 1, 1],
    'side_id': ['A', 'A', 'A']
})

ARGS = {
    'cbl_side_labels': df_valid
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pandas — 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
compute_metrics Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
mila-iqia/cableinspect-ad-code/src/anomaly_detector/evaluation_utils.py
code served (permissive licence) · get_code("753b40afacd6ec68")
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 dict. 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 pandas as pd
import numpy as np

# Create sample binary classification data
np.random.seed(0)
n_samples = 20

# Create true labels (binary: 0 or 1)
y_true_data = np.random.randint(0, 2, n_samples)
y_true = pd.Series(y_true_data, name='y_true')

# Create predictions (binary: 0 or 1)
y_pred_data = np.random.randint(0, 2, n_samples)
y_pred = pd.Series(y_pred_data, name='y_pred')

# Define metric names to compute
metric_names = ['accuracy', 'precision', 'recall', 'f1_score', 'fpr']

# Construct the ARGS dict
ARGS = {
    'y_true': y_true,
    'y_pred': y_pred,
    'metric_names': metric_names
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pandas, sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
crop_image Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
mila-iqia/cableinspect-ad-code/dataset/raw_to_cropped_dataset.py
code served (permissive licence) · get_code("d7f4146dfedb7f98")
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

# Create a valid image with RGB channels
# Shape: (height, width, 3) for RGB
# We need a cable in the middle with green background on sides
height = 100
width = 80
image = np.zeros((height, width, 3), dtype=np.uint8)

# Create green background (high green, low red/blue)
image[:, :, 1] = 200  # Green channel high

# Create a cable region in the middle (low green, higher red/blue)
cable_start_col = 20
cable_end_col = 60
image[:, cable_start_col:cable_end_col, 0] = 100  # Red
image[:, cable_start_col:cable_end_col, 1] = 50   # Green (lower)
image[:, cable_start_col:cable_end_col, 2] = 100  # Blue

# Create a cable region in the middle rows (not at top/bottom)
cable_start_row = 25
cable_end_row = 75
image[cable_start_row:cable_end_row, cable_start_col:cable_end_col, 0] = 100
image[cable_start_row:cable_end_row, cable_start_col:cable_end_col, 1] = 30
image[cable_start_row:cable_end_row, cable_start_col:cable_end_col, 2] = 100

# Image config with required parameters
img_cfg = {
    'final_height': 50,
    'final_width': 60,
    'height_margin': 5,
    'window_size': 10,
    'threshold': 2,
}

ARGS = {
    'image': image,
    'img_cfg': img_cfg,
}
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 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
extract_metrics Ran
ran; our contract draft was wrong, not the code
mila-iqia/cableinspect-ad-code/src/anomaly_detector/evaluation_utils.py
code served (permissive licence) · get_code("a8e594894de43df9")
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 dict. 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 pandas as pd
from pathlib import Path
import tempfile
import os

# Create a temporary CSV file with sample data
temp_dir = tempfile.mkdtemp()
csv_path = Path(temp_dir) / "results.csv"

# Create sample data with the required columns
data = {
    'object_category': ['cat', 'cat', 'dog', 'dog', 'cat', 'dog'],
    'label_targets': [0, 1, 1, 0, 1, 1],
    'label_preds': [0, 1, 1, 0, 0, 1]
}
df = pd.DataFrame(data)
df.to_csv(csv_path, index=False)

ARGS = {
    'result_path': csv_path,
    'groupby_feats': ['object_category'],
    'metric_names': ['accuracy', 'precision', 'recall', 'f1_score', 'fpr']
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas, sklearn — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
flatten_dict Ran
ran; our contract draft was wrong, not the code
mila-iqia/cableinspect-ad-code/src/enhanced-patchcore/post_processing/post_processing_unsupervised_results.py
code served (permissive licence) · get_code("94bd9041d52daa8d")
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 dict. 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
import pandas as pd
from collections.abc import MutableMapping

# Create a nested dictionary to flatten
nested_dict = {
    'level1': {
        'level2a': {
            'value1': 10,
            'value2': 20
        },
        'level2b': {
            'value3': 30
        }
    },
    'toplevel': 'direct_value'
}

ARGS = {
    'd': nested_dict,
    'sep': '.'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pandas, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict 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
get_anomaly_ids Ran
ran; our contract draft was wrong, not the code
mila-iqia/cableinspect-ad-code/dataset/utils.py
code served (permissive licence) · get_code("6b425c3917a99747")
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 set. 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 pandas as pd
import numpy as np

# Create a sample DataFrame for cbl_side_abnormal_img_labels
# Must have 'cable_id', 'side_id', and 'anomaly_id' columns
cbl_side_abnormal_img_labels = pd.DataFrame({
    'cable_id': ['C01', 'C01', 'C01', 'C01', 'C01'],
    'side_id': ['A', 'A', 'A', 'A', 'A'],
    'anomaly_id': ['001_00', '002_00', '003_00', '004_00', '005_00']
})

# connected_anomalies: list of sets/lists showing which anomalies are connected
connected_anomalies = [
    {'001_00', '002_00'},  # anomalies 001_00 and 002_00 are connected
    {'004_00'}             # anomaly 004_00 is standalone
]

# split_ratio: float between 0 and 1
split_ratio = 0.6

# old_selected_anomalies: set of anomaly IDs already selected
old_selected_anomalies = set()

# kfold: boolean flag
kfold = False

# train_anomaly_id: set of anomaly IDs in training set (used when kfold=True)
train_anomaly_id = None

ARGS = {
    'cbl_side_abnormal_img_labels': cbl_side_abnormal_img_labels,
    'connected_anomalies': connected_anomalies,
    'split_ratio': split_ratio,
    'old_selected_anomalies': old_selected_anomalies,
    'kfold': kfold,
    'train_anomaly_id': train_anomaly_id
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type set — a set output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a set 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
get_border Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
mila-iqia/cableinspect-ad-code/dataset/raw_to_cropped_dataset.py
code served (permissive licence) · get_code("6e8bda85f761c8f1")
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 numpy as np

# Create a sample RGB image where:
# - Background is greenish (high green values)
# - Cable regions have lower green relative to red/blue
# Image shape: (height, width, 3) for RGB channels

height = 20
width = 30
image = np.zeros((height, width, 3), dtype=np.uint8)

# Fill with greenish background (high green channel)
image[:, :, 1] = 200  # Green channel high

# Create cable region at top (lower green, higher red/blue)
image[0:5, :, 0] = 100  # Red channel
image[0:5, :, 1] = 50   # Green channel low
image[0:5, :, 2] = 100  # Blue channel

# Create cable region at bottom (lower green, higher red/blue)
image[15:20, :, 0] = 100  # Red channel
image[15:20, :, 1] = 50   # Green channel low
image[15:20, :, 2] = 100  # Blue channel

idx_k = 5  # Window size for inspecting color intensity
g_threshold = 1  # Threshold multiplier for green vs red+blue
is_top = True  # Find top border

ARGS = {
    "image": image,
    "idx_k": idx_k,
    "g_threshold": g_threshold,
    "is_top": is_top,
}
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 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
identify_connected_anomalies Ran
ran; our contract draft was wrong, not the code
mila-iqia/cableinspect-ad-code/dataset/utils.py
code served (permissive licence) · get_code("922b7ffc50bacd31")
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 pandas as pd
import networkx
from itertools import combinations

# Create a minimal valid DataFrame for testing
# The function expects columns: 'cable_id', 'side_id', 'image_path', 'anomaly_id'

data = {
    'cable_id': [1, 1, 1, 1, 1, 1],
    'side_id': ['A', 'A', 'A', 'A', 'A', 'A'],
    'image_path': ['img_1.jpg', 'img_1.jpg', 'img_2.jpg', 'img_2.jpg', 'img_3.jpg', 'img_3.jpg'],
    'anomaly_id': [101, 102, 102, 103, 103, 104]
}

cbl_side_abnormal_img_labels = pd.DataFrame(data)

ARGS = {
    'cbl_side_abnormal_img_labels': cbl_side_abnormal_img_labels
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
networkx, pandas — 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
read_prompt_from_yaml Ran
ran; our contract draft was wrong, not the code
mila-iqia/cableinspect-ad-code/src/anomaly_detector/base_anomaly_detector_inference.py
code served (permissive licence) · get_code("416586b364c17784")
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.

from pathlib import Path
import yaml
import tempfile
import os

# Create a temporary YAML file with prompt data
temp_dir = tempfile.mkdtemp()
yaml_file_path = Path(temp_dir) / "prompts.yaml"

# Create sample YAML content with multiple prompt types
yaml_content = {
    "simple_prompt": "This is a simple prompt for testing.",
    "complex_prompt": "This is a more complex prompt with multiple lines.\nIt contains detailed instructions.",
    "summarization": "Summarize the following text in one sentence.",
}

# Write the YAML file
with open(yaml_file_path, 'w') as f:
    yaml.dump(yaml_content, f)

# Define the arguments dictionary
ARGS = {
    "yaml_file": yaml_file_path,
    "prompt_type": "simple_prompt",
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
yaml — 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
read_result_csv Ran
ran, honoured the contract we drafted
mila-iqia/cableinspect-ad-code/src/anomaly_detector/evaluation_utils.py
code served (permissive licence) · get_code("704fc42c8390c49f")
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 DataFrame. 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 tempfile
import pandas as pd
from pathlib import Path

# Create a temporary CSV file with sample data
with tempfile.NamedTemporaryFile(mode='w', suffix='.csv', delete=False) as f:
    temp_csv_path = f.name
    f.write("col1,col2,col3\n")
    f.write("1,2,3\n")
    f.write("4,5,6\n")
    f.write("7,8,9\n")

result_path = Path(temp_csv_path)

ARGS = {
    "result_path": result_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DataFrame — a DataFrame output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataFrame output the recorded ndim 2 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
remove_broken_runs Ran
ran; our contract draft was wrong, not the code
mila-iqia/cableinspect-ad-code/src/enhanced-patchcore/post_processing/post_processing_unsupervised_results.py
code served (permissive licence) · get_code("d731e161ae42ec44")
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.

# Setup code for remove_broken_runs function

# This function takes two lists and removes filenames containing broken run identifiers
# It uses list operations: iteration, membership checking (in), and remove()

ARGS = {
    "metrics_fnames": [
        "run_001_metrics.csv",
        "run_002_metrics.csv",
        "run_003_metrics.csv",
        "run_004_backup_metrics.csv",
        "run_005_metrics.csv",
    ],
    "broken_runs": [
        "run_002",
        "run_004",
    ],
}
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
update_multi_gpu_training_config Ran
ran; our contract draft was wrong, not the code
mila-iqia/cableinspect-ad-code/src/enhanced-patchcore/src/anomalib/config/config.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from sukanyapatra1997/ulsad-2024, is pointer only (licence: NONE) · get_code("6d3c92b52fa4d6da")
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 sukanyapatra1997/ulsad-2024, 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.

update_nncf_config Ran
ran; our contract draft was wrong, not the code
mila-iqia/cableinspect-ad-code/src/enhanced-patchcore/src/anomalib/config/config.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from sukanyapatra1997/ulsad-2024, is pointer only (licence: NONE) · get_code("5179dd442c5dbf8b")
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 sukanyapatra1997/ulsad-2024, 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.

read_image Not yet run
unverified (harvested, no recorded run)
mila-iqia/cableinspect-ad-code/dataset/raw_to_cropped_dataset.py
code served (permissive licence) · get_code("3a9a6499b8b37aad")
How it ran

no invocation recorded.

Also present in other papers' code

Of 22 samples lifted from this paper's linked repositories, 22 carry a function identity and 0 do not. Of the 22 distinct functions with an identity, 5 are also present in other papers whose code we hold (5 with at least one paper dated earlier, 0 the same month, 5 later) and 17 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
add_anomalous_label 2 other papers
1 dated earlier, 1 later
2307.10792 (2023-07)
Optimizing PatchCore for Few/many-shot Anomaly Detection
2410.16255 (2024-10)
Revisiting Deep Feature Reconstruction for Logical and Structural Industrial Anomaly Detection
add_label 2 other papers
1 dated earlier, 1 later
2307.10792 (2023-07)
Optimizing PatchCore for Few/many-shot Anomaly Detection
2410.16255 (2024-10)
Revisiting Deep Feature Reconstruction for Logical and Structural Industrial Anomaly Detection
add_normal_label 2 other papers
1 dated earlier, 1 later
2307.10792 (2023-07)
Optimizing PatchCore for Few/many-shot Anomaly Detection
2410.16255 (2024-10)
Revisiting Deep Feature Reconstruction for Logical and Structural Industrial Anomaly Detection
update_multi_gpu_training_config 2 other papers
1 dated earlier, 1 later
2307.10792 (2023-07)
Optimizing PatchCore for Few/many-shot Anomaly Detection
2410.16255 (2024-10)
Revisiting Deep Feature Reconstruction for Logical and Structural Industrial Anomaly Detection
update_nncf_config 2 other papers
1 dated earlier, 1 later
2307.10792 (2023-07)
Optimizing PatchCore for Few/many-shot Anomaly Detection
2410.16255 (2024-10)
Revisiting Deep Feature Reconstruction for Logical and Structural Industrial Anomaly Detection

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

Machine learning models are increasingly being deployed in real-world contexts. However, systematic studies on their transferability to specific and critical applications are underrepresented in the research literature. An important example is visual anomaly detection (VAD) for robotic power line inspection. While existing VAD methods perform well in controlled environments, real-world scenarios present diverse and unexpected anomalies that current datasets fail to capture. To address this gap, we introduce CableInspect-AD, a high-quality, publicly available dataset created and annotated by domain experts from Hydro-Québec, a Canadian public utility. This dataset includes high-resolution images with challenging real-world anomalies, covering defects with varying severity levels. To address the challenges of collecting diverse anomalous and nominal examples for setting a detection threshold, we propose an enhancement to the celebrated PatchCore algorithm. This enhancement enables its use in scenarios with limited labeled data. We also present a comprehensive evaluation protocol based on cross-validation to assess models' performances. We evaluate our Enhanced-PatchCore for few-shot and many-shot detection, and Vision-Language Models for zero-shot detection. While promising, these models struggle to detect all anomalies, highlighting the dataset's value as a challenging benchmark for the broader research community.

For agents

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

get_harvested_code_for_paper("2409.20353")
get_code_for_paper("2409.20353")
have("2409.20353")

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

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

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

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

Connect an agent — have() is free.