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

Processing time for paddleocr with multiprocessing #14234

Open
FRAki73 opened this issue Nov 15, 2024 · 1 comment
Open

Processing time for paddleocr with multiprocessing #14234

FRAki73 opened this issue Nov 15, 2024 · 1 comment

Comments

@FRAki73
Copy link

FRAki73 commented Nov 15, 2024

I measured the processing time for OCR by executing the following code.
The execution results are as follows, and the processing time is about 5 times longer when executed with multiprocessing.
I would like to know why the time is getting longer and what to do about it.
Can someone please help me?

Processing time of OCR: 1.1000 [sec]
OCR Result: The difficult thing in the life is
Processing time of OCR: 5.5675 [sec]
OCR Result: The difficult thing in the life is

import time
import multiprocessing
from multiprocessing import Process

#paddle OCR
from paddleocr import PaddleOCR

def normalEntry():
    processes = []
    p = Process(target=OCR_runnable, args=())
    processes.append(p)
    p.start()

    for process in processes:
        process.join()

def OCR_runnable():

    ocr = PaddleOCR(use_angle_cls=False, lang='en', show_log=False)

    start_time = time.time()
    result = ocr.ocr("./test.png", cls=False)
    end_time = time.time()
    elapsed_time = end_time - start_time
    print(f"Processing time of OCR: {elapsed_time:.4f} [sec]")
    print("OCR Result: " + result[0][0][1][0])

if __name__ == '__main__':
    multiprocessing.freeze_support()
    OCR_runnable()
    normalEntry()

test

Originally posted by @FRAki73 in #14221

@freemedom
Copy link

freemedom commented Nov 22, 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
Development

No branches or pull requests

2 participants