title: Text/Image processing in Python
body: <p><em>Brief introduction</em>:</p>
  
  <p>I'm trying to get certain texts from an image of a lot of texts.</p>
  
  <p>By just thinking, there should be at least two ways to handle this problem: </p>
  
  <p><strong>One way</strong> is first segmenting the images by text areas — for example, train the neural network with a bunch of sample images that contain the sample texts, and then let the trained model locate corresponding text areas in the real image, then crop that area out from the image, save it — and secondly use, for instance, <code>pytesseract</code> to convert image to string.</p>
  
  <p><strong>The other way</strong> is to reverse the processes. First convert the image into strings, then train the neural network with sample real texts, then let the trained model find corresponding texts in texts converted from images.</p>
  
  <hr>
  
  <p><em>So, my questions are listed below</em>:</p>
  
  <ol>
  <li><p><strong>Can this problem be solved without training a neural network?</strong> Will it be more efficient than NN, in terms of <strong><em>time taken to run the program</em></strong> and <strong><em>accuracy of results</em></strong>?</p></li>
  <li><p><strong>Among the two methods above I wrote, which one is better</strong>, in terms of <strong><em>time taken to run the program</em></strong> and <strong><em>accuracy of results</em></strong>?</p></li>
  <li><strong>Any other experienced suggestions?</strong></li>
  </ol>
  
  <hr>
  
  <p><em>Additional background information if needed</em>:</p>
  
  <p>So, I have a number of groups of screenshots of different web pages, each of which has a lot of texts on it. And I want to extract certain paragraphs from that large volume of texts. The paragraphs I want to extract express similar things but under different contexts.</p>
  
  <p>For example, on a large mixed online forum platform, many comments are made on different things, some on landscapes of mountains, some politics, some sciences, etc... As that platform cannot only have one page, there must be hundreds of pages where countless of users make their comments. Now I want to extract the comments on politics specifically from the entire forum, i.e. from all the pages that platform has. So I would use <code>Python</code> + <code>Selenium</code> to scrape the pages and save the screenshots. Now we need to go back to the questions asked above. What to do now? </p>
  
  <hr>
  
  <p>Update:</p>
  
  <p>Just a thought went by. Probably a NN trained by images that contain texts cannot give a very accurate location of wanted texts, as the NN might be only looking for arrangements of pixels instead of the words, or even meaning, that compose the sentences or paragraphs. So maybe the second method, text processing, may be better in this case? (like <code>NLP</code>?)</p>