edouardoyallon / scatwave

ScatWave is a Torch implementation of scattering using CUDA
http://www.di.ens.fr/~oyallon/
21 stars 5 forks source link

Structure of the code #5

Closed edouardoyallon closed 7 years ago

edouardoyallon commented 9 years ago

For now, the idea is to do:(I'll do a tutorial asap in the wiki)

Scat=require 'init'

my_network=Scat.network:new(J,size_x,size_y)

my_network:scat(..) my_network:WT(..)

Contrary to scatnet, no dynamic programming, everything will have to be encoded(to ensure it is fast at each step and for clarification purpose)

For now, I've separated "complex", "convolution", "fft"(maybe not done on this skeleton, will be fixed on saturdya evening), "wavelet transform" and "filters bank". Check "scat" code in network to get what is going on, but the calls are the same as with MATLAB.

We can not perform any oversampling, to be consistant in size with respect to deepnet. I did not implement anything to regroup the coefficients into a tensor, yet torch is naturally tensorized.

Any suggestions after reading my pretty crappy code?

Thanks!

lostanlen commented 9 years ago

Scat=require 'init'

``` my_network=Scat.network:new(J,size_x,size_y) my_network:scat(..) my_network:WT(..)

Could you give us the actual prototype of the function ? It looks like "my_network" contains both the filters and the data, which is awkward. Having a "stateful" network which wraps architectures and data together looks nice from 500 miles above, but is likely to kill performance because of memory overhead. Why not a setup function so build the scattering architecture and then a propagate function that takes 1/ the input data, 2/ the architecture, 3/ the output destination ; as inputs and writes into its third argument ?

We can not perform any oversampling, to be consistant in size with respect to deepnet.

What do you mean ?

Any suggestions after reading my pretty crappy code?

Indent the code. Get rid of commented code. Get rid of useless whitespace. Put a one-line comment before each section of each function explaining what it does. Then provide a toy MWE of what is working so far. This is MUCH more urgent than writing any tutorial.

edouardoyallon commented 9 years ago

Scat=require 'init'

``` my_network=Scat.network:new(J,size_x,size_y) my_network:scat(..) my_network:WT(..)

Could you give us the actual prototype of the function ? It looks like "my_network" contains both the filters and the data,

Yes, it is a class that I was thinking to use as an object to build and play with networks.

which is awkward. Having a "stateful" network which wraps architectures and data together looks nice from 500 miles above, but is likely to kill performance because of memory overhead.

Actually, it's not like in MATLAB. All the memory process are pretty much low level(while the code is high level, and that's pretty cool) The bottle neck is only not to perform any reshape or to increase the memory of a tensor.(creating new memory is fine)

Why not a setup function so build the scattering architecture and then a propagate function that takes 1/ the input data, 2/ the architecture, 3/ the output destination ; as inputs and writes into its third argument ?

I think it's easier if there is like a function scat(x) that gives your representation, with regard to the mini batch structure of the algorithm of DL. (you can have a look here: https://github.com/nagadomi/kaggle-cifar10-torch7/blob/cuda-convnet2/lib/minibatch_sgd.lua this the function where I will replace inputs by scat(inputs)!

We can not perform any oversampling, to be consistant in size with respect to deepnet.

What do you mean ?

We will be on a GPU. There is NO WAY the representation will be oversampled, especially regarding the size and "more than critical" sampling they are using.(their sampling is clearly degrading the info)

Any suggestions after reading my pretty crappy code?

Indent the code. Get rid of commented code. Get rid of useless whitespace. Put a one-line comment before each section of each function explaining what it does. Then provide a toy MWE of what is working so far. This is MUCH more urgent than writing any tutorial.

It is on tamaris, I'll add this asap. ScatWave is outputting some coefficients, yet there is no unit tests to perform a safe check. I'll fix that asap, the idea right now is more to be sure that everybody has Torch installed and working...