tfutils

package
v0.0.0-...-e9349c8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package tfutils provides various functions usefull when constructing TensorFlow compute graphs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToBytes

func BytesToBytes(s *op.Scope, inputPH, outputOP tf.Output, feeds map[tf.Output]*tf.Tensor) (conversionFunc func([]byte) ([]byte, error), err error)

BytesToBytes takes a scope, a placeholder for a []byte, and an output of []byte and returns a `func([]byte)[]byte`. feeds may be an empty map, or it may be populated with whatever special feeds your graph needs.

func ComputeMFCC

func ComputeMFCC(s *op.Scope, pcm tf.Output) (mfcc, sampleRatePH tf.Output)

ComputeMFCC compute the Mel-frequency cepstrum coefficients of the PCM audio

func ComputeSpectrogram

func ComputeSpectrogram(s *op.Scope, pcm tf.Output, freqMin, freqBuf int) (slice tf.Output)

ComputeSpectrogram computes the spectrogram of the given audio

func EmbedTrainingData

func EmbedTrainingData(inputs [][][]float32, outputs [][libaural2.StridesPerClip]int32, ids []libaural2.ClipID, numSubSeqs int, batchSize int) (graph *tf.Graph, err error)

EmbedTrainingData returns a GrapDef with the inputs and outputs embeded inputs must be of shape [len, libaural2.StridesPerClip, libaural2.InputSize] outputs must be of shape [len, libaural2.StridesPerClip] where len is the same for inputs, outputs, and ids.

func EncodeWav

func EncodeWav(s *op.Scope, pcmOutput tf.Output) (wavBytesOutput, sampleRatePH tf.Output)

EncodeWav encodes pcm to wav file

func MakeAudioClipToMFCCtensor

func MakeAudioClipToMFCCtensor() (renderMFCC func(*libaural2.AudioClip) (*tf.Tensor, error), err error)

MakeAudioClipToMFCCtensor makes a function that takes an audioClip and returns a tensor of mfccs sutable for feeding to seqInference

func MakeCleanWav

func MakeCleanWav(sampleRate int) (cleanWav func([]byte) ([]byte, error), err error)

MakeCleanWav returns a function which takes the bytes of a wav file, converts to PCM, checks that it is good and reconstructs a wav file from the PCM. If the input is malformed, it will return an error. The output may be slighty different from the input. Use the output.

func MakeProbsTensorToImage

func MakeProbsTensorToImage() (probsToImage func(*tf.Tensor) ([]byte, error), err error)

MakeProbsTensorToImage makes a function that takes a tensor of probs, and returns the byte of an image.

func ParseRawBytesToPCM

func ParseRawBytesToPCM(s *op.Scope) (rawBytes, pcm tf.Output)

ParseRawBytesToPCM returns a placeholder for []byte of an int16le raw file, and an output for float PCM

func ParseWavBytesToPCM

func ParseWavBytesToPCM(s *op.Scope) (wavBytes, pcm tf.Output)

ParseWavBytesToPCM returns a placeholder for []byte of an int16le wav file, and an output for float PCM

func ReadRawToPCM

func ReadRawToPCM(s *op.Scope) (filePath, pcm tf.Output)

ReadRawToPCM returns a placeholder for a filepath to an int16le raw file, and an output for float PCM

func ReadWaveToPCM

func ReadWaveToPCM(s *op.Scope) (filePath, pcm tf.Output)

ReadWaveToPCM returns a placeholder for a filepath to an int16le wav file, and an output for float PCM

func RenderImage

func RenderImage(s *op.Scope, values tf.Output) (jpegBytes tf.Output)

RenderImage takes an operation of shape [time, freq], and returns an operation of the bytes in JPEG image.

func SplitInputSeqs

func SplitInputSeqs(inputSet [][][]float32) (splitSet [][][]float32)

SplitInputSeqs splits long seqs into shorter seqs for training.

Types

This section is empty.

Directories

Path Synopsis
demo
protobuf/tensorflow/core/framework
Package tensorflow is a generated protocol buffer package.
Package tensorflow is a generated protocol buffer package.
Package lstmutils contains some useful functions for processing trained LSTM models in the particular format used by aural2.
Package lstmutils contains some useful functions for processing trained LSTM models in the particular format used by aural2.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL