热门

最新

红包

立Flag

投票

同城

我的

发布
qq_30328203
qq_30328203
6 年前
trueqq_30328203

我用#CSDN#这个app发现了有技术含量的博客,小伙伴们求同去《web-security第六期:畅谈 Spring Security Authorization(授权)》, 一起来围观吧 https://blog.csdn.net/qq_42013035/article/details/106712074?utm_source=app

CSDN App 扫码分享
分享
评论
点赞
打赏
  • 复制链接
  • 举报
下一条:
求助,TypeError: only integer scalar arrays can be converted to a scalar index代码如下:import globimport osimport cv2import numpy as np classification = ['airplane','automobile','bird','cat','deer','dog','frog','horse','ship','truck']def unpickle(file): import pickle with open(file, 'rb') as fo: dict = pickle.load(fo, encoding='bytes') return dictfolders = r'地址'trfiles = glob.glob(folders + "/data_batch*")data = []labels = []for file in trfiles: dt = unpickle(file) data += list(dt[b"data"]) labels += list(dt[b"data"]) print(labels)imgs = np.reshape(data, [-1, 3, 32, 32]) for i in range(imgs.shape[0]): im_data = imgs[i, ...] im_data = np.transpose(im_data, [1, 2, 0]) im_data = cv2.cvtColor(im_data, cv2.COLOR_RGB2BGR) f = "{},{}".format(r'地址', classification[labels[i]]) if not os.path.exists(f): os.mkdir(f) cv2.imwrite("{}/{}.jpg".format(f, str(i)), im_data)
立即登录