This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 便利なデバッガー | |
import pdb; pdb.set_trace() | |
# 毎回書くアレ。画像表示用関数 | |
import matplotlib.pyplot as plt | |
def single_color(img, dpi=72): | |
plt.figure(dpi=dpi) | |
plt.imshow(img) | |
plt.show() | |
plt.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
print("range: ", np.max(X[0]), np.min(X[0])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 画面をリフレッシュしつつアタッチ | |
tmux a -d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GPUconfig = tf.ConfigProto( | |
gpu_options=tf.GPUOptions( | |
allow_growth=True | |
, visible_device_list="0" | |
) | |
, device_count={"GPU":1} | |
) | |
with tf.Session(graph=graph, config=GPUconfig) as sess: | |
print(sess.run()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tqdm import tqdm | |
import numpy as np | |
from skimage.io import imread, imsave | |
win_h = win_w = 640 | |
orig = imread(fname="image_A.png") | |
ours = imread(fname="image_B.png") | |
def main(): | |
for i in tqdm(range(1)): | |
h_bias, w_bias = np.random.randint(0, orig.shape[0]-win_h), np.random.randint(0, orig.shape[1]-win_w) | |
crop_orig = orig[h_bias:h_bias+win_h, w_bias:w_bias+win_w] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM nvidia/cuda:9.0-cudnn7-runtime-ubuntu16.04 | |
# Set anaconda(miniconda) path | |
ENV MINICONDA /opt/miniconda | |
ENV PATH $MINICONDA/bin:$PATH | |
# Download anaconda and install it | |
RUN apt-get update && apt-get install -y wget build-essential | |
RUN apt-get update && apt-get install -y --no-install-recommends \ | |
build-essential \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run --rm hello-world |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# resize | |
from skimage.io import imread, imsave | |
from skimage.transform import resize | |
x = imread("X.png") | |
x2 = resize(x, (128, 128)) | |
imsave("resize.png", x2) | |
# overlay | |
from skimage.io import imread, imsave | |
from skimage.transform import resize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# curl -O https://gist.githubusercontent.com/xagano/1ba3caabd6d1c40d0fe85058a7294222/raw/b2ea3934cfeec110aaf74ca8f5bbdd07fae628fe/TF2_MNIST.py | |
import time | |
import tensorflow as tf | |
mnist = tf.keras.datasets.mnist | |
(x_train, y_train), (x_test, y_test) = mnist.load_data() | |
x_train, x_test = x_train / 255.0, x_test / 255.0 | |
model = tf.keras.models.Sequential([ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Before running this cell, you will set hidden vars by "add-ons" menu. | |
""" | |
from kaggle_secrets import UserSecretsClient | |
def clone_repository( | |
ssh_keyval: "str: BEGIN RSA PRIVATE KEY to END RSA PRIVATE KEY" | |
, ssh_keyname: "str: id_rsa..." | |
, gitrepo: "str: your private repository to clone" |
OlderNewer