求助,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)