alexstaravoitau / behavioral-cloning

Behavioral cloning: end-to-end learning for self-driving cars.
http://navoshta.com/end-to-end-deep-learning/
Apache License 2.0
103 stars 30 forks source link

Tip: in `data.py` it is significantly faster to use Python lists instead of `np.append()` #1

Open sebasibarguen opened 7 years ago

sebasibarguen commented 7 years ago

Hey! Awesome code, read you blog post and found your data augmentation methods awesome.

I checked out the data.py file, and noticed you were using np.append to add a new image to the feature set. It is much faster to first use Python lists, and then convert them numpy arrays later. It can be from 10 -30 times faster.

So you could do something like:

x = []
y = []
...
x.append(image)
y.append(angle)
...
x = np.asarray(x)
y = np.asarray(y)
alexstaravoitau commented 6 years ago

Thanks @sebasibarguen, awesome hint! I know it's an old issue (sorry my notifications were turned off), but feel free to submit a PR if you happen to work on this again. 🙂