dribnet / pixray

neural image generation
Other
402 stars 53 forks source link

adding LossInterface class and custom loss classes #30

Closed EleaZhong closed 3 years ago

EleaZhong commented 3 years ago

This is for modularizing making new losses, making them easier to create as well as use.

This also takes saturation, smoothness, and palette out from pixray.py as examples for modular losses. I've also included a simple symmetry loss to show an example of how a new loss can be added through this: no further changes to pixray.py is needed except importing that loss and adding to loss_class_table.

I've also made a Colab notebook that gives a basic overview of using new loss classes, and demonstrates using the new function add_custom_loss to add a new loss class from the notebook interface, without needing to reload. the notebook is here