首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >tensorflow api对象检测模型中的微小对象检测

tensorflow api对象检测模型中的微小对象检测
EN

Stack Overflow用户
提问于 2019-06-28 00:24:03
回答 2查看 362关注 0票数 0

我有一个使用tensorflow对象检测api和更快的rcnn模型的对象检测模型。这个模型能够检测到清晰可见的对象,但无法检测到尺寸较小或distance.Does较大的对象,需要在更快的rcnn配置文件中进行任何更改吗?如果是,那是什么?如果不是,那么这个模型如何检测微小的物体呢?下面是更快的rcnn配置文件以供参考

代码语言:javascript
复制
model {
  faster_rcnn {
    num_classes: 4
    image_resizer {
      keep_aspect_ratio_resizer {
        min_dimension: 600
        max_dimension: 1024
      }
    }
    feature_extractor {
      type: 'faster_rcnn_inception_v2'
      first_stage_features_stride: 16
    }
    first_stage_anchor_generator {
      grid_anchor_generator {
        scales: [0.25, 0.5, 1.0, 2.0]
        aspect_ratios: [0.5, 1.0, 2.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.7
    first_stage_max_proposals: 300
    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 {
        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.6
        max_detections_per_class: 100
        max_total_detections: 300
      }
      score_converter: SOFTMAX
    }
    second_stage_localization_loss_weight: 2.0
    second_stage_classification_loss_weight: 1.0
  }
}

train_config: {
  batch_size: 1
  optimizer {
    momentum_optimizer: {
      learning_rate: {
        manual_step_learning_rate {
          initial_learning_rate: 0.0002
          schedule {
            step: 3000
            learning_rate: .00002
          }
          schedule {
            step: 15000
            learning_rate: .000002
          }
        }
      }
      momentum_optimizer_value: 0.9
    }
    use_moving_average: false
  }
  gradient_clipping_by_norm: 10.0
  fine_tune_checkpoint: "C:/multi_cat_3/models/research/object_detection/faster_rcnn_inception_v2_coco_2018_01_28/model.ckpt"
  from_detection_checkpoint: true
  load_all_detection_checkpoint_vars: true

  num_steps: 20000
  data_augmentation_options {
    random_horizontal_flip {
    }
  }
}


train_input_reader: {
  tf_record_input_reader {
    input_path: "C:/multi_cat_3/models/research/object_detection/train.record"
  }
  label_map_path: "C:/multi_cat_3/models/research/object_detection/training/labelmap.pbtxt"
}

eval_config: {
  metrics_set: "coco_detection_metrics"
  num_examples: 1311
}

eval_input_reader: {
  tf_record_input_reader {
    input_path: "C:/multi_cat_3/models/research/object_detection/test.record"
  }
  label_map_path: "C:/multi_cat_3/models/research/object_detection/training/labelmap.pbtxt"
  shuffle: false
  num_readers: 1
}
EN

回答 2

Stack Overflow用户

发布于 2019-09-06 16:21:43

我猜你需要用你想要测试的相似图像来训练模型。在您的案例中,您将使用该数据集测试和训练模型。获取所需高度或距离的图像,并尽可能准确地标记图像。

我想这个就行了。

票数 0
EN

Stack Overflow用户

发布于 2020-10-11 01:02:40

COCO指标将对象大小定义为:

代码语言:javascript
复制
small objects: area < 32*2
medium objects: 32*2 < area < 96*2
large objects: area > 96*2

因此,无论你想要检测哪个对象,将主图像平铺/剪切成几个部分,直到你的对象相对于整个图像的分辨率看起来更大。

选择不会将列车图像调整为低于所需大小的模型(以使对象相对于整个图像更大)。

在配置下。例如,如果您的原始图像为2000x2000,对象为30x30,如果您选择以下配置,则对象的大小也将调整为小于30x30,因为在将训练图像传递到模型进行训练之前,训练图像的大小将调整为600x1024。

但如果图像可以被切割成4x4的瓦片(500x500),下面的规格将把它的大小调整为600x600,对象将大于30x30。

代码语言:javascript
复制
image_resizer {
      keep_aspect_ratio_resizer {
        min_dimension: 600
        max_dimension: 1024

PS:在推理时,需要通过模型传递相同的剪切/平铺图像,这可能会增加推理时间。

另一种选择是选择适合image_resizer函数中给出的原始图像分辨率的配置,但需要更高的规格(CPU/GPU/TPU)来处理训练。

哈!

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56795222

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档