1
$\begingroup$

I recently bought a Jetson Nano and I'm amazed with everything about it. But I don't know what is happening, because I created a very simple neural network with keras and it's taking way to long. I know is taking to long, because I runned the same ANN in my PC's CPU and it was faster than the jetson nano.

Here's the code:

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)

I should mention that of course, I did the correct installation of TensorFlow GPU library and not the normal TensorFlow, in fact I used the resources in this link: TensorFlow GPU Jetson Nano

$\endgroup$
  • $\begingroup$ Hi Juan and welcome to this community! Try asking this question on Data Science SE. This question is related to the performance of certain hardware, which should be off-topic here, where we focus on theoretical and philosophical aspects of AI. $\endgroup$ – nbro Dec 13 '19 at 20:05
0
$\begingroup$

First of all, you mentioned that you installed the correct version of Tensorflow on Jetson. You can list the available Tensorflow devices with:

from tensorflow.python.client import device_lib
print(device_lib.list_local_devices())

And make sure that you see the GPU available.

More importantly, Jetson Nano has a 128-core NVIDIA Maxwell™ architecture-based GPU. This might not be a powerful GPU for training a neural network with. As you can see here, in NVIDIA's official benchmark, they only tested trained models (i.e. classifications, object detections and segmentations). You can consider training your Keras model using another hardware and use it for labeling, classification, or etc. in your Jetson.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.