-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Low FPS when with visualisation #18
Comments
Hi, Eoinoe Because camera uses OpenCV but visualization uses PIL. draw_bounding_box_on_image_array() function in visualization_utils.py:
To make matters worse, these are called in visualize_boxes_and_labels_on_image_array() function by object. performance check:
output with 300x300 image size:
output with 1280x720 image size:
Image conversion of 300x300 size is processed within 1 second. However, half of the processing time is used for this conversion. Rewrite PIL to OpenCV in visualization_utils.py, it can be sped up. I wrote sample code for ssd_mobilenet_v1.
Note:
|
@naisy again great work! Would you mind filing a Pull Request i would very much like to include this feature! ANother question: Does your multi-processing show performance increase? Has it better results than multi threading? Also: Try pulling my newest master, where the config is moved from a yml file to an own class, this should also make your code for multiprocessing much leaner, as you dont have to load each config variable again, but just pass the class. EDIT: I added you cv vis util, i already did an cv implementation for the deeplab models but to adjust it also for object_detection was a very good thing! EDIT2: I need to additionally update some code to use OpenCV instead of PIL for the mask drawing.
Image and ImageColor are PIL Packages EDIT2: I did it:
Its added to the latest commit |
Hi, @gustavz, I added the following two functions.
By searching with _cv you will find the fixes. I deleted the following two functions.
Also, I changed the color definition for OpenCV. I didn't fix next three functions.
If this code runs on other models, it will need to modify these functions. My multi-processing code is bad performance than multi-threading.
The fastest one is Pipe(). But that is slower than multi-threading. Certainly yml has more code in multi-processing. Therefore, I think it is good idea to modify parameters with yml and prepare a class to load it. |
alright, now i have the config class plus the yaml file. have a try :) |
Hi @gustavz, Nice! v2.0's both run_objectdetection.py and run_deeplab.py worked! How about in your environment? |
@naisy Yeah i face similar results. Another point:
The Problem is that this correctly draws the colored masks, but darkens everything around the mask, so if you have several objects on the input image, everything gets nearly black. Do you have an idea how to solve this corretcly?
Instead of the cvtColor function, but i has the same effect. |
Hi @gustavz, I saw run_deeplab.py. And about color making,
|
Thanks for the hints! Very useful as always @naisy 👍 but be carefull you only use 20 colors. Deeplab is trained on 20+1(Background) Classes. |
Yes! Need 20+1! |
The FPS that my Jetson TX2 Outputs fluctuates a lot when I set ‘visualize’ to true in the config.yml file. The FPS drop significantly (down to 7-8FPS from 33-35FPS) when there are many objects present. I was wondering if anyone else experienced this and knew where the bottleneck was occurring.
I changed the object_detection.py script slightly, so that it can use a video as an Input, and the drop in frames does not occur when I set ‘visualize’ to false (in the config.yml).
I understand that visualising the output will reduce the FPS, but I was not expecting it to be so drastic. It would be greatly appreciated if someone could explain why the drop is so drastic or even how to reduce the drop in frames
The text was updated successfully, but these errors were encountered: