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 中没有传入样本
    

      

  • 相关阅读:
    一些命令
    DB-5:使用PowerDesigner连接数据库并生成ER图
    [原创]OpenEuler20.03安装配置PostgreSQL13.4详细图文版
    oss 视频转码
    java lambda groupby 的map顺序问题
    Springboot得到RabbitMQ队列消息的数量
    Rabbitmq 定时任务 (代码实现)
    Rabbitmq 定时任务
    Mac navicat 15
    Mac 重置 idea
  • 原文地址:https://www.cnblogs.com/lizhiqing/p/10975718.html
Copyright © 2011-2022 走看看