SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2008.00334 · 2020

Uncertainty-based Traffic Accident Anticipation with Spatio-Temporal Relational Learning

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 7 have no contract verdict; 0 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/2008.00334.json · badge: /api/ran/2008.00334.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
Cogito2012/UString canonical (classifier label)
classifier basis: census
8 ran · 2 no recorded run
FunctionStatusWhere it lives
compute_graph_edge_weights Ran
ran on a synthesized input
Cogito2012/UString/src/DataLoader.py
code served (permissive licence) · get_code("1f2bee452d766f67")
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 1, dtype family float, shape (171,) 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

# For a complete graph of 19 nodes, the number of edges is 19 * 18 / 2 = 171
N = 19
num_edges = N * (N - 1) // 2

# Create boxes: shape (19, 4)
# Each box is [x1, y1, x2, y2] where (x1, y1) is top-left and (x2, y2) is bottom-right
boxes = np.random.rand(19, 4).astype(np.float32) * 100
# Ensure x1 < x2 and y1 < y2
boxes[:, 2] = boxes[:, 0] + np.random.rand(19).astype(np.float32) * 50
boxes[:, 3] = boxes[:, 1] + np.random.rand(19).astype(np.float32) * 50

# Create edges: shape (171, 2)
# Generate all pairs of nodes (complete graph)
edges = []
for i in range(N):
    for j in range(i + 1, N):
        edges.append([i, j])
edges = np.array(edges, dtype=np.int64)

ARGS = {
    "boxes": boxes,
    "edges": edges,
}
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 1, dtype family float, shape (171,) — shape (171,) 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
generate_graph_from_list Ran
ran on a synthesized input
Cogito2012/UString/src/DataLoader.py
code served (permissive licence) · get_code("17771c96b9488ae3")
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 int; 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 networkx
import itertools

def generate_graph_from_list(L, create_using=None):
    G = networkx.empty_graph(len(L), create_using)
    if len(L) > 1:
        if G.is_directed():
            edges = itertools.permutations(L, 2)
        else:
            edges = itertools.combinations(L, 2)
        G.add_edges_from(edges)
    graph_edges = list(G.edges())
    return graph_edges

