1、getops使用,参见我的博客:
https://blog.csdn.net/weixin_41770169/article/details/85695457
2、不支持的层
(tensorflow) bash-3.2$ python /Users/xuqiong/PycharmProjects/keras2ncnn/Keras2NCNN.py -i /Users/xuqiong/PycharmProjects/keras2ncnn/ssrnet_3_3_3_64.h5
Traceback (most recent call last):
File "/Users/xuqiong/PycharmProjects/keras2ncnn/Keras2NCNN.py", line 392, in <module>
text_net, binary_weights = k2n_converter.convert()
File "/Users/xuqiong/PycharmProjects/keras2ncnn/Keras2NCNN.py", line 370, in convert
layer_ncnn_lst = self._dump_layer_weights(layer)
File "/Users/xuqiong/PycharmProjects/keras2ncnn/Keras2NCNN.py", line 339, in _dump_layer_weights
raise ValueError("non supported layer:{}".format(layer_name))
ValueError: non supported layer:t
猜测是h5文件中不含有结构,只有权重信息。因此,先将纯权值的模型改成结构+权值。
3、模型保存为:结构+权值
https://blog.csdn.net/weixin_41770169/article/details/85697281
https://blog.csdn.net/weixin_41770169/article/details/85705489
4、再次运行keras2ncnn
还是步骤2同样的问题,跟进去后发现,如下网址给的脚本有很多问题,由于项目第一周期时间紧,决定放弃直接从keras转ncnn。而是改成keras改成caffe,再转ncnn。
https://github.com/yanghanxy/Keras2NCNN