Skip to content

Instantly share code, notes, and snippets.

View wookayin's full-sized avatar
🗿
Pretty occupied

Jongwook Choi wookayin

🗿
Pretty occupied
View GitHub Profile
@wookayin
wookayin / reload-tensorflow-flags.py
Last active March 12, 2018 13:33
Reset tensorflow tf.app.flags, in ipython notebook
# use the following snippet in your ipython notebook shell
import argparse
import tensorflow as tf
tf.app.flags.FLAGS = tf.python.platform.flags._FlagValues()
tf.app.flags._global_parser = argparse.ArgumentParser()
@wookayin
wookayin / imshow_grid.py
Last active March 19, 2019 20:49
IPython notebook snippet for plotting multiple images in a grid.
# in a courtesy of Caffe's filter visualization example
# http://nbviewer.jupyter.org/github/BVLC/caffe/blob/master/examples/00-classification.ipynb
def imshow_grid(data, height=None, width=None, normalize=False, padsize=1, padval=0):
'''
Take an array of shape (N, H, W) or (N, H, W, C)
and visualize each (H, W) image in a grid style (height x width).
'''
if normalize:
data -= data.min()
df = pd.DataFrame({'a': [5,1,6,2,23], 'b': [7,7,7,7,7]})
"""
Out:
a b
0 5 7
1 1 7
2 6 7
3 2 7
4 23 7
"""
@tam17aki
tam17aki / SRUCell.py
Last active April 2, 2021 17:52
A TensorFlow implementation of Simple Recurrent Unit (SRU).
# -*- coding: utf-8 -*-
# Copyright (C) 2017 by Akira TAMAMORI
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
@eddieespinal
eddieespinal / cropCameraImage.swift
Last active April 14, 2021 08:16
Crops a Picture from AVCaptureSession to the bounds of the AVCaptureVideoPreviewLayer (so Preview = CameraImage) - Swift Version
//This is the swift version of the following gist by @shexbeer https://gist.github.com/shexbeer/cb069d36ca8ec5edb515
func cropCameraImage(original: UIImage, previewLayer: AVCaptureVideoPreviewLayer) -> UIImage? {
var image = UIImage()
let previewImageLayerBounds = previewLayer.bounds
let originalWidth = original.size.width
let originalHeight = original.size.height
@marcorei
marcorei / clean-toc.gs
Created March 10, 2016 12:05
Google Apps Script which cleans the Table of Content from unwanted headings.
/**
* Creates a menu entry in the Google Docs UI when the document is opened.
*
* @param {object} e The event parameter for a simple onOpen trigger. To
* determine which authorization mode (ScriptApp.AuthMode) the trigger is
* running in, inspect e.authMode.
*/
function onOpen(e) {
DocumentApp.getUi().createAddonMenu()
.addItem('Clean Table of Contents', 'cleanToC')
@romainl
romainl / sort.vim
Created December 31, 2018 10:30
Sort operator
function! Sort(type, ...)
'[,']sort
endfunction
nmap <silent> <key> :set opfunc=Sort<CR>g@
" usage:
" <key>ip
" <key>G
@swyoon
swyoon / np_to_tfrecords.py
Last active November 29, 2022 06:39
From numpy ndarray to tfrecords
import numpy as np
import tensorflow as tf
__author__ = "Sangwoong Yoon"
def np_to_tfrecords(X, Y, file_path_prefix, verbose=True):
"""
Converts a Numpy array (or two Numpy arrays) into a tfrecord file.
For supervised learning, feed training inputs to X and training labels to Y.
For unsupervised learning, only feed training inputs to X, and feed None to Y.
@prasadsilva
prasadsilva / fresh-chrome-with-custom-tz.sh
Last active June 4, 2023 12:54 — forked from stuartsierra/fresh-chrome.sh
Launch new instances of Google Chrome on OS X with isolated cache, cookies, user config and custom Timezone
#!/usr/bin/env bash
# fresh-chrome
#
# Use this script on OS X to launch a new instance of Google Chrome
# with its own empty cache, cookies, and user configuration.
#
# The first time you run this script, it will launch a new Google
# Chrome instance with a permanent user-data directory, which you can
# customize below. Perform any initial setup you want to keep on every

Displaying Configurations in TensorBoard

This is a simple demonstration of displaying training configuration in a TensorBoard, using text summaries.

Screenshot