Skip to content

Instantly share code, notes, and snippets.

View ardamavi's full-sized avatar

Arda Mavi ardamavi

View GitHub Profile
@ardamavi
ardamavi / XOR-Decoder.py
Last active July 14, 2020 06:07
Message Encoder and Decoder
# Encrypted Message Decoder
# Arda Mavi
def decode(encrypted_binary_message, key):
# Key to binary:
binary_key = " ".join('{0:08b}'.format(ord(one_char), 'b') for one_char in key) + " "
# Decode encrypted message with using key and XOR gate:
@ardamavi
ardamavi / 3d-u-net.py
Created July 4, 2018 19:24
3D U-Net Model
def get_3d_u_net(data_shape):
inputs = Input(shape=(data_shape))
conv_block_1 = Conv3D(32, (3, 3, 3), strides=(1, 1, 1), padding='same')(inputs)
conv_block_1 = Activation('relu')(conv_block_1)
conv_block_1 = Conv3D(32, (3, 3, 3), strides=(1, 1, 1), padding='same')(conv_block_1)
conv_block_1 = Activation('relu')(conv_block_1)
pool_block_1 = MaxPooling3D(pool_size=(2, 2, 2), strides=(2, 2, 2))(conv_block_1)
# Arda Mavi
import os
from keras.models import Model
from keras.optimizers import Adam
from keras.models import model_from_json
from keras.layers import Input, Conv2D, UpSampling2D, Activation, MaxPooling2D, Flatten, Dense, concatenate, Dropout
def save_model(model, path='Data/Model/', model_name = 'model', weights_name = 'weights.h5'):
if not os.path.exists(path):
@ardamavi
ardamavi / index.html
Last active March 5, 2019 11:10
Keras - Django Web App
<html>
<head>
<title>Arda Mavi - App</title>
</head>
<body>
<center>
<a style="text-decoration: none; font-size: 6em;" href="/">
<span style="color:#fc4f3f;">Arda Mavi</span> <span style="color:#808080"></span> <span style="color:#3377CC;">App</span>
</a>
<br/><br/><br/>
@ardamavi
ardamavi / create_dataset.py
Created March 2, 2018 18:34
Create Dataset Process for ours Sign Language Digits Dataset
# Arda Mavi
# For https://github.com/ardamavi/Sign-Language-Digits-Dataset
import os
import cv2
import platform
import numpy as np
from scipy.misc import imresize, imsave
img_size = 100
@ardamavi
ardamavi / ncs_process.py
Created January 19, 2018 18:21
Deep Learning with Intel Movidius Neural Compute Stick
# Arda Mavi
import mvnc.mvncapi as mvnc
# Devices List:
def get_devices_list():
devices = mvnc.EnumerateDevices()
if len(devices) == 0:
print('Not found any Intel Movidius NCS device!')
return None
@ardamavi
ardamavi / get_dataset.py
Last active June 7, 2023 02:20
For reading datasets and converting to numpy files.
# Arda Mavi
import os
import numpy as np
from os import listdir
from scipy.misc import imread, imresize
from keras.utils import to_categorical
from sklearn.model_selection import train_test_split
# Settings:
img_size = 64
@ardamavi
ardamavi / get_model.py
Created October 22, 2017 15:59
Deep Learning Models With Keras
# Arda Mavi
import os
import sys
from keras.models import Model
from keras.layers import Input, Conv2D, MaxPooling2D, Activation, Flatten, Dense, Dropout
from keras.models import model_from_json
def save_model(model, path='Data/Model'):
if not os.path.exists(path):
os.makedirs(path)
@ardamavi
ardamavi / Sentence2Tensor.py
Last active September 8, 2017 11:55
Sentence to Tensor
# Arda Mavi
import string
import numpy as np
characters = string.printable # All printable characters.
token_index = dict(zip(range(0, len(characters)), characters))
max_word = 140
max_length = 80
char_len = 100 #len(token_index)
@ardamavi
ardamavi / sentence_coder.py
Last active July 16, 2017 14:39
Sentence encoder and decoder
"""
By Arda Mavi
github.com/ardamavi
Using:
# Encoder:
If you want to encode your sentence, use this command: encode(<your_sentence>)
Example:
Your Sentence: "ar ma"
Return: [[0.0, 0.6538461538461539], [0.46153846153846156, 0.0]]