2

我最近买了一台 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

4

2 回答 2

3

Jetson Nano 主要用于推理。即使有可能,培训也不是首选。此链接可能会有所帮助。您可以尝试使用 Nvidia 的迁移学习工具包和 Deepstream 在 Nano 上实现理想和高效的使用。

于 2020-01-01T12:27:41.953 回答
0

@Juan Carlos Jchr

嘿,只需检查https://stackexchange.com/sites

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

于 2019-12-13T18:06:06.227 回答