addons/giou_loss.py at master · tensorflow/addons - GitHub
文章推薦指數: 80 %
model = tf.keras.Model(). >>> model.compile('sgd', loss=tfa.losses.GIoULoss()). Args: mode: one of ['giou', 'iou'], decided to calculate GIoU or IoU loss.
Skiptocontent
{{message}}
tensorflow
/
addons
Public
Notifications
Fork
589
Star
1.6k
Code
Issues
208
Pullrequests
39
Actions
Projects
2
Security
Insights
More
Code
Issues
Pullrequests
Actions
Projects
Security
Insights
Permalink
master
Branches
Tags
Couldnotloadbranches
Nothingtoshow
{{refName}}
default
Couldnotloadtags
Nothingtoshow
{{refName}}
default
Atagalreadyexistswiththeprovidedbranchname.ManyGitcommandsacceptbothtagandbranchnames,socreatingthisbranchmaycauseunexpectedbehavior.Areyousureyouwanttocreatethisbranch?
addons/tensorflow_addons/losses/giou_loss.py
/
Jumpto
GIoULoss
Class
__init__
Function
giou_loss
Function
_calculate_giou
Function
Gotofile
Gotofile
T
Gotoline
L
Gotodefinition
R
Copypath
Copypermalink
Thiscommitdoesnotbelongtoanybranchonthisrepository,andmaybelongtoaforkoutsideoftherepository.
Cannotretrievecontributorsatthistime
138lines(114sloc)
5.22KB
Raw
Blame
Editthisfile
E
OpeninGitHubDesktop
OpenwithDesktop
Viewraw
Viewblame
ThisfilecontainsbidirectionalUnicodetextthatmaybeinterpretedorcompileddifferentlythanwhatappearsbelow.Toreview,openthefileinaneditorthatrevealshiddenUnicodecharacters.
LearnmoreaboutbidirectionalUnicodecharacters
Showhiddencharacters
#Copyright2019TheTensorFlowAuthors.AllRightsReserved.
#
#LicensedundertheApacheLicense,Version2.0(the"License");
#youmaynotusethisfileexceptincompliancewiththeLicense.
#YoumayobtainacopyoftheLicenseat
#
#http://www.apache.org/licenses/LICENSE-2.0
#
#Unlessrequiredbyapplicablelaworagreedtoinwriting,software
#distributedundertheLicenseisdistributedonan"ASIS"BASIS,
#WITHOUTWARRANTIESORCONDITIONSOFANYKIND,eitherexpressorimplied.
#SeetheLicenseforthespecificlanguagegoverningpermissionsand
#limitationsundertheLicense.
#==============================================================================
"""ImplementsGIoUloss."""
fromtypingimportOptional
importtensorflowastf
fromtypeguardimporttypechecked
fromtensorflow_addons.utils.keras_utilsimportLossFunctionWrapper
fromtensorflow_addons.utils.typesimportTensorLike
@tf.keras.utils.register_keras_serializable(package="Addons")
classGIoULoss(LossFunctionWrapper):
"""ImplementstheGIoUlossfunction.
GIoUlosswasfirstintroducedinthe
[GeneralizedIntersectionoverUnion:
AMetricandALossforBoundingBoxRegression]
(https://giou.stanford.edu/GIoU.pdf).
GIoUisanenhancementformodelswhichuseIoUinobjectdetection.
Usage:
>>>gl=tfa.losses.GIoULoss()
>>>boxes1=tf.constant([[4.0,3.0,7.0,5.0],[5.0,6.0,10.0,7.0]])
>>>boxes2=tf.constant([[3.0,4.0,6.0,8.0],[14.0,14.0,15.0,15.0]])
>>>loss=gl(boxes1,boxes2)
>>>loss
延伸文章資訊
- 1Giou loss tf代码 - CSDN博客
loss: a float tensor of shape [batch_size, num_anchors] tensor ... IOU_loss、DIOU_loss、GIOU_loss、C...
- 2Generalized Intersection over Union
Generalized Intersection over Union. A Metric and A Loss for Bounding Box Regression. Cite Paper ...
- 3tfaddons source: R/losses.R - Rdrr.io
@param margin Float, margin term in the loss definition. ... do.call(tfa$losses$LiftedStructLoss,...
- 4tfa.losses.GIoULoss | TensorFlow Addons
tfa.losses.GIoULoss ... Implements the GIoU loss function. ... GIoU loss was first introduced in ...
- 5Keras Loss Functions: Everything You Need to Know
loss functions available in Keras and how to use them, ... import tensorflow_addons as tfa model....