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 numpy as np | |
import cv2 | |
from matplotlib import pyplot as plt | |
img = cv2.imread("imgs/chapter5/sudoku.png", 0) | |
img = cv2.blur(img, (3, 3)) | |
kernel = [ | |
[0, -1, 0], | |
[-1, 5, -1], | |
[0, -1, 0] | |
] |
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 numpy as np | |
import cv2 | |
from matplotlib import pyplot as plt | |
img = cv2.imread("imgs/chapter5/sudoku.png", 0) | |
kernel = [ | |
[1, 1, 1, 1, 1], | |
[1, 1, 1, 1, 1], | |
[1, 1, 1, 1, 1], | |
[1, 1, 1, 1, 1], |
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 numpy as np | |
import cv2 | |
from matplotlib import pyplot as plt | |
img = cv2.imread("imgs/chapter5/sudoku.png", 0) | |
kernel = [ | |
[1, 4, 6, 4, 1], #row1 | |
[4, 16, 24, 16, 4], #row1*4 | |
[6, 24, 36, 24, 6], #row1*6 | |
[4, 16, 24, 16, 4], #row1*4 |
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 numpy as np | |
import cv2 | |
from matplotlib import pyplot as plt | |
img = cv2.imread("imgs/chapter5/sudoku.png", 0) | |
kernel = [ | |
[1, 2, 1], #row1 | |
[2, 4, 2], #row1*2 | |
[1, 2, 1] #row1*1 | |
] | |
kernel = np.array(kernel)/16 #Normalized kernel |
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
network.append(gtf.flatten()); | |
network.append(gtf.dropout(drop_probability=0.2)); | |
network.append(gtf.fully_connected(units=1024)); | |
network.append(gtf.dropout(drop_probability=0.2)); | |
network.append(gtf.fully_connected(units=gtf.system_dict["dataset"]["params"]["num_classes"])); |
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
network.append(gtf.densenet_block(bottleneck_size=4, growth_rate=64, dropout=0.2)); | |
network.append(gtf.average_pooling(kernel_size=2)); | |
network.append(gtf.inception_a_block(pooling_branch_channels=32, pool_type="avg")); | |
network.append(gtf.average_pooling(kernel_size=2)); | |
network.append(gtf.inception_c_block(channels_7x7=3, pool_type="avg")); | |
network.append(gtf.average_pooling(kernel_size=2)); |
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
network.append(gtf.resnet_v1_bottleneck_block(output_channels=64, stride=1, downsample=True)); | |
network.append(gtf.average_pooling(kernel_size=2)); | |
network.append(gtf.resnet_v2_bottleneck_block(output_channels=64, stride=1, downsample=True)); | |
network.append(gtf.average_pooling(kernel_size=2)); |
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
network = []; | |
network.append(gtf.resnet_v1_block(output_channels=32, stride=1, downsample=True)); | |
network.append(gtf.average_pooling(kernel_size=2)); | |
network.append(gtf.resnet_v2_block(output_channels=64, stride=1, downsample=True)); | |
network.append(gtf.average_pooling(kernel_size=2)); |
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
gtf.Training_Params(num_epochs=5,display_progress=True,display_progress_realtime=True, | |
save_intermediate_models=False, | |
save_training_logs=True) | |
gtf.optimizer_sgd(0.0001) | |
gtf.lr_fixed() | |
gtf.loss_softmax_crossentropy() | |
gtf.Train() |
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
network.append(gtf.convolution(output_channels=16)); | |
network.append(gtf.batch_normalization()); | |
network.append(gtf.relu()); | |
network.append(gtf.max_pooling()); |