tensorflow————Handwritten digit recognition (mnist) learning record

       It mainly records some problems caused by reading in data.

       In tensorflow.keras.datasets, automatic download of mnist data set is provided. After downloading, two tuples are returned, the training set and the test set, the test set is 60,000 images and labels, and the training set is 10,000 images and labels. The picture size is 28*28. In fit , it can be of numpy type or dataset type. For the two different data types, there are also points to be noted for the input_shape of the network model. Record below

  • There are many advantages to using dataset, you can use many of the built-in data processing functions in tensorflow, such as dataset.map(precoess)
  • Use numpy format to read in for training, you can get success, each batch is 1.

  • Turn the tuple into a dataset object, use the above network for training, and find that it is not feasible, and the input format is wrong
  • Therefore, we increased the dimension to make it 28*28*1, and found that the format was still incorrect when inputting. Therefore, the front dimension should be increased.

     

  • Therefore, we change the format to none*28*28, and the training is successful, or we can change the above input to 28*28*1

     

  • Through the above, if the dataset type is input set, if input_shape is 28*28, then dataset must be None*28*28, if inpu_shape is 28*28*1, then dataset must be None*28*28*1

     

Guess you like

Origin blog.csdn.net/JACKSONMHLK/article/details/107025339