【发布时间】:2023-03-06 10:39:01
【问题描述】:
我目前正在将 google colab 用于我的手语识别模型深度学习项目之一,我正在加载我从 Google Drive 创建的自定义数据集。我的数据集包含不同的字母文件夹,其中包含各个字母的符号。
这只是我用来创建训练数据的代码的一部分
training_data = []
def create_training_data():
for category in CATEGORIES:
path = os.path.join(DATADIR,category) # create path to image of respective alphabet
class_num = CATEGORIES.index(category) # get the classification for each alphabet A : 0, C : 1, D : 2,...
for img in tqdm(os.listdir(path)): # iterate over each image
img_array = cv2.imread(os.path.join(path,img) ,cv2.IMREAD_GRAYSCALE) # convert to array
training_data.append([img_array, class_num]) # add this to our training_data
create_training_data()
X = []
y = []
for features,label in training_data:
X.append(np.array(features))
y.append(label)
但只是这个过程占用了所有可用的 RAM,那么我有什么办法可以最大限度地减少 RAM 使用量??
【问题讨论】:
标签: python google-colaboratory