界面已本地化;技能介绍与说明文档按所选语言由 AI 自动翻译,代码、命令、路径和专业术语保留原文,以原作者文档为准。
探索技能
效率与协作 · SKILL.md

training

training

【效率与协作】Guides Mask_RCNN training, fine-tuning, weights, checkpoints, layer selection, schedules, callbacks, and backend constraints.

独立 GitHub 快照 · 自动分类 · 以原作者文档为准

技能说明

GitHub

name: training description: "Guides Mask_RCNN training, fine-tuning, weights, checkpoints, layer selection, schedules, callbacks, and backend constraints." disable-model-invocation: true metadata: disco-role: operating license: NOASSERTION

Training and Fine-tuning

Use this sub-skill when a task asks to train, fine-tune, resume, configure, or troubleshoot Matterport Mask_RCNN training on COCO, Balloon/VIA, Nucleus, Shapes, or a custom instance segmentation dataset.

Read first by need

Training workflow

  1. Prepare training and validation datasets with data-preparation. Both datasets must be loaded and prepare() must be called.

  2. Define a training Config with the correct NUM_CLASSES, image sizes, STEPS_PER_EPOCH, VALIDATION_STEPS, and memory-aware GPU_COUNT/IMAGES_PER_GPU.

  3. Build the model:

    from mrcnn import model as modellib
    model = modellib.MaskRCNN(mode="training", config=config, model_dir="logs")
    
  4. Load initial weights. For COCO-to-custom transfer, exclude class-specific heads.

  5. Train heads first, then optionally deeper ResNet/FPN layers:

    model.train(dataset_train, dataset_val,
                learning_rate=config.LEARNING_RATE,
                epochs=30,
                layers="heads")
    model.train(dataset_train, dataset_val,
                learning_rate=config.LEARNING_RATE / 10,
                epochs=60,
                layers="all")
    
  6. Validate by building an inference config and routing detection/evaluation to inference-evaluation.

Decision points

  • New class count? Set NUM_CLASSES = 1 + foreground_count and exclude final heads when loading COCO weights.
  • Small dataset? Start with layers="heads"; use augmentation carefully; freeze batch norm unless you have large batches.
  • CPU-only? Treat training as a code/data smoke test, not a practical run.
  • Multi-GPU? Verify exact TensorFlow/CUDA/Keras compatibility before using GPU_COUNT > 1.
  • No original sample script? Use the bundled training template and references; this skill is self-contained.
我的收藏