Skip to content

Instantly share code, notes, and snippets.

@previtus
previtus / gist:7755f96f047aaedaea9a7338afbde7e1
Created November 10, 2017 23:12 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
# 1. resize to 1024 (on min dimension, not a square)
# 2. crop out middle
for file in *.png; do convert $file -geometry 1024x1024^ -gravity center -crop 1024x1024+0+0 ${file}.jpg; done
@previtus
previtus / client.py
Created February 10, 2018 03:23
running keras/tensorflow on different machine server with local client
import requests
from timeit import default_timer as timer
PORT = "9999"
PRED_KERAS_REST_API_URL = "http://localhost:"+PORT+"/predict"
TIME_KERAS_REST_API_URL = "http://localhost:"+PORT+"/time"
IMAGE_PATH = "small.jpg"
# load the input image and construct the payload for the request
image = open(IMAGE_PATH, "rb").read()
#when facing similar issue to the one mentioned at https://github.com/tensorflow/tensorflow/issues/1439
import tensorflow as tf
print("Count of global variables", len(tf.global_variables()))
print("Count of graph elements",len(tf.get_default_graph().get_operations()))
# thanks to https://github.com/bapoczos/ArtML/blob/master/fast-style-transfer/transform_video.py
# thanks to Barnabas Poczos and Gene Kogan
import subprocess, shutil
import os, fnmatch
in_args = [
'ffmpeg',
'-i', in_path,
'%s/frame_%%d.png' % in_dir
@previtus
previtus / foreground, background
Last active September 4, 2018 02:50
linux, ctrl+z, bg, fg - fun
ctrl + z = will suspend the currently foregrounded program
jobs = see suspended / running jobs with number
bg = will run in background (the most recently suspended program)
(use bg %2 with the job number, which you can check with jobs)
fg = will bring to foreground the most recently suspended program
@previtus
previtus / load.py
Last active April 15, 2018 00:06
Load all JSONs and process one with selected keywords to txt files
import os, fnmatch, random
import json
from pprint import pprint
def load(path, keywords_find, keywords_exclude):
# Frames to crops
files = sorted(os.listdir(path))
#print("files",len(files), files[0:10])
files = fnmatch.filter(files, '*.json')
random.shuffle(files)
# link https://github.com/platanus/openface-api
(had this before)
(installed docker)
docker pull bamos/openface
git clone https://github.com/platanus/openface-api.git
cd openface-api
git init
git add --all
@previtus
previtus / model
Last active September 13, 2018 15:31
ML CLASS NOTES
from keras.models import Sequential
from keras.layers import Dense, Conv2D, MaxPooling2D, Flatten
model = Sequential()
model.add(Conv2D(32, (3,3), activation='relu', input_shape=input_shape))
model.add(Flatten())
model.add(Dense(10))
model.summary()
@previtus
previtus / darkflow_tester.py
Created December 19, 2018 11:21
simple_darkflow_tester
# [SETUP, get these:]
# built_graph/yolo.meta
# built_graph/yolo.pb
# (using # flow --model cfg/yolo.cfg --load bin/yolo.weights --savepb)
from darkflow.net.build import TFNet
import numpy
import os, fnmatch, random
import cv2