generalized_dice_loss
kandi X-RAY | generalized_dice_loss Summary
kandi X-RAY | generalized_dice_loss Summary
generalized_dice_loss
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of generalized_dice_loss
generalized_dice_loss Key Features
generalized_dice_loss Examples and Code Snippets
Community Discussions
Trending Discussions on generalized_dice_loss
QUESTION
I am trying to implement a multi class dice loss function in tensorflow. Since it is multi class dice, I need to convert the probabilities of each class into its one-hot form. For example, if my network outputs these probabilities:
[0.2, 0.6, 0.1, 0.1] (assuming 4 classes)
I need to convert this into:
[0 1 0 0]
This can be done by using tf.argmax followed by tf.one_hot
ANSWER
Answered 2019-May-14 at 00:44Take a look at How is the smooth dice loss differentiable?. You won't need to do the conversion (convert [0.2, 0.6, 0.1, 0.1]
to [0 1 0 0]
). Just leave them as the continuous value between 0 and 1.
If I understand correctly, the loss function is just a surrogate to achieve your expected objective. Even though it is not the same, as long as it is a good proxy, it is fine (otherwise, it is not differentiable).
In the evaluation time, feel free to use the tf.argmax
to get the real metric.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install generalized_dice_loss
You can use generalized_dice_loss like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page