mmocr
Use MMOCR for OCR inference, dataset preparation, config-driven training/evaluation, model components, registries, and OpenMMLab OCR troubleshooting.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- mmocr
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Use MMOCR for OCR inference, dataset preparation, config-driven training/evaluation, model components, registries, and OpenMMLab OCR troubleshooting.
- disable-model-invocation
- true
02 资源文件 5
- 参考文档references/package-overview.md4.5 KB
- 参考文档references/repo-provenance.md2.3 KB
- 参考文档references/repo-routing-metadata.json312 B
- 参考文档references/troubleshooting.md4.3 KB
- 脚本scripts/check_mmocr_environment.py5.1 KB
03 SKILL.md 正文
MMOCR
Use this repo skill when a task involves OpenMMLab MMOCR: text detection, text recognition, OCR chains, text spotting, key information extraction (KIE), OCR datasets, config-driven training/evaluation, or MMOCR component extension.
Start here
- Read
references/package-overview.mdfor the package capability map, public install shape, backend expectations, and bundled helper summary. - Run
scripts/check_mmocr_environment.pywhen you need to verify imports, dependency versions, CUDA visibility, or optional config loading. - Use the route map below for workflow details.
- Read
references/troubleshooting.mdfor cross-cutting install/import/backend/download/headless-display failures. - Check
references/repo-provenance.mdbefore deciding whether this skill matches a newer checkout or package version.
Minimal public install and import check
MMOCR depends on PyTorch, MMEngine, MMCV, and MMDetection. The project recommends OpenMIM for OpenMMLab packages:
pip install -U openmim
mim install mmengine
mim install mmcv
mim install mmdet
mim install mmocr
Then verify the environment from any working directory:
python scripts/check_mmocr_environment.py
For config work, verify that the config loads and uses the MMOCR registry scope:
python scripts/check_mmocr_environment.py --config CONFIG --require-default-scope mmocr
A CPU import/config check is not proof of CUDA, distributed, or Slurm readiness. Require real backend checks before claiming those paths work.
Route map
| User asks for... | Read |
|---|---|
OCR inference over images/folders/arrays, MMOCRInferencer, task inferencers, saved predictions/visualizations, model aliases, KIE chains, or headless inference troubleshooting |
sub-skills/ocr-inference/SKILL.md |
| Config inspection, model-family selection, training/testing/evaluation command construction, work directories, checkpoints, AMP, TTA, distributed launch, or Slurm routing | sub-skills/training-evaluation-configs/SKILL.md |
| Dataset preparation, dataset_zoo-style metadata, textdet/textrecog/textspotting/KIE annotation formats, LMDB recognition data, or dataset-layout debugging | sub-skills/data-preparation/SKILL.md |
| Registries, DataSamples, transforms, model components, dictionaries, metrics, visualizers, custom modules, or OpenMMLab project extensions | sub-skills/model-api-components/SKILL.md |
Common decisions
- For image prediction, use
ocr-inference; for dataset evaluation against a checkpoint, usetraining-evaluation-configs. - For any train/test command, run the config smoke script first and confirm data/checkpoint availability before launching expensive work.
- For private datasets, start with
data-preparationand validate the annotation/task choice before editing training configs. - For registry or custom module errors, use
model-api-componentsbefore trying another long run. - For remote servers, prefer saved visualization files over GUI display.
- For pretrained aliases or dataset preparers, ask before using network downloads or shared caches.
Backend policy
- CPU is enough for import checks, config smoke, dataset metadata preflight, registry probes, and many troubleshooting tasks.
- CUDA/GPU is optional but required for honest accelerated inference/training/evaluation verification.
- Distributed/NCCL and Slurm are optional operational backends; do not infer them from CPU success.
- Long training, large evaluation, model downloads, dataset downloads, and scheduler jobs need explicit user approval.
Bundled helpers
scripts/check_mmocr_environment.py: root import/version/backend/config smoke.sub-skills/ocr-inference/scripts/mmocr_inference_smoke.py: inference preflight and opt-in execution helper.sub-skills/training-evaluation-configs/scripts/mmocr_config_smoke.py: config summary without training.sub-skills/data-preparation/scripts/mmocr_dataset_preflight.py: dataset metadata and tiny annotation checks.sub-skills/model-api-components/scripts/mmocr_component_registry_probe.py: registry, DataSample, and dictionary probe.
Non-goals
- This skill does not replace MMOCR's package installation or model weights.
- It does not bundle full training/evaluation launchers, pretrained checkpoints, datasets, or GUI assets.
- It does not claim CUDA, distributed, or Slurm readiness unless the caller verifies those backends in their runtime.
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).