After speaking to one of the tesseract contributors:

import os

os.environ['OMP_THREAD_LIMIT'] = '2'


Should do the job, as OMP_NUM_THREADS is an environment variable. However,
the speed difference is very small. It might be better to process several
images in parallell rather than to process one as fast as possible.





Den tis 29 maj 2018 kl 07:56 skrev nick <wcdg...@gmail.com>:

> hi
> I don't know , which file should change for *OMP_NUM_THREADS ? or wihch
> command should test ?*
>
> On Monday, May 28, 2018 at 3:10:25 PM UTC+4:30, Jakob Salomonsson wrote:
>>
>> Calling the help function in python through help(pytesseract.pytesseract)
>> yields this result, among others:
>>
>> *DATA*
>> *    OMP_NUM_THREADS = 3*
>> *    OMP_THREAD_LIMIT = 3*
>> *    RGB_MODE = 'RGB'*
>> *    __warningregistry__ = {'version': 332, ('unclosed file
>> <_io.BufferedWr...*
>> *    numpy_installed = True*
>> *    tesseract_cmd = '/anaconda3/envs/Work/bin/tesseract'*
>>
>>
>> Im specifying *tesseract_cmd *(through: * 
>> pytesseract.pytesseract.tesseract_cmd
>> = "/anaconda3/envs/Work/bin/tesseract"*) and it works as intended.
>> But when I try to do the same with *OMP_NUM_THREADS or *
>> *OMP_THREAD_LIMIT* (through: *pytesseract.pytesseract.OMP_NUM_THREADS =
>> 3 *or *pytesseract.pytesseract.OMP_THREAD_LIMIT = 3*) no multi threading
>> is happening.
>>
>>
>>
>> Den mån 28 maj 2018 kl 12:11 skrev nick <wcd...@gmail.com>:
>>
>>> how  and where we could change this variable ?
>>>
>>> --
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "tesseract-ocr" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/tesseract-ocr/HA_q6F1_34E/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> tesseract-oc...@googlegroups.com.
>>> To post to this group, send email to tesser...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/tesseract-ocr.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/tesseract-ocr/241b0072-f83e-44b4-a4c5-4136f7bbcfa9%40googlegroups.com
>>> <https://groups.google.com/d/msgid/tesseract-ocr/241b0072-f83e-44b4-a4c5-4136f7bbcfa9%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> You received this message because you are subscribed to a topic in the
> Google Groups "tesseract-ocr" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/tesseract-ocr/HA_q6F1_34E/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> tesseract-ocr+unsubscr...@googlegroups.com.
> To post to this group, send email to tesseract-ocr@googlegroups.com.
> Visit this group at https://groups.google.com/group/tesseract-ocr.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tesseract-ocr/ebc34df5-25de-48ef-90d7-f07f1df30009%40googlegroups.com
> <https://groups.google.com/d/msgid/tesseract-ocr/ebc34df5-25de-48ef-90d7-f07f1df30009%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"tesseract-ocr" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tesseract-ocr+unsubscr...@googlegroups.com.
To post to this group, send email to tesseract-ocr@googlegroups.com.
Visit this group at https://groups.google.com/group/tesseract-ocr.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tesseract-ocr/CALhJBJESr%2BK8S%3DjqjxgbHAn%2BeTz_9KLqYkR5-ER0zZ-5TMntUw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to