9.27---报错整理

  1. 错误一:
    1. 报错:
      RuntimeError: tf.gradients is not supported when eager execution is enabled. Use tf.GradientTape instead.
    2. 报错原因:chow_output类型是tf.tensor,last_conv_layer是keras.layers.convolustional.conv2d.Conv2D 出现类型不兼容,查询到的解决方法是直接替换为使用tensorflow中的keras.
    3. 解决:
      原始代码:
           grads=K.gradients(chow_output,last_conv_layer)[0]  # 松狮类别相对于block5_conv3输出特征图的梯度 
      
      修改后的代码:
          with tf.GradientTape() as gtape:
                  grads = gtape.gradient(chow_output, last_conv_layer.output)
  2. 错误二:
    1. 报错:
      module 'cv2.cv2' has no attribute 'xfeatures2d'
  3. 错误三:
    1. 报错:
      error: (-215:Assertion failed) npoints >= 4 && npoints == std::max(ipoints.checkVector(2, CV_32F), ipoints.checkVector(2, CV_64F)) in function 'cv::solvePnPRansac'
  4. 错误四:
    1. 报错:
      The 'color' trait of a GlyphFactory instance must be a tuple of the form: (0.0 <= a floating point number <= 1.0, 0.0 <= a floating point number <= 1.0, 0.0 <= a floating point number <= 1.0) or None, but a value of array([0.70980392, 0.69019608, 0.67843137]) <class 'numpy.ndarray'> was specified.
    2. 解决:报错信息已很明显地提示,解决:只需要将array中的元素逐个拿出然后用括号括起来即可形成tuple
  5. 错误五:
    1. 报错:module 'sklearn.datasets' has no attribute 'samples_generator'
    2. 解决:删除samples_generator
  6. 错误六:
    1. 报错:报错:ImportError: No module named ‘keras_contrib‘
    2. 解决:pip install git+https://www.github.com/keras-team/keras-contrib.git   
  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值