bubbliiiing / mobilenet-ssd-keras

这是一个mobilenet-ssd-keras的源码,可以用于训练自己的轻量级ssd模型。
MIT License
105 stars 34 forks source link

convert .h5 to .pb #8

Open zhuhongtao666 opened 3 years ago

zhuhongtao666 commented 3 years ago

我最近在做移动端的目标检测,用了您的框架代码,目标检测模型服务器训练都没问题,主要问题在把.h5的模型转换成.pb上会报错,在转换过程中需要在load_model函数中声明自定义层PriorBox: objects = {'relu6': relu6, 'PriorBox': PriorBox} h5_model = load_model(weight_file_path, custom_objects=objects) 但是这个类里初始化函数init有两个参数需要填:'img_size' and 'min_size',我根据nets/ssd.py文件,把img_size初始化成[512,512,3], min_size设置成30后,会报错: ValueError: A Concatenate layer requires inputs with matching shapes except for the concat axis. Got inputs shapes: [(None, 24656, 4), (None, 24656, 2), (None, 5492, 8)] concat的shape会对不上,想问您这两个参数要怎么设置?

bubbliiiing commented 3 years ago

PriorBox不是这样设置吧,PriorBox是用于产生先验框的啊。你看看utils.py下的anchors.py