Answers.Body: <p>I think Demento has answered it well, but probably below can add some more understanding to you.</p>
  
  <p>[1] Usually the data stored for image processing relates to the <strong>Image Pixel Densities</strong>(<em>as per the many courses i visited online</em>), which can be very well maintained using a <strong>matrix of pixel density values</strong>, corresponding to the resolution of each image.
  Then it depends on the image's color spectrum (<em>is it a colored or a gray scale</em>); as per the case of hand written text recognition you don't really require the pixel values for a colored image.</p>
  
  <p>Consider that if you have a colored image then you have to store the RGB values for each pixel, thus <strong>tripling</strong> the matrix size, and the training could be very well done with just the gray scale values, thus it would be better to convert all the images to gray scale in preprocessing step and also take care to convert the image to gray scale when you actually use the trained network to recognize an image (<em>just a novice mistake!</em>).</p>
  
  <p>As per the <strong>storage</strong> for the required matrix form of the pixel density values, a flat file storage would suffice, but I would recommend libraries instead <em>(if working in python or other alternatives</em>), like <strong>pandas</strong> and <strong>numpy</strong>. For these libraries provide a robust solution for data management and retrieval.</p>
  
  <p>For more details - <a href="https://docs.scipy.org/doc/numpy-dev/user/quickstart.html" rel="nofollow noreferrer">https://docs.scipy.org/doc/numpy-dev/user/quickstart.html</a>
  <a href="https://github.com/pandas-dev/pandas" rel="nofollow noreferrer">https://github.com/pandas-dev/pandas</a></p>
  
  <p>[2] Now I would emphasize on why not to use any DataBase(DB) for the storage of such information.
  Firstly the integration of it would only result in an <strong>unnecessary overhead</strong> to your efforts of training the Network and also when you would want to recognize an image(<em>which would always be a single matrix form of it's Image Pixel Densities</em>), you would require the connection to the same DB and would also need to make an <strong>insertion</strong> to it first, for the script to be able to extract from there and make recognition(<em>not recomended</em>).</p>
  
  <p>There is a fact we don't really concern ourselves with is the quality of the training image dataset, we do ignore the presence of <strong>noise</strong> in the dataset(<em>would be minimum if using a preprocessed standard data set such MNIST <a href="http://yann.lecun.com/exdb/mnist/" rel="nofollow noreferrer">http://yann.lecun.com/exdb/mnist/</a></em>), but if creating one's own data set we have to consider noise and rectify accordingly in the preprocessing task itself.</p>
  
  <p>With noise I mean <strong>loss or overlap of pixel density information</strong> which is usually adds a <strong>blurring effect</strong> to the images, and can seriously damage the training metrics.
  To overcome it, there are approaches to rectify the pixel values with a prior learning methods such as extracting data from obfuscated images,
   see link- <a href="https://arxiv.org/pdf/1609.00408.pdf" rel="nofollow noreferrer">https://arxiv.org/pdf/1609.00408.pdf</a>.</p>
  
  <p><em>With the above case you would require to make updates in the DB for very single record in the preprocessing task even before you start to train the Network, thus it can increase the total requests to the DB in multifolds and thus impeding the whole benefit of using it in the first place</em>.</p>
  
  <p>I suppose the above should give you fair idea, about the kind of data to store and the Data Storage to prefer accordingly.
  I worked out the Digit Classification using MNIST data set with obscuration using a NN Pipeline, to refer <a href="https://github.com/kchopra456/Digit-Classification-and-Image-Obfuscation-ANN" rel="nofollow noreferrer">https://github.com/kchopra456/Digit-Classification-and-Image-Obfuscation-ANN</a>.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-05T06:49:26.840Z
Answers.Text: thank you for your response, I really admit your justification for 'no storage'.  let consider the image of '1'(digit). I have 3 images in size respectively 234kb,2mb,65kb. I trained my system with this  data. now I am not really wish to store the 234+2048+65 of kb of data. instead of this a vector representation data that emphasize strecture of '1'. that data will be improved by the next trainning.
Answers.UserDisplayName: Sathish Kumar D
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-05T06:53:07.247Z
Answers.Text: like us. we know the structure of alphabets by the training of the view we seen in childhood. But we are not having the data about which color and which scale (in books).
Answers.UserDisplayName: Sathish Kumar D
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-05T06:54:02.197Z
Answers.Text: is it possible to store that kind of data. is there exists any data structure for that
Answers.UserDisplayName: Sathish Kumar D
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-05T08:15:08.483Z
Answers.Text: From my understanding till now, you want to train the network not by pixel densities as a direct classifier but rather using a figurative vector scale(_some knowledge about how we draw that character on paper_). I'm not sure about the feasibility of that, but i would like to point out something I feel that can get you in a bottleneck.
  You mention that you want to use the vector representation achieved after each learning iteration to modify the input **data set** for the next iteration!
  This might not be a good approach because the intermediate data set is guaranteed to have a lot of noise.
Answers.UserDisplayName: Karan Chopra
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-05T08:24:21.040Z
Answers.Text: Also about the varying sizes of images as **Input Data Set**, can be handled easily in preprocessing.
  You can easily compress the  images to suitable size, because we don't really require high scale images for character classification; as not much detail is required in an image to represent a character.
  Go for gray scale images for about 400 pixel size and your network will work miracles!, even though you wan to test on a real world image that would be of much higher resolution; you can just take the image through the preprocessing task and then classify.
Answers.UserDisplayName: Karan Chopra
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-05T08:28:02.343Z
Answers.Text: No Data Structure of such kind would be available for direct use, you might have to dig for something similar and modify for your needs; or you can use cloud storage for that purpose and use the **url** and retrieve the image through that before feeding, an overhead but can be used( _time required to train is not actually an important parameter!_ ).
Answers.UserDisplayName: Karan Chopra
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-09-02T05:00:53.013Z
Answers.LastActivityDate: 2017-09-02T05:00:53.013Z
Answers.UserDisplayName: Karan Chopra
Answers.Body: <p>Your question depends heavily on the method you are using for machine learning. It sounds like you want to extract certain features like "curves and straight lines" from your images and use them as training data. This step of extraction is usually not considered part of the training process but part of pre-processing. During pre-precessing you read your image in, extract certain features or perform some transformation and store the new data as your actual training samples or use them for training right away without intermediate storage. Usually storing this information is a good idea if you want to use the image for training more than once and you want to skip the pre-processing step in future training cycles.</p>
  
  <p><strong>Comparing File Storage and Database Storage</strong></p>
  
  <p>How you store your processed data for training is relatively independent from the application of machine learning and the general principles for data storage apply. Storing the data in a flat file is usually very convenient as disk storage is readily available and the APIs for storing and reading files are part of your programming language and OS. A database adds additional complexity to your architecture but has of course it's benefits, especially if you want to make the training data available to other instances or different learning engines. If you are working with a <strong>really</strong> huge amount of data, a well structured database can help you organize your data better and provides helpful functions for handling this data efficiently.</p>
  
  <p>Keep in mind that the actual training of your AI takes place initially and once completed, you can roll out your AI without all the training data. So you only need to handle training data for a limited time in your application lifecycle. The speed of training is usually not very important, because it happens once and not during the daily use of the AI. Therefore the speed of file access during training can be neglected.</p>
  
  <p><strong>Conclusion</strong></p>
  
  <p>In conclusion, for most applications, the simpler implementation using just flat files is good enough. If you want to store each sample in an individual file or pack them together on bigger batches and use some meta information to identify the individual samples in the file is more a matter of taste than real technical relevance.</p>
  
  <p><strong>Storing data after training</strong></p>
  
  <p>Judging from your question, you sound like you understand machine learning in general. Just to clarify one potential misunderstanding for beginners - you don't have to store any of the "learned" information as data after training, as each training step just adapts weights and biases in the neural network. The actual training data can be thrown away after successful training, if you don't need it for future training cycles.</p>
  
  <p><strong>Further Information / References</strong></p>
  
  <p>To finish my answer I want to recommend a current course from <a href="https://www.youtube.com/playlist?list=PL3FW7Lu3i5JvHM8ljYj-zLfQRF3EO8sYv" rel="nofollow noreferrer">Stanford University about CNNs and visual recognition</a> (Dated Spring 2017). It is a great source of information for implementing neural networks for image recognition.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-29T05:01:43.913Z
Answers.Text: asking again. if we input a image as a training input, then that is a direct knowledge of machine. may be my question is not clear
Answers.UserDisplayName: Sathish Kumar D
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-29T05:05:51.330Z
Answers.Text: I need a form of knowledge that stored in a system. human brain evaluate '7' as 'horizontal line and vertical left crossed line start from right of the horizontal line'. like that machine must have some conceptual data to represent their knowledge.
Answers.UserDisplayName: Sathish Kumar D
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-29T05:46:42.923Z
Answers.Text: With a NN, that is not necessarily the case. The added knowledge manifests itself as small adaptions in the weights and biases of the neurons. There is nothing like a lookup table for the knowledge. When using a CNN there are some "intermediate templates" for each class, which sounds like what you are looking for. Please take a look at the Stanford course I linked for more details. The templates get explained in detail starting in the 5th lecture.
Answers.UserDisplayName: Demento
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-29T06:04:31.683Z
Answers.Text: perfect, I'm really considering this as wow fact. that the system will increase it's ability on day my day work.
  
  answer was very clear. thank you.
Answers.UserDisplayName: Sathish Kumar D
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-26T07:27:55.930Z
Answers.LastActivityDate: 2017-08-26T07:27:55.930Z
Answers.UserDisplayName: Demento
Body: <p>What we are doing in the image processing training.  We are storing some form of data which is going to act as the knowledge or experience of the system. </p>
  
  <ul>
  <li>In which form can the system store it's training data?</li>
  </ul>
  
  <p>For example, with the hand written recognition, we can represent the digits as combinations of curves and straight lines. For every round of training the recognition system stores data.  Is the data typically stored in a flat file (such as txt) or a database?</p>
  
  <p>I have seen in <a href="https://en.wikipedia.org/wiki/Tesseract_(software)" rel="nofollow noreferrer">Tesseract OCR</a> that there is a text file that stores the x0,y0,x1,y1. They are the pixel points that represents the square on the training image that has the picture.</p>
  
  <p>I need a efficient form of knowledge for Machine Learning, and would appreciate advice, context, or an explanation of the merits or downsides of different approaches. </p>
  
  <blockquote>
    <p>I need a form of knowledge that stored in a system. human brain evaluate '7' as 'horizontal line and vertical left crossed line start from right of the horizontal line'. like that machine must have some conceptual data to represent their knowledge.</p>
  </blockquote>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-08-26T05:56:03.287Z
Comments.Text: Welcome to AI!  I took the liberty of editing the question for greater readibility—don't hesitate to let me know if I've misrepresented anything.  It might be helpful if you indicated what language you're planning on working in, and possibly the system architecture you envision.  (Data is data, but the way you store it may be influenced by these factors.)
Comments.UserDisplayName: DukeZhou
Tags: <machine-learning><image-recognition><training><knowledge-representation>
Title: As a starter: what is the form of training data for image processing
UserDisplayName: Sathish Kumar D
ThreadText: # As a starter: what is the form of training data for image processing
  
  (Asked by: username_0 on 2017-08-26)
  
  What we are doing in the image processing training. We are storing some form of data which is going to act as the knowledge or experience of the system.
  
  * In which form can the system store it's training data?
  
  For example, with the hand written recognition, we can represent the digits as combinations of curves and straight lines. For every round of training the recognition system stores data. Is the data typically stored in a flat file (such as txt) or a database?
  
  I have seen in [Tesseract OCR](https://en.wikipedia.org/wiki/Tesseract_(software)) that there is a text file that stores the x0,y0,x1,y1. They are the pixel points that represents the square on the training image that has the picture.
  
  I need a efficient form of knowledge for Machine Learning, and would appreciate advice, context, or an explanation of the merits or downsides of different approaches.
  
  > I need a form of knowledge that stored in a system. human brain evaluate '7' as 'horizontal line and vertical left crossed line start from right of the horizontal line'. like that machine must have some conceptual data to represent their knowledge.
  
  **Tags:** machine-learning, image-recognition, training, knowledge-representation
  
  > **Comments:**
  > **username_1**: Welcome to AI!  I took the liberty of editing the question for greater readibility—don't hesitate to let me know if I've misrepresented anything.  It might be helpful if you indicated what language you're planning on working in, and possibly the system architecture you envision.  (Data is data, but the way you store it may be influenced by these factors.)  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_3 on 2017-08-26. Score: 3 | Accepted answer
  
  Your question depends heavily on the method you are using for machine learning. It sounds like you want to extract certain features like "curves and straight lines" from your images and use them as training data. This step of extraction is usually not considered part of the training process but part of pre-processing. During pre-precessing you read your image in, extract certain features or perform some transformation and store the new data as your actual training samples or use them for training right away without intermediate storage. Usually storing this information is a good idea if you want to use the image for training more than once and you want to skip the pre-processing step in future training cycles.
  
  **Comparing File Storage and Database Storage**
  
  How you store your processed data for training is relatively independent from the application of machine learning and the general principles for data storage apply. Storing the data in a flat file is usually very convenient as disk storage is readily available and the APIs for storing and reading files are part of your programming language and OS. A database adds additional complexity to your architecture but has of course it's benefits, especially if you want to make the training data available to other instances or different learning engines. If you are working with a **really** huge amount of data, a well structured database can help you organize your data better and provides helpful functions for handling this data efficiently.
  
  Keep in mind that the actual training of your AI takes place initially and once completed, you can roll out your AI without all the training data. So you only need to handle training data for a limited time in your application lifecycle. The speed of training is usually not very important, because it happens once and not during the daily use of the AI. Therefore the speed of file access during training can be neglected.
  
  **Conclusion**
  
  In conclusion, for most applications, the simpler implementation using just flat files is good enough. If you want to store each sample in an individual file or pack them together on bigger batches and use some meta information to identify the individual samples in the file is more a matter of taste than real technical relevance.
  
  **Storing data after training**
  
  Judging from your question, you sound like you understand machine learning in general. Just to clarify one potential misunderstanding for beginners - you don't have to store any of the "learned" information as data after training, as each training step just adapts weights and biases in the neural network. The actual training data can be thrown away after successful training, if you don't need it for future training cycles.
  
  **Further Information / References**
  
  To finish my answer I want to recommend a current course from [Stanford University about CNNs and visual recognition](https://www.youtube.com/playlist?list=PL3FW7Lu3i5JvHM8ljYj-zLfQRF3EO8sYv) (Dated Spring 2017). It is a great source of information for implementing neural networks for image recognition.
  
  > **Comments:**
  > **username_0**: asking again. if we input a image as a training input, then that is a direct knowledge of machine. may be my question is not clear  
  > **username_0**: I need a form of knowledge that stored in a system. human brain evaluate '7' as 'horizontal line and vertical left crossed line start from right of the horizontal line'. like that machine must have some conceptual data to represent their knowledge.  
  > **username_3**: With a NN, that is not necessarily the case. The added knowledge manifests itself as small adaptions in the weights and biases of the neurons. There is nothing like a lookup table for the knowledge. When using a CNN there are some "intermediate templates" for each class, which sounds like what you are looking for. Please take a look at the Stanford course I linked for more details. The templates get explained in detail starting in the 5th lecture.  
  > **username_0**: perfect, I'm really considering this as wow fact. that the system will increase it's ability on day my day work.  answer was very clear. thank you.  
  
  ---
  
  ### Answer by username_2 on 2017-09-02. Score: 1
  
  I think username_3 has answered it well, but probably below can add some more understanding to you.
  
  [1] Usually the data stored for image processing relates to the **Image Pixel Densities**(*as per the many courses i visited online*), which can be very well maintained using a **matrix of pixel density values**, corresponding to the resolution of each image.
  Then it depends on the image's color spectrum (*is it a colored or a gray scale*); as per the case of hand written text recognition you don't really require the pixel values for a colored image.
  
  Consider that if you have a colored image then you have to store the RGB values for each pixel, thus **tripling** the matrix size, and the training could be very well done with just the gray scale values, thus it would be better to convert all the images to gray scale in preprocessing step and also take care to convert the image to gray scale when you actually use the trained network to recognize an image (*just a novice mistake!*).
  
  As per the **storage** for the required matrix form of the pixel density values, a flat file storage would suffice, but I would recommend libraries instead *(if working in python or other alternatives*), like **pandas** and **numpy**. For these libraries provide a robust solution for data management and retrieval.
  
  For more details - <https://docs.scipy.org/doc/numpy-dev/user/quickstart.html>
  <https://github.com/pandas-dev/pandas>
  
  [2] Now I would emphasize on why not to use any DataBase(DB) for the storage of such information.
  Firstly the integration of it would only result in an **unnecessary overhead** to your efforts of training the Network and also when you would want to recognize an image(*which would always be a single matrix form of it's Image Pixel Densities*), you would require the connection to the same DB and would also need to make an **insertion** to it first, for the script to be able to extract from there and make recognition(*not recomended*).
  
  There is a fact we don't really concern ourselves with is the quality of the training image dataset, we do ignore the presence of **noise** in the dataset(*would be minimum if using a preprocessed standard data set such MNIST <http://yann.lecun.com/exdb/mnist/>*), but if creating one's own data set we have to consider noise and rectify accordingly in the preprocessing task itself.
  
  With noise I mean **loss or overlap of pixel density information** which is usually adds a **blurring effect** to the images, and can seriously damage the training metrics.
  To overcome it, there are approaches to rectify the pixel values with a prior learning methods such as extracting data from obfuscated images,
  see link- <https://arxiv.org/pdf/1609.00408.pdf>.
  
  *With the above case you would require to make updates in the DB for very single record in the preprocessing task even before you start to train the Network, thus it can increase the total requests to the DB in multifolds and thus impeding the whole benefit of using it in the first place*.
  
  I suppose the above should give you fair idea, about the kind of data to store and the Data Storage to prefer accordingly.
  I worked out the Digit Classification using MNIST data set with obscuration using a NN Pipeline, to refer <https://github.com/kchopra456/Digit-Classification-and-Image-Obfuscation-ANN>.
  
  > **Comments:**
  > **username_0**: thank you for your response, I really admit your justification for 'no storage'.  let consider the image of '1'(digit). I have 3 images in size respectively 234kb,2mb,65kb. I trained my system with this  data. now I am not really wish to store the 234+2048+65 of kb of data. instead of this a vector representation data that emphasize strecture of '1'. that data will be improved by the next trainning.  
  > **username_0**: like us. we know the structure of alphabets by the training of the view we seen in childhood. But we are not having the data about which color and which scale (in books).  
  > **username_0**: is it possible to store that kind of data. is there exists any data structure for that  
  > **username_2**: From my understanding till now, you want to train the network not by pixel densities as a direct classifier but rather using a figurative vector scale(_some knowledge about how we draw that character on paper_). I'm not sure about the feasibility of that, but i would like to point out something I feel that can get you in a bottleneck. You mention that you want to use the vector representation achieved after each learning iteration to modify the input **data set** for the next iteration! This might not be a good approach because the intermediate data set is guaranteed to have a lot of noise.  
  > **username_2**: Also about the varying sizes of images as **Input Data Set**, can be handled easily in preprocessing. You can easily compress the  images to suitable size, because we don't really require high scale images for character classification; as not much detail is required in an image to represent a character. Go for gray scale images for about 400 pixel size and your network will work miracles!, even though you wan to test on a real world image that would be of much higher resolution; you can just take the image through the preprocessing task and then classify.  
  > **username_2**: No Data Structure of such kind would be available for direct use, you might have to dig for something similar and modify for your needs; or you can use cloud storage for that purpose and use the **url** and retrieve the image through that before feeding, an overhead but can be used( _time required to train is not actually an important parameter!_ ).  
  
  ---
  
  