Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cyberzhg/keras-losses
Some loss functions in Keras
https://github.com/cyberzhg/keras-losses
coral-loss keras loss-functions ranking-loss
Last synced: 3 months ago
JSON representation
Some loss functions in Keras
- Host: GitHub
- URL: https://github.com/cyberzhg/keras-losses
- Owner: CyberZHG
- License: mit
- Created: 2018-10-10T07:10:45.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-01-22T12:02:05.000Z (about 3 years ago)
- Last Synced: 2023-09-25T08:54:07.713Z (over 1 year ago)
- Topics: coral-loss, keras, loss-functions, ranking-loss
- Language: Python
- Homepage:
- Size: 10.7 KB
- Stars: 10
- Watchers: 5
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Keras Losses
Some loss functions in Keras.
## Install
```bash
python setup.py install
```## Usage
### Ranking Loss
![](https://user-images.githubusercontent.com/853842/46719694-29ed0400-cca1-11e8-9be5-9bf298952d90.png)
```python
from keras_losses import get_ranking_lossranking_loss = get_ranking_loss(gamma=2.0, mp=2.5, mn=0.5)
```### Weighted Categorical Cross-Entropy Loss
![](https://user-images.githubusercontent.com/853842/46720488-3eca9700-cca3-11e8-845d-b44adc31df74.png)
```python
from keras_losses import get_weighted_categorical_crossentropy, get_weighted_sparse_categorical_crossentropyweighted_loss = get_weighted_categorical_crossentropy(weights=[0.8, 0.1, 0.2, 0.3, 0.4])
weighted_loss = get_weighted_sparse_categorical_crossentropy(weights=[0.8, 0.1, 0.2, 0.3, 0.4])
```### CORAL Loss
![](https://user-images.githubusercontent.com/853842/108617122-c23d4b00-744e-11eb-86e8-ee95fc03421a.png)
![](https://user-images.githubusercontent.com/853842/108617126-c5383b80-744e-11eb-8aa0-e0f8acd69aa8.png)
![](https://user-images.githubusercontent.com/853842/108617127-c79a9580-744e-11eb-82e3-f99b3618dea3.png)
```python
from keras_losses import coral_loss
```