Skip to content

Instantly share code, notes, and snippets.

@leechanwoo
leechanwoo / python_variable.py
Created August 22, 2017 08:36
python basic
integer = 10
floating_point = 10.5
string1 = ‘hello python!’
string2 = “hello python”
print( integer )
print( floating_point )
print( string1 )
print( string2 )
@leechanwoo
leechanwoo / session1.py
Created August 22, 2017 12:54
tensorflow basic, session
import tensorflow as tf
const = tf.constant("hello world")
print(const)
@leechanwoo
leechanwoo / linear_regression.py
Created August 23, 2017 04:53
multicampus linear regression example
import tensorflow as tf
import matplotlib.pyplot as plt
%matplotlib inline
data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
x = tf.placeholder(tf.int32)
a = tf.Variable(5)
b = tf.Variable(2)
@leechanwoo
leechanwoo / logistic_regression.py
Last active September 11, 2017 17:37
logistic regression example code
import tensorflow as tf
import matplotlib.pyplot as plt
%matplotlib inline
samples = 1000
data = [[float(i)*0.01] for i in range(-samples, samples)]
label = [[1 if i[0] > 2.5 else 0] for i in data]
x = tf.placeholder(tf.float32)
y_ = tf.placeholder(tf.float32)
@leechanwoo
leechanwoo / simple_neuralnet.py
Created August 23, 2017 06:36
neural network simple model
import tensorflow as tf
import matplotlib.pyplot as plt
%matplotlib inline
samples = 1000
up = [i for i in range(10)]
down = [9-i for i in range(10)]
data = [up if i%2 == 0 else down for i in range(samples)]
label = [[1] if i%2 == 0 else [0] for i in range(samples)]
@leechanwoo
leechanwoo / get_accuracy.py
Created August 23, 2017 07:18
get accuracy
import tensorflow as tf
samples = 1000
up = [i for i in range(10)]
down = [9-i for i in range(10)]
data = [up if i%2 == 0 else down for i in range(samples)]
label = [[1] if i%2 == 0 else [0] for i in range(samples)]
tf.reset_default_graph()
x = tf.placeholder(tf.float32, shape=[None, 10])
@leechanwoo
leechanwoo / dataset url.txt
Last active August 24, 2017 04:22
dataset url...
Train Dataset0
https://drive.google.com/open?id=0B1UrJwDGWri2NHYtaDJUMEJrdHc
Label preprocessed
https://drive.google.com/open?id=0B1UrJwDGWri2UG1kV1JNSTBETTQ
cuDNN update
\\70.12.107.50\Users\student\Download\cudnn-8.0-windows10-x64-v5.1\cuda\ <<< copy
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\ <<< paste
@leechanwoo
leechanwoo / queue_runners.py
Last active August 24, 2017 01:30
queue runners
import tensorflow as tf
import matplotlib.pyplot as plt
import os
%matplotlib inline
files = "dataset/test_dataset_png/"
file_dir = os.path.join(os.getcwd(), files)
filenames = [os.path.join(file_dir, f) for f in os.listdir(file_dir)]
filename_queue = tf.train.string_input_producer(filenames)
@leechanwoo
leechanwoo / dataset_class.py
Created August 24, 2017 02:08
csv reader simple
dataset = tf.contrib.data.TextLineDataset(labelname).batch(10)
itr = dataset.make_one_shot_iterator()
batch = itr.get_next()
with tf.Session() as sess:
print(sess.run(batch))
@leechanwoo
leechanwoo / cnn_conv.py
Created August 24, 2017 03:04
CNN part1
import tensorflow as tf
import matplotlib.pyplot as plt
import os
%matplotlib inline
images = "dataset/test_dataset_png/"
image_dir = os.path.join(os.getcwd(), images)
imagenames = [os.path.join(image_dir, f) for f in os.listdir(image_dir)]
label = "dataset/test_dataset_csv/label.csv"