This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Keras Implementation of Mish Activation Function. | |
# Import Necessary Modules. | |
from __future__ import absolute_import | |
from __future__ import division | |
from __future__ import print_function | |
from keras.engine.base_layer import Layer | |
from keras import backend as K |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This example shows how to use keras TensorBoard callback | |
# with model.train_on_batch | |
import tensorflow.keras as keras | |
# Setup the model | |
model = keras.models.Sequential() | |
model.add(...) # Add your layers | |
model.compile(...) # Compile as usual |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
import torch.nn as nn | |
import torch.nn.functional as F | |
# Focal loss implementation inspired by | |
# https://github.com/c0nn3r/RetinaNet/blob/master/focal_loss.py | |
# https://github.com/doiken23/pytorch_toolbox/blob/master/focalloss2d.py | |
class MultiClassBCELoss(nn.Module): | |
def __init__(self, | |
use_weight_mask=False, |