Skip to content

Instantly share code, notes, and snippets.

import torch.nn as nn
import torch
class FocalLoss(nn.Module):
# implementation adapted from https://amaarora.github.io/2020/06/29/FocalLoss.html
# paper: https://arxiv.org/abs/1708.02002
"Focal Loss"
def __init__(self, alpha=.25, gamma=2, reduction='none', pos_weight=None):
super(FocalLoss, self).__init__()
self.alpha = torch.tensor([alpha, 1-alpha])#.cuda()
[['color.key.shot.na: 0.9225'],
['color.saturation.neutral: 0.9356'],
['color.theory.analagous: 0.8844'],
['color.tones.warm: 0.8524'],
['shot.angle.low: 0.8402'],
['shot.composition.center: 0.9619'],
['shot.focus.na: 0.7580'],
['shot.framing.wide: 0.8396'],
['shot.level.level: 0.9755'],
['shot.lighting.cast.hard: 0.8004'],
{'color_key': {'color.key.blue': 0.0003,
'color.key.green': 0.0001,
'color.key.luma': 0.0636,
'color.key.matte': 0.0087,
'color.key.shot.na': 0.9225,
'color.key.texture.na': 0.0049},
'color_saturation': {'color.saturation.desaturated': 0.0453,
'color.saturation.neutral': 0.9356,
'color.saturation.pastel': 0.001,
'color.saturation.saturated': 0.018},
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://cdn.knightlab.com/libs/juxtapose/latest/css/juxtapose.css">
</head>
<body>
<div class='juxtapose'>
<img src='https://imgur.com/mfkC86l' />
@rsomani95
rsomani95 / film-roll.svg
Last active August 1, 2019 06:42
SVG Film Strip that's perfect for a custom scroll bar
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.