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

Prevent mtcnn logging #128

Open
freedom9393 opened this issue Mar 31, 2024 · 8 comments
Open

Prevent mtcnn logging #128

freedom9393 opened this issue Mar 31, 2024 · 8 comments

Comments

@freedom9393
Copy link

When I test mtcnn with huge number of images, it shows long logs:

1/1 [==============================] - 0s 11ms/step
1/1 [==============================] - 0s 12ms/step
1/1 [==============================] - 0s 12ms/step
1/1 [==============================] - 0s 11ms/step
1/1 [==============================] - 0s 11ms/step
1/1 [==============================] - 0s 11ms/step
3/3 [==============================] - 0s 1ms/step
1/1 [==============================] - 0s 11ms/step
1/1 [==============================] - 0s 10ms/step
1/1 [==============================] - 0s 12ms/step
1/1 [==============================] - 0s 12ms/step
1/1 [==============================] - 0s 11ms/step
1/1 [==============================] - 0s 10ms/step
1/1 [==============================] - 0s 10ms/step
1/1 [==============================] - 0s 10ms/step

and I think this process consumes more time. So, is there any way to prevent showing logs and testing faster?

@ladyshen
Copy link

ladyshen commented Mar 31, 2024 via email

@saleweaver
Copy link

Yes please!

@ladyshen
Copy link

ladyshen commented Jul 20, 2024 via email

@saleweaver
Copy link

saleweaver commented Jul 20, 2024

@freedom9393 the only thing that worked for me is to surpress everything those methods output...

@contextmanager
def suppress_stdout_stderr():
    with open(os.devnull, "w") as devnull:
        old_stdout = sys.stdout
        old_stderr = sys.stderr
        sys.stdout = devnull
        sys.stderr = devnull
        try:
            yield
        finally:
            sys.stdout = old_stdout
            sys.stderr = old_stderr

And use like

with suppress_stdout_stderr():
    results = detector.detect_faces(rgb_frame)

@wpritom
Copy link

wpritom commented Aug 28, 2024

is it originating from the mtcnn library or any other supporting library? I tried to dig in but didn't find it in the mtcnn library.

@ladyshen
Copy link

ladyshen commented Aug 28, 2024 via email

@saleweaver
Copy link

is it originating from the mtcnn library or any other supporting library? I tried to dig in but didn't find it in the mtcnn library.

I think it's from an underlying library. I found no output whatsoever from this one.

@wpritom
Copy link

wpritom commented Aug 28, 2024

is it originating from the mtcnn library or any other supporting library? I tried to dig in but didn't find it in the mtcnn library.

I think it's from an underlying library. I found no output whatsoever from this one.

Yes. The issue can be solved manually here. However, verbose flag should be added in the MTCNN library too.

#121

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants