Skip to content

Instantly share code, notes, and snippets.

View fedden's full-sized avatar
🤖
Training deep audio models

Leon Fedden fedden

🤖
Training deep audio models
View GitHub Profile
## Fresh install of Ubuntu 16.04
## Note I have copied much of this by hand - be wary of subtle typos!
# Get a proper browser.
cd ~
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' | sudo tee /etc/apt/sources.list.d/google-chrome.list
sudo apt-get update
sudo apt-get install google-chrome-stable -y
ffmpeg -i video.mp4 -f mp3 -ab 192000 -vn music.mp3
ffmpeg -i video.mp4 -i music.mp3 -codec copy -shortest video_with_audio.mp4
ffmpeg -r 25 -f image2 -s 640x360 -i image_%04d.png -vcodec libx264 -crf 25 -pix_fmt yuv420p name_of_output_file.mp4
cd pix2pix-tensorflow
python3 tools/process.py --input_dir path/to/edges/images --b_dir path/to/original/images --operation combine --output_dir edge2image
start_frame =
end_frame =
for image in range(start_frame, end_frame):
file_name = 'edge2image_test/images/image_{num:04d}'.format(num=image)
input_file = cv2.imread(file_name + '-inputs.png')
output_file = cv2.imread(file_name + '-outputs.png')
target_file = cv2.imread(file_name + '-targets.png')
save_file = np.hstack((input_file, output_file, target_file))
save_name = file_name + '.png'
import numpy as np
import cv2
import os
def auto_canny(image, sigma=0.33):
median = np.median(image)
lower = int(max(0, (1.0 - sigma) * median))
upper = int(min(255, (1.0 + sigma) * median))
return cv2.Canny(image, lower, upper)
ffmpeg -i downloaded_file.mp4 -vf scale=640x360 path/to/frames/folder/image_%04d.png
@fedden
fedden / utube.sh
Last active December 20, 2017 20:02
youtube-dl https://www.youtube.com/path/to/your/video/here
def run_differential_evolution(solution_size=5,
population_size=1000,
iteration_count=100,
print_results=False,
differential_weight=1.0,
crossover_probability=0.5,
lower=0.0,
upper=1.0):
while population_size % 3 != 0:
string = "took {}s to run population size of {} for {} iterations"
population_size = 500
iteration_count = 100
solution_size = 64 * 64
# Naive DFO
with tf.device("/cpu:0"):
start = time.time()
naive_dfo(solution_size=solution_size,