Toybrick

error to convert ssd_mobilenet_v2_coco_2018_03_29

pangu

注册会员

积分
77
楼主
发表于 2019-2-13 12:25:28    查看: 12004|回复: 8 | [复制链接]    打印 | 只看该作者
I modifed ssd-model.py to conver convert ssd_mobilenet_v2_coco_2018_03_29 to RKNN as below.

    rknn.load_tensorflow(tf_pb='./ssd_mobilenet_v2_coco_2018_03_29/frozen_inference_graph.pb')
    inputs=['FeatureExtractor/MobilenetV2/MobilenetV2/Conv2d_0/BatchNorm/batchnorm/mul_1'],

But I got the following errors:

--> Loading model
Catch exception when loading tensorflow model: ./frozen.pb!
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/rknn/api/rknn.py", line 50, in load_tensorflow
    std_values=std_values)
  File "rknn/api/redirect_stdout.py", line 67, in rknn.api.redirect_stdout.redirect_stdout.func_wrapper
  File "rknn/api/redirect_stdout.py", line 68, in rknn.api.redirect_stdout.redirect_stdout.func_wrapper
  File "rknn/api/rknn_base.py", line 138, in rknn.api.rknn_base.RKNNBase.load_tensorflow
  File "rknn/base/rknnlib/converter/convert_tf.py", line 93, in rknn.base.rknnlib.converter.convert_tf.convert_tf.__init__
  File "rknn/base/rknnlib/converter/tensorflowloader.py", line 53, in rknn.base.rknnlib.converter.tensorflowloader.TF_Graph_Preprocess.__init__
AttributeError: 'NoneType' object has no attribute 'op'

done
--> Building model
Catch exception when building RKNN model!
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/rknn/api/rknn.py", line 159, in build
    ret = self.rknn_base.build(do_quantization=do_quantization, dataset=dataset, pack_vdata=pre_compile)
  File "rknn/api/redirect_stdout.py", line 67, in rknn.api.redirect_stdout.redirect_stdout.func_wrapper
  File "rknn/api/redirect_stdout.py", line 68, in rknn.api.redirect_stdout.redirect_stdout.func_wrapper
  File "rknn/api/rknn_base.py", line 404, in rknn.api.rknn_base.RKNNBase.build
  File "rknn/api/rknn_base.py", line 703, in rknn.api.rknn_base.RKNNBase._quantize
  File "rknn/base/tensorzonex.py", line 213, in rknn.base.tensorzonex.get_data_file
  File "/usr/lib/python3.5/posixpath.py", line 122, in splitext
    return genericpath._splitext(p, sep, None, extsep)
  File "/usr/lib/python3.5/genericpath.py", line 118, in _splitext
    sepIndex = p.rfind(sep)
AttributeError: 'NoneType' object has no attribute 'rfind'

done
Export RKNN model failed!
done


Any idea why this happens?

Pangu,


回复

使用道具 举报

jefferyzhang

版主

积分
13578
沙发
发表于 2019-2-13 15:52:35 | 只看该作者
Please use rknntoolkit 0.9.8 try again, initializing with verbose argument, and it will print more error info to us.
回复

使用道具 举报

pangu

注册会员

积分
77
板凳
 楼主| 发表于 2019-2-14 01:23:19 | 只看该作者
Below is output of rknn-toolkit-v0.9.8 with verbose=True:

D import clients finished
E Catch exception when loading tensorflow model: ./ssd_mobilenet_v2_coco_2018_03_29/frozen_inference_graph.pb!
T Traceback (most recent call last):
T   File "rknn/api/rknn_base.py", line 143, in rknn.api.rknn_base.RKNNBase.load_tensorflow
T   File "rknn/base/rknnlib/converter/convert_tf.py", line 93, in rknn.base.rknnlib.converter.convert_tf.convert_tf.__init__
T   File "rknn/base/rknnlib/converter/tensorflowloader.py", line 53, in rknn.base.rknnlib.converter.tensorflowloader.TF_Graph_Preprocess.__init__
T AttributeError: 'NoneType' object has no attribute 'op'
2019-02-13 08:57:06.514403: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled
to use: AVX2 FMA
E Catch exception when building RKNN model!
T Traceback (most recent call last):
T   File "rknn/api/rknn_base.py", line 470, in rknn.api.rknn_base.RKNNBase.build
T   File "rknn/api/rknn_base.py", line 874, in rknn.api.rknn_base.RKNNBase._quantize
T   File "rknn/base/tensorzonex.py", line 213, in rknn.base.tensorzonex.get_data_file
T   File "/usr/lib/python3.5/posixpath.py", line 122, in splitext
T     return genericpath._splitext(p, sep, None, extsep)
T   File "/usr/lib/python3.5/genericpath.py", line 118, in _splitext
T     sepIndex = p.rfind(sep)
T AttributeError: 'NoneType' object has no attribute 'rfind'
E RKNN model is None
回复

使用道具 举报

pangu

注册会员

积分
77
地板
 楼主| 发表于 2019-2-14 17:03:06 | 只看该作者
Are you able to find out why ssd_mobilenet_v2_coco_2018_03_29 model can not work with RKNN tool?

Thanks,
回复

使用道具 举报

pangu

注册会员

积分
77
5#
 楼主| 发表于 2019-2-15 10:27:32 | 只看该作者
This model, http://download.tensorflow.org/m ... o_2018_01_28.tar.gz is OK.
But this one, v2, http://download.tensorflow.org/m ... o_2018_03_29.tar.gz is not OK.
The error is below using RKNN-0.9.8:

D save dump info to: ./test.log
--> Loading model
D import clients finished
E Catch exception when loading tensorflow model: ./ssd_mobilenet_v2_coco_2018_03_29/frozen_inference_graph.pb!
T Traceback (most recent call last):
T   File "rknn/api/rknn_base.py", line 143, in rknn.api.rknn_base.RKNNBase.load_tensorflow
T   File "rknn/base/rknnlib/converter/convert_tf.py", line 93, in rknn.base.rknnlib.converter.convert_tf.convert_tf.__init__
T   File "rknn/base/rknnlib/converter/tensorflowloader.py", line 53, in rknn.base.rknnlib.converter.tensorflowloader.TF_Graph_Preprocess.__init__
T AttributeError: 'NoneType' object has no attribute 'op'
done
--> Building model
2019-02-14 18:05:06.858750: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
E Catch exception when building RKNN model!
T Traceback (most recent call last):
T   File "rknn/api/rknn_base.py", line 470, in rknn.api.rknn_base.RKNNBase.build
T   File "rknn/api/rknn_base.py", line 874, in rknn.api.rknn_base.RKNNBase._quantize
T   File "rknn/base/tensorzonex.py", line 213, in rknn.base.tensorzonex.get_data_file
T   File "/usr/lib/python3.5/posixpath.py", line 122, in splitext
T     return genericpath._splitext(p, sep, None, extsep)
T   File "/usr/lib/python3.5/genericpath.py", line 118, in _splitext
T     sepIndex = p.rfind(sep)
T AttributeError: 'NoneType' object has no attribute 'rfind'
done
--> Init runtime environment
done
--> Running model
E RKNN model is None
done
inference result:  None
Traceback (most recent call last):
  File "./ssd2.py", line 90, in <module>
    predictions = outputs[1].reshape((1, NUM_RESULTS, 4))
TypeError: 'NoneType' object is not subscriptable


Can you download http://download.tensorflow.org/m ... o_2018_03_29.tar.gz to reproduce it?

Thanks,
回复

使用道具 举报

linuxsky

注册会员

积分
151
6#
发表于 2019-2-15 13:13:38 | 只看该作者
pangu 发表于 2019-2-15 10:27
This model, http://download.tensorflow.org/models/object_detection/ssd_mobilenet_v1_coco_2018_01_28. ...

我今天在测试时也发现了,好像只有 V1 版本能转, V2 或者 V1 其它数据集的都又这个问题,是不支持某些 OP 么?
回复

使用道具 举报

pangu

注册会员

积分
77
7#
 楼主| 发表于 2019-2-16 10:04:35 | 只看该作者
Agreed. I even try export_inference_graph on ssd_mob ile_v1_coco below and use the frozen pb with ssd.py, I got the same error again.

python3 ./src/models/research/object_detection/export_inference_graph.py \
    --input_type image_tensor \
    --pipeline_config_path ssd_mobilenet_v1_coco_2018_01_28/pipeline.config \
    --trained_checkpoint_prefix ssd_mobilenet_v1_coco_2018_01_28/model.ckpt \
    --output_directory object_detection_graph


It seems rknn model converter tool is not mature and hope RK eng can fix it asap. Otherwise, we can not use it for our own trained model
回复

使用道具 举报

linuxsky

注册会员

积分
151
8#
发表于 2019-2-18 11:19:22 | 只看该作者
这个问题解决了么?
回复

使用道具 举报

yhc

注册会员

积分
177
9#
发表于 2019-2-18 12:02:54 | 只看该作者
mobilenet v2的input和v1是不一样的,请用参考下面代码

  1.    
  2. rknn.load_tensorflow(tf_pb='./ssd_mobilenet_v2_coco_2018_03_29/frozen_inference_graph.pb',
  3.                          inputs=['FeatureExtractor/MobilenetV2/MobilenetV2/input'],
  4.                          outputs=['concat', 'concat_1'],
  5.                          input_size_list=[[300, 300, 3]])
复制代码
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

产品中心 购买渠道 开源社区 Wiki教程 资料下载 关于Toybrick


快速回复 返回顶部 返回列表