datitran / object_detector_app

Real-Time Object Recognition App with Tensorflow and OpenCV

Home Page:https://medium.com/towards-data-science/building-a-real-time-object-recognition-app-with-tensorflow-and-opencv-b7a2b4ebdc32

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why use Process and Pool?

Aspirinkb opened this issue · comments

commented

I see that Process and Pool are used in 'object_detection_app.py'. Do you think the Process is necessary?

Nope the Process class is not necessary. Thanks for pointing this out. In an earlier version, I started with process and then switched to Pool without removing the Process class. I updated the code and also add explicit termination of the workers at the end.

commented

I comment out the statements about Pool, and add process.start() in the .py file. It runs without any problems. Why do you use Pool, not Process? I just do not know the advantage of Pool. Could you give any advice?

Well as you can read from the official python documentation a pool creates a pool of workers processes. You can also create multiple processes as well. I just use pool for convenience. There is also some pros/cons using pool vs process but I think the main difference is that using the process class, it spins up the workers independently whereas with the pool class it is not. And this has some implication on CPU cores etc..