Skip to content
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

Taking too long to process images. How to leverage GPU properly? #23

Closed
aman-captech opened this issue Oct 17, 2018 · 8 comments · Fixed by #133
Closed

Taking too long to process images. How to leverage GPU properly? #23

aman-captech opened this issue Oct 17, 2018 · 8 comments · Fixed by #133

Comments

@aman-captech
Copy link

aman-captech commented Oct 17, 2018

I am using TensorFlow 1.8.0. with a Nvidia 960M GPU. I have obtained the following results on two sets of 5 images with different resolutions:
No. of images; Resolution; Runtime; GPU Memory used:
5; 3280x2460; 220secs; 3176Mib
5; 167x215; 61secs; 380Mib

Can anyone suggest why is it taking so long to process these images. The inference time seems to be way off from the benchmark results given in the repo.
Also for the second set of low res. images why isn't more GPU memory being utilised to process faster?
Am I unable to leverage the GPU properly? If yes, please help me out with how to go about this?
Has anyone else experienced such results?

@thelastfunction
Copy link

Hi aman,
Have you solved the problem as I am also facing the same problem. The inference time is way more than what is in the benchmark.

@lishangqiu
Copy link

Hi aman,
I am facing the same problem too. Did you solve it? I wonder if we can predict on batch.

@thelastfunction
Copy link

Hi,
I figured it out , you may not be doing inference on Batch on Images or It may be using CPU as default make sure that you have installed tensorflow-gpu and performed Inference on Batch of Images

@photoszzt
Copy link

@thelastfunction How do you do batch of images? detect_faces doesn't accept a batch of images.

@JiaHeng-DLUT
Copy link

@photoszzt I am facing the same problem too. Did you solve it? How to predict on batch?

@photoszzt
Copy link

@JiaHeng-DLUT I switch to RetinaFace: https://github.com/deepinsight/insightface/tree/master/RetinaFace with this implementation: https://github.com/biubug6/Pytorch_Retinaface

@JiaHeng-DLUT
Copy link

@photoszzt Thanks!

@chaudharyachint08
Copy link

First repository appeared to be removed, for me across three it looks like MTCNN is faster on CPU than GPU

ipazc pushed a commit that referenced this issue Oct 7, 2024
…tch processing support

- Completely refactored the MTCNN implementation following best coding practices.
- Optimized code by removing unnecessary transpositions, resulting in faster computation. Fixes #22.
- Transposed convolutional layer weights to eliminate the need for additional transpositions during preprocessing and postprocessing, improving overall efficiency.
- Converted preprocessing and postprocessing functions into matrix operations to accelerate computation. Fixes #14, #110.
- Added batch processing support to enhance performance for multiple input images. Fixes #9, #71.
- Migrated network architecture to TensorFlow >= 2.12 for improved compatibility and performance. Fixes #80, #82, #90, #91, #93, #98, #104, #112, #114, #115, #116.
- Extensively documented the project with detailed explanations of thresholds and parameters. Fixes #12, #41, #52, #57, #99, #122, #117.
- Added support for selecting computation backends (CPU, GPU, etc.) with the `device` parameter. Fixes #23.
- Added new parameters to control the result format (support for x1, y1, x2, y2 instead of x1, y1, width, height) and the ability to return tensors instead of dictionaries. Fixes #72.
- Configured PyLint support to ensure code quality and style adherence.
- Organized functions into specific modules (`mtcnn.utils.*` and `mtcnn.stages.*`) for better modularity.
- Created Jupyter notebooks for visualization and ablation studies of each stage, allowing detailed exploration of layers, weights, and intermediate results. Fixes #88, #102.
- Added a comprehensive training guide for the model. Fixes #35, #39.
- Updated README with information on the new version, including the complete Read the Docs documentation that describes the process, theoretical background, and usage examples. Fixes #53, #73.
- Configured GitHub Actions for continuous integration and delivery (CI/CD).
- Fixed memory leak by switching to a more efficient TensorFlow method (`model(tensor)` instead of `model.predict(tensor)`). Fixes #87, #109, #121, #125, #128.
- Made TensorFlow an optional dependency to prevent conflicts with user-installed versions. Fixes #95.
- Added comprehensive unit tests for increased reliability and coverage.
@ipazc ipazc mentioned this issue Oct 8, 2024
@ipazc ipazc closed this as completed in #133 Oct 8, 2024
@ipazc ipazc closed this as completed in b6eba4b Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants