调整CIFAR-10数据集大小时出现内存错误

时间:2018-07-22 07:09:30

标签: python image numpy scipy resize

我正在使用转移学习,使用预先训练的ResNet50模型对CIFAR-10数据集进行分类。但是问题在于此模型接受的最小大小为(197,197),而CIFAR-10数据集的大小为(32,32)。因此,我使用此代码将模型的大小调整为(200,200)

input_list = ['foo','bar','baz']
for i in range(-1,-len(input_list)-1,-1)
    print(input_list[i])

是否有任何有效的方法来执行此操作,因为它会引起# Reshaping the training data X_train_new = np.array([misc.imresize(X_train[i], (200, 200, 3)) for i in range(0, len(X_train))]).astype('float32') # Preprocessing the data, so that it can be fed to the pre-trained ResNet50 model. resnet_train_input = preprocess_input(X_train_new) # Creating bottleneck features for the training data train_features = model.predict(resnet_train_input) # Saving the bottleneck features np.savez('resnet_features_train', features=train_features) 升高。这是回溯:

  

()中的MemoryError跟踪(最近一次通话最近)         1#重塑训练数据   ----> 2 X_train_new = np.array([misc.imresize(X_train [i],(200,200,3))for i in range(0,len(X_train))])。astype('float32' )         3         4#预处理数据,以便可以将其输入经过预先训练的ResNet50模型。         5 resnet_train_input =预处理输入(X_train_new)

     

MemoryError:

0 个答案:

没有答案