• 本网豪情赞助商

  • login failed for display 0 ubuntuallowed_u
  • css设定文本超出一行或多行就隐藏并显示省略
  • css设定文本超出一行或多行就隐藏并显示省略
  • 微信小程序如何把接口调用成功的回调函数返回
  • CodeIgniter - 数据库的增删改查
  • php生成excel的三种方式
  • 小程序UI库推荐
  • 多个句子竖向排列
  • 美团,大众点评,58城市行政区域和商圈数据实
  • java.security.InvalidKeyException: Illega
  • h3>

    对未成功读入的图像跳过


    文章摘要: 大批量处理数据时,若因个别图像错误导致代码中断,从头再来比较浪费时间 对未成功读入的图像跳过(读图 import cv2) for i in range(1,1000): image = cv2.imdecode(np.fromfile(xxx.jpg),dtype=np.uint8),-1) try: image.shape except: print(fail to rea


    文章TAG:

    大批量处理数据时,若因个别图像错误导致代码中断,从头再来比较浪费时间
     
    对未成功读入的图像跳过(读图 import cv2)
     
    for i in range(1,1000):
        image = cv2.imdecode(np.fromfile('xxx.jpg'),dtype=np.uint8),-1)
        try:
            image.shape 
        except:
            print('fail to read xxx.jpg')
            continue
        ......
    若该图像可能不存在,即没有该图像的文件名,也可用try判断
     
    try:
        np.fromfile('xxx.jpg')
    except:
     
    ---------------------