-
Notifications
You must be signed in to change notification settings - Fork 88
/
Copy pathsummary.py
30 lines (27 loc) · 1.21 KB
/
summary.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#--------------------------------------------#
# 该部分代码用于看网络结构
#--------------------------------------------#
from nets.frcnn import get_model
from utils.utils import net_flops
if __name__ == "__main__":
input_shape = [600, 600]
num_classes = 21
_, model = get_model(num_classes, 'vgg', input_shape=[input_shape[0], input_shape[1], 3])
#--------------------------------------------------------#
# 由于faster-rcnn-keras里面存在一些不可计算层
# 如ROIpooling
# 因此无法正确计算FLOPs,可参考pytorch版本
#--------------------------------------------------------#
#--------------------------------------------#
# 查看网络结构网络结构
#--------------------------------------------#
model.summary()
#--------------------------------------------#
# 计算网络的FLOPS
#--------------------------------------------#
net_flops(model, table=False)
#--------------------------------------------#
# 获得网络每个层的名称与序号
#--------------------------------------------#
# for i,layer in enumerate(model.layers):
# print(i,layer.name)