对于faster_rcnn_meta_arch.py的理解见这篇文章
对于inception_resnet_v2.py的理解见这篇文章
"""Inception Resnet v2 Faster R-CNN implementation.
参见Szegedy等人的“Inception-v4,Inception-ResNet Impact of Residual Connections on
Learning"(论文地址:https://arxiv.org/abs/1602.07261)
以及Huang等人的
“Speed/accuracy trade-offs for modern convolutional object detectors" by
(论文地址:https://arxiv.org/abs/1611.10012)
"""
import tensorflow as tf
from object_detection.meta_architectures import faster_rcnn_meta_arch
from object_detection.net import inception_resnet_v2
slim = tf.contrib.slim
class FasterRCNNInceptionResnetV2FeatureExtractor(
faster_rcnn_meta_arch.FasterRCNNFeatureExtractor):
""" 这个类主要是Inception_Resnet_v2 Faster R-CNN的特征提取器的相关实现 """
def __init__(self,
is_training,
first_stage_features_stride,
reuse_weights=None,
weight_decay=0.0):
"""Constructor.
Args:
is_training: 见faster_rcnn_meta_arch的构造器
first_stage_features_stride: 同上
reuse_weights: 同上
weight_decay: 同上
Raises:
ValueError: 如果 `first_stage_features_stride` 既不是8也不是16。
"""
if first_stage_features_stride != 8 and first_stage_features_stride != 16:
raise ValueError('`first_stage_features_stride` must be 8 or 16.')
super(FasterRCNNInceptionResnetV2FeatureExtractor, self).__init__(
is_training, first_stage_features_stride, reuse_weights, weight_decay)
def preprocess<