@zdenko This discussion maybe better suited for tesseract-dev forum or do you want to track it as a issue on github?
ShreeDevi ____________________________________________________________ भजन - कीर्तन - आरती @ http://bhajans.ramparivar.com On Sat, Apr 28, 2018 at 1:19 PM, Janpieter Sollie <[email protected] > wrote: > Would it be a problem for you if I rewrite the opencl engine completely, > and you people provide me help to link the tesseract kernel -> opencl > engine parts? > in attachment, I already have a list of features I'd like to port to > openCL. As this uses the GPU in a heavy way, I will implement multi-card > support on the host. > Is it a problem for you guys to think of tesseract 5.0 as a milestone? > > > 2018-04-27 15:53 GMT+00:00 Janpieter Sollie <[email protected]>: > >> if I'm right, a neural net is about the engine parts, not the image >> characterisation rendering method, am I right? because I see many >> presentations, and most of them talk about the history of tesseract, but >> that's not what I need >> >> 2018-04-27 14:27 GMT+00:00 ShreeDevi Kumar <[email protected]>: >> >>> Please see >>> >>> https://github.com/tesseract-ocr/tesseract/wiki/4.0-with-LSTM >>> >>> For info about neural nets used by tesseract >>> >>> On Fri 27 Apr, 2018, 7:48 PM Janpieter Sollie, < >>> [email protected]> wrote: >>> >>>> I had a quick thought about what you could offload to opencl. I will >>>> need some help from you people (I am a C programmer, not C++, at least not >>>> experienced) to do the host code, but this algorithm is perfectly >>>> optimizeable in openCL. >>>> the way I'd do it: >>>> >>>> prerequirements: >>>> - you can define 65k offsets (x,y) in whose you want the openCL engine >>>> to look for dots (x,y), the optimal position and closest neighbour can be >>>> reported in the first part. >>>> - you can make a RAW image of both the image and the characters. size >>>> of the letters doesn't matter, but they must be trimmed properly >>>> >>>> 1. you give me a matrix of 256*256 offsets(short, short) to analyze, >>>> with a max of 64 dots (char, char) (I assume these are neurons) to analyze >>>> in each offset. >>>> so, this gives you a start memory usage of 2⁸ * 2⁸ *4 + 64*2 = 256k + >>>> 128 bytes >>>> each dot MUST contain a black pixel. >>>> then we add the image, this is a charimage of max (to be discussed with >>>> you guys), I assume a 4096*4096 pixel image would be fine, especially when >>>> a character can contain a 4x4 matrix defining a 0/1 (black/white) value. >>>> 2. Then I follow these steps in the openCL engine: >>>> - we analyze the neurons >>>> - draw a cirle around them of x black points. (this circle can be >>>> 0, in which case the neuron is white), for which the circle is completely >>>> black >>>> - when we encounter one or more white points, a direction of the >>>> points is calculated. if there's no whitespace at the other side, the >>>> neuron offset is moved for x/2 in the opposite direction and analyze neuron >>>> is restarted for x/2. else, quit the 'analyze neuron' part. This can be >>>> done in local memory, in which case it will cost you 256*2=512 bytes of >>>> local ram to determine the optimal neuron position. Most graphic cards have >>>> a limit of 32k ram, so this is no problem :-) >>>> - determine the closest dot next to this one: >>>> for each dot != this one, draw a line of black points, if no line >>>> can be found, jump to next dot. >>>> watch distance. If it's smaller than the previous neuron && this >>>> dot id hasn't a link pointing from the destination to this one, save dot >>>> id. >>>> so, at the end: >>>> - each neuron of each offset is optimally centered in a return >>>> matrix of 256*256*64*2 = 2²³ = 8M of memory >>>> - each neuron has a unique id to its closest neighbour, to which >>>> it's guaranteed to be attached. an id of -1 means no id could be found. >>>> 256*256*64 = 4M of memory >>>> >>>> 3. we focus on neuron list -> character mapping. this is a separate >>>> kernel. A "probability" factor is involved here, but I will think about it >>>> further. I suggest to use a list of 64 character images at once, otherwise >>>> you need lots of memory :-) >>>> - define the top, left and right neuron. create a zoom factor for the >>>> image. calculate the aspect ratio. The probability is >>>> 1-diff(aspect_ratio1, aspect_ratio2) >>>> - analyze each link in the font character. total probability *= >>>> (found_link_length / total_link_length) >>>> - report the probability. >>>> On the PC: the character with the highest probability is the character >>>> you 're looking for. Be aware that you need to compare the possibilities >>>> of the different offsets if they overlap. >>>> >>>> if the tesseract project can use this, please let me know >>>> >>>> 2018-04-27 9:36 GMT+00:00 Zdenko Podobny <[email protected]>: >>>> >>>>> Only documentation we have is code itself ;-) But you can start with >>>>> searching for opencl issue in tesseract issue tracker on github... >>>>> >>>>> Zdenko >>>>> >>>>> >>>>> pi 27. 4. 2018 o 10:56 Janpieter Sollie <[email protected]> >>>>> napísal(a): >>>>> >>>>>> I'd be glad to help. using tesseract 4, I am able to perform a 90% >>>>>> accuracy on OpenCL. I do not have any experience with neural networks >>>>>> (i'm >>>>>> just a high-school (no college educated IT-support guy with some >>>>>> knowledge >>>>>> about OpenCL), so can you recommend me some documentation to understand >>>>>> the >>>>>> engine of tesseract 4? >>>>>> >>>>>> 2018-04-27 10:50 GMT+02:00 Zdenko Podobny <[email protected]>: >>>>>> >>>>>>> If you have experience your help will be warmly welcomed. >>>>>>> OpenCL is not maintained and it is on good way to be removed if >>>>>>> maintainer/contributor will not be found. >>>>>>> Anyway it is not used extensively, so there is a place for >>>>>>> improvement, >>>>>>> >>>>>>> Zdenko >>>>>>> >>>>>>> >>>>>>> pi 27. 4. 2018 o 10:21 Janpieter Sollie <[email protected]> >>>>>>> napísal(a): >>>>>>> >>>>>>>> Hello everyone, >>>>>>>> >>>>>>>> I have a question about the openCL selection procedure of tesseract: >>>>>>>> >>>>>>>> my output: >>>>>>>> >>>>>>>> [DS] Profile read from file (tesseract_opencl_profile_devices.dat). >>>>>>>> [DS] Device[1] 1:Fiji score is 0.202927 >>>>>>>> [DS] Device[2] 1:Ellesmere score is 1.468799 >>>>>>>> [DS] Device[3] 1:Ellesmere score is 1.468799 >>>>>>>> [DS] Device[4] 1:Bonaire score is 1.533776 >>>>>>>> [DS] Device[5] 1:Tonga score is 0.184236 >>>>>>>> [DS] Device[6] 0:(null) score is 1.123015 >>>>>>>> [DS] Selected Device[5]: "Tonga" (OpenCL) >>>>>>>> >>>>>>>> Ugh, this is weird .. why does tesseract take my Tonga instead of >>>>>>>> my fiji device? can I force it to use the fiji? >>>>>>>> I understand the ellesmere have lower access times (they 're behind >>>>>>>> a pcie switch), but fiji and tonga are both directly connected via a >>>>>>>> pcie >>>>>>>> 2.0 X16 bus. Do we need a better tesseract selection procedure? >>>>>>>> If so, I'm quite skilled at opencl, I'd be glad to help! >>>>>>>> >>>>>>>> kind regards, >>>>>>>> >>>>>>>> Janpieter >>>>>>>> >>>>>>>> -- >>>>>>>> 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 [email protected]. >>>>>>>> To post to this group, send email to [email protected] >>>>>>>> . >>>>>>>> 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/4568b2b8-532 >>>>>>>> d-457c-920b-60407e7b278e%40googlegroups.com >>>>>>>> <https://groups.google.com/d/msgid/tesseract-ocr/4568b2b8-532d-457c-920b-60407e7b278e%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/to >>>>>>> pic/tesseract-ocr/uNRDFTavDfc/unsubscribe. >>>>>>> To unsubscribe from this group and all its topics, send an email to >>>>>>> [email protected]. >>>>>>> To post to this group, send email to [email protected]. >>>>>>> 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/CAJbzG8wHCUB >>>>>>> mAs3Q8%3D%2BzBPODuuDPS2g%3DZ-6Gve%3DLWpzVWwvTkw%40mail.gmail.com >>>>>>> <https://groups.google.com/d/msgid/tesseract-ocr/CAJbzG8wHCUBmAs3Q8%3D%2BzBPODuuDPS2g%3DZ-6Gve%3DLWpzVWwvTkw%40mail.gmail.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 [email protected]. >>>>>> To post to this group, send email to [email protected]. >>>>>> 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/CAJEYFEaZNSW >>>>>> sV-hL-9DYWJahUR-8_3Wi%2BO5XwRkwFPWZHZgSOA%40mail.gmail.com >>>>>> <https://groups.google.com/d/msgid/tesseract-ocr/CAJEYFEaZNSWsV-hL-9DYWJahUR-8_3Wi%2BO5XwRkwFPWZHZgSOA%40mail.gmail.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/to >>>>> pic/tesseract-ocr/uNRDFTavDfc/unsubscribe. >>>>> To unsubscribe from this group and all its topics, send an email to >>>>> [email protected]. >>>>> To post to this group, send email to [email protected]. >>>>> 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/CAJbzG8yBJ8U >>>>> cP-Oy-fkJ_zcszj2OUDag3zJdEd_qZbQpD0F6Yg%40mail.gmail.com >>>>> <https://groups.google.com/d/msgid/tesseract-ocr/CAJbzG8yBJ8UcP-Oy-fkJ_zcszj2OUDag3zJdEd_qZbQpD0F6Yg%40mail.gmail.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 [email protected]. >>>> To post to this group, send email to [email protected]. >>>> Visit this group at https://groups.google.com/group/tesseract-ocr. >>>> To view this discussion on the web visit https://groups.google.com/d/ms >>>> gid/tesseract-ocr/CAJEYFEYVKhsUxP280ZXwMZoS262d8scEbYrCF9QE- >>>> 0BseUdg6w%40mail.gmail.com >>>> <https://groups.google.com/d/msgid/tesseract-ocr/CAJEYFEYVKhsUxP280ZXwMZoS262d8scEbYrCF9QE-0BseUdg6w%40mail.gmail.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/to >>> pic/tesseract-ocr/uNRDFTavDfc/unsubscribe. >>> To unsubscribe from this group and all its topics, send an email to >>> [email protected]. >>> To post to this group, send email to [email protected]. >>> Visit this group at https://groups.google.com/group/tesseract-ocr. >>> To view this discussion on the web visit https://groups.google.com/d/ms >>> gid/tesseract-ocr/CAG2NduVubSs4PBoX21Yx06foCunrOedBf1Tzq-_fT >>> 19MWtN55A%40mail.gmail.com >>> <https://groups.google.com/d/msgid/tesseract-ocr/CAG2NduVubSs4PBoX21Yx06foCunrOedBf1Tzq-_fT19MWtN55A%40mail.gmail.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 [email protected]. > To post to this group, send email to [email protected]. > 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/CAJEYFEYc6eNJQKzg4s_n1%3DyhmEwTp3VMHO6% > 3DcbPa3iengCsv8Q%40mail.gmail.com > <https://groups.google.com/d/msgid/tesseract-ocr/CAJEYFEYc6eNJQKzg4s_n1%3DyhmEwTp3VMHO6%3DcbPa3iengCsv8Q%40mail.gmail.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 [email protected]. To post to this group, send email to [email protected]. 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/CAG2NduV8D%3DU%3D1eX-u8GzhHN5MvD_bwFdiSM5nPdYXZ9QhMEErg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

