tensorflow / models

Models and examples built with TensorFlow
Other
76.94k stars 45.79k forks source link

tesnorflow_ object_ detection api ,total processing time . #3224

Closed A7medMaher closed 6 years ago

A7medMaher commented 6 years ago

I'm using tensorflow object detection API for detecting cars license plates, using tensorflow CPU version (I don`t have a powerful GPU), on Jupyter notebook, I noticed that it took about 8 to 12 seconds to show the output when running all the cells , but if I run DETECTION cell only is took 4 sec only .

When exporting the notebook as .py file , I should run all the file [took about 12 sec]to show the output. Is there any way to export the notebook file into [for example 2 .py files ] the first file will have all the cells that above DETECTION cell and this file might run only once and the other file will contain the content of the the DETECTION cell . I thought in this way we can optimize the processing time by running the part of the code that consumes more time in the background . I hope that my idea is clear .

the used code

https://github.com/tensorflow/models/blob/master/research/object_detection/object_detection_tutorial.ipynb

I`m using ssd_mobilenet_v1_coco_2017_11_17 [already downloaded it ]

after the test is completed , I'm planning to build a real time system using Raspberry Pi and I wondering about the time consuming .

any further suggestions will be usefull .

system infos OS Name Microsoft Windows 7 x64 Processor :Intel(R) Core(TM) i5-2410M CPU @ 2.30GHz, 2301 Mhz, 2 Core(s), 4 Logical Processor(s) Total Physical Memory 7.95 GB

Python version 3.5.2 Tensorflow version 1.4.0

tatianashp commented 6 years ago

This question is better asked on StackOverflow since it is not a bug or feature request. There is also a larger community that reads questions there. Thanks!

A7medMaher commented 6 years ago

Dear @tatianashp I already asked in StackOverflow and they sent me here . Anyway thanks for yr feedback

tatianashp commented 6 years ago

The code outside the Detection downloads and sets up the model. It needs to be executed before you can run code in the Detection cell. So, your idea won't work. On the other hand, you set up model just once and use it to process images multiple times. So, the cost of the set up might not matter if you are building a real time system.

To get better performance on CPU you might try following suggestions at https://www.tensorflow.org/performance/performance_guide#optimizing_for_cpu.

A7medMaher commented 6 years ago

Dear @tatianashp Could you explain how to perform optimization steps ? Thanks

tatianashp commented 6 years ago

Actually, it is quite complex and might not work. I didn't notice you were running on Windows.

The guide that I referenced suggests that you build TensorFlow from source and use Intel MKL. But, we do not support building from source on Windows. You can try anyway, following instructions at https://www.tensorflow.org/install/install_sources. It might work.