swift-models
swift-models copied to clipboard
Deep Dream Example
I am preparing a deep dream example.

One Issue that I am facing is finding the gradient of a specific activation. For instance suppose that output of a layer has the shape [1, 7, 7, 32] and I need to only include the loss at [1, 7, 7, 0] (S4TF throws an error that indexing is not differentiable) . One workaround is to multiply by tensors of zeros except at the activation index. Any better ideas ?
I wonder which specific indexing APIs are you using? Advanced indexing/slicing APIs were recently added and should be made differentiable. 🙂
cc @rxwei @eaplatanios
@dan-zheng I am using the naive tensor[0..<1,0..<7, 0..<7, 0..<1]. For the record i am doing all my experiments of colab so the build might be old.
I think we need inception model - @Hvass-Labs - has prepared a well documented tutorial here https://github.com/Hvass-Labs/TensorFlow-Tutorials/blob/master/14_DeepDream.ipynb
@johndpope I used a vgg model and it is working. The inception model might create better visuals, however.
fyi - @t-ae cut stylegan some months back - I wonder if there's interest to upgrade it to stylegan2 https://github.com/t-ae/stylegan-s4tf - seeing some amazing things on twitter by roadrunner https://twitter.com/ak92501
https://twitter.com/ak92501/status/1212784293723934726?s=20

@t-ae - did you consider doing a PR for stylegan here ? / it would be well welcomed
@johndpope I have some reasons to think my code is not suitable for here.
- As I wrote in readme, I used LSGAN loss instead of WGAN-GP because S4TF doesn't support higher order differentiation for now. I suspect it leads poor results.
- My code generates 256x256 images, which is much smaller than original 1024x1024. And I have no resource to train 1024x1024 images.
- I used tensorboardx wrapper for visualizing training process. I think it's not good to add not-pure-swift things.
IMO StyleGAN demo with pre-trained weights from original TensorFlow implementation is more suitable for here than StyleGAN training code.
I don't read StyleGAN2 paper yet. I'll check if there's something I can do with S4TF.
Hey @brettkoonce - I think instead of / (as well as socks) - need to be handing out some coupons for training on TPUs. How do we get SfTF to support higher order differentiation ? is there a ticket to track that functionality? I understood S4TF would reach some parity with tensorflow eventually.
@johndpope probably a better question for @saeta than me. In general now that #146 has been merged, maybe this can be closed as well.
my bad - Brennan Saeta @saeta - are there any efforts to get S4TF working on TPUs?