5. VGGnet_train.py ( Faster-RCNN_TF代码解读)

本文档详细解读了Faster R-CNN在TensorFlow实现中的核心文件VGGnet_train.py,涵盖了从VGG网络到RPN、RoI Proposal直至RCNN的完整流程。关键函数如feed()、conv()、softmax()定义于network.py,而'rpn-data'、'rpn-rois'、'roi-data'层涉及的函数分别为anchor_target_layer、proposal_layer和proposal_target_layer。
摘要由CSDN通过智能技术生成

5. /lib/networks/VGGnet_train.py

本文件是整个faster网络结构。从VGG到RPN,到RoI Proposal,最后是RCNN。
网络结构如下:
RPN+RoI Proposal+RCNN网络

调用函数链接:

  1. 本文件调用的函数,如feed(), conv(), softmax()等都在network.py中。
  2. ‘rpn-data’层所用到的函数:anchor_target_layer
  3. ‘rpn-rois’层所用到的函数:proposal_layer
  4. ‘roi-data’层所用到的函数:proposal_target_layer

代码解读:

import tensorflow as tf
from networks.network import Network


#define

n_classes = 21
_feat_stride = [16,]
anchor_scales = [8, 16, 32]

class VGGnet_train(Network):
    def __init__(self, trainable=True):
        self.inputs = []
        self.data = tf.placeholder(tf.float32, shape=[None, None, None, 3])
        self.im_info = tf.placeholder(tf.float32, shape=[None, 3])
        self.gt_boxes = tf.placeholder(tf.float32, shape=[None, 5])
        #该参数定义dropout比例
        self.keep_prob = tf.placeholder(tf.float32)
        self.layers = dict({
  'data':self.data, 'im_info':self.im_info, 'gt_boxes':self.gt_boxes})
        self.trainable = trainable
        self.setup()

        # create ops and placeholders for bbox normalization process
        #建立weights,biases变量,用tf.assign来更新
        with tf.variable_scope('bbox_pred', reuse=True):
            weights = tf.get_variable("weights")
            biases = tf.get_variable("biases")

            self.bbox_weights = tf.placeholder(weights.dtype, shape=weights.get_shape())
            self.bbox_
  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值