API Reference
This section provides comprehensive technical documentation for the render-tag core modules. Documentation is auto-generated from source code using mkdocstrings.
Fundamental data structures and Pydantic models used throughout the pipeline.
render_tag.core.schema.recipe
Rigid schema for render-tag Scene Recipes.
Following the "Move-Left" architecture, this schema defines exactly what a worker needs to render a single frame, with all random decisions resolved.
Classes
CameraIntrinsics
Bases: BaseModel
Camera intrinsic parameters (baked into final K-matrix).
Source code in src/render_tag/core/schema/recipe.py
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | |
CameraRecipe
Bases: BaseModel
Recipe for a camera pose and configuration.
Source code in src/render_tag/core/schema/recipe.py
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | |
LightRecipe
Bases: BaseModel
Specific light source configuration.
Source code in src/render_tag/core/schema/recipe.py
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | |
ObjectRecipe
Bases: BaseModel
Recipe for a single object in the scene.
Source code in src/render_tag/core/schema/recipe.py
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | |
SceneRecipe
Bases: BaseModel
Complete instruction set for a single generated scene.
Source code in src/render_tag/core/schema/recipe.py
231 232 233 234 235 236 237 238 239 240 241 | |
SensorDynamicsRecipe
Bases: BaseModel
Recipe for dynamic sensor artifacts (Motion Blur, Rolling Shutter).
Source code in src/render_tag/core/schema/recipe.py
63 64 65 66 67 68 69 70 | |
SensorNoiseComponent
Bases: BaseModel
Single noise layer in a stacked sensor-noise pipeline.
Source code in src/render_tag/core/schema/recipe.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | |
SensorNoiseConfig
Bases: BaseModel
Configuration for parametric sensor noise.
Backward-compatible: flat fields describe a single-model pipeline (legacy
shape). models opts into a stacked pipeline where each component is
applied in list order — real sensors stack shot + read + quantization
noise, and this field lets the schema express that honestly.
If both are present, models wins and the flat fields are ignored.
Source code in src/render_tag/core/schema/recipe.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | |
WorldRecipe
Bases: BaseModel
Resolved world environment configuration.
Source code in src/render_tag/core/schema/recipe.py
216 217 218 219 220 221 222 223 224 225 226 227 228 | |
render_tag.core.schema.job
Job specification and infrastructure schemas for render-tag.
Defines the JobSpec contract used to communicate between the CLI/Host and the rendering backend.
Classes
JobInfrastructure
Bases: BaseModel
Infrastructure settings for the job.
Source code in src/render_tag/core/schema/job.py
31 32 33 34 35 36 37 38 39 | |
JobPaths
Bases: BaseModel
Absolute paths for job execution.
Source code in src/render_tag/core/schema/job.py
21 22 23 24 25 26 27 28 | |
JobSpec
Bases: BaseModel
Immutable specification for a rendering job.
A JobSpec defines everything needed to execute a complex rendering task, including paths, infrastructure limits, and the scene configuration.
Attributes:
| Name | Type | Description |
|---|---|---|
version |
str
|
The schema version for migration tracking. |
job_id |
str
|
Unique identifier for the job. |
paths |
JobPaths
|
Absolute paths to output and asset locations. |
infrastructure |
JobInfrastructure
|
Resource limits (workers, memory). |
global_seed |
int
|
Master seed for all deterministic operations. |
scene_config |
GenConfig
|
The procedural generation parameters. |
Source code in src/render_tag/core/schema/job.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
Functions
from_file
classmethod
from_file(path: Path | str) -> JobSpec
Load and migrate JobSpec from a file (in-memory only).
Source code in src/render_tag/core/schema/job.py
108 109 110 111 112 113 114 | |
from_json
classmethod
from_json(json_str: str) -> JobSpec
Deserialize and migrate JobSpec from JSON.
Source code in src/render_tag/core/schema/job.py
102 103 104 105 106 | |
get_scene_indices
get_scene_indices(scenes_per_shard: int) -> list[int]
Get the deterministic list of scene indices for the current shard.
Source code in src/render_tag/core/schema/job.py
92 93 94 95 96 97 98 99 100 | |
get_total_shards
get_total_shards(scenes_per_shard: int) -> int
Calculate the total number of shards needed for this job.
Source code in src/render_tag/core/schema/job.py
87 88 89 90 | |
SeedManager
Manages deterministic seed generation hierarchy.
Source code in src/render_tag/core/schema/job.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | |
Functions
get_shard_seed
get_shard_seed(shard_index: int) -> int
Get a deterministic seed for a specific shard index.
Uses SHA256 hashing of (master_seed, shard_index) to produce a deterministic seed in O(1) time.
Source code in src/render_tag/core/schema/job.py
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | |
Functions
calculate_job_id
calculate_job_id(spec: JobSpec) -> str
Calculates a deterministic SHA256 hash for the given JobSpec.
Source code in src/render_tag/core/schema/job.py
150 151 152 153 154 155 156 157 158 159 160 161 | |
get_env_fingerprint
get_env_fingerprint(
root_dir: Path | None = None,
) -> tuple[str, str]
Returns a SHA256 hash of the uv.lock file and the BlenderProc version.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
root_dir
|
Path | None
|
The project root directory. Defaults to the current working directory. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[str, str]
|
A tuple of (env_hash, blender_version). |
Source code in src/render_tag/core/schema/job.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | |
render_tag.core.schema.subject
Classes
BoardSubjectConfig
Bases: BaseModel
Configuration for a single calibration board.
Attributes:
| Name | Type | Description |
|---|---|---|
type |
Literal['BOARD']
|
Discriminator for polymorphic schema. |
rows |
PositiveInt
|
Number of rows in the grid. |
cols |
PositiveInt
|
Number of columns in the grid. |
marker_size_mm |
PositiveFloat
|
Edge length of the markers in millimeters. |
dictionary |
str
|
Tag family used for markers. |
spacing_ratio |
PositiveFloat | None
|
Ratio of marker size to spacing (AprilGrid only). |
square_size_mm |
PositiveFloat | None
|
Total edge length of a grid cell (ChArUco only). |
Source code in src/render_tag/core/schema/subject.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
Functions
migrate_units
classmethod
migrate_units(data: Any) -> Any
Migrate meters to millimeters.
Source code in src/render_tag/core/schema/subject.py
98 99 100 101 102 103 104 105 106 107 108 109 | |
validate_board_constraints
validate_board_constraints() -> BoardSubjectConfig
Validate that square_size_mm is greater than marker_size_mm for ChArUco.
Source code in src/render_tag/core/schema/subject.py
111 112 113 114 115 116 | |
validate_dictionary
classmethod
validate_dictionary(v: str) -> str
Reject board dictionaries this environment cannot render.
Source code in src/render_tag/core/schema/subject.py
90 91 92 93 94 95 96 | |
SubjectConfig
Bases: RootModel
Root model for polymorphic subjects.
Source code in src/render_tag/core/schema/subject.py
120 121 122 123 | |
TagSubjectConfig
Bases: BaseModel
Configuration for a collection of flying tags.
Attributes:
| Name | Type | Description |
|---|---|---|
type |
Literal['TAGS']
|
Discriminator for polymorphic schema. |
tag_families |
list[str]
|
List of tag families to sample from. |
size_mm |
PositiveFloat
|
Edge length of the markers in millimeters. |
tags_per_scene |
int | tuple[int, int]
|
Number of markers to generate per scene. |
Source code in src/render_tag/core/schema/subject.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | |
Functions
migrate_units
classmethod
migrate_units(data: Any) -> Any
Migrate size_meters to size_mm.
Source code in src/render_tag/core/schema/subject.py
48 49 50 51 52 53 54 | |
validate_tag_families
classmethod
validate_tag_families(v: list[str]) -> list[str]
Reject tag families this environment cannot render.
Source code in src/render_tag/core/schema/subject.py
39 40 41 42 43 44 45 46 | |
render_tag.core.schema.board
Classes
BoardConfig
Bases: BaseModel
Configuration for a calibration board.
Keypoint Contract (Top-Left, Clockwise): All exported keypoints_3d arrays follow OpenCV 4.6+ standard. For each marker, the four corners are serialized in this exact index order:
Index 0: Top-Left (-X, +Y in Blender local / min-X, min-Y in image)
Index 1: Top-Right (+X, +Y in Blender local / max-X, min-Y in image)
Index 2: Bottom-Right (+X, -Y in Blender local / max-X, max-Y in image)
Index 3: Bottom-Left (-X, -Y in Blender local / min-X, max-Y in image)
The winding is strictly Clockwise in image-space (Y-down, OpenCV convention),
which corresponds to a positive Shoelace signed area. The pipeline MUST NOT
re-sort or apply convex-hull algorithms to projected corners; index 0 always
maps to Top-Left regardless of camera rotation.
Calibration points (saddle points / AprilGrid intersections) are serialized
left-to-right across each row, top-to-bottom (row 0 first), matching the
iterator order of both the texture synthesizer and the layout generator.
Source code in src/render_tag/core/schema/board.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | |
Functions
validate_board_constraints
validate_board_constraints() -> BoardConfig
Validate type-specific constraints for calibration boards.
Returns:
| Type | Description |
|---|---|
BoardConfig
|
The validated BoardConfig instance. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If square_size is missing for ChArUco, spacing_ratio is missing for AprilGrid, or if marker_size is not smaller than square_size for ChArUco. |
Source code in src/render_tag/core/schema/board.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | |
BoardDefinition
Bases: BaseModel
Output descriptor shipped in BOARD DetectionRecords.
Unlike BoardConfig (input configuration), this captures the resolved
physical parameters needed to instantiate cv2.aruco.CharucoBoard or
a Kalibr AprilGrid downstream without external config.
Source code in src/render_tag/core/schema/board.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |
Functions
validate_aprilgrid_spacing
validate_aprilgrid_spacing() -> BoardDefinition
Validate that AprilGrid definitions include spacing_ratio.
Source code in src/render_tag/core/schema/board.py
101 102 103 104 105 106 107 108 | |
Procedural mathematics and scene construction logic.
render_tag.generation.compiler
Deterministic Scene Compiler for render-tag.
Shifts all "decision-making" (random sampling, asset selection, pose calculation) from the Blender runtime to the pure-Python preparation phase.
Classes
SceneCompiler
Compiles a high-level JobSpec/GenConfig into a list of rigid SceneRecipes.
This class owns all randomness and ensures that the resulting recipes are purely execution-ready instructions for a "dumb" worker.
Attributes:
| Name | Type | Description |
|---|---|---|
config |
The generation configuration. |
|
global_seed |
Master seed for deterministic derivations. |
|
output_dir |
Path to storage for recipes and textures. |
|
asset_provider |
Resolver for textures and HDRI environments. |
|
strategy |
SubjectStrategy
|
Current subject rendering strategy (e.g., TagStrategy). |
Source code in src/render_tag/generation/compiler.py
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 | |
Functions
compile_scene
compile_scene(
scene_id: int, *, validate: bool = False
) -> SceneRecipe
Compile a single scene recipe with full determinism.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scene_id
|
int
|
The unique identifier for the scene. |
required |
validate
|
bool
|
When True, run |
False
|
Returns:
| Type | Description |
|---|---|
SceneRecipe
|
A fully resolved SceneRecipe with all randomness removed. |
Source code in src/render_tag/generation/compiler.py
326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 | |
compile_shards
compile_shards(
shard_index: int,
total_shards: int,
exclude_ids: set[int] | None = None,
*,
total_scenes: int | None = None,
validate: bool = False,
) -> list[SceneRecipe]
Compile a specific shard of scenes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
shard_index
|
int
|
The zero-based index of the current shard. |
required |
total_shards
|
int
|
The total number of shards the job is split into. |
required |
exclude_ids
|
set[int] | None
|
Optional set of scene IDs to skip. |
None
|
total_scenes
|
int | None
|
Total scenes across all shards. Defaults to
|
None
|
validate
|
bool
|
If True, each scene is built under the retry-on-invalid
loop (see |
False
|
Returns:
| Type | Description |
|---|---|
list[SceneRecipe]
|
A list of compiled SceneRecipe objects for this shard. |
Source code in src/render_tag/generation/compiler.py
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | |
save_recipe_json
save_recipe_json(
recipes: list[SceneRecipe],
filename: str = "scene_recipes.json",
) -> Path
Serialize a list of recipes to {output_dir}/{filename}.
Source code in src/render_tag/generation/compiler.py
381 382 383 384 385 386 387 388 389 390 391 | |
Functions
compute_overscan_intrinsics
compute_overscan_intrinsics(
k_target: list[list[float]],
resolution: tuple[int, int],
distortion_coeffs: list[float],
distortion_model: str = "brown_conrady",
n_samples: int = 32,
) -> tuple[list[list[float]], tuple[int, int]]
Compute the linear overscan K-matrix and resolution needed to cover all rays sampled by the distorted target image.
Samples the 4 edges of the target image at n_samples points each and applies iterative inverse distortion to find the maximum undistorted angular extent. The returned overscan K and resolution guarantee that Blender's linear render fully covers the field needed for the post-warp.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
k_target
|
list[list[float]]
|
3x3 target K-matrix [[fx,0,cx],[0,fy,cy],[0,0,1]]. |
required |
resolution
|
tuple[int, int]
|
(width, height) of the target distorted image. |
required |
distortion_coeffs
|
list[float]
|
Distortion coefficients for the model. |
required |
distortion_model
|
str
|
'brown_conrady' or 'kannala_brandt'. |
'brown_conrady'
|
n_samples
|
int
|
Number of sample points per edge. |
32
|
Returns:
| Type | Description |
|---|---|
(k_linear, (W_lin, H_lin))
|
Overscan K-matrix and pixel dimensions. |
Source code in src/render_tag/generation/compiler.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | |
compute_spherical_overscan_params
compute_spherical_overscan_params(
k_target: list[list[float]],
resolution: tuple[int, int],
distortion_coeffs: list[float],
margin_deg: float = 2.0,
n_samples: int = 32,
) -> tuple[float, tuple[int, int]]
Compute the FOV and square resolution for a Blender FISHEYE_EQUIDISTANT intermediate render.
In the equidistant model, pixel radius is proportional to incidence angle θ, which stays bounded for any physically realisable lens (unlike tan(θ) in the pinhole model). This makes it the correct intermediate representation for Kannala-Brandt fisheye lenses.
Samples the 4 edges of the target image, unprojects through the inverse Kannala-Brandt model to ideal normalised rays, converts to incidence angles θ = atan(‖ray‖), and adds a safety margin before computing render parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
k_target
|
list[list[float]]
|
3x3 target K-matrix [[fx,0,cx],[0,fy,cy],[0,0,1]]. |
required |
resolution
|
tuple[int, int]
|
(width, height) of the target distorted image. |
required |
distortion_coeffs
|
list[float]
|
Kannala-Brandt coefficients [k1, k2, k3, k4]. |
required |
margin_deg
|
float
|
Angular margin in degrees added beyond θ_max (default 2°). |
2.0
|
n_samples
|
int
|
Number of sample points per edge. |
32
|
Returns:
| Type | Description |
|---|---|
(fov_spherical, (R, R))
|
full FOV in radians and square render resolution. |
Source code in src/render_tag/generation/compiler.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 | |
derive_iso_coupled_noise
derive_iso_coupled_noise(
camera_config: CameraConfig,
) -> tuple[float, SensorNoiseConfig | None]
Derive effective (iso_noise, sensor_noise) from camera.iso.
Returns the user-configured values unchanged when iso_coupling is False.
When coupling is enabled, fills only fields the user left at their schema
defaults so explicit overrides always win.
Source code in src/render_tag/generation/compiler.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | |
Worker pool management, ZMQ communication, and parallel rendering.
render_tag.orchestration.orchestrator
Unified orchestration engine for render-tag.
Handles worker pool management, sharding, and parallel execution.
Classes
OrchestratorConfig
dataclass
Immutable configuration for the UnifiedWorkerOrchestrator.
Attributes:
| Name | Type | Description |
|---|---|---|
num_workers |
int
|
Number of parallel Blender processes to maintain. |
base_port |
int
|
Starting port for ZMQ communication. |
blender_script |
Path | None
|
Path to the worker bootstrap script. |
blender_executable |
str | None
|
Path to the Blender or BlenderProc binary. |
use_blenderproc |
bool
|
Whether to use the BlenderProc wrapper. |
mock |
bool
|
If True, uses mocks instead of a real Blender process. |
vram_threshold_mb |
float | None
|
VRAM limit for preventative worker restarts. |
ephemeral |
bool
|
If True, workers are optimized for short-lived jobs. |
max_renders_per_worker |
int | None
|
Restart worker after this many renders. |
worker_id_prefix |
str
|
Prefix for naming worker processes. |
seed |
int
|
Global random seed for deterministic generation. |
memory_limit_mb |
int | None
|
Soft RAM limit per worker process. |
Source code in src/render_tag/orchestration/orchestrator.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |
Functions
__post_init__
__post_init__()
Resolve defaults for blender_script and blender_executable.
Source code in src/render_tag/orchestration/orchestrator.py
89 90 91 92 93 94 95 96 97 | |
UnifiedWorkerOrchestrator
Manages a pool of persistent Blender workers.
Source code in src/render_tag/orchestration/orchestrator.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 | |
Functions
__enter__
__enter__()
Context manager entry: starts the orchestrator.
Source code in src/render_tag/orchestration/orchestrator.py
457 458 459 460 461 | |
__exit__
__exit__(et, ev, tb)
Context manager exit: stops the orchestrator.
Source code in src/render_tag/orchestration/orchestrator.py
463 464 465 | |
cleanup_all
classmethod
cleanup_all()
Stop all active orchestrator instances and their workers.
Source code in src/render_tag/orchestration/orchestrator.py
167 168 169 170 171 172 | |
execute_recipe
execute_recipe(
recipe: dict,
output_dir: Path,
rm: str = "cycles",
sid: str | None = None,
) -> Response
Execute a single render job on an available worker.
Handles retries for transient failures and resource exhaustion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recipe
|
dict
|
The JSON-serializable scene description. |
required |
output_dir
|
Path
|
Path where the rendered artifacts will be saved. |
required |
rm
|
str
|
Renderer mode ('cycles', 'eevee', 'workbench'). |
'cycles'
|
sid
|
str | None
|
Optional shard ID for the render task. |
None
|
Returns:
| Type | Description |
|---|---|
Response
|
The worker response containing status and metadata. |
Raises:
| Type | Description |
|---|---|
WorkerCommunicationError
|
If the render fails after all retries. |
Source code in src/render_tag/orchestration/orchestrator.py
389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 | |
get_worker
get_worker() -> PersistentWorkerProcess
Acquire an available worker from the queue (blocking).
Source code in src/render_tag/orchestration/orchestrator.py
285 286 287 | |
release_worker
release_worker(worker: PersistentWorkerProcess)
Return a worker to the pool, handling health checks and restarts.
If a worker has exceeded its render limit or resource threshold, it is restarted before being returned to the queue.
Source code in src/render_tag/orchestration/orchestrator.py
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 | |
start
start(shard_id: str = 'main')
Initialize the worker pool and start persistent processes.
Calculates memory budgets, verifies port availability, and launches workers in parallel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
shard_id
|
str
|
Optional identifier for the current work shard. |
'main'
|
Raises:
| Type | Description |
|---|---|
WorkerStartupError
|
If workers fail to initialize or contact the bridge. |
Source code in src/render_tag/orchestration/orchestrator.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 | |
stop
stop()
Shutdown all workers and release resources.
Source code in src/render_tag/orchestration/orchestrator.py
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | |
Functions
get_completed_scene_ids
get_completed_scene_ids(output_dir: Path) -> set[int]
Scan output directory for completed scene metadata files.
Source code in src/render_tag/orchestration/orchestrator.py
468 469 470 471 472 473 474 475 476 477 478 479 | |
orchestrate
orchestrate(
job_spec: JobSpec,
workers: int = 1,
executor_type: str = "local",
resume: bool = False,
batch_size: int = 5,
verbose: bool = False,
progress_cb: Callable[[int, int], None] | None = None,
) -> OrchestrationResult
Main orchestration loop for executing a JobSpec.
Handles sharding, resumption, and parallel execution of render tasks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
job_spec
|
JobSpec
|
Detailed specification of the rendering job. |
required |
workers
|
int
|
Number of parallel worker processes to spawn. |
1
|
executor_type
|
str
|
Infrastructure target ('local', 'cloud'). |
'local'
|
resume
|
bool
|
If True, skips already completed scenes. |
False
|
batch_size
|
int
|
Number of recipes per worker batch. |
5
|
verbose
|
bool
|
If True, enables debug logging. |
False
|
progress_cb
|
Callable[[int, int], None] | None
|
Optional callback(increment, total) for progress reporting. |
None
|
Returns:
| Type | Description |
|---|---|
OrchestrationResult
|
OrchestrationResult containing detailed execution metrics. |
Source code in src/render_tag/orchestration/orchestrator.py
629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 | |
resolve_shard_index
resolve_shard_index() -> int
Resolve the current shard index from cloud environment variables.
Source code in src/render_tag/orchestration/orchestrator.py
482 483 484 485 486 487 | |
render_tag.orchestration.worker
Worker process management for render-tag.
Classes
PersistentWorkerProcess
Lifecycle manager for a Blender subprocess with ZMQ IPC.
Source code in src/render_tag/orchestration/worker.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | |
Functions
stop
stop()
Shut down the worker process and its communication client.
Source code in src/render_tag/orchestration/worker.py
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | |
Functions
set_worker_priority
set_worker_priority()
Linux-specific: Set process priority for workers and ensure death with parent.
Source code in src/render_tag/orchestration/worker.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 | |
Dataset readers and writers for standard formats (COCO, CSV, Rich Truth).
render_tag.data_io.readers
Structured readers for render-tag datasets.
Provides Pydantic-validated ingestion of rich_truth.json with convenience
accessors for calibration workflows. The :class:CalibrationFrame class
yields matched 2D/3D point pairs ready for cv2.solvePnP or
cv2.calibrateCamera.
Attributes
Classes
CalibrationFrame
A single image's calibration data with matched 2D-3D point pairs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
board_record
|
DetectionRecord
|
The BOARD-type DetectionRecord for this image. |
required |
Source code in src/render_tag/data_io/readers.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
Attributes
board_definition
property
board_definition: BoardDefinition
The board geometry descriptor.
image_id
property
image_id: str
Image identifier (derived from the underlying record).
k_matrix
cached
property
k_matrix: ndarray
3x3 camera intrinsic matrix.
resolution
property
resolution: tuple[int, int]
(width, height) in pixels.
Functions
get_all_keypoints_with_visibility
get_all_keypoints_with_visibility() -> tuple[
np.ndarray, np.ndarray
]
Return all keypoints and a boolean visibility mask.
Returns:
| Type | Description |
|---|---|
ndarray
|
Tuple of |
ndarray
|
|
tuple[ndarray, ndarray]
|
|
Source code in src/render_tag/data_io/readers.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
get_valid_calibration_pairs
get_valid_calibration_pairs() -> tuple[
np.ndarray, np.ndarray, np.ndarray
]
Extract matched 2D image points and 3D object points, filtering sentinels.
Returns:
| Type | Description |
|---|---|
ndarray
|
Tuple of |
ndarray
|
|
ndarray
|
|
tuple[ndarray, ndarray, ndarray]
|
|
Source code in src/render_tag/data_io/readers.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | |
RenderTagDataset
Structured reader for rich_truth.json datasets.
Loads and validates all detection records through Pydantic, providing typed access to tags, boards, and calibration data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset_path
|
Path | str
|
Directory containing |
required |
Source code in src/render_tag/data_io/readers.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | |
Attributes
board_definition
property
board_definition: BoardDefinition | None
The board definition shared by all frames (from the first BOARD record).
image_ids
property
image_ids: list[str]
Unique image IDs in insertion order.
records
property
records: list[DetectionRecord]
All detection records in the dataset.
Functions
from_json
classmethod
from_json(path: Path | str) -> RenderTagDataset
Load from a specific rich_truth.json file path.
Handles backward compatibility: if loaded JSON has board_definition
nested inside metadata (old format), it is migrated to the top-level
field before validation.
Source code in src/render_tag/data_io/readers.py
142 143 144 145 146 147 148 149 150 151 152 153 154 155 | |
from_records
classmethod
from_records(
records: list[DetectionRecord],
) -> RenderTagDataset
Create from an existing list of DetectionRecords.
Source code in src/render_tag/data_io/readers.py
157 158 159 160 161 162 163 164 | |
get_board_record
get_board_record(image_id: str) -> DetectionRecord | None
The BOARD record for an image, or None.
Source code in src/render_tag/data_io/readers.py
180 181 182 183 184 185 | |
get_calibration_frame
get_calibration_frame(
image_id: str,
) -> CalibrationFrame | None
Return a CalibrationFrame for the given image, or None.
Source code in src/render_tag/data_io/readers.py
198 199 200 201 202 203 | |
get_records
get_records(image_id: str) -> list[DetectionRecord]
All records for a given image.
Source code in src/render_tag/data_io/readers.py
176 177 178 | |
get_tag_records
get_tag_records(image_id: str) -> list[DetectionRecord]
All TAG records for an image.
Source code in src/render_tag/data_io/readers.py
187 188 189 | |
iter_calibration_frames
iter_calibration_frames() -> Iterator[CalibrationFrame]
Yield a :class:CalibrationFrame for each image that has a BOARD record.
Source code in src/render_tag/data_io/readers.py
191 192 193 194 195 196 | |
Functions
unwrap_rich_truth
unwrap_rich_truth(raw: list | dict) -> list[dict]
Extract the records list from either format.
v1 (legacy): bare JSON array → returned as-is
v2+: {"version": "2.0", "records": [...], ...} → records extracted
Source code in src/render_tag/data_io/readers.py
219 220 221 222 223 224 225 226 227 | |
render_tag.data_io.writers
Data export writers for render-tag.
This module handles writing detection annotations in various formats: - CSV format for corner coordinates - COCO format for instance segmentation
Attributes
Classes
AtomicWriter
Mixin for atomic file writing using temp file + rename.
Source code in src/render_tag/data_io/writers.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
BoardConfigWriter
Writer for calibration board configuration.
Source code in src/render_tag/data_io/writers.py
473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 | |
Functions
__init__
__init__(output_dir: Path) -> None
Initialize the BoardConfig writer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_dir
|
Path
|
Root directory for dataset output. |
required |
Source code in src/render_tag/data_io/writers.py
476 477 478 479 480 481 482 | |
write_config
write_config(
board_config: BoardConfig,
filename: str = "board_config.json",
) -> Path
Save the board configuration to a JSON file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
board_config
|
BoardConfig
|
The BoardConfig instance to save. |
required |
filename
|
str
|
Name of the output JSON file. |
'board_config.json'
|
Returns:
| Type | Description |
|---|---|
Path
|
Path to the written file. |
Source code in src/render_tag/data_io/writers.py
484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 | |
COCOWriter
Bases: AtomicWriter
Writer for COCO format annotations.
Source code in src/render_tag/data_io/writers.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 | |
Functions
__init__
__init__(
output_dir: Path,
filename: str = "annotations.json",
eval_margin_px: int = 0,
) -> None
Initialize the COCO writer.
Source code in src/render_tag/data_io/writers.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |
add_annotation
add_annotation(
image_id: int,
category_id: int,
corners: list[tuple[float, float]],
width: int | None = None,
height: int | None = None,
detection: DetectionRecord | None = None,
) -> int
Add an annotation for a detected tag (optionally clipped).
Source code in src/render_tag/data_io/writers.py
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 | |
add_category
add_category(
name: str, supercategory: str = "fiducial_marker"
) -> int
Add a category and return its ID.
Source code in src/render_tag/data_io/writers.py
168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | |
add_image
add_image(file_name: str, width: int, height: int) -> int
Add an image entry and return its ID.
Source code in src/render_tag/data_io/writers.py
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | |
save
save(filename: str | None = None) -> Path
Save the COCO annotations to a JSON file.
Source code in src/render_tag/data_io/writers.py
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 | |
CSVWriter
Writes detection data to a CSV file.
Keeps the file handle open for the writer's lifetime to avoid per-row open/close overhead. Call close() or use as a context manager to flush.
Source code in src/render_tag/data_io/writers.py
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | |
Functions
__init__
__init__(output_path: Path) -> None
Initialize the CSV writer.
Source code in src/render_tag/data_io/writers.py
79 80 81 82 83 84 | |
close
close() -> None
Flush and close the underlying file handle.
Source code in src/render_tag/data_io/writers.py
123 124 125 126 127 128 | |
write_detection
write_detection(
detection: DetectionRecord,
width: int | None = None,
height: int | None = None,
) -> None
Write a single detection to the CSV file (optionally clipped).
Source code in src/render_tag/data_io/writers.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
write_detections
write_detections(detections: list[DetectionRecord]) -> None
Write multiple detections to the CSV file.
Source code in src/render_tag/data_io/writers.py
118 119 120 121 | |
ProvenanceWriter
Bases: AtomicWriter
Writer for a unified dataset provenance mapping (image_id -> SceneRecipe).
Source code in src/render_tag/data_io/writers.py
453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 | |
Functions
add_provenance
add_provenance(
image_id: str,
provenance: dict[str, Any] | SceneProvenance,
) -> None
Add provenance for a single image.
Source code in src/render_tag/data_io/writers.py
460 461 462 463 464 | |
save
save() -> Path
Save the unified provenance mapping to a JSON file.
Source code in src/render_tag/data_io/writers.py
466 467 468 469 470 | |
RichTruthWriter
Bases: AtomicWriter
Writer for structured JSON 'Data Product' containing all metadata.
Source code in src/render_tag/data_io/writers.py
390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 | |
Functions
add_detection
add_detection(detection: DetectionRecord) -> None
Add a detection record, computing per-point visibility flags.
Source code in src/render_tag/data_io/writers.py
402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 | |
save
save() -> Path
Save all detections wrapped in a versioned envelope.
The evaluation_context reflects the actual margin used for visibility tagging. When records carry their own eval_margin_px (per-record beats writer default), _effective_margin_px is kept up-to-date during add_detection() so this is O(1).
Source code in src/render_tag/data_io/writers.py
433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 | |
Functions
merge_all_shards
merge_all_shards(
output_dir: Path, cleanup: bool = True
) -> None
Merge every per-worker shard file in output_dir into its canonical name.
Source code in src/render_tag/data_io/writers.py
694 695 696 697 698 699 | |
merge_coco_shards
merge_coco_shards(
output_dir: Path,
final_filename: str = "coco_labels.json",
cleanup: bool = False,
)
Merge multiple COCO JSON shards into a single canonical file.
Source code in src/render_tag/data_io/writers.py
518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 | |
merge_csv_shards
merge_csv_shards(
output_dir: Path,
final_filename: str = "ground_truth.csv",
cleanup: bool = False,
)
Merge multiple CSV shards into a single canonical file.
Source code in src/render_tag/data_io/writers.py
572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 | |
merge_provenance_shards
merge_provenance_shards(
output_dir: Path,
final_filename: str = "provenance.json",
cleanup: bool = False,
)
Merge multiple provenance JSON shards into a single canonical file.
Source code in src/render_tag/data_io/writers.py
662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 | |
merge_rich_truth_shards
merge_rich_truth_shards(
output_dir: Path,
final_filename: str = "rich_truth.json",
cleanup: bool = False,
)
Merge multiple RichTruth JSON shards into a single canonical file.
Source code in src/render_tag/data_io/writers.py
616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 | |
Dataset quality verification and telemetry analysis.
render_tag.audit.auditor
Unified auditing and telemetry for render-tag.
Provides data ingestion, geometric/environmental auditing, quality gates, and worker telemetry analysis using Polars.
Classes
AuditDiff
Detects statistical drift between two audit reports.
Source code in src/render_tag/audit/auditor.py
512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 | |
AuditReport
Bases: BaseModel
Complete audit report for a dataset.
Source code in src/render_tag/audit/auditor.py
89 90 91 92 93 94 95 96 97 | |
AuditResult
Bases: BaseModel
Final result of an audit run, including gates.
Source code in src/render_tag/audit/auditor.py
117 118 119 120 121 122 123 | |
DatasetAuditor
Orchestrates the full audit of a dataset.
Coordinates geometric, environmental, and integrity checks to produce a comprehensive quality report and gate status.
Attributes:
| Name | Type | Description |
|---|---|---|
dataset_path |
Path to the dataset root. |
|
reader |
Helper for high-speed data ingestion. |
Source code in src/render_tag/audit/auditor.py
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 | |
Functions
__init__
__init__(dataset_path: Path) -> None
Initialize the DatasetAuditor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset_path
|
Path
|
Directory containing the images and metadata. |
required |
Source code in src/render_tag/audit/auditor.py
233 234 235 236 237 238 239 240 | |
run_audit
run_audit(
gate_config: QualityGateConfig | None = None,
) -> AuditResult
Execute all audit passes and evaluate quality gates.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gate_config
|
QualityGateConfig | None
|
Optional configuration for metric-based pass/fail gates. |
None
|
Returns:
| Type | Description |
|---|---|
AuditResult
|
An AuditResult containing the full report and gate status. |
Source code in src/render_tag/audit/auditor.py
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | |
DatasetReader
Handles high-speed ingestion of datasets.
Source code in src/render_tag/audit/auditor.py
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | |
Functions
load_raw_records
load_raw_records() -> tuple[
list[dict[str, Any]], dict[str, Any]
]
Load raw JSON records and the evaluation_context header.
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
(records, evaluation_context) where evaluation_context is an empty |
dict[str, Any]
|
dict for v1 (legacy bare-array) files. |
Source code in src/render_tag/audit/auditor.py
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | |
DictionaryOrientationError
Bases: ValueError
Raised when the texture payload is 180° out of phase with the 3D geometry.
The projected 3D TL anchor lands on annotated corners[2] (BR) instead of corners[0] (TL), which proves the UV mapping or index convention is inverted.
Source code in src/render_tag/audit/auditor.py
39 40 41 42 43 44 | |
DistributionStats
Bases: BaseModel
Statistical distribution summary.
Source code in src/render_tag/audit/auditor.py
50 51 52 53 54 55 56 57 | |
EnvironmentalAudit
Bases: BaseModel
Audit results for environmental variance.
Source code in src/render_tag/audit/auditor.py
70 71 72 73 74 | |
GateRule
Bases: BaseModel
A single rule for a quality gate.
Source code in src/render_tag/audit/auditor.py
100 101 102 103 104 105 106 107 108 | |
GeometricAudit
Bases: BaseModel
Audit results for geometric coverage.
Source code in src/render_tag/audit/auditor.py
60 61 62 63 64 65 66 67 | |
IntegrityAudit
Bases: BaseModel
Audit results for data integrity.
Source code in src/render_tag/audit/auditor.py
77 78 79 80 81 82 83 84 85 86 | |
QualityGateConfig
Bases: BaseModel
Configuration for quality gates.
Source code in src/render_tag/audit/auditor.py
111 112 113 114 | |
TelemetryAuditor
Collects and analyzes worker telemetry using Polars.
Source code in src/render_tag/audit/auditor.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
Functions
add_entry
add_entry(
worker_id: str,
telemetry: Telemetry,
event_type: str = "heartbeat",
)
Adds a telemetry record.
Source code in src/render_tag/audit/auditor.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 | |
analyze_throughput
analyze_throughput() -> dict[str, Any]
Calculates throughput statistics.
Source code in src/render_tag/audit/auditor.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
Functions
The 3D rendering driver that runs inside the Blender environment.
render_tag.backend.engine
Unified rendering engine for render-tag.
Combines the RenderFacade (Blender abstraction) and the execution loop into a single, high-performance module.
Classes
CyclesRenderStrategy
Configures the high-fidelity Cycles path tracer.
Source code in src/render_tag/backend/engine.py
81 82 83 84 85 | |
EeveeRenderStrategy
Configures the real-time Eevee engine.
Source code in src/render_tag/backend/engine.py
88 89 90 91 92 93 94 95 | |
RenderContext
dataclass
Groups all necessary state for executing a single render task.
Source code in src/render_tag/backend/engine.py
57 58 59 60 61 62 63 64 65 66 67 68 69 | |
RenderEngineStrategy
Bases: Protocol
Protocol for rendering engine configuration strategies.
Source code in src/render_tag/backend/engine.py
72 73 74 75 76 77 78 | |
Functions
configure
configure() -> None
Configure the Blender scene for this specific engine.
Source code in src/render_tag/backend/engine.py
76 77 78 | |
RenderFacade
High-level interface for rendering fiducial tag scenes.
Attributes:
| Name | Type | Description |
|---|---|---|
renderer_mode |
The rendering engine to use ('cycles', 'eevee', 'workbench'). |
|
logger |
Logger for tracking rendering progress. |
|
config |
Detailed configuration for the renderer. |
Source code in src/render_tag/backend/engine.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | |
Functions
__init__
__init__(
renderer_mode: str = "cycles",
logger: Logger | None = None,
config: RendererConfig | None = None,
)
Initialize the RenderFacade.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
renderer_mode
|
str
|
Name of the engine to use. |
'cycles'
|
logger
|
Logger | None
|
Optional pre-configured logger. |
None
|
config
|
RendererConfig | None
|
Optional renderer configuration presets. |
None
|
Source code in src/render_tag/backend/engine.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | |
render_camera
render_camera(
camera_recipe: CameraRecipe,
) -> dict[str, Any]
Configures a camera and renders the image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
camera_recipe
|
CameraRecipe
|
Resolved recipe containing pose, intrinsics, and sensor settings. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
A dictionary containing the 'img' (ndarray) and 'segmap' (metadata). |
Source code in src/render_tag/backend/engine.py
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 | |
reset_volatile_state
reset_volatile_state()
Clears objects from the scene but keeps heavy environment assets.
Source code in src/render_tag/backend/engine.py
184 185 186 187 | |
setup_world
setup_world(world_recipe: WorldRecipe)
Resolves world parameters and environment state.
Source code in src/render_tag/backend/engine.py
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | |
spawn_objects
spawn_objects(
object_recipes: list[ObjectRecipe],
) -> list[Any]
Creates subjects (tags, boards, etc.) using decoupled AssetBuilders.
This method implements Scene Graph Deduplication: if a BOARD with a composite texture is present, it suppresses the generation of individual TAG objects that would otherwise cause Z-fighting.
Source code in src/render_tag/backend/engine.py
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | |
WorkbenchRenderStrategy
Configures the fast Workbench engine for previews.
Source code in src/render_tag/backend/engine.py
98 99 100 101 102 | |
Functions
execute_recipe
execute_recipe(
recipe: SceneRecipe,
ctx: RenderContext,
seed: int | None = None,
) -> None
Execute a single scene recipe using the RenderContext.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
recipe
|
SceneRecipe
|
The fully resolved scene description. |
required |
ctx
|
RenderContext
|
Execution context (writers, output paths, etc.). |
required |
seed
|
int | None
|
Optional overrides for reproducibility. |
None
|
Source code in src/render_tag/backend/engine.py
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 | |
render_tag.backend.worker_server
Classes
ZmqBackendServer
ZeroMQ-based rendering server for Blender workers with Dual-Socket Architecture.
Source code in src/render_tag/backend/worker_server.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 | |
Functions
get_telemetry
get_telemetry() -> Telemetry
Returns current worker health and state metrics (Thread Safe).
Source code in src/render_tag/backend/worker_server.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | |
run
run(max_renders: int | None = None)
Starts the server loop.
Source code in src/render_tag/backend/worker_server.py
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 | |
stop
stop()
Stops the server loop and closes sockets.
Source code in src/render_tag/backend/worker_server.py
196 197 198 199 200 201 202 203 204 205 206 207 208 209 | |