导入
YOLO的结构(主干网络、颈部网络和头部网络)
了解 YOLO 中常用术语的含义:backbone(主干网络)、neck(颈部网络)和 head(检测头)。
...
YOLO框架的结构
1import tensorflow as tf 2 3base_model = tf.keras.applications.ResNet50(include_top=False, input_shape=,weights=, pooling='') 4print(base_model.summary())
- 在
input_shape参数中传入图像的输入维度,如下所示:
1input_shape=(32, 32, 3),weights=None, pooling='max'
- 由于我们不使用预训练模型,需将
weights参数设为None,如下所示:
1weights=None
- 为最后一层添加最大池化(max-pooling),如下所示:
1pooling='max'
最终代码应如下所示:
1base_model= tf.keras.applications.ResNet50(include_top=False,input_shape=(32, 32, 3),weights=None, pooling='max')
- 在
input_shape参数中传入图像的输入维度,如下所示:
1input_shape=(32, 32, 3),weights=None, pooling='max'
- 由于我们不使用预训练模型,将
weights参数设为None,如下所示:
1weights=None
- 为最后一层添加最大池化操作,如下所示:
1pooling='max'
最终代码应如下所示:
1base_model= tf.keras.applications.ResNet50(include_top=False,input_shape=(32, 32, 3),weights=None, pooling='max')
...
头部网络输出的预测结果形状