Exemplo n.º 1
0
import numpy as np

from vulcanai.net import Network

import theano.tensor as T

from vulcanai.utils import get_one_hot

from vulcanai import mnist_loader

from vulcanai.model_tests import run_test

(train_images, train_labels, test_images,
 test_labels) = mnist_loader.load_fashion_mnist()

train_labels = get_one_hot(train_labels)

input_var = T.fmatrix('input')
y = T.fmatrix('truth')

network_dense_config = {
    'mode': 'dense',
    'units': [512],
    'dropouts': [0.2],
}

dense_net = Network(name='3_dense_test',
                    dimensions=[None] + list(train_images.shape[1:]),
                    input_var=input_var,
                    y=y,
                    config=network_dense_config,
Exemplo n.º 2
0
label_map = {
    '0': 'T-shirt/top',
    '1': 'Trouser',
    '2': 'Pullover',
    '3': 'Dress',
    '4': 'Coat',
    '5': 'Sandal',
    '6': 'Shirt',
    '7': 'Sneaker',
    '8': 'Bag',
    '9': 'Ankle boot'
}

display_tsne(train_images[:1000], train_labels[:1000], label_map)

train_labels = get_one_hot(train_labels)
test_labels = get_one_hot(test_labels)

train_images = np.reshape(train_images, (train_images.shape[0], 28, 28))
test_images = np.reshape(test_images, (test_images.shape[0], 28, 28))

input_var = T.tensor4('input')
y = T.fmatrix('truth')

network_conv_config = {
    'mode': 'conv',
    'filters': [16, 32],
    'filter_size': [[5, 5], [5, 5]],
    'stride': [[1, 1], [1, 1]],
    'pool': {
        'mode': 'average_exc_pad',