Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
coincheung 99e04f64fb | 1 year ago | |
---|---|---|
csrc | 1 year ago | |
pytorch_loss | 1 year ago | |
.gitignore | 4 years ago | |
LICENSE | 5 years ago | |
README.md | 1 year ago | |
affinity_loss.py | 3 years ago | |
amsoftmax.py | 3 years ago | |
conv_ops.py | 3 years ago | |
dice_loss.py | 3 years ago | |
dual_focal_loss.py | 3 years ago | |
ema.py | 3 years ago | |
focal_loss.py | 2 years ago | |
generalized_iou_loss.py | 3 years ago | |
hswish.py | 3 years ago | |
info_nce_dist.py | 2 years ago | |
iou_loss.py | 1 year ago | |
label_smooth.py | 3 years ago | |
large_margin_softmax.py | 3 years ago | |
lovasz_softmax.py | 3 years ago | |
mish.py | 3 years ago | |
one_hot.py | 3 years ago | |
partial_fc_amsoftmax.py | 1 year ago | |
pc_softmax.py | 3 years ago | |
setup.py | 2 years ago | |
soft_dice_loss.py | 2 years ago | |
swish.py | 3 years ago | |
taylor_softmax.py | 3 years ago | |
triplet_loss.py | 3 years ago |
My implementation of label-smooth, amsoftmax, partial-fc, focal-loss, dual-focal-loss, triplet-loss, giou/diou/ciou-loss/func, affinity-loss, pc_softmax_cross_entropy, ohem-loss(softmax based on line hard mining loss), large-margin-softmax(bmvc2019), lovasz-softmax-loss, and dice-loss(both generalized soft dice loss and batch soft dice loss). Maybe this is useful in my future work.
Also tried to implement swish, hard-swish(hswish) and mish activation functions.
Additionally, cuda based one-hot function is added (support label smooth).
Newly add an "Exponential Moving Average(EMA)" operator.
Add convolution ops, such as coord-conv2d, and dynamic-conv2d(dy-conv2d).
Some operators are implemented with pytorch cuda extension, so you need to compile it first:
$ python setup.py install
After installing, now you can pick up what you need and use the losses or ops like one of thes:
from pytorch_loss import SwishV1, SwishV2, SwishV3
from pytorch_loss import HSwishV1, HSwishV2, HSwishV3
from pytorch_loss import MishV1, MishV2, MishV3
from pytorch_loss import convert_to_one_hot, convert_to_one_hot_cu, OnehotEncoder
from pytorch_loss import EMA
from pytorch_loss import TripletLoss
from pytorch_loss import SoftDiceLossV1, SoftDiceLossV2, SoftDiceLossV3
from pytorch_loss import PCSoftmaxCrossEntropyV1, PCSoftmaxCrossEntropyV2
from pytorch_loss import LargeMarginSoftmaxV1, LargeMarginSoftmaxV2, LargeMarginSoftmaxV3
from pytorch_loss import LabelSmoothSoftmaxCEV1, LabelSmoothSoftmaxCEV2, LabelSmoothSoftmaxCEV3
from pytorch_loss import GIOULoss, DIOULoss, CIOULoss
from pytorch_loss import iou_func, giou_func, diou_func, ciou_func
from pytorch_loss import FocalLossV1, FocalLossV2, FocalLossV3
from pytorch_loss import Dual_Focal_loss
from pytorch_loss import GeneralizedSoftDiceLoss, BatchSoftDiceLoss
from pytorch_loss import AMSoftmax
from pytorch_loss import AffinityFieldLoss, AffinityLoss
from pytorch_loss import OhemCELoss, OhemLargeMarginLoss
from pytorch_loss import LovaszSoftmaxV1, LovaszSoftmaxV3
from pytorch_loss import TaylorCrossEntropyLossV1, TaylorCrossEntropyLossV3
from pytorch_loss import InfoNceDist
from pytorch_loss import PartialFCAMSoftmax
from pytorch_loss import TaylorSoftmaxV1, TaylorSoftmaxV3
from pytorch_loss import LogTaylorSoftmaxV1, LogTaylorSoftmaxV3
from pytorch_loss import CoordConv2d, DY_Conv2d
Note that some losses or ops have 3 versions, like LabelSmoothSoftmaxCEV1
, LabelSmoothSoftmaxCEV2
, LabelSmoothSoftmaxCEV3
, here V1
means the implementation with pure pytorch ops and use torch.autograd
for backward computation, V2
means implementation with pure pytorch ops but use self-derived formula for backward computation, and V3
means implementation with cuda extension. Generally speaking, the V3
ops are faster and more memory efficient, since I have tried to squeeze everything in one cuda kernel function, which in most cases brings less overhead than a combination of pytorch ops.
For those who happen to find this repo, if you see errors in my code, feel free to open an issue to correct me.
No Description
Python Cuda C++
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》