Skip to content

Instantly share code, notes, and snippets.

View taki0112's full-sized avatar
:octocat:
Make everyone's life more fun via AI

Junho Kim taki0112

:octocat:
Make everyone's life more fun via AI
View GitHub Profile
@yunjey
yunjey / contextual_loss.py
Created September 20, 2018 08:54
pytorch implementation of contextual loss: https://arxiv.org/abs/1803.02077
def contextual_loss(x, y, h=0.5):
"""Computes contextual loss between x and y.
Args:
x: features of shape (N, C, H, W).
y: features of shape (N, C, H, W).
Returns:
cx_loss = contextual loss between x and y (Eq (1) in the paper)
"""
@leechanwoo
leechanwoo / safe_queue_runners.py
Created August 25, 2017 08:06
key value batch
import tensorflow as tf
import numpy as np
import os
import matplotlib.pyplot as plt
%matplotlib inline
file_dir = os.path.join(os.getcwd(), "dataset/test_dataset_png")
image_paths = [os.path.join(file_dir, i) for i in os.listdir(file_dir)]
@leechanwoo
leechanwoo / cnn_with_tensorboard.py
Last active August 25, 2017 08:49
cnn with tensorboard
import tensorflow as tf
import matplotlib.pyplot as plt
import os
%matplotlib inline
tf.reset_default_graph()
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)]