This file contains hidden or 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 my blog post: http://vict0rsch.github.io/2018/06/06/tensorflow-streaming-multilabel-f1/ | |
import tensorflow as tf | |
import numpy as np | |
from tensorflow.python.ops import variable_scope | |
from tensorflow.python.ops import array_ops | |
from tensorflow.python.framework import ops | |
from sklearn.metrics import f1_score | |
This file contains hidden or 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
""" | |
" Description: TensorFlow ExpandNet for HDR image reconstruction. | |
" Author: LiJinghui | |
" Date: March 2018 | |
""" | |
from __future__ import division | |
import numpy as np | |
import cv2 | |
import os, random, glob | |
import tensorflow as tf |
This file contains hidden or 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 sklearn.utils import check_X_y | |
from sklearn.preprocessing import LabelEncoder | |
from sklearn.metrics.cluster.unsupervised import check_number_of_labels | |
from numba import jit | |
@jit(nogil=True, parallel=True) | |
def euclidean_distances_numba(X, Y=None, Y_norm_squared=None): | |
# disable checks | |
XX_ = (X * X).sum(axis=1) |
This file contains hidden or 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 selenium import webdriver | |
import sys, getopt, time, subprocess, shlex | |
from xvfbwrapper import Xvfb | |
def run(): | |
print('Sreencast website animation') | |
xvfb = Xvfb(width=1280, height=720, colordepth=24) | |
xvfb.start() |
This file contains hidden or 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
# Installing ffmpeg with H265 support | |
brew tap varenc/ffmpeg | |
brew install varenc/ffmpeg/ffmpeg --with-fdk-aac --HEAD | |
# Installing mp4edit tool | |
brew install bento4 |
This file contains hidden or 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 argparse | |
import psutil | |
import tensorflow as tf | |
from typing import Dict, Any, Callable, Tuple | |
## Data Input Function | |
def data_input_fn(data_param, | |
batch_size:int=None, | |
shuffle=False) -> Callable[[], Tuple]: | |
"""Return the input function to get the test data. |
This file contains hidden or 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
# Run interactive python tensorflow container | |
docker run --rm -it --name py-tf --entrypoint python tensorflow/tensorflow:1.3.0-py3 | |
# Run jupyter notebook container | |
docker run --rm -dit -p 8888:8888 -p 6006:6006 -v "${PWD}":/notebooks --name notebook tensorflow/tensorflow:1.3.0-py3 | |
# Run on ubuntu server with GPU and have it run on startup | |
nvidia-docker run -dit \ | |
-p 8888:8888 -p 6006:6006 \ | |
-v /home/nbs:/notebooks \ |
This file contains hidden or 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 logging | |
import numpy as np | |
import tensorflow as tf | |
from tensorflow.contrib import layers | |
GO_TOKEN = 0 | |
END_TOKEN = 1 | |
UNK_TOKEN = 2 |
This file contains hidden or 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 asyncio | |
from concurrent import futures | |
import functools | |
import inspect | |
import threading | |
from grpc import _server | |
def _loop_mgr(loop: asyncio.AbstractEventLoop): |
This file contains hidden or 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 subprocess | |
import datetime | |
import numpy as np | |
THREAD_NUM=4 | |
def get_video_info(fileloc) : | |
command = ['ffprobe', | |
'-v', 'fatal', | |
'-show_entries', 'stream=width,height,r_frame_rate,duration', |