parameters-random-and-utilities
Use when controlling imgaug stochastic parameters, seeds, deterministic replay, dtype conversion, sample data, grids, or utility helpers.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- parameters-random-and-utilities
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Use when controlling imgaug stochastic parameters, seeds, deterministic replay, dtype conversion, sample data, grids, or utility helpers.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/data-and-dtype-utilities.md2.3 KB
- 参考文档references/parameters-and-rng.md2.1 KB
- 参考文档references/troubleshooting.md1.8 KB
- 脚本scripts/smoke_parameters_and_data.py1.4 KB
03 SKILL.md 正文
Parameters, Randomness, and Utilities
Use this sub-skill when the task is about how imgaug samples augmentation parameters, controls reproducibility, handles dtype/range conversion, loads built-in example data, or uses utility functions such as resizing, grids, and display helpers.
What this sub-skill covers
- Parameter shortcuts: scalar values,
(a, b)tuples, lists, andimgaug.parameters.StochasticParameterobjects. - Distribution objects such as
Choice,Uniform,Normal, andClip. - Seeds,
RNG, deterministic replay, and deprecatedrandom_state/deterministicAPI warnings. - Dtype conversion, clipping, range checks, and compatibility with current NumPy.
- Sample quokka images and annotations from
imgaug.data. - Utility helpers: resize, draw grids, and headless-safe visualization alternatives.
What it does not cover
- Building high-level image pipelines belongs to
../augmentation-pipelines/SKILL.md. - Constructing keypoints, boxes, dense maps, and mixed batches belongs to
../augmentables-and-batches/SKILL.md. - Background/multicore execution belongs to
../multicore-and-diagnostics/SKILL.md.
Typical triggers
- “How do tuple parameters work in imgaug?”
- “Make this imgaug pipeline reproducible.”
- “Why does imgaug warn about
random_state?” - “Use the built-in quokka image as a tiny fixture.”
- “Fix dtype clipping or NumPy import errors.”
Fast path
- Read
references/parameters-and-rng.mdfor stochastic parameters and reproducibility. - Read
references/data-and-dtype-utilities.mdfor dtype helpers, resizing, grids, and sample data. - Run
scripts/smoke_parameters_and_data.pyto verify parameter sampling, quokka data, and dtype conversion. - Read
references/troubleshooting.mdfor NumPy 2, deprecations, dtype range, and display failures.
Core parameter pattern
Many augmenter parameters accept flexible forms:
import imgaug.augmenters as iaa
import imgaug.parameters as iap
# Shortcut for a uniform blur range.
blur = iaa.GaussianBlur(sigma=(0.0, 3.0))
# Explicit stochastic distribution clipped to a safe range.
param = iap.Clip(iap.Normal(1.0, 0.1), 0.1, 3.0)
blur2 = iaa.GaussianBlur(sigma=param)
Reproducibility pattern
Use a seed on an augmenter or convert a pipeline to deterministic form when the same sampled transform must be replayed.
seq = iaa.Sequential([iaa.Fliplr(0.5), iaa.Add((0, 5))], seed=1)
det = seq.to_deterministic()
out_a = det(images=images)
out_b = det(images=images)
For aligned images and annotations, a single call containing every augmentable remains the safest pattern.
Utility warning signs
AttributeErrorinvolvingnp.sctypes: installnumpy<2for imgaug 0.4.0.- Unexpected clipping or rounding: inspect dtype helpers and value ranges before conversion.
- Display failure on a server: avoid
ia.imshow; write grids to image files instead. - Deprecation warnings around
random_stateordeterministic: preferseed,RNG, andto_deterministic()patterns.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).