How to use the anna.util.set_parameters_from_unsupervised_model function in anna

To help you get started, we’ve selected a few anna examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ifp-uiuc / an-analysis-of-unsupervised-pre-training-iclr-2015 / cifar10 / cae / layer3 / train.py View on Github external
w = w.transpose(1, 0)
    w = w.reshape(channels, width, height, filters)
    w = numpy.float32(w)
    return w

print('Start')

pid = os.getpid()
print('PID: {}'.format(pid))
f = open('pid', 'wb')
f.write(str(pid)+'\n')
f.close()

model = CAELayer3Model('experiment', './', learning_rate=1e-4)
checkpoint = checkpoints.unsupervised_layer2
util.set_parameters_from_unsupervised_model(model, checkpoint)
monitor = util.Monitor(model, save_steps=200)

model.conv1.trainable = False
model.conv2.trainable = False
model._compile()

# Loading CIFAR-10 dataset
print('Loading Data')
train_data = numpy.load('/data/cifar10/train_X.npy')
test_data = numpy.load('/data/cifar10/test_X.npy')

train_dataset = unsupervised_dataset.UnsupervisedDataset(train_data)
test_dataset = unsupervised_dataset.UnsupervisedDataset(test_data)
train_iterator = train_dataset.iterator(
    mode='random_uniform', batch_size=128, num_batches=100000)
test_iterator = test_dataset.iterator(mode='sequential', batch_size=128)
github ifp-uiuc / an-analysis-of-unsupervised-pre-training-iclr-2015 / cifar10 / 10_to_1 / cnn_adu / train.py View on Github external
from anna.datasets import supervised_dataset

import checkpoints
from models import CNNModel

print('Start')

pid = os.getpid()
print('PID: {}'.format(pid))
f = open('pid', 'wb')
f.write(str(pid)+'\n')
f.close()

model = CNNModel('experiment', './', learning_rate=1e-2)
checkpoint = checkpoints.unsupervised_layer3
util.set_parameters_from_unsupervised_model(model, checkpoint)
monitor = util.Monitor(model)

# Add dropout
model.fc4.dropout = 0.5
model._compile()

# Loading CIFAR-10 dataset
print('Loading Data')
data_path = '/data/cifar10/'
reduced_data_path = os.path.join(data_path, 'reduced', 'cifar10_500')

train_data = numpy.load(os.path.join(reduced_data_path, 'train_X_split_0.npy'))
train_labels = numpy.load(os.path.join(reduced_data_path,
                          'train_y_split_0.npy'))
test_data = numpy.load('/data/cifar10/test_X.npy')
test_labels = numpy.load('/data/cifar10/test_y.npy')
github ifp-uiuc / an-analysis-of-unsupervised-pre-training-iclr-2015 / cifar10 / 5_to_1 / cnn_u / train.py View on Github external
from anna.datasets import supervised_dataset

import checkpoints
from models import CNNModel

print('Start')

pid = os.getpid()
print('PID: {}'.format(pid))
f = open('pid', 'wb')
f.write(str(pid)+'\n')
f.close()

model = CNNModel('experiment', './', learning_rate=1e-2)
checkpoint = checkpoints.unsupervised_layer3
util.set_parameters_from_unsupervised_model(model, checkpoint)
monitor = util.Monitor(model)

# Loading CIFAR-10 dataset
print('Loading Data')
data_path = '/data/cifar10/'
reduced_data_path = os.path.join(data_path, 'reduced', 'cifar10_1000')

train_data = numpy.load(os.path.join(reduced_data_path, 'train_X_split_0.npy'))
train_labels = numpy.load(os.path.join(reduced_data_path,
                          'train_y_split_0.npy'))
test_data = numpy.load('/data/cifar10/test_X.npy')
test_labels = numpy.load('/data/cifar10/test_y.npy')

train_dataset = supervised_dataset.SupervisedDataset(train_data, train_labels)
test_dataset = supervised_dataset.SupervisedDataset(test_data, test_labels)
train_iterator = train_dataset.iterator(
github ifp-uiuc / an-analysis-of-unsupervised-pre-training-iclr-2015 / stl10 / cnn_adcu / train.py View on Github external
args = parser.parse_args()

train_split = int(args.split)
if train_split < 0 or train_split > 9:
    raise Exception("Training Split must be in range 0-9.")
print('Using STL10 training split: {}'.format(train_split))

pid = os.getpid()
print('PID: {}'.format(pid))
f = open('pid_'+str(train_split), 'wb')
f.write(str(pid)+'\n')
f.close()

model = CNNModel('experiment', './', learning_rate=1e-2)
checkpoint = checkpoints.unsupervised_layer3
util.set_parameters_from_unsupervised_model(model, checkpoint)
monitor = util.Monitor(model,
                       checkpoint_directory='checkpoints_'+str(train_split))

# Loading STL-10 dataset
print('Loading Data')
X_train = numpy.load('/data/stl10_matlab/train_splits/train_X_'
                     + str(train_split)+'.npy')
y_train = numpy.load('/data/stl10_matlab/train_splits/train_y_'
                     + str(train_split)+'.npy')
X_test = numpy.load('/data/stl10_matlab/test_X.npy')
y_test = numpy.load('/data/stl10_matlab/test_y.npy')

X_train = numpy.float32(X_train)
X_train /= 255.0
X_train *= 1.0
github ifp-uiuc / an-analysis-of-unsupervised-pre-training-iclr-2015 / stl10 / cae / unsupervised_layer3 / train.py View on Github external
w = w.transpose(1, 0)
    w = w.reshape(channels, width, height, filters)
    w = numpy.float32(w)
    return w

print('Start')

pid = os.getpid()
print('PID: {}'.format(pid))
f = open('pid', 'wb')
f.write(str(pid)+'\n')
f.close()

model = CAELayer3Model('experiment', './', learning_rate=1e-7)
checkpoint = checkpoints.unsupervised_layer2
util.set_parameters_from_unsupervised_model(model, checkpoint)
monitor = util.Monitor(model, save_steps=200)

model.conv1.trainable = False
model.conv2.trainable = False
model._compile()

# Loading STL-10 dataset
print('Loading Data')
data = numpy.load('/data/stl10_matlab/unsupervised.npy')
data = numpy.float32(data)
data /= 255.0
data *= 2.0
train_data = data[0:90000, :, :, :]
test_data = data[90000::, :, :, :]

train_dataset = unsupervised_dataset.UnsupervisedDataset(train_data)
github ifp-uiuc / an-analysis-of-unsupervised-pre-training-iclr-2015 / cifar10 / 50_to_1 / cnn_adu / train.py View on Github external
from anna.datasets import supervised_dataset

import checkpoints
from models import CNNModel

print('Start')

pid = os.getpid()
print('PID: {}'.format(pid))
f = open('pid', 'wb')
f.write(str(pid)+'\n')
f.close()

model = CNNModel('experiment', './', learning_rate=1e-2)
checkpoint = checkpoints.unsupervised_layer3
util.set_parameters_from_unsupervised_model(model, checkpoint)
monitor = util.Monitor(model)

# Add dropout
model.fc4.dropout = 0.5
model._compile()

# Loading CIFAR-10 dataset
print('Loading Data')
data_path = '/data/cifar10/'
reduced_data_path = os.path.join(data_path, 'reduced', 'cifar10_100')

train_data = numpy.load(os.path.join(reduced_data_path, 'train_X_split_0.npy'))
train_labels = numpy.load(os.path.join(reduced_data_path,
                          'train_y_split_0.npy'))
test_data = numpy.load('/data/cifar10/test_X.npy')
test_labels = numpy.load('/data/cifar10/test_y.npy')
github ifp-uiuc / an-analysis-of-unsupervised-pre-training-iclr-2015 / cifar10 / 1_to_1 / cnn_au / train.py View on Github external
from anna.datasets import supervised_dataset

import checkpoints
from models import CNNModel

print('Start')

pid = os.getpid()
print('PID: {}'.format(pid))
f = open('pid', 'wb')
f.write(str(pid)+'\n')
f.close()

model = CNNModel('experiment', './', learning_rate=1e-2)
checkpoint = checkpoints.unsupervised_layer3
util.set_parameters_from_unsupervised_model(model, checkpoint)
monitor = util.Monitor(model)

# Loading CIFAR-10 dataset
print('Loading Data')
train_data = numpy.load('/data/cifar10/train_X.npy')
train_labels = numpy.load('/data/cifar10/train_y.npy')
test_data = numpy.load('/data/cifar10/test_X.npy')
test_labels = numpy.load('/data/cifar10/test_y.npy')

train_dataset = supervised_dataset.SupervisedDataset(train_data, train_labels)
test_dataset = supervised_dataset.SupervisedDataset(test_data, test_labels)
train_iterator = train_dataset.iterator(
    mode='random_uniform', batch_size=128, num_batches=100000)
test_iterator = test_dataset.iterator(mode='random_uniform', batch_size=128,
                                      num_batches=100000)
github ifp-uiuc / an-analysis-of-unsupervised-pre-training-iclr-2015 / cifar10 / 50_to_1 / cnn_au / train.py View on Github external
from anna.datasets import supervised_dataset

import checkpoints
from models import CNNModel

print('Start')

pid = os.getpid()
print('PID: {}'.format(pid))
f = open('pid', 'wb')
f.write(str(pid)+'\n')
f.close()

model = CNNModel('experiment', './', learning_rate=1e-2)
checkpoint = checkpoints.unsupervised_layer3
util.set_parameters_from_unsupervised_model(model, checkpoint)
monitor = util.Monitor(model)

# Loading CIFAR-10 dataset
print('Loading Data')
data_path = '/data/cifar10/'
reduced_data_path = os.path.join(data_path, 'reduced', 'cifar10_100')

train_data = numpy.load(os.path.join(reduced_data_path, 'train_X_split_0.npy'))
train_labels = numpy.load(os.path.join(reduced_data_path,
                          'train_y_split_0.npy'))
test_data = numpy.load('/data/cifar10/test_X.npy')
test_labels = numpy.load('/data/cifar10/test_y.npy')

train_dataset = supervised_dataset.SupervisedDataset(train_data, train_labels)
test_dataset = supervised_dataset.SupervisedDataset(test_data, test_labels)
train_iterator = train_dataset.iterator(
github ifp-uiuc / an-analysis-of-unsupervised-pre-training-iclr-2015 / cifar10 / 5_to_1 / cnn_au / train.py View on Github external
from anna.datasets import supervised_dataset

import checkpoints
from models import CNNModel

print('Start')

pid = os.getpid()
print('PID: {}'.format(pid))
f = open('pid', 'wb')
f.write(str(pid)+'\n')
f.close()

model = CNNModel('experiment', './', learning_rate=1e-2)
checkpoint = checkpoints.unsupervised_layer3
util.set_parameters_from_unsupervised_model(model, checkpoint)
monitor = util.Monitor(model)

# Loading CIFAR-10 dataset
print('Loading Data')
data_path = '/data/cifar10/'
reduced_data_path = os.path.join(data_path, 'reduced', 'cifar10_1000')

train_data = numpy.load(os.path.join(reduced_data_path, 'train_X_split_0.npy'))
train_labels = numpy.load(os.path.join(reduced_data_path,
                          'train_y_split_0.npy'))
test_data = numpy.load('/data/cifar10/test_X.npy')
test_labels = numpy.load('/data/cifar10/test_y.npy')

train_dataset = supervised_dataset.SupervisedDataset(train_data, train_labels)
test_dataset = supervised_dataset.SupervisedDataset(test_data, test_labels)
train_iterator = train_dataset.iterator(
github ifp-uiuc / an-analysis-of-unsupervised-pre-training-iclr-2015 / stl10 / cae / unsupervised_layer2 / train.py View on Github external
w = w.transpose(1, 0)
    w = w.reshape(channels, width, height, filters)
    w = numpy.float32(w)
    return w

print('Start')

pid = os.getpid()
print('PID: {}'.format(pid))
f = open('pid', 'wb')
f.write(str(pid)+'\n')
f.close()

model = CAELayer2Model('experiment', './', learning_rate=1e-5)
checkpoint = checkpoints.unsupervised_layer1
util.set_parameters_from_unsupervised_model(model, checkpoint)
monitor = util.Monitor(model, save_steps=200)

model.conv1.trainable = False
model._compile()

# Loading STL-10 dataset
print('Loading Data')
data = numpy.load('/data/stl10_matlab/unsupervised.npy')
data = numpy.float32(data)
data /= 255.0
data *= 2.0
train_data = data[0:90000, :, :, :]
test_data = data[90000::, :, :, :]

train_dataset = unsupervised_dataset.UnsupervisedDataset(train_data)
test_dataset = unsupervised_dataset.UnsupervisedDataset(test_data)