Skip to content

Instantly share code, notes, and snippets.

@yongjun823
yongjun823 / setting.json
Created July 8, 2019 07:52
vscode editor.tokenColorCustomizations
{
"workbench.colorTheme": "Default Light+",
"workbench.iconTheme": "material-icon-theme",
"editor.tokenColorCustomizations": {
"[Material Theme Lighter]": {
},
"[Default Light+]": {
"keywords": "#0000ff"
}
import tensorflow as tf
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Flatten, Dense, Conv2D
from tensorflow.keras.preprocessing.image import ImageDataGenerator
train_datagen = ImageDataGenerator(
rescale=1./255,
validation_split=0.15
)
@yongjun823
yongjun823 / soscon_robot.py
Last active April 8, 2019 11:29
2018 SOSCON_Hackathon 삼성 청소기 주행 알고리즘 대회 3등 우수상
import os
import time
import copy
from soscon.env import Env
from soscon.status import Status
from soscon.data.observation import Observation
class RobotController():
LIDAR_DATA_SIZE = 360
IR_DATA_SIZE = 5
@yongjun823
yongjun823 / tf_sim.py
Last active February 20, 2019 04:31
tensorflow Similarity Calc psnr & ssim (tf eager execution )
import tensorflow as tf
import numpy as np
import os
import cv2
import argparse
def read_img(name):
x = cv2.imread(name, cv2.IMREAD_COLOR)
x = cv2.cvtColor(x, cv2.COLOR_BGR2RGB)
return x
@yongjun823
yongjun823 / data_resize.py
Last active February 13, 2019 05:16
image resize & random crop , crop --> resize, SR train data
import random
import os
from tqdm import tqdm
from PIL import Image, ImageOps
from concurrent.futures import ThreadPoolExecutor
original_path = './original/'
resize_path = './resize/'
data_path = './data/'
pbar = None
@yongjun823
yongjun823 / Gaussian_elimination.py
Created December 4, 2018 17:04
가우스 소거법(Gaussian elimination) Python
import numpy as np
def get_pivot(arr, reverse=False):
if reverse:
arr = np.flip(arr, 0)[1:]
for item in arr:
if item != 0:
return item
@yongjun823
yongjun823 / resize.py
Created November 22, 2018 04:36
python image resizing & icc_profile multi threading!
from PIL import Image, ImageOps, ImageCms
from random import randrange
from tqdm import tqdm
from concurrent.futures import ThreadPoolExecutor
import os
import io
original_path = 'original'
resize_path = 'resize'
folder_arr = ['0']
@yongjun823
yongjun823 / tl_data.py
Created November 20, 2018 00:09
tensorflow estimator
import tensorlayer as tl
import tensorflow as tf
from config import config, log_config
from utils import *
def read_tf_img(path, name):
temp_string = tf.read_file(path + name)
temp_decoded = tf.image.decode_image(temp_string, channels=4)
temp_image = tf.image.per_image_standardization(temp_decoded)
@yongjun823
yongjun823 / tl_tpu.py
Created November 19, 2018 10:35
tensorflow + tensorlayer tpu session mnist
import os
import pprint
import tensorflow as tf
import tensorlayer as tl
if 'COLAB_TPU_ADDR' not in os.environ:
print('ERROR: Not connected to a TPU runtime; please see the first cell in this notebook for instructions!')
else:
tpu_address = 'grpc://' + os.environ['COLAB_TPU_ADDR']
print ('TPU address is', tpu_address)
@yongjun823
yongjun823 / img_crop.py
Created November 17, 2018 08:09
python image random crop
from PIL import Image, ImageOps
from random import randrange
from tqdm import tqdm
import os
target_size = 448
original_path = 'original'
resize_path = 'resize'
folder_arr = ['1262768']