Toybrick

TensorFlow模型转换问题

yaowei

中级会员

积分
375
发表于 2019-7-1 08:19:37    查看: 6804|回复: 6 | [复制链接]    打印 | 显示全部楼层
现有TensorFlow MTCNN模型,转换过程中遇到一些问题,请求帮助:

模型repo: https://github.com/blaueck/tf-mtcnn

RKNN版本:1.0.0

转换系统:Ubuntu 18.04

代码:

  1. import numpy as np
  2. import cv2
  3. from rknn.api import RKNN

  4. rknn = RKNN()

  5. print('--> config model:')
  6. rknn.config(channel_mean_value='127.5 127.5 127.5 128', reorder_channel='0 1 2')
  7. print('done!')

  8. print('--> Loading tensorflow model:')
  9. ret = rknn.load_tensorflow(
  10.     tf_pb = './mtcnn.pb',
  11.     inputs = ['input'],
  12.     outputs = ['landmarks','prob','box'],
  13.     input_size_list = [[498,310,3]]
  14. )
  15. if ret != 0:
  16.     print('Load tensorflow model failed!')
  17.     exit(ret)
  18. print('done')

  19. print('-->Building model:')
  20. ret = rknn.build(do_quantization=True, dataset='./dataset.txt')
  21. if ret != 0:
  22.     print('Build MTCNN failed!')
  23.     exit(ret)
  24. print('done!')

  25. print('-->Export RKNN model:')
  26. ret = rknn.export_rknn('./mtcnn.rknn')
  27. if ret != 0:
  28.     print('Export mtcnn.rknn failed!')
  29.     exit(ret)
  30. print('done!')
复制代码


错误信息:

  1. --> config model:
  2. done!
  3. --> Loading tensorflow model:
  4. done
  5. -->Building model:
  6. E Catch exception when building RKNN model!
  7. T Traceback (most recent call last):
  8. T   File "rknn/api/rknn_base.py", line 498, in rknn.api.rknn_base.RKNNBase.build
  9. T   File "rknn/api/rknn_base.py", line 1067, in rknn.api.rknn_base.RKNNBase._quantize
  10. T   File "rknn/base/RKNNlib/app/tensorzone/workspace.py", line 221, in rknn.base.RKNNlib.app.tensorzone.workspace.Workspace.load_net
  11. T   File "rknn/base/RKNNlib/app/tensorzone/graph.py", line 125, in rknn.base.RKNNlib.app.tensorzone.graph.Graph.get_input_shape
  12. T UnboundLocalError: local variable 'in_layer' referenced before assignment
  13. Build MTCNN failed!
复制代码


一些问题:

1. 参数inputs和outputs有没有什么问题?查看pb文件的inputs和outputs参数一般是怎样进行的?

2. 解决上面的转换问题的一般性思路是什么?
回复

使用道具 举报

jefferyzhang

版主

积分
13608
发表于 2019-7-1 09:32:44 | 显示全部楼层
请把verbose=True打开,才能知道具体是什么原因。目前这LOG看不出什么。
PB文件的io名字可以通过Netron软件查看
回复

使用道具 举报

yaowei

中级会员

积分
375
 楼主| 发表于 2019-7-1 09:41:17 | 显示全部楼层
  1. W verbose file path is invalid, debug info will not dump to file.
  2. --> config model:
  3. done!
  4. --> Loading tensorflow model:
  5. D import clients finished
  6. I Current TF Model producer version 0 min consumer version 0 bad consumer version []
  7. I Disconnect onet/cond/switch_t:out4096 and onet/cond/strided_slice_8/stack_1:in0
  8. I Disconnect onet/cond/switch_f:out4096 and onet/cond/Const_1:in0
  9. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/strided_slice_3/stack_2:in0
  10. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/boolean_mask_1/Prod/reduction_indices:in0
  11. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/strided_slice_1/stack_1:in0
  12. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/boolean_mask_1/strided_slice/stack_2:in0
  13. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/strided_slice_2/stack_2:in0
  14. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/strided_slice_8/stack:in0
  15. I Disconnect onet/cond/switch_t:out4096 and onet/cond/prelu3/Greater/y:in0
  16. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask/strided_slice_2/stack_2:in0
  17. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/strided_slice_7/stack_1:in0
  18. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask_3/Reshape_1/shape:in0
  19. I Disconnect onet/cond/switch_t:out4096 and onet/cond/strided_slice_5/stack:in0
  20. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/boolean_mask/strided_slice_1/stack_2:in0
  21. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask_2/strided_slice_1/stack_1:in0
  22. I Disconnect onet/cond/switch_t:out4096 and onet/cond/Flatten/flatten/Reshape/shape/1:in0
  23. I Disconnect onet/cond/switch_t:out4096 and onet/cond/strided_slice_3/stack:in0
  24. I Disconnect onet/cond/switch_t:out4096 and onet/cond/strided_slice_6/stack:in0
  25. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/boolean_mask_2/strided_slice_1/stack_2:in0
  26. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/add_1/y:in0
  27. I Disconnect onet/cond/switch_t:out4096 and onet/cond/ExpandDims/dim:in0
  28. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask/strided_slice_1/stack_2:in0
  29. I Disconnect onet/cond/switch_t:out4096 and onet/cond/strided_slice_7/stack:in0
  30. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/boolean_mask_2/strided_slice_2/stack:in0
  31. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/strided_slice_4/stack_2:in0
  32. I Disconnect onet/cond/switch_t:out4096 and onet/cond/prelu4/Greater/y:in0
  33. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask_2/strided_slice_1/stack:in0
  34. I Disconnect onet/cond/switch_t:out4096 and onet/cond/prelu2/Greater/y:in0
  35. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/mul_1/y:in0
  36. I Disconnect onet/cond/switch_t:out4096 and onet/cond/non_max_suppression/iou_threshold:in0
  37. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/CropAndResize/crop_size:in0
  38. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/strided_slice_7/stack_2:in0
  39. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask_1/strided_slice_2/stack_1:in0
  40. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/boolean_mask_2/strided_slice_2/stack_2:in0
  41. I Disconnect onet/cond/switch_t:out4096 and onet/cond/strided_slice_9/stack:in0
  42. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/prelu3/Greater/y:in0
  43. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/boolean_mask/strided_slice_1/stack:in0
  44. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/strided_slice_4/stack_1:in0
  45. I Disconnect onet/cond/switch_t:out4096 and onet/cond/Tile_1/multiples:in0
  46. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/boolean_mask_2/concat/axis:in0
  47. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask/concat/axis:in0
  48. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/strided_slice_4/stack:in0
  49. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/strided_slice_5/stack:in0
  50. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/boolean_mask/Prod/reduction_indices:in0
  51. I Disconnect onet/cond/switch_t:out4096 and onet/cond/Reshape/shape:in0
  52. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask_2/strided_slice_1/stack_2:in0
  53. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/boolean_mask_1/strided_slice_1/stack_1:in0
  54. I Disconnect onet/cond/switch_t:out4096 and onet/cond/strided_slice_7/stack_1:in0
  55. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask_1/strided_slice_1/stack:in0
  56. I Disconnect rnet/cond/switch_f:out4096 and rnet/cond/Const_1:in0
  57. I Disconnect onet/cond/switch_t:out4096 and onet/cond/strided_slice_4/stack:in0
  58. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/boolean_mask_2/Prod/reduction_indices:in0
  59. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask/strided_slice/stack:in0
  60. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask_1/Prod/reduction_indices:in0
  61. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/boolean_mask/strided_slice/stack_2:in0
  62. I Disconnect onet/cond/switch_t:out4096 and onet/cond/strided_slice_2/stack_2:in0
  63. I Disconnect onet/cond/switch_t:out4096 and onet/cond/strided_slice_1/stack_2:in0
  64. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask/strided_slice/stack_1:in0
  65. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/strided_slice/stack:in0
  66. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask/strided_slice_1/stack:in0
  67. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask_1/strided_slice_1/stack_1:in0
  68. I Disconnect onet/cond/switch_t:out4096 and onet/cond/Flatten_2/flatten/strided_slice/stack:in0
  69. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/strided_slice_6/stack:in0
  70. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/strided_slice_2/stack_1:in0
  71. I Disconnect onet/cond/switch_t:out4096 and onet/cond/Flatten_2/flatten/strided_slice/stack_2:in0
  72. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask_2/strided_slice/stack_1:in0
  73. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/non_max_suppression/NonMaxSuppressionV2/max_output_size:in0
  74. I Disconnect onet/cond/switch_t:out4096 and onet/cond/strided_slice_3/stack_1:in0
  75. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/strided_slice_1/stack:in0
  76. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/prelu2/Greater/y:in0
  77. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/boolean_mask_2/strided_slice_2/stack_1:in0
  78. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask_3/strided_slice_2/stack:in0
  79. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/concat/axis:in0
  80. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/strided_slice_8/stack_2:in0
  81. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask_1/strided_slice/stack_1:in0
  82. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask_1/strided_slice/stack_2:in0
  83. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask_2/strided_slice/stack_2:in0
  84. I Disconnect onet/cond/switch_t:out4096 and onet/cond/strided_slice_9/stack_1:in0
  85. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/Flatten_1/flatten/Reshape/shape/1:in0
  86. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask_3/strided_slice_1/stack_2:in0
  87. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/strided_slice_3/stack:in0
  88. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/mul_2/y:in0
  89. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask/strided_slice_2/stack:in0
  90. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/boolean_mask_2/strided_slice_1/stack_1:in0
  91. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask_1/Reshape_1/shape:in0
  92. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask_1/strided_slice/stack:in0
  93. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/boolean_mask_2/strided_slice_1/stack:in0
  94. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/strided_slice_5/stack_2:in0
  95. I Disconnect onet/cond/switch_t:out4096 and onet/cond/strided_slice_8/stack_2:in0
  96. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask_3/strided_slice/stack_1:in0
  97. I Disconnect onet/cond/switch_t:out4096 and onet/cond/strided_slice_5/stack_2:in0
  98. I Disconnect onet/cond/switch_t:out4096 and onet/cond/strided_slice_2/stack:in0
  99. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/boolean_mask/strided_slice_1/stack_1:in0
  100. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/strided_slice_6/stack_2:in0
  101. I Disconnect onet/cond/switch_t:out4096 and onet/cond/Tile/input:in0
  102. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/boolean_mask_1/strided_slice_1/stack_2:in0
  103. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask/strided_slice/stack_2:in0
  104. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/prelu1/Greater/y:in0
  105. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask_2/strided_slice_2/stack_1:in0
  106. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/Flatten_1/flatten/strided_slice/stack_2:in0
  107. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask_2/concat/axis:in0
  108. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask_2/Reshape_1/shape:in0
  109. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask/Reshape_1/shape:in0
  110. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask_3/strided_slice/stack_2:in0
  111. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/Flatten/flatten/Reshape/shape/1:in0
  112. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/boolean_mask/strided_slice_2/stack_2:in0
  113. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/boolean_mask_1/strided_slice_1/stack:in0
  114. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask_1/strided_slice_1/stack_2:in0
  115. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/boolean_mask_2/strided_slice/stack:in0
  116. I Disconnect onet/cond/switch_t:out4096 and onet/cond/strided_slice_1/stack:in0
  117. I Disconnect onet/cond/switch_t:out4096 and onet/cond/Flatten_1/flatten/strided_slice/stack:in0
  118. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/boolean_mask_1/strided_slice/stack_1:in0
  119. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/boolean_mask_1/strided_slice_2/stack_1:in0
  120. I Disconnect onet/cond/switch_t:out4096 and onet/cond/strided_slice_2/stack_1:in0
  121. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask_3/strided_slice_2/stack_1:in0
  122. I Disconnect onet/cond/switch_t:out4096 and onet/cond/strided_slice/stack_2:in0
  123. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask_2/strided_slice_2/stack:in0
  124. I Disconnect rnet/cond/switch_f:out4096 and rnet/cond/Const:in0
  125. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/Flatten/flatten/strided_slice/stack_1:in0
  126. I Disconnect onet/cond/switch_t:out4096 and onet/cond/CropAndResize/crop_size:in0
  127. I Disconnect onet/cond/switch_t:out4096 and onet/cond/Flatten_1/flatten/Reshape/shape/1:in0
  128. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask_3/strided_slice_1/stack:in0
  129. I Disconnect onet/cond/switch_t:out4096 and onet/cond/Flatten_1/flatten/strided_slice/stack_1:in0
  130. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/strided_slice_3/stack_1:in0
  131. I Disconnect onet/cond/switch_t:out4096 and onet/cond/Reshape_1/shape:in0
  132. I Disconnect onet/cond/switch_t:out4096 and onet/cond/prelu1/Greater/y:in0
  133. I Disconnect onet/cond/switch_t:out4096 and onet/cond/strided_slice_9/stack_2:in0
  134. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask_3/strided_slice/stack:in0
  135. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/boolean_mask_2/Reshape_1/shape:in0
  136. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask_2/strided_slice/stack:in0
  137. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask_2/Prod/reduction_indices:in0
  138. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/strided_slice_8/stack_1:in0
  139. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/boolean_mask/strided_slice_2/stack_1:in0
  140. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/prelu4/Greater/y:in0
  141. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask_1/strided_slice_2/stack_2:in0
  142. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/boolean_mask_2/strided_slice/stack_2:in0
  143. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask_2/strided_slice_2/stack_2:in0
  144. I Disconnect onet/cond/switch_t:out4096 and onet/cond/non_max_suppression/NonMaxSuppressionV2/max_output_size:in0
  145. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/boolean_mask_1/concat/axis:in0
  146. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/Tile/input:in0
  147. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/boolean_mask/concat/axis:in0
  148. I Disconnect onet/cond/switch_t:out4096 and onet/cond/strided_slice_8/stack:in0
  149. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/non_max_suppression/iou_threshold:in0
  150. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/Max/reduction_indices:in0
  151. I Disconnect onet/cond/switch_t:out4096 and onet/cond/Flatten_2/flatten/strided_slice/stack_1:in0
  152. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/Flatten/flatten/strided_slice/stack:in0
  153. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask_3/concat/axis:in0
  154. I Disconnect onet/cond/switch_t:out4096 and onet/cond/strided_slice_5/stack_1:in0
  155. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/boolean_mask_1/Reshape_1/shape:in0
  156. I Disconnect onet/cond/switch_t:out4096 and onet/cond/Flatten/flatten/strided_slice/stack:in0
  157. I Disconnect onet/cond/switch_t:out4096 and onet/cond/ExpandDims_1/dim:in0
  158. I Disconnect onet/cond/switch_t:out4096 and onet/cond/strided_slice_4/stack_1:in0
  159. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/strided_slice_2/stack:in0
  160. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask/Prod/reduction_indices:in0
  161. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/Flatten_1/flatten/strided_slice/stack_1:in0
  162. I Disconnect onet/cond/switch_f:out4096 and onet/cond/Const_2:in0
  163. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask_1/concat/axis:in0
  164. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/boolean_mask_1/strided_slice_2/stack:in0
  165. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/boolean_mask/Reshape_1/shape:in0
  166. I Disconnect onet/cond/switch_t:out4096 and onet/cond/strided_slice/stack_1:in0
  167. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/boolean_mask/strided_slice/stack_1:in0
  168. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/boolean_mask/strided_slice/stack:in0
  169. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/boolean_mask_1/strided_slice_2/stack_2:in0
  170. I Disconnect onet/cond/switch_t:out4096 and onet/cond/strided_slice_6/stack_1:in0
  171. I Disconnect onet/cond/switch_t:out4096 and onet/cond/Flatten/flatten/strided_slice/stack_1:in0
  172. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/strided_slice_7/stack:in0
  173. I Disconnect onet/cond/switch_t:out4096 and onet/cond/concat/axis:in0
  174. I Disconnect onet/cond/switch_f:out4096 and onet/cond/Const:in0
  175. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/strided_slice/stack_1:in0
  176. I Disconnect onet/cond/switch_t:out4096 and onet/cond/Flatten_1/flatten/strided_slice/stack_2:in0
  177. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/strided_slice_1/stack_2:in0
  178. I Disconnect onet/cond/switch_t:out4096 and onet/cond/prelu5/Greater/y:in0
  179. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/strided_slice/stack_2:in0
  180. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/concat_1/axis:in0
  181. I Disconnect onet/cond/switch_t:out4096 and onet/cond/strided_slice_4/stack_2:in0
  182. I Disconnect onet/cond/switch_t:out4096 and onet/cond/strided_slice_7/stack_2:in0
  183. I Disconnect onet/cond/switch_t:out4096 and onet/cond/strided_slice_1/stack_1:in0
  184. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/boolean_mask_2/strided_slice/stack_1:in0
  185. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask_3/strided_slice_2/stack_2:in0
  186. I Disconnect onet/cond/switch_t:out4096 and onet/cond/Tile_2/multiples:in0
  187. I Disconnect onet/cond/switch_t:out4096 and onet/cond/strided_slice_6/stack_2:in0
  188. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/boolean_mask_1/strided_slice/stack:in0
  189. I Disconnect onet/cond/switch_t:out4096 and onet/cond/strided_slice/stack:in0
  190. I Disconnect onet/cond/switch_t:out4096 and onet/cond/strided_slice_3/stack_2:in0
  191. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask/strided_slice_2/stack_1:in0
  192. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/Flatten/flatten/strided_slice/stack_2:in0
  193. I Disconnect onet/cond/switch_t:out4096 and onet/cond/Flatten_2/flatten/Reshape/shape/1:in0
  194. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask/strided_slice_1/stack_1:in0
  195. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/Flatten_1/flatten/strided_slice/stack:in0
  196. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/strided_slice_5/stack_1:in0
  197. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask_3/strided_slice_1/stack_1:in0
  198. I Disconnect onet/cond/switch_t:out4096 and onet/cond/Flatten/flatten/strided_slice/stack_2:in0
  199. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask_3/Prod/reduction_indices:in0
  200. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/strided_slice_6/stack_1:in0
  201. I Disconnect onet/cond/switch_t:out4096 and onet/cond/boolean_mask_1/strided_slice_2/stack:in0
  202. I Disconnect rnet/cond/switch_t:out4096 and rnet/cond/boolean_mask/strided_slice_2/stack:in0
  203. I Fix merge rnet/cond/Merge branch rnet/cond/Const:out0 with switch_op None
  204. I Fix merge rnet/cond/Merge_1 branch rnet/cond/Const_1:out0 with switch_op None
  205. I Fix merge onet/cond/Merge branch onet/cond/Const:out0 with switch_op None
  206. I Fix merge onet/cond/Merge_1 branch onet/cond/Const_1:out0 with switch_op None
  207. I Fix merge onet/cond/Merge_2 branch onet/cond/Const_2:out0 with switch_op None
  208. I Have 0 tensors convert to const tensor
  209. []
  210. I build output layer attach_landmarks:out0
  211. I build output layer attach_prob:out0
  212. I build output layer attach_box:out0
  213. I build input layer input_out_0_placeholder:out0
  214. D Try match Identity landmarks
  215. I Match identity [['landmarks']] [['Identity']] to [['noop']]
  216. D Try match Identity prob
  217. I Match identity [['prob']] [['Identity']] to [['noop']]
  218. D Try match Identity box
  219. I Match identity [['box']] [['Identity']] to [['noop']]
  220. D Try match Const onet/cond/Const_2
  221. I Match const [['onet/cond/Const_2']] [['C']] to [['variable']]
  222. D Try match Const onet/cond/Const_1
  223. I Match const [['onet/cond/Const_1']] [['C']] to [['variable']]
  224. D Try match Const onet/cond/Const
  225. I Match const [['onet/cond/Const']] [['C']] to [['variable']]
  226. D connect onet/cond/Const_2_7 0  ~ landmarks_4 0
  227. D connect onet/cond/Const_1_8 0  ~ prob_5 0
  228. D connect onet/cond/Const_9 0  ~ box_6 0
  229. D connect landmarks_4 0  ~ attach_landmarks/out0_0 0
  230. D connect prob_5 0  ~ attach_prob/out0_1 0
  231. D connect box_6 0  ~ attach_box/out0_2 0
  232. 2019-07-01 09:37:15.277140: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
  233. 2019-07-01 09:37:15.299464: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2208000000 Hz
  234. 2019-07-01 09:37:15.300688: I tensorflow/compiler/xla/service/service.cc:150] XLA service 0x1ffb370 executing computations on platform Host. Devices:
  235. 2019-07-01 09:37:15.300709: I tensorflow/compiler/xla/service/service.cc:158]   StreamExecutor device (0): <undefined>, <undefined>
  236. D Process onet/cond/Const_2_7 ...
  237. D RKNN output shape(variable): (0 10)
  238. D Process landmarks_4 ...
  239. D RKNN output shape(noop): (0 10)
  240. D Process attach_landmarks/out0_0 ...
  241. D RKNN output shape(output): (0 10)
  242. D Process onet/cond/Const_1_8 ...
  243. D RKNN output shape(variable): (0)
  244. D Process prob_5 ...
  245. D RKNN output shape(noop): (0)
  246. D Process attach_prob/out0_1 ...
  247. D RKNN output shape(output): (0)
  248. D Process onet/cond/Const_9 ...
  249. D RKNN output shape(variable): (0 4)
  250. D Process box_6 ...
  251. D RKNN output shape(noop): (0 4)
  252. D Process attach_box/out0_2 ...
  253. D RKNN output shape(output): (0 4)
  254. I Build mtcnn complete.
  255. D Remove attach_input/out0_3.
  256. D Remove landmarks_4.
  257. D Remove prob_5.
  258. D Remove box_6.
  259. D Optimizing network with force_1d_tensor, swapper, merge_layer, auto_fill_bn, auto_fill_multiply, merge_avgpool_conv1x1, auto_fill_zero_bias, proposal_opt_import
  260. D Optimizing network with conv2d_big_kernel_size_transform
  261. D Optimizing network with auto_fill_tf_quantize, qnt_single_transmit_quantize, align_quantize, broadcast_quantize, qnt_adjust_coef
  262. --- Logging error ---
  263. Traceback (most recent call last):
  264.   File "/usr/lib/python3.6/logging/__init__.py", line 996, in emit
  265.     stream.write(msg)
  266. ValueError: I/O operation on closed file.
  267. Call stack:
  268.   File "pb-to-rknn.py", line 16, in <module>
  269.     input_size_list = [[498,310,3]]
  270.   File "/home/yaowei/.local/lib/python3.6/site-packages/rknn/api/rknn.py", line 62, in load_tensorflow
  271.     std_values=std_values)
  272.   File "/home/yaowei/.local/lib/python3.6/site-packages/tensorflow/python/util/deprecation.py", line 323, in new_func
  273.     instructions)
  274.   File "/home/yaowei/.local/lib/python3.6/site-packages/tensorflow/python/platform/tf_logging.py", line 166, in warning
  275.     get_logger().warning(msg, *args, **kwargs)
  276. Message: 'From %s: %s (from %s) is deprecated and will be removed %s.\nInstructions for updating:\n%s'
  277. Arguments: ('/home/yaowei/.local/lib/python3.6/site-packages/rknn/api/rknn.py:62', 'extract_sub_graph', 'tensorflow.python.framework.graph_util_impl', 'in a future version', 'Use tf.compat.v1.graph_util.extract_sub_graph')
  278. done
  279. -->Building model:
  280. D import clients finished
  281. I Load net...
  282. D Load layer attach_landmarks/out0_0 ...
  283. D Load layer attach_prob/out0_1 ...
  284. D Load layer attach_box/out0_2 ...
  285. D Load layer onet/cond/Const_2_7 ...
  286. D Load layer onet/cond/Const_1_8 ...
  287. D Load layer onet/cond/Const_9 ...
  288. I Load net complete...
  289. E Catch exception when building RKNN model!
  290. T Traceback (most recent call last):
  291. T   File "rknn/api/rknn_base.py", line 498, in rknn.api.rknn_base.RKNNBase.build
  292. T   File "rknn/api/rknn_base.py", line 1067, in rknn.api.rknn_base.RKNNBase._quantize
  293. T   File "rknn/base/RKNNlib/app/tensorzone/workspace.py", line 221, in rknn.base.RKNNlib.app.tensorzone.workspace.Workspace.load_net
  294. T   File "rknn/base/RKNNlib/app/tensorzone/graph.py", line 125, in rknn.base.RKNNlib.app.tensorzone.graph.Graph.get_input_shape
  295. T UnboundLocalError: local variable 'in_layer' referenced before assignment
  296. Build MTCNN failed!
复制代码


回复

使用道具 举报

yaowei

中级会员

积分
375
 楼主| 发表于 2019-7-1 09:43:05 | 显示全部楼层
好复杂,看不太懂,verbose信息的解读有什么相关资料吗?还有,input_size_list = [[498,310,3]]的值应当如何确定呢?我用的就是test_image.jpg文件的大小。
回复

使用道具 举报

yaowei

中级会员

积分
375
 楼主| 发表于 2019-7-2 13:55:44 | 显示全部楼层
麻烦关注一下这个问题
回复

使用道具 举报

yaowei

中级会员

积分
375
 楼主| 发表于 2019-7-4 15:35:45 | 显示全部楼层
有得到后方工程师大佬的解答吗?
回复

使用道具 举报

hfu

新手上路

积分
38
发表于 2019-7-10 00:16:29 | 显示全部楼层
https://github.com/blaueck/tf-mtcnn/blob/master/caffe2tf.py
tf-mtcnn 图像输入尺寸是
img_shape = [None, None, 3]

实际大小通过 tf.shape() 得到
def stage_one(images, min_size, factor, thresold, scope):
    img_shape = tf.shape(images)

rknn 输入必须规定图像尺寸, 但是模型没有提供, 可能是这个问题。

回复

使用道具 举报

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

本版积分规则

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


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