See the question and discussion on StackOverflow: How to get the fundamental frequency using Harmonic Product Spectrum?.
We’re trying to estimate the fundamental frequency of a voiced A4 note (440 Hz). (See the question for link to audio clip.)
| import discord | |
| import asyncio | |
| import speech_recognition as sr | |
| from threading import Thread | |
| # bot token and wit.ai api key | |
| TOKEN = "" | |
| WIT_AI_KEY = "" | |
| # we need a sink for the listen function, so we just define our own |
| #!/bin/bash | |
| # | |
| # script to extract ImageNet dataset | |
| # ILSVRC2012_img_train.tar (about 138 GB) | |
| # ILSVRC2012_img_val.tar (about 6.3 GB) | |
| # make sure ILSVRC2012_img_train.tar & ILSVRC2012_img_val.tar in your current directory | |
| # | |
| # https://github.com/facebook/fb.resnet.torch/blob/master/INSTALL.md | |
| # | |
| # train/ |
| from torch.utils.data.sampler import Sampler | |
| from torch.utils.data.sampler import RandomSampler | |
| class WeightedLossSampler(Sampler, Callback): | |
| def __init__(self, data_source, replacement=True, bs=64, init_fac=1, ls_init_fac=1e-2): | |
| self.num_samples = len(data_source) | |
| self.weights = to_gpu(torch.ones(self.num_samples)*init_fac) | |
| self.replacement = replacement | |
| self.i = 0 |
| #!/usr/bin/env python | |
| """ | |
| pytorch_lifted_loss.py | |
| """ | |
| import torch | |
| import torch.nn as nn | |
| from torch.autograd import Variable |
| #include <queue> | |
| #include <boost/thread/mutex.hpp> | |
| #include <boost/thread/condition_variable.hpp> | |
| // Based on https://www.justsoftwaresolutions.co.uk/threading/implementing-a-thread-safe-queue-using-condition-variables.html | |
| template<typename Data> | |
| class BlockingQueue { | |
| private: | |
| std::queue<Data> queue; | |
| mutable boost::mutex queue_mutex; |
| #!/usr/bin/env python | |
| """ | |
| A quick, partial implementation of ENet (https://arxiv.org/abs/1606.02147) using PyTorch. | |
| The original Torch ENet implementation can process a 480x360 image in ~12 ms (on a P2 AWS | |
| instance). TensorFlow takes ~35 ms. The PyTorch implementation takes ~25 ms, an improvement | |
| over TensorFlow, but worse than the original Torch. | |
| """ | |
| from __future__ import absolute_import |
See the question and discussion on StackOverflow: How to get the fundamental frequency using Harmonic Product Spectrum?.
We’re trying to estimate the fundamental frequency of a voiced A4 note (440 Hz). (See the question for link to audio clip.)
##Sequence to Sequence -- Video to Text
Paper : ICCV 2015 PDF
Download Model: S2VT_VGG_RGB_MODEL (333MB)
| # colored stream handler for python logging framework (use the ColorStreamHandler class). | |
| # | |
| # based on: | |
| # http://stackoverflow.com/questions/384076/how-can-i-color-python-logging-output/1336640#1336640 | |
| # how to use: | |
| # i used a dict-based logging configuration, not sure what else would work. | |
| # | |
| # import logging, logging.config, colorstreamhandler | |
| # |