# Construct valid arguments
ARGS = {
    "L": [0, 1, 2, 3],
    "create_using": None
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
networkx — 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 int — 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
generate_st_graph Ran
ran on a synthesized input
Cogito2012/UString/src/DataLoader.py
code served (permissive licence) · get_code("214b0b5552c42efd")
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 networkx

# Create a small detections array
# Shape: (num_frames, num_boxes, features)
# We need at least 4 features for the boxes (x1, y1, x2, y2)
# Let's use 2 frames and 3 boxes
num_frames = 2
num_boxes = 3
num_features = 4  # x1, y1, x2, y2

detections = np.random.rand(num_frames, num_boxes, num_features).astype(np.float32)

# Scale box coordinates to be reasonable (0-100 range)
detections[:, :, :4] = detections[:, :, :4] * 100

# Ensure x1 < x2 and y1 < y2
for i in range(num_frames):
    for j in range(num_boxes):
        x1, y1, x2, y2 = detections[i, j, :4]
        detections[i, j, 0] = min(x1, x2)
        detections[i, j, 1] = min(y1, y2)
        detections[i, j, 2] = max(x1, x2)
        detections[i, j, 3] = max(y1, y2)

ARGS = {
    "detections": detections
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
networkx, 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
get_boxes Ran
ran on a synthesized input
Cogito2012/UString/script/extract_res101_dad.py
code served (permissive licence) · get_code("bdd64a977afd9b6c")
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 (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

# Set up arguments for get_boxes function
# The function expects:
# - dets_all: array-like of detections with bboxes (each row has at least 4 elements: x1, y1, x2, y2)
# - im_size: tuple/list with (height, width) of image

# Create sample detection array with a few bounding boxes
# Each row: [x1, y1, x2, y2, ...other_info]
dets_all = np.array([
    [10, 20, 100, 150, 0.95],      # valid bbox
    [5, 5, 50, 60, 0.87],           # valid bbox
    [200, 200, 201, 201, 0.5],      # too small (h=2, w=2, filtered out)
    [-5, -5, 30, 40, 0.78],         # bbox with negative coords (will be clipped)
    [0, 0, 5, 5, 0.6],              # very small bbox (h=6, w=6, valid)
], dtype=np.float32)

# Image size as (height, width)
im_size = (300, 400)

ARGS = {
    "dets_all": dets_all,
    "im_size": im_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 2, dtype family int, shape (4, 4) — shape (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
get_video_frames Ran
ran on a synthesized input
Cogito2012/UString/script/extract_res101_dad.py
code served (permissive licence) · get_code("4c512b058c37afb2")
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 4, dtype family int; 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
import cv2
import numpy as np

# Create a temporary video file with exactly 100 frames
temp_dir = tempfile.mkdtemp()
video_file = os.path.join(temp_dir, "test_video.mp4")

# Create a video with 100 frames using cv2
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
frame_width = 640
frame_height = 480
fps = 30.0

out = cv2.VideoWriter(video_file, fourcc, fps, (frame_width, frame_height))

# Write 100 frames to the video
for i in range(100):
    frame = np.random.randint(0, 255, (frame_height, frame_width, 3), dtype=np.uint8)
    out.write(frame)

out.release()

ARGS = {
    "video_file": video_file,
    "n_frames": 100
}
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 list, ndim 4, dtype family int — 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_video_frames Ran
ran on a synthesized input
Cogito2012/UString/script/vis_crash_det.py
code served (permissive licence) · get_code("8cf8cc5c870f5866")
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 4, dtype family int; 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 cv2
import numpy as np
import tempfile

# Create a temporary video file for testing
def create_test_video(filepath, num_frames=60, width=320, height=240):
    """Create a simple test video file with dummy frames."""
    fourcc = cv2.VideoWriter_fourcc(*'mp4v')
    out = cv2.VideoWriter(filepath, fourcc, 30.0, (width, height))
    
    for i in range(num_frames):
        # Create a simple frame with changing colors
        frame = np.zeros((height, width, 3), dtype=np.uint8)
        frame[:, :, 0] = (i * 4) % 256  # Blue channel
        frame[:, :, 1] = (i * 2) % 256  # Green channel
        frame[:, :, 2] = i % 256        # Red channel
        out.write(frame)
    
    out.release()

# Create a temporary video file
temp_dir = tempfile.gettempdir()
video_path = os.path.join(temp_dir, 'test_video.mp4')
create_test_video(video_path, num_frames=100)

ARGS = {
    'video_file': video_path,
    'n_frames': 50
}
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 list, ndim 4, dtype family int — 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
process Ran
ran on a synthesized input
Cogito2012/UString/script/split_dad.py
code served (permissive licence) · get_code("6242e10c800afddf")
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 numpy as np
import tempfile
import shutil

# Create temporary directories for testing
temp_base = tempfile.mkdtemp()
data_path = os.path.join(temp_base, "data")
dest_path = os.path.join(temp_base, "dest")
phase = "train"

os.makedirs(os.path.join(data_path, phase), exist_ok=True)
os.makedirs(dest_path, exist_ok=True)

# Create sample .npz files in the data directory
for file_idx in range(2):
    filename = f"batch_{file_idx}.npz"
    filepath = os.path.join(data_path, phase, filename)
    
    # Create sample data with matching shapes
    sample_data = {
        'data': np.random.randn(3, 128),  # 3 samples, 128 features
        'labels': np.array([0, 1, 0]),     # 3 labels
        'det': np.array([0.9, 0.8, 0.7]),  # 3 detection scores
        'ID': np.array([b'video_001', b'video_002', b'video_003'])  # 3 video IDs as bytes
    }
    
    np.savez(filepath, **sample_data)

ARGS = {
    'data_path': data_path,
    'dest_path': dest_path,
    'phase': phase
}
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 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
tuple_to_array Ran
ran, honoured the contract we drafted
Cogito2012/UString/src/utils.py
pointer only (licence: MIT); the stored copy get_code serves, from VGraphRNN/VGRNN, is pointer only (licence: NONE) · get_code("cb2d801625fc35f2")
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 VGraphRNN/VGRNN, 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.

bbox_to_imroi Not yet run
unverified (harvested, no recorded run)
Cogito2012/UString/script/extract_res101_dad.py
code served (permissive licence) · get_code("2027d64ab218fc74")
How it ran

no invocation recorded.

evaluation Not yet run
unverified (harvested, no recorded run)
Cogito2012/UString/src/eval_tools.py
code served (permissive licence) · get_code("491e614341f4f94d")
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, 1 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 9 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
tuple_to_array 2 other papers
1 dated earlier, 1 later
1908.09710 (2019-08)
Variational Graph Recurrent Neural Networks
2106.10197 (2021-06)
A Dynamic Spatial-temporal Attention Network for Early Anticipation of Traffic Accidents

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

Traffic accident anticipation aims to predict accidents from dashcam videos as early as possible, which is critical to safety-guaranteed self-driving systems. With cluttered traffic scenes and limited visual cues, it is of great challenge to predict how long there will be an accident from early observed frames. Most existing approaches are developed to learn features of accident-relevant agents for accident anticipation, while ignoring the features of their spatial and temporal relations. Besides, current deterministic deep neural networks could be overconfident in false predictions, leading to high risk of traffic accidents caused by self-driving systems. In this paper, we propose an uncertainty-based accident anticipation model with spatio-temporal relational learning. It sequentially predicts the probability of traffic accident occurrence with dashcam videos. Specifically, we propose to take advantage of graph convolution and recurrent networks for relational feature learning, and leverage Bayesian neural networks to address the intrinsic variability of latent relational representations. The derived uncertainty-based ranking loss is found to significantly boost model performance by improving the quality of relational features. In addition, we collect a new Car Crash Dataset (CCD) for traffic accident anticipation which contains environmental attributes and accident reasons annotations. Experimental results on both public and the newly-compiled datasets show state-of-the-art performance of our model. Our code and CCD dataset are available at https://github.com/Cogito2012/UString.

For agents

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

get_harvested_code_for_paper("2008.00334")
get_code_for_paper("2008.00334")
have("2008.00334")

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

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

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

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

Connect an agent — have() is free.