This is done using ffmpeg:
ffmpeg -i source.mp3 -vn -ss 00:00:18 -t 00:00:20 noisesample.wav
sox noisesample.wav -n noiseprof noise_profile_file
ffmpeg -i source_video -i source_audio -c:v copy -map 0:v:0 -map 1:a:0 output_video |
# coords => List of tuple => [(x1, y1), ....(xn, yn)] | |
def voronoi(coords, width=800, height=800, use_max=False): | |
coord_matrix = np.array(coords) | |
X, Y = zip(*coords) | |
if use_max: | |
w, h = max(X) + 2, max(Y) + 2 | |
else: | |
w, h = width, height | |
print("Computing voronoi diagram of size :: {}, {}".format(w, h)) |
import numpy as np | |
import matplotlib.pyplot as plt | |
from scipy.spatial import Voronoi | |
def voronoi_finite_polygons_2d(vor, radius=None): | |
""" | |
Reconstruct infinite voronoi regions in a 2D diagram to finite | |
regions. | |
Parameters |
#!/usr/bin/env python3 | |
import glob | |
from collections import defaultdict | |
import shutil | |
import os | |
def create_dir(dirname): | |
if not os.path.isdir(dirname): | |
os.mkdir(dirname) |
Convert sequence of image files into video.
The image filepaths are inside "files.txt" with each line representing.
mencoder -nosound -noskip -oac copy -ovc copy -o output.avi -mf fps=6 'mf://@files.txt'
""" Python implementation of the OASIS algorithm. | |
Graham Taylor | |
Based on Matlab implementation of: | |
Chechik, Gal, et al. | |
"Large scale online learning of image similarity through ranking." | |
The Journal of Machine Learning Research 11 (2010): 1109-1135. | |
""" | |
from __future__ import division |
def euclidean_distance(vects): | |
x, y = vects | |
sum_square = K.sum(K.square(x - y), axis=1, keepdims=True) | |
return K.sqrt(K.maximum(sum_square, K.epsilon())) | |
def eucl_dist_output_shape(shapes): | |
shape1, shape2 = shapes | |
return (shape1[0], 1) | |
def cosine_distance(vests): |
# POST simple text | |
curl -XPOST localhost:8000/test --data "i am paradox" -H "Content-Type: text/plain" | |
# POST JSON | |
# GET | |
curl -XGET localhost:8000/test |