This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
learner = create_cnn(data, models.resnet34, metrics=error_rate) | |
learner.fit_one_cycle(5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
learner = create_cnn(data, models.resnet34, metrics=error_rate) | |
learner.fit_one_cycle(5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fastai.vision import * | |
from fastai.metrics import error_rate | |
path = 'data/kittencat/' | |
data = ImageDataBunch.from_folder(path, train=".", valid_pct=0.2, | |
ds_tfms=get_transforms(), size=224, num_workers=4).normalize(imagenet_stats) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fastai.vision import * | |
from fastai.metrics import error_rate | |
path = 'data/kittencat/' | |
data = ImageDataBunch.from_folder(path, train=".", valid_pct=0.2, | |
ds_tfms=get_transforms(), size=224, num_workers=4).normalize(imagenet_stats) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
learner = create_cnn(data, models.resnet34, metrics=error_rate) | |
learner.fit_one_cycle(5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
path = 'data/paintings/' | |
data = ImageDataBunch.from_folder(path, train=".", valid_pct=0.2, | |
ds_tfms=get_transforms(), size=224, num_workers=4).normalize(imagenet_stats) | |
data.show_batch(rows=3, figsize=(7,8)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from fastai.vision import * | |
from fastai.metrics import error_rate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstddef> | |
#include <iostream> | |
#include <string> | |
#include <vector> | |
#include <torch/torch.h> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
import numpy as np | |
import cifar_data_loader | |
(train_images, train_labels, test_images, test_labels, mean_image) = cifar_data_loader.load_data() | |
print(train_images.shape) | |
print(train_labels.shape) | |
print(test_images.shape) | |
print(test_labels.shape) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input_minus_mean = input - mean_image #Subtract mean from input images | |
layer1_weights = tf.get_variable("layer1_weights", [3, 3, 3, 64], initializer=tf.contrib.layers.variance_scaling_initializer()) | |
layer1_bias = tf.Variable(tf.zeros([64])) | |
layer1_conv = tf.nn.conv2d(input_minus_mean, filter=layer1_weights, strides=[1,1,1,1], padding='SAME') #Use input_minus_mean now | |
layer1_out = tf.nn.relu(layer1_conv + layer1_bias) |