Skip to content

Instantly share code, notes, and snippets.

View geoffreygarrett's full-sized avatar
🇺🇦

Geoffrey Garrett geoffreygarrett

🇺🇦
  • Delft University of Technology
  • Netherlands
View GitHub Profile
We couldn’t find that file to show.
@geoffreygarrett
geoffreygarrett / problem.py
Created May 25, 2019 15:01
DeepLearning#4
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
def argument_input_interface(
n_conv,
kernel_conv,
stride_conv,
kernel_pool,
stride_pool,
n_layers,
dim1=(6, 32),
dim2=(120, 40)
):
>> Signature for class instantiation.
# trial = CNN(train_dataset,
# test_dataset,
# n_conv,
# dim1,
# kernel_conv,
# stride_conv,
# kernel_pool,
# stride_pool,
# n_layers,
@geoffreygarrett
geoffreygarrett / DeepLearning#1
Created May 24, 2019 19:32
running CNN_Class.py
/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)
#!/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() {
@geoffreygarrett
geoffreygarrett / cython-python-setup.py
Last active December 8, 2018 18:32
[setup.py with cython] #cython #python #python3 #setup #setup.py
# 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
@geoffreygarrett
geoffreygarrett / constants.py
Created November 19, 2018 11:49
AE4878_constants_python_import
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())
@geoffreygarrett
geoffreygarrett / constants.json
Created November 19, 2018 11:25
AE4878_constants
{
"AU": {
"unit": "u.km",
"val": 149597870.66
},
"DS": {
"unit": "u.s",
"val": 86164.1004
},
"iDelfi": {