Tensorflow object detection API 源码阅读笔记:Fast r-cnn

Update:
建议先看从编程实现角度学习Faster R-CNN,比较直观。这里由于源代码抽象程度较高,显得比较混乱。

Old:

之前看过检测api整体的代码架构,rpn部分和几个基本类,这次仔细看看Fast r-cnn部分,顺便把之前看过的东西串一串。

"""object_detection/meta_architectures/faster_rcnn_meta_arch.py"""
class FasterRCNNFeatureExtractor(object)类声明了_extract_proposal_features_extract_box_classifier_features等抽象函数。

不过我们先看下restore_from_classification_checkpoint_fn函数,它返回的是variables_to_restore字典,看一下后面的restore_map函数就懂了,创建了模型中变量和checkpoint中变量名字的映射,且区分了分类的checkpoint(用于初始化)和检测的checkpoint。
class FasterRCNNMetaArch(model.DetectionModel)
注意到用了好多@property,是将方法当成属性来调用。在类的定义中使用@property修饰函数,可以让调用者写出简短的代码,同时保证对参数进行必要的检查。还可以定义只读属性,不定义setter方法就是一个只读属性。

"""这个max_num_proposals为什么这样设定?,暂时不太明白,后续研究"""
def max_num_proposals(self):
    Max number of proposals (to pad to) for each image in the input batch.
    At training time, this is set to be the `second_stage_batch_size` if hard
    example miner is not configured, else it is set to
    `first_stage_max_proposals`. At inference time, this is always set to
    `first_stage_max_proposals`.

"""这个函数调用了image_resizer_fn,把归一化等其他预处理都留给feature_extractor来做"""
def preprocess(self, inputs)


  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值