深度学习模型训练速度非常慢的Jetson Nano

时间:2019-12-13 16:49:11

标签: python keras deep-learning nvidia-jetson nvidia-jetson-nano

我最近购买了Jetson Nano,对此一切感到惊讶。但是我不知道发生了什么,因为我用keras创建了一个非常简单的神经网络,并且它花费了很长时间。我知道花了很长时间,因为我在PC的CPU中运行了相同的ANN,并且它比jetson nano更快。

代码如下:

import numpy as np
import matplotlib.pyplot as plt
import pandas as pd

dataset = pd.read_csv('Churn_Modelling.csv')
X = dataset.iloc[:, 3:13].values
y = dataset.iloc[:, 13].values

from sklearn.preprocessing import LabelEncoder, OneHotEncoder
labelencoder_X_1 = LabelEncoder()
X[:, 1] = labelencoder_X_1.fit_transform(X[:, 1])
labelencoder_X_2 = LabelEncoder()
X[:, 2] = labelencoder_X_2.fit_transform(X[:, 2])
onehotencoder = OneHotEncoder(categorical_features = [1])
X = onehotencoder.fit_transform(X).toarray()
X = X[:, 1:]

from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.2, random_state = 0)

from sklearn.preprocessing import StandardScaler
sc = StandardScaler()
X_train = sc.fit_transform(X_train)
X_test = sc.transform(X_test)

from tensorflow import keras
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense

classifier = Sequential()

classifier.add(Dense(units = 6, kernel_initializer = 'uniform', activation = 'relu', input_dim = 11))

classifier.add(Dense(units = 6, kernel_initializer = 'uniform', activation = 'relu'))

classifier.add(Dense(units = 1, kernel_initializer = 'uniform', activation = 'sigmoid'))

classifier.compile(optimizer = 'adam', loss = 'binary_crossentropy', metrics = ['accuracy'])

classifier.fit(X_train, y_train, batch_size = 10, epochs = 100)

y_pred = classifier.predict(X_test)
y_pred = (y_pred > 0.5)

我应该提到,当然,我正确安装了TensorFlow GPU库,而不是正常的TensorFlow,实际上,我使用了以下链接中的资源:TensorFlow GPU Jetson Nano

2 个答案:

答案 0 :(得分:1)

Jetson Nano主要用于推理。即使可能,也不优选训练。 这个link可能会有所帮助。 您可以尝试使用Nvidia的Transfer Learning Toolkit和Deepstream在Nano上实现理想和有效的使用。

答案 1 :(得分:0)

@Juan Carlos Jchr

嘿,只需选中https://stackexchange.com/sites

我认为您的问题会在这里得到更好的回答:https://ai.stackexchange.com/