zoukankan      html  css  js  c++  java
  • 错题本

    报错信息:Cannot cast ufunc subtract output from dtype('float64') to dtype('int64') with casting rule 'same_kind'

    输入的数据类型为浮点型,需要的数据类型是整形。

    可以通过下面的语句完成类型转换

    np.array(dta,dtype=np.float) 

    AttributeError: '_io.TextIOWrapper' object has no attribute 'xreadlines'
    

      python 2 中有file.xreadlines(),作为一个迭代器,一次读取一行文件,在python3中已经移除,可使用file.readlines()代替

    matrix 和 np.array 的逆

    np.linalg.inv
    
    matrix.I
    

    Open CV  imwrite

     cv.imwrite('filename', img)

    OpenCv error: (-2) could not find a writer for the specified extension in function cv::imwrite_

    filename 缺少拓展名

    cv2.error: OpenCV(4.1.0) /io/opencv/modules/imgproc/src/resize.cpp:3718: error: (-215:Assertion failed) !ssize.empty() in function 'resize'

    >>>  img0 = cv2.imread('dir')
    >>> img1 = img0[x0:x1, y0:y1, :]
    >>> img2 = cv2.resize(img1, (128, 128))

    cv2.error: OpenCV(4.1.0) /io/opencv/modules/imgproc/src/resize.cpp:3718: error: (-215:Assertion failed) !ssize.empty() in function 'resize'
    这是由于img1的w,h为0导致的
    注意处理img1时要满足
    (x0>x1)&(y0>y1)
    否则会导致img.shape[:2]=(0,0)

    can't assign to operator

    变量名出错
    
    a-b = np.load('a-b.npy')
    改为
    a_b = np.load('a-b.npy')
    
    + - / 之类operator不能用于变量名中
    出现改错误应当检查变量名
    

      

    AttributeError: 'ProgbarLogger' object has no attribute 'log_values'

    generator 中没有传入样本
    

      

  • 相关阅读:
    [LeetCode] Letter Combinations of a Phone Number
    [LeetCode] Combinations
    [Algorithms] Longest Increasing Subsequence
    2.Orange安装
    1.Orange是什么鬼?
    5.motan之注解方式配置
    4.motan之集群调用
    3.motan之异步调用
    2、motan入门程序
    1、微博RPC框架Motan
  • 原文地址:https://www.cnblogs.com/lizhiqing/p/10975718.html
Copyright © 2011-2022 走看看