SSD代码部分笔记附加keras版本代码

代码ssd_training.py

使用tensorflow进行写

写出来是MultiboxLoss类,在以下代码中导入该模块:SSD_training.ipynb

功能:计算loss值

代码ssd_utils.py

使用tensorflow和numpy进行写

写出来的是BBoxUtility,定义了box框, 在以下代码中导入该模块:

SSD_training.ipynb   SSD.ipynb

预测最终每张图片的结果

encode_box用于训练的编码框,仅用于指定prior,box我们编码的方差

assign_boxes指定框将箱子分配到prior训练

decode_boxes将框局部预测转向prior

detection_out做非最大抑制(NMS)我们预测的结果。

代码ssd_layer.py

定义了Normalize、PriorBox,在以下代码中导入该模块:

ssd.py 

在介绍了归一化层在ParseNet。

# Arguments(论据)

img_size: Size of the input image as tuple(w, h).

        min_size: Minimum box size in pixels(像素).

        max_size: Maximum box size in pixels.

        aspect_ratios(横宽比): List of aspect ratios of boxes.

        flip: Whether to consider reverseaspect ratios.

        Variances(方差): List of variances for x, y, w, h.

        clip: Whether to clip the prior'scoordinate

 # Input shape

4D tensor with shape:

        `(samples, rows, cols, channels)` ifdim_ordering='tf'.

# Output shape

        3D tensor with shape:

        (samples, num_boxes, 8)

定义了函数call

定义了prior boxes形状

定义了prior boxes的中心

定义了prior boxes的 xmin, ymin, xmax, ymax

定义了 variances(方差)

#TODO

        Add possibility not to have variances.


注:在运行程序之前,在目录文件夹下新建checkpoints文件夹用于训练时存储参数

猜你喜欢

转载自blog.csdn.net/tumi678/article/details/77336186