持续更新中
第一部分:
import numpy as np
import tensorflow as tf
import yolo.config as cfg
slim = tf.contrib.slim
#创建YOLONet 类
class YOLONet(object):
def __init__(self, is_training=True):
'''
构造函数
利用cfg配置文件对网络参数进行初始化,定义网络的输入和输出等信息,
'''
self.classes = cfg.CLASSES
self.num_class = len(self.classes)
self.image_size = cfg.IMAGE_SIZE
self.cell_size = cfg.CELL_SIZE #将图片分为
self.boxes_per_cell = cfg.BOXES_PER_CELL #每个格子输出2个Bounding Box信息
self.output_size = (self.cell_size * self.cell_size) *\
(self.num_class + self.boxes_per_cell * 5)
self.scale = 1.0 * self.image_size / self.cell_size
self.boundary1 = self.cell_size * self.cell_size * self.num_class
self.boundary2 = self.boundary1 +\
self.cell_size * self