I think you may have difficulty getting the result you want with your current 
approach. The signal and the spectrum are really the same thing, but 
transformed using the FFT. That means that any operation on one implies a dual 
operation on the other.  Downsampling the frequency spectrum implies decreasing 
the field of view of the signal.  So effectively what you’re doing is limiting 
the ANN’s view of the signal to some constant sized window, probably in the 
centre of the signal. I assume you want to noise filter the entire signal, not 
just the middle of it.

There are two approaches I'd consider:  1) you could use a fully convolutional 
ANN, which can handle different sized input. 2) you could perform a short time 
Fourier transform with fixed window sizes, and have your fully connected ANN 
operate on the individual STFT frames.

For audio recordings, I would probably use the STFT approach if you want to 
operate in the frequency domain, or just implement a fully convolutional 
network in the signal domain.  Because your audio recording is not stationary 
(the frequency content changes over time) it will be difficult to effectively 
filter the global frequency spectrum (as opposed to the local ones provided by 
the STFT).


> On Mar 30, 2017, at 4:00 AM, Torsten Knodt <torsten.kn...@datas-world.de> 
> wrote:
> 
> Hello Rob,
> sorry for answering late. Somehow I did not see the notification.
> The signal comes from audio recordings of very different length and sample 
> rate. I am not really sure whether this very simple way of fingerpinting 
> works at the end or I need a sliding window over time at the end which would 
> also result in a fixed resolution. As this would increase the amount of data 
> and complicate the further prpcessing, I first chose the other way un the 
> hope the result is good enough.
> At tje end the data shall pre-train an adaptive notch filter to remove 
> (changing) background noise. The filter will run on an low power embedded 
> system.
> So far this is just a vague idea. I had several applications in the past 
> where I would have required the solution, outside of audio.
> 
> Robb Brown <robb.br...@gmail.com <mailto:robb.br...@gmail.com>> schrieb am 
> Mo., 27. März 2017 23:50:
> This seems like a very odd thing to be doing.  Downsampling the frequency 
> spectrum is (in the ideal case) equivalent to decreasing the field of view of 
> the FFT on the original signal.  Why don't you just decrease the size of your 
> original FFT?  That will make the FFT faster, and make your downsampling 
> operation unnecessary.
> 
> 
> On Monday, March 27, 2017 at 12:26:37 PM UTC-4, Torsten Knodt wrote:
> Hello,
> I am totally new to theano and have a first implementation to reduce the 
> resolution of the frequency axis of FFT data. My function basically sums 
> multiple consecutive bins to one, but also handles cases where the target 
> resolution is no integer multiple of the source resolution.
> from math import log2
> from numpy import 
> array,arange,asarray,ceil,clip,empty,floor,trunc,frombuffer,save
> from theano import shared,function
> from theano.tensor import matrix,scalar,vector
> 
> def resample(self, input_data, fsi, fso, fdo):
>   fsi = float(fsi)
>   fdi = fsi/len(input_data)
>   output_data = empty(shape=int(ceil(fso/fdo)))
>   for o in range(len(output_data)):
>     fmino = o*fdo
>     fnexto = (o+1)*fdo
>     _v = vector()
>     _i = scalar(dtype='int64')
>     _fdi = scalar()
>     _fmino = scalar()
>     _fnexto = scalar()
>     _f1 = 
> function([_i,_fdi,_fmino,_fnexto,_v],(((_i+1)*_fdi).clip(_fmino,_fnexto)-(_i*_fdi).clip(_fmino,_fnexto))/_fdi*_v[_i])
>     output_data[o] = sum([_f1(i,fdi,fmino,fnexto,input_data) for i in 
> range(int(clip(floor(fmino/fdi),0,len(input_data)-1)),int(clip(ceil(fnexto/fdi),
>  1, len(input_data))))])
>   output_data = output_data / output_data.sum()
>   return output_data
> 
> The background is, that I need fixed size FFT data to train a neuronal 
> network which shall do some classification of the input.
> What would be your recommendations to improve the performance of the 
> function? Improvements to efficiently handle multiple datasets of different 
> source frequency resolutions would be of special interest. Currently I only 
> work on my CPU, but plan to move to GPU later.
> input_data is already a numpy array. fsi specifies the maximum input 
> frequency, while fso specifies the maximum output frequency. fdo specifies 
> the requested resolution of the output.
> 
> Thanks in Advance
>      Torsten Knodt
> 
> -- 
> 
> --- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "theano-users" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/theano-users/cmJB8_0HB-k/unsubscribe 
> <https://groups.google.com/d/topic/theano-users/cmJB8_0HB-k/unsubscribe>.
> To unsubscribe from this group and all its topics, send an email to 
> theano-users+unsubscr...@googlegroups.com 
> <mailto:theano-users+unsubscr...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.
> 
> -- 
> 
> --- 
> You received this message because you are subscribed to a topic in the Google 
> Groups "theano-users" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/theano-users/cmJB8_0HB-k/unsubscribe 
> <https://groups.google.com/d/topic/theano-users/cmJB8_0HB-k/unsubscribe>.
> To unsubscribe from this group and all its topics, send an email to 
> theano-users+unsubscr...@googlegroups.com 
> <mailto:theano-users+unsubscr...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to theano-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to