autorope / donkeycar

Open source hardware and software platform to build a small scale self driving car.
http://www.donkeycar.com
MIT License
3.16k stars 1.3k forks source link

Performance issue in /donkeycar/parts (by P3) #926

Open DLPerf opened 3 years ago

DLPerf commented 3 years ago

Hello! I've found a performance issue in donkeycar/parts/salient.py: with tf.Session() as session(here) is repeatedly called in the loop for layer in [5, 4, 3, 2, 1](here).

tf.Session being defined repeatedly could lead to incremental overhead. If you define tf.Session out of the loop and pass tf.Session as a parameter to the loop, your program would be much more efficient. Here is the Stack Overflow post to support it.

Looking forward to your reply. Btw, I am very glad to create a PR to fix it if you are too busy.

DLPerf commented 3 years ago

Hello, I'm looking forward to your reply~

sctse999 commented 3 years ago

Yes pls do a PR. If you can submit a test case which can show the performance gap it would be fantastic.