1. Use a layer that calls `self.add_loss(value)`. Docs: https://keras.io/api/losses/#the-addloss-api … And if you need access to labels, use the "endpoint layer" pattern: https://keras.io/examples/keras_recipes/endpoint_layer_pattern/ …
-
-
Show this thread
-
2. Override the `train_step` method of your Model class to implement your custom loss. Guide: https://keras.io/guides/customizing_what_happens_in_fit/ … A few examples: Metric learning: https://keras.io/examples/vision/metric_learning/ … Vanilla GAN: https://keras.io/examples/generative/dcgan_overriding_train_step/ … WGAN-GP: https://keras.io/examples/generative/wgan_gp/ … CycleGAN: https://keras.io/examples/generative/cyclegan/ …
Show this thread -
3. Write a custom training loop from scratch. Guide: https://keras.io/guides/writing_a_training_loop_from_scratch/ … Remember that Keras defaults are only meant to cover the most common workflows -- for anything else, you have a range of increasingly advanced options. We call it "progressive disclosure of complexity"
Show this thread
End of conversation
New conversation -
-
-
I had this exact problem and I ended up using a tf.Estimator to handle the training part, kept Keras for modeling the network. Estimators are a great alternative when Keras's training does not fit your use case.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Sir
@fchollet is it alright to use a Softmax Classifier with a Binary Cross-Entropy loss? I seem to be getting faster training results, better convergence, and high accuracies. Compared to the softmax + categorical CE. Hope you can help. Thank you, sir! -
Btw I have 5 classes
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.