Skip to content

Instantly share code, notes, and snippets.

View HTLife's full-sized avatar

Jacky Liu HTLife

  • National Chung Cheng University
  • Tokyo, Japan
View GitHub Profile
import numpy as np
import os
import tensorflow as tf
#import urllib2
#from datasets import imagenet
#from nets import inception
#from preprocessing import inception_preprocessing
from PIL import Image, ImageDraw, ImageFont
@HTLife
HTLife / CNNLSTM.ipynb
Last active September 24, 2019 15:42
DeepVO like neural network structure example
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@HTLife
HTLife / 樣式(適用所有卡片)
Created February 26, 2018 04:03
Anki card template
.frontbg {
background-color: #53cd80;
border-radius: 7px;
color: #fff;
position: relative;
left: 0;
}
.android .frontbg {
background-color: #eelf34;
border-radius: 7px;
@HTLife
HTLife / summary.py
Created March 16, 2018 06:37
Pytorch model summary
def summary(input_size, model):
def register_hook(module):
def hook(module, input, output):
class_name = str(module.__class__).split('.')[-1].split("'")[0]
module_idx = len(summary)
m_key = '%s-%i' % (class_name, module_idx+1)
summary[m_key] = OrderedDict()
summary[m_key]['input_shape'] = list(input[0].size())
summary[m_key]['input_shape'][0] = -1
@HTLife
HTLife / cnn_lstm.py
Last active April 8, 2021 05:00
Time distributed CNNs + LSTM in Keras
def defModel():
model = Sequential()
#Izda.add(TimeDistributed(
# Convolution2D(40,3,3,border_mode='same'), input_shape=(sequence_lengths, 1,8,10)))
model.add(
TimeDistributed(
Conv2D(32, (7, 7), padding='same', strides = 2),
input_shape=(None, 540, 960, 2)))
model.add(Activation('relu'))
@HTLife
HTLife / cnn_lstm.py
Last active March 25, 2018 13:57
MNIST CNNs + LSTM
# pytorch mnist cnn + lstm
from __future__ import print_function
import argparse
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torchvision import datasets, transforms
from torch.autograd import Variable
@HTLife
HTLife / .tmux.conf
Created April 17, 2018 06:55
tmux conf
Put this at the bottom of .tmux.conf:
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'nhdaly/tmux-better-mouse-mode'
# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin '[email protected]/user/plugin'
# set -g @plugin '[email protected]/user/plugin'
@HTLife
HTLife / install.sh
Created May 7, 2018 14:25
tmux mouse mode installation script
git clone https://github.com/nhdaly/tmux-better-mouse-mode ~/.tmux
echo 'set-option -g mouse on' >> ~/.tmux.conf
echo 'run-shell ~/.tmux/scroll_copy_mode.tmux' >> ~/.tmux.conf
tmux source-file ~/.tmux.conf
@HTLife
HTLife / ga.R
Created May 8, 2018 04:12
GA with R
#R version 3.3.2
set.seed(10)
N_size = 20
N_bit = 8
Gen = 50
mut_freq = 0.1
Population = matrix(sample(c(0,1), size=N_size*N_bit, replace=TRUE), N_size, N_bit)
[formats]
version=1.0
data\normal\priority=-1
data\normal\bold=false
data\normal\italic=false
data\normal\overline=false
data\normal\underline=false
data\normal\strikeout=false
data\normal\waveUnderline=false
data\normal\foreground=#f8f8f2