This file contains hidden or 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 | |
from CNN_Class import CNN, random_split, CustomDataset | |
import pygmo as pg | |
NORMALIZE = True | |
IMAGE_PATH = 'database/' | |
dataset = CustomDataset(image_path=IMAGE_PATH, normalise=NORMALIZE, train=True) | |
lengths = [10000, 10778] # train data and test data | |
train_dataset, test_dataset = random_split(dataset, lengths) # 20778 |
This file contains hidden or 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
def argument_input_interface( | |
n_conv, | |
kernel_conv, | |
stride_conv, | |
kernel_pool, | |
stride_pool, | |
n_layers, | |
dim1=(6, 32), | |
dim2=(120, 40) | |
): |
This file contains hidden or 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
>> Signature for class instantiation. | |
# trial = CNN(train_dataset, | |
# test_dataset, | |
# n_conv, | |
# dim1, | |
# kernel_conv, | |
# stride_conv, | |
# kernel_pool, | |
# stride_pool, | |
# n_layers, |
This file contains hidden or 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
/usr/bin/python3 /home/ggarrett/Repositories/DeepLearning/CNN_Class.py | |
LOADING DATA... | |
DATA LOADING SUCCESSFUL | |
PRESS ENTER TO START TRAINING | |
Net( | |
(conv0): Conv2d(3, 6, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) | |
(pool): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False) | |
(conv1): Conv2d(6, 16, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) | |
(conv2): Conv2d(16, 32, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1)) | |
(fc0): Linear(in_features=1152, out_features=120, bias=True) |
This file contains hidden or 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
#!/bin/bash | |
DATE="$(date +%d-%b-%Y)" | |
USER="$(id -u -n)" | |
BACKUP_PATH="/media/${USER}/$1/Ubuntu_Backup-$DATE" | |
# Define folders to backup from home. | |
declare -a arr=("Documents" "Desktop" "Picture" "PycharmProjects" "Repositories" "InspiringCodeSnippets" "University") | |
function backup_folder() { |
This file contains hidden or 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
# REFERENCE: https://stackoverflow.com/questions/4505747/how-should-i-structure-a-python-package-that-contains-cython-code | |
# github) (I don't expect this to be a popular package, but it was a good chance to learn Cython). | |
# This method relies on the fact that building a .pyx file with Cython.Distutils.build_ext (at least with Cython version 0.14) always seems to create a .c file in the same directory as the source .pyx file. | |
# Here is a cut-down version of setup.py which I hope shows the essentials: | |
from distutils.core import setup | |
from distutils.extension import Extension | |
try: | |
from Cython.Distutils import build_ext |
This file contains hidden or 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 json | |
import os | |
AE4878_path = os.path.dirname(os.path.realpath(__file__)) | |
with open(os.path.join(AE4878_path,'constants.json')) as handle: | |
course_constants = json.loads(handle.read()) |
This file contains hidden or 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
{ | |
"AU": { | |
"unit": "u.km", | |
"val": 149597870.66 | |
}, | |
"DS": { | |
"unit": "u.s", | |
"val": 86164.1004 | |
}, | |
"iDelfi": { |
NewerOlder