pytorch-multiple-style-transfer icon indicating copy to clipboard operation
pytorch-multiple-style-transfer copied to clipboard

Added a better implementation of Conditional Instance Normalization

Open Aftaab99 opened this issue 5 years ago • 2 comments

The current implementation is correct, but because you are indexing in a ModuleList, it's currently not possible to convert the torch model to ONNX or trace it with TorchScript. I have changed the implementation a bit, it now uses nn.Embedding to store the shift and scale parameters, which I think is more consistent with the authors' implementation in the Magenta Demos repo.

Just my two cents, you can accept the PR if you like. I've added a new trained model for the updated network. I couldn't run inference on your content image due to memory issue, so I chose a smaller image.

By the way, awesome implementation. Its one of the few on the internet I could find, probably the only one for Pytorch. Thanks a lot for creating it.

Aftaab99 avatar Dec 30 '19 17:12 Aftaab99

@Aftaab99 Glad that you found this repo helpful. Thank you for the pull request. Sorry I kind of checked out this project for a long time...

TBH, I was really unfamiliar with ONNX and I have never dealt with pull request :sweat_smile:. I'm afraid I will not have the time to check the details of your implementation. So I guess most likely I will just accept an option for ONNX using your method.

Again sorry, it may take some time for me to process your request, lots of things happened this year to me and I need to prioritize other stuff.

kewellcjj avatar Mar 13 '20 03:03 kewellcjj

Cool, I totally understand.

Aftaab99 avatar Mar 13 '20 11:03 Aftaab99