import numpy as np
from PIL import Image
import sys, os
sys.path.append(os.pardir + "/deep-learning-from-scratch") # setting to import parent dir files
from dataset.mnist import load_mnist

def mnist_test():
    # wait some minutes for first call...
    (x_train, t_train), (x_test, t_test) = load_mnist(flatten=True, normalize=False)
    # output each data formation
    print(x_train.shape) # (60000, 784)
    print(t_train.shape) # (60000, )
    print(x_test.shape) # (10000, 784)
    print(t_test.shape) # (10000)

def img_show(img):
    pil_img = Image.fromarray(np.uint8(img))
    pil_img.show()

def mnist_img():
    (x_train, t_train), (x_test, t_test) = load_mnist(flatten=True, normalize=False)
    img = x_train[0]
    label = t_train[0]
    print(label) # 5
    
    print(img.shape)  # (784,)
    img = img.reshape(28, 28) # transfrom original image size
    print(img.shape) # (28, 28)
    
    img_show(img)

mnist_img()

a15abbd8ae0b91392d84310d94e959e3a6a70ede
<mask token>


def mnist_img():
    (x_train, t_train), (x_test, t_test) = load_mnist(flatten=True,
        normalize=False)
    img = x_train[0]
    label = t_train[0]
    print(label)
    print(img.shape)
    img = img.reshape(28, 28)
    print(img.shape)
    img_show(img)


<mask token>

<mask token>


def img_show(img):
    pil_img = Image.fromarray(np.uint8(img))
    pil_img.show()


def mnist_img():
    (x_train, t_train), (x_test, t_test) = load_mnist(flatten=True,
        normalize=False)
    img = x_train[0]
    label = t_train[0]
    print(label)
    print(img.shape)
    img = img.reshape(28, 28)
    print(img.shape)
    img_show(img)


<mask token>

<mask token>


def mnist_test():
    (x_train, t_train), (x_test, t_test) = load_mnist(flatten=True,
        normalize=False)
    print(x_train.shape)
    print(t_train.shape)
    print(x_test.shape)
    print(t_test.shape)


def img_show(img):
    pil_img = Image.fromarray(np.uint8(img))
    pil_img.show()


def mnist_img():
    (x_train, t_train), (x_test, t_test) = load_mnist(flatten=True,
        normalize=False)
    img = x_train[0]
    label = t_train[0]
    print(label)
    print(img.shape)
    img = img.reshape(28, 28)
    print(img.shape)
    img_show(img)


<mask token>

import numpy as np
from PIL import Image
import sys, os
sys.path.append(os.pardir + '/deep-learning-from-scratch')
from dataset.mnist import load_mnist


def mnist_test():
    (x_train, t_train), (x_test, t_test) = load_mnist(flatten=True,
        normalize=False)
    print(x_train.shape)
    print(t_train.shape)
    print(x_test.shape)
    print(t_test.shape)


def img_show(img):
    pil_img = Image.fromarray(np.uint8(img))
    pil_img.show()


def mnist_img():
    (x_train, t_train), (x_test, t_test) = load_mnist(flatten=True,
        normalize=False)
    img = x_train[0]
    label = t_train[0]
    print(label)
    print(img.shape)
    img = img.reshape(28, 28)
    print(img.shape)
    img_show(img)


mnist_img()

import numpy as np
from PIL import Image
import sys, os
sys.path.append(os.pardir + "/deep-learning-from-scratch") # setting to import parent dir files
from dataset.mnist import load_mnist

def mnist_test():
    # wait some minutes for first call...
    (x_train, t_train), (x_test, t_test) = load_mnist(flatten=True, normalize=False)
    # output each data formation
    print(x_train.shape) # (60000, 784)
    print(t_train.shape) # (60000, )
    print(x_test.shape) # (10000, 784)
    print(t_test.shape) # (10000)

def img_show(img):
    pil_img = Image.fromarray(np.uint8(img))
    pil_img.show()

def mnist_img():
    (x_train, t_train), (x_test, t_test) = load_mnist(flatten=True, normalize=False)
    img = x_train[0]
    label = t_train[0]
    print(label) # 5
    
    print(img.shape)  # (784,)
    img = img.reshape(28, 28) # transfrom original image size
    print(img.shape) # (28, 28)
    
    img_show(img)

mnist_img()
