Tensorflow对象检测再训练,置信度确实很低

时间:2019-04-15 15:16:28

标签: tensorflow deep-learning object-detection object-detection-api pre-trained-model

我正在尝试重新训练张量流对象检测模型-更快的r cnn(在iNaturalist上预训练)数据。但是,经过约6万步的训练(总损失稳定后),如果我进行评估,则我的检测结果的置信度得分太低,约为e-5。

原始模型大约有2k个类。我正在训练4个班级-几乎相等的分布,有900个样本。数据扩充选项为“ random_horizo​​ntal_flip”。

我应该增加样本数量吗?也许有更多的增强选项?

任何帮助将不胜感激!谢谢!

编辑: 所使用的配置文件

model {
  faster_rcnn {
    num_classes: 4
    image_resizer {
      keep_aspect_ratio_resizer {
        min_dimension: 600
        max_dimension: 1024
      }
    }
    feature_extractor {
      type: "faster_rcnn_resnet50"
      first_stage_features_stride: 16
    }
    first_stage_anchor_generator {
      grid_anchor_generator {
        height_stride: 16
        width_stride: 16
        scales: 0.25
        scales: 0.5
        scales: 1.0
        scales: 2.0
        aspect_ratios: 0.5
        aspect_ratios: 1.0
        aspect_ratios: 2.0
      }
    }
    first_stage_box_predictor_conv_hyperparams {
      op: CONV
      regularizer {
        l2_regularizer {
          weight: 0.0
        }
      }
      initializer {
        truncated_normal_initializer {
          stddev: 0.009999999776482582
        }
      }
    }
    first_stage_nms_score_threshold: 0.0
    first_stage_nms_iou_threshold: 0.699999988079071
    first_stage_max_proposals: 32
    first_stage_localization_loss_weight: 2.0
    first_stage_objectness_loss_weight: 1.0
    initial_crop_size: 14
    maxpool_kernel_size: 2
    maxpool_stride: 2
    second_stage_box_predictor {
      mask_rcnn_box_predictor {
        fc_hyperparams {
          op: FC
          regularizer {
            l2_regularizer {
              weight: 0.0
            }
          }
          initializer {
            variance_scaling_initializer {
              factor: 1.0
              uniform: true
              mode: FAN_AVG
            }
          }
        }
        use_dropout: false
        dropout_keep_probability: 1.0
      }
    }
    second_stage_batch_size: 2
    second_stage_post_processing {
      batch_non_max_suppression {
        score_threshold: 0.0
        iou_threshold: 0.6000000238418579
        max_detections_per_class: 25
        max_total_detections: 25
      }
      score_converter: SOFTMAX
    }
    second_stage_localization_loss_weight: 2.0
    second_stage_classification_loss_weight: 1.0
  }
}
train_config {
  batch_size: 1
  data_augmentation_options {
    random_horizontal_flip {
    }
  }
  optimizer {
    momentum_optimizer {
      learning_rate {
        manual_step_learning_rate {
          initial_learning_rate: 0.0003000000142492354
          schedule {
            step: 3000000
            learning_rate: 2.9999999242136255e-05
          }
          schedule {
            step: 3500000
            learning_rate: 3.000000106112566e-06
          }
        }
      }
      momentum_optimizer_value: 0.8999999761581421
    }
    use_moving_average: false
  }
  gradient_clipping_by_norm: 10.0
  fine_tune_checkpoint: "/home/vectorweb3/Documents/Development_Sandbox/Manya/experimental-scripts/models/research/oid/faster_rcnn_resnet50_fgvc_2018_07_19/model.ckpt"
  from_detection_checkpoint: true
  num_steps: 100000
  freeze_variables: ".*FeatureExtractor*."
  load_all_detection_checkpoint_vars: false
}
train_input_reader {
  label_map_path: "/home/vectorweb3/Documents/Development_Sandbox/Manya/experimental-scripts/models/research/object_detection/data/mosquito_label_map.pbtxt"
  queue_capacity: 4
  min_after_dequeue: 2
  tf_record_input_reader {
    input_path: "/home/vectorweb3/Documents/Development_Sandbox/Manya/training_input_output_models/set4/tf_records.record"
  }
}
eval_config {
  num_examples: 40
  max_evals: 1
  metrics_set: "pascal_voc_detection_metrics"
  use_moving_averages: false
  min_score_threshold: 0.0
}
eval_input_reader {
  label_map_path: "/home/vectorweb3/Documents/Development_Sandbox/Manya/experimental-scripts/models/research/object_detection/data/mosquito_label_map.pbtxt"
  shuffle: false
  num_readers: 1
  tf_record_input_reader {
    input_path: "/home/vectorweb3/Documents/Development_Sandbox/Manya/training_input_output_models/set4/tf_records.record"
  }
}

原始配置文件为here。 主要区别在于以下内容:

  • 类数:在原始情况下为2854,对于我的任务来说仅为4
  • 最大检测次数:原始案例只有4个,对于我的任务是25个

训练损失如下:

enter image description here

0 个答案:

没有答案