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 os | |
import argparse | |
import numpy as np | |
from PIL import Image | |
# Format description from: http://fileformats.archiveteam.org/wiki/Award_BIOS_logo | |
MAGIC = b'AWBM' | |
PALMAGIC = b'RGB ' | |
def parse(): |
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 tensorpack | |
from tensorpack.dataflow import (FakeData, MultiThreadMapData, MultiProcessMapData, imgaug, BatchData) | |
import numpy as np | |
import time | |
def test(x): | |
# simulate heavy workload | |
time.sleep(0.01) | |
x[0], _prms = aug.augment_return_params(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
import tensorflow as tf | |
import numpy as np | |
def gen_one_hot(sess, h, w, input_dtype, one_hot_axis): | |
mat = np.random.rand(h, w) * 10 | |
# matt has shape [h, w] | |
matt = tf.constant(mat, input_dtype, shape=mat.shape) | |
matt_oh = tf.one_hot(matt, depth=10, axis=one_hot_axis) | |
print (sess.run(matt_oh).shape) | |