[实习2021-03-30]Object_detection_tutorial踩坑记录

Object_detection_tutorial踩坑记录

环境记录

  • Ubuntu
  • tensorflow-gpu == 2.4.1
  • python == 3.6.13

issue 1

AttributeError: 'AutoTrackable' object has no attribute 'output_shapes'

解决方案

# masking_model.output_shapes 替换为以下
masking_model.signatures['serving_default'].output_shapes

issue 2

在运行maskrcnn模型时出现
TypeError: Cannot interpret 'tf.uint8' as a data type
#~/miniconda3/envs/rcnn/lib/python3.6/site-packages/object_detection/utils/ops.py in reframe_box_masks_to_image_masks(box_masks, boxes, image_height, image_width, resize_method)
resize_method = 'nearest' if box_masks.dtype == tf.uint8 else resize_method # 这一行报错

问题原因

numpy.ndarray无法与tensor比较

解决方案

  1. 在进入reframe_box_masks_to_image_masks函数之前将box_masks转换为Tensor格式

    tf.convert_to_tensor(output_dict[‘detection_masks’])s

  2. 修改自己环境下的site-packages/object_detection/utils/ops.py的源码

    1. import numpy as np

    2. resize_method = ‘nearest’ if box_masks.dtype == tf.uint8 else resize_method

      修改为

      resize_method = ‘nearest’ if box_masks.dtype == np.uint8 else resize_method

  • 4
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值