You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Faster R-CNN Inception ResNet V2树种检测漏检调参咨询

问题:Faster R-CNN检测图像树种时大量漏检的参数调整方案

我正使用Faster R-CNN Inception ResNet V2 1024x1024模型对图像中的树种进行检测,遇到的问题是模型无法识别出图像中的全部树木。将first_stage_max_proposals参数设置为1500仅能带来轻微改善,调整grid_anchor_generator、max_detections_per_class、max_total_detections等参数也没有明显效果。

下方为模型配置文件,以及漏检示例图像:
漏检示例图

# Faster R-CNN with Inception Resnet v2 (no atrous)
# Sync-trained on COCO (with 8 GPUs) with batch size 16 (800x1333 resolution)
# Initialized from Imagenet classification checkpoint
# TF2-Compatible, *Not* TPU-Compatible
#
# Achieves 39.6 mAP on COCO

model {
  faster_rcnn {
    num_classes: 7
    image_resizer {
        fixed_shape_resizer {
    height: 867
    width: 867
  }
    }
    feature_extractor {
      type: 'faster_rcnn_inception_resnet_v2_keras'
    }
    first_stage_anchor_generator {
      grid_anchor_generator {
        scales:[0.1,0.4,0.45,0.5,0.6,0.7,0.8,0.90,1.0,
                1.2,1.25,1.3,1.35,1.4,1.45,1.5,1.6,1.8,1.90,1.95,2.0,
                2.2,2.25,2.3,2.35,2.4,2.45,2.5,2.6,2.8,2.90,2.95,3.0,
                3.2,3.25,3.3,3.35,3.4,3.45,3.5,3.6,3.8,3.90,3.95,4.0,
                4.2,4.25,4.3,4.35,4.4,4.45,4.5,4.6,4.8,4.90,4.95,5.0,
                5.2,5.25,5.3,5.35,5.4,5.45,5.5,5.6,5.8,5.90,5.95,6.0,
                6.2,6.25,6.3,6.35,6.4,6.45,6.5,6.6,6.8,6.90,6.95,7.0,
                7.2,7.25,7.3,7.35,7.4,7.45,7.5,7.6,7.8,7.90,7.95,8.0,
                8.2,8.25,8.3,8.35,8.4,8.45,8.5,8.55,8.6,8.8,8.90,8.95,9.0
                ]
        aspect_ratios: [0.2,0.5,0.75,1.0,1.25,1.3,1.35,1.4,1.45,1.5,1.6,1.7,1.75,1.8,1.9,1.95,2.0,2.25,2.5,2.75,3.0,3.5,4.0]
        height_stride: 16
        width_stride: 16
      }
    }
    first_stage_box_predictor_conv_hyperparams {
      op: CONV
      regularizer {
        l2_regularizer {
          weight: 0.0
        }
      }
      initializer {
        truncated_normal_initializer {
          stddev: 0.01
        }
      }
    }
    first_stage_nms_score_threshold: 0.0
    first_stage_nms_iou_threshold: 0.4
    first_stage_max_proposals: 300
    first_stage_localization_loss_weight: 2.0
    first_stage_objectness_loss_weight: 1.0
    initial_crop_size: 17
    maxpool_kernel_size: 1
    maxpool_stride: 1
    second_stage_box_predictor {
      mask_rcnn_box_predictor {
        use_dropout: false
        dropout_keep_probability: 1.0
        fc_hyperparams {
          op: FC
          regularizer {
            l2_regularizer {
              weight: 0.0
            }
          }
          initializer {
            variance_scaling_initializer {
              factor: 1.0
              uniform: true
              mode: FAN_AVG
            }
          }
        }
      }
    }
    second_stage_post_processing {
      batch_non_max_suppression {
        score_threshold: 0.0
        iou_threshold: 0.25
        max_detections_per_class: 100
        max_total_detections: 700
      }
      score_converter: SOFTMAX
    }
    second_stage_localization_loss_weight: 2.0
    second_stage_classification_loss_weight: 1.0
  }
}

train_config: {
  batch_size: 2
  num_steps: 25000
  optimizer {
    momentum_optimizer: {
      learning_rate: {
        cosine_decay_learning_rate {
          learning_rate_base: 0.0008
          total_steps: 25000
          warmup_learning_rate: 0.00001
          warmup_steps: 2000
        }
      }
      momentum_optimizer_value: 0.9
    }
    use_moving_average: false
  }
  gradient_clipping_by_norm: 10.0
  fine_tune_checkpoint_version: V2
  fine_tune_checkpoint: "faster_rcnn_inception_resnet_v2_1024x1024_coco17_tpu-8/checkpoint/ckpt-0"
  fine_tune_checkpoint_type: "detection"
  }

train_input_reader: {
  label_map_path: "images/labelmap.pbtxt"
  tf_record_input_reader {
    input_path: "train.record"
  }
}

eval_config: {
  metrics_set: "coco_detection_metrics"
  use_moving_averages: false
  batch_size: 1;
}

eval_input_reader: {
  label_map_path: "images/labelmap.pbtxt"
  shuffle: false
  num_epochs: 1
  tf_record_input_reader {
    input_path: "test.record"
  }
}

调整建议

  • 优化锚框配置:你当前设置了上百种锚框尺度和二十多种宽高比,冗余度过高会大幅增加RPN的负样本占比,反而降低小目标召回率。先统计你的数据集中所有标注框的尺度、宽高比分布,仅保留和标注匹配的3-5种尺度、3-6种宽高比即可,多余参数全部删除。
  • 调整第一阶段NMS阈值:当前first_stage_nms_iou_threshold设为0.4,过低的阈值会提前过滤掉密集分布的相邻树木候选框,建议调整到0.6~0.7区间,保留更多有效候选。
  • 对齐输入分辨率:你使用的预训练权重是基于1024x1024分辨率训练的,当前输入resize到867x867会丢失大量小树木的特征细节,建议将fixed_shape_resizer的宽高改为1024x1024,和预训练分辨率对齐。
  • 扩容检测上限:先统计单张图像中最多的树木标注数量,将max_total_detections、max_detections_per_class调整为比最大值高30%以上,避免后处理阶段截断有效检测结果。
  • 优化训练配置:当前L2正则化权重为0,容易出现过拟合,建议将一二阶段的L2正则权重调整到1e-41e-5区间;25000步的训练长度对于密集目标检测任务偏短,建议提升到4000050000步,显存充足的前提下可以将batch size提升到4~8,同步等比例调整学习率。
  • 补充小目标优化:如果训练集中小尺寸树木、稀有树种的标注占比低,可以加入多尺度训练、随机裁剪增强,也可以适当调高稀有类别的分类损失权重,提升模型对小目标、小众类别的感知能力。

内容的提问来源于stack exchange,提问作者maiko zirakadze

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.06 10:06:02