public class MPSCNNYOLOLossDescriptor extends NSObject implements NSCopying
The MPSCNNYOLOLossDescriptor specifies a loss filter descriptor that is used to create a MPSCNNLoss filter. The MPSCNNYOLOLoss is a filter that has been specialized for object detection tasks and follows a specific layout for the feature-channels of the input, output, weight and label data.
The layout of the data within the feature-channels is as follows:
Each anchorbox uses ( 2+2+1 + numberOfClasses = 5 + numberOfClasses ) feature channels.
Therefore the total number of feature channels used is: (5 + numberOfClasses) * numberOfAnchorBoxes. The first feature channel for anchorbox index 'anchorIdx' is at fcIndex = (5 + numberOfClasses) * anchorIdx, and the feature channels within each anchorbox are stored in the layout: 'XYWHCFFFFFF...', where (XY) are the so-called raw x and y coordinates of the bounding box within each gridcell and (WH) are the corresponding width and height. 'C' signifies a confidence for having an object in the cell and FFFFF... are the feature channel values for each class of object to be classified in the object detector.
The YOLO-loss filter works by operating mostly independently on each anchorbox: * The XY-channels of the inputs are first transformed to relative XY-values by applying the sigmoid-neuron on them, after which they are passed through the loss function defined by @ref XYLossDescriptor, which is typically chosen to be the @ref MPSCNNLossTypeMeanSquaredError type loss function. * The WH-channels contain the raw width and height of the bounding box and they are operated with the loss function defined by @ref WHLossDescriptor, which is typically of type @ref MPSCNNLossTypeHuber. * The C-channel contains the confidence value of having an object in the bounding box and it is operated by the loss function defined by @ref confidenceLossDescriptor, which is typically chosen to be [@ref] MPSCNNLossTypeSigmoidCrossEntropy. * The FFFFF... (number of channels is number of classes) channels contains the raw feature channels for object classes, used to identify which objects are the most probable ones in the bounding box and these channels are passed through the loss function defined by @ref classesLossDescriptor, which in typical cases is of the type @ref MPSCNNLossTypeSoftMaxCrossEntropy.
For details on how to set up the label values and anchorboxes see https://arxiv.org/abs/1612.08242
NSObject.Function_instanceMethodForSelector_ret, NSObject.Function_methodForSelector_ret| Modifier | Constructor and Description |
|---|---|
protected |
MPSCNNYOLOLossDescriptor(org.moe.natj.general.Pointer peer) |
| Modifier and Type | Method and Description |
|---|---|
static boolean |
accessInstanceVariablesDirectly() |
static MPSCNNYOLOLossDescriptor |
alloc() |
static MPSCNNYOLOLossDescriptor |
allocWithZone(org.moe.natj.general.ptr.VoidPtr zone) |
NSData |
anchorBoxes()
[@property] anchorBoxes
|
static boolean |
automaticallyNotifiesObserversForKey(java.lang.String key) |
static void |
cancelPreviousPerformRequestsWithTarget(java.lang.Object aTarget) |
static void |
cancelPreviousPerformRequestsWithTargetSelectorObject(java.lang.Object aTarget,
org.moe.natj.objc.SEL aSelector,
java.lang.Object anArgument) |
MPSCNNLossDescriptor |
classesLossDescriptor()
[@property] classesLossDescriptor
|
static NSArray<java.lang.String> |
classFallbacksForKeyedArchiver() |
static org.moe.natj.objc.Class |
classForKeyedUnarchiver() |
static MPSCNNYOLOLossDescriptor |
cnnLossDescriptorWithXYLossTypeWHLossTypeConfidenceLossTypeClassesLossTypeReductionTypeAnchorBoxesNumberOfAnchorBoxes(int XYLossType,
int WHLossType,
int confidenceLossType,
int classesLossType,
int reductionType,
NSData anchorBoxes,
long numberOfAnchorBoxes)
Make a descriptor for a MPSCNNYOLOLoss object.
|
MPSCNNLossDescriptor |
confidenceLossDescriptor()
[@property] confidenceLossDescriptor
|
java.lang.Object |
copyWithZone(org.moe.natj.general.ptr.VoidPtr zone) |
static java.lang.String |
debugDescription_static() |
static java.lang.String |
description_static() |
static long |
hash_static() |
MPSCNNYOLOLossDescriptor |
init() |
static NSObject.Function_instanceMethodForSelector_ret |
instanceMethodForSelector(org.moe.natj.objc.SEL aSelector) |
static NSMethodSignature |
instanceMethodSignatureForSelector(org.moe.natj.objc.SEL aSelector) |
static boolean |
instancesRespondToSelector(org.moe.natj.objc.SEL aSelector) |
static boolean |
isSubclassOfClass(org.moe.natj.objc.Class aClass) |
static NSSet<java.lang.String> |
keyPathsForValuesAffectingValueForKey(java.lang.String key) |
float |
maxIOUForObjectAbsence()
[@property] neg_iou
|
float |
minIOUForObjectPresence()
[@property] pos_iou
|
static MPSCNNYOLOLossDescriptor |
new_objc() |
long |
numberOfAnchorBoxes()
[@property] numberOfAnchorBoxes
|
boolean |
reduceAcrossBatch()
[@property] reduceAcrossBatch
|
int |
reductionType()
[@property] reductionType
|
boolean |
rescore()
[@property] rescore
|
static boolean |
resolveClassMethod(org.moe.natj.objc.SEL sel) |
static boolean |
resolveInstanceMethod(org.moe.natj.objc.SEL sel) |
float |
scaleClass()
[@property] scaleClass
|
float |
scaleNoObject()
[@property] scaleNoObject
|
float |
scaleObject()
[@property] scaleObject
|
float |
scaleWH()
[@property] scaleWH
|
float |
scaleXY()
[@property] scaleXY
|
void |
setAnchorBoxes(NSData value)
[@property] anchorBoxes
|
void |
setClassesLossDescriptor(MPSCNNLossDescriptor value)
[@property] classesLossDescriptor
|
void |
setConfidenceLossDescriptor(MPSCNNLossDescriptor value)
[@property] confidenceLossDescriptor
|
void |
setMaxIOUForObjectAbsence(float value)
[@property] neg_iou
|
void |
setMinIOUForObjectPresence(float value)
[@property] pos_iou
|
void |
setNumberOfAnchorBoxes(long value)
[@property] numberOfAnchorBoxes
|
void |
setReduceAcrossBatch(boolean value)
[@property] reduceAcrossBatch
|
void |
setReductionType(int value)
[@property] reductionType
|
void |
setRescore(boolean value)
[@property] rescore
|
void |
setScaleClass(float value)
[@property] scaleClass
|
void |
setScaleNoObject(float value)
[@property] scaleNoObject
|
void |
setScaleObject(float value)
[@property] scaleObject
|
void |
setScaleWH(float value)
[@property] scaleWH
|
void |
setScaleXY(float value)
[@property] scaleXY
|
static void |
setVersion_static(long aVersion) |
void |
setWHLossDescriptor(MPSCNNLossDescriptor value)
[@property] WHLossDescriptor
|
void |
setXYLossDescriptor(MPSCNNLossDescriptor value)
[@property] XYLossDescriptor
|
static org.moe.natj.objc.Class |
superclass_static() |
static long |
version_static() |
MPSCNNLossDescriptor |
WHLossDescriptor()
[@property] WHLossDescriptor
|
MPSCNNLossDescriptor |
XYLossDescriptor()
[@property] XYLossDescriptor
|
accessibilityActivate, accessibilityActivationPoint, accessibilityAssistiveTechnologyFocusedIdentifiers, accessibilityAttributedHint, accessibilityAttributedLabel, accessibilityAttributedUserInputLabels, accessibilityAttributedValue, accessibilityContainerType, accessibilityCustomActions, accessibilityCustomRotors, accessibilityDecrement, accessibilityDragSourceDescriptors, accessibilityDropPointDescriptors, accessibilityElementAtIndex, accessibilityElementCount, accessibilityElementDidBecomeFocused, accessibilityElementDidLoseFocus, accessibilityElementIsFocused, accessibilityElements, accessibilityElementsHidden, accessibilityFrame, accessibilityHint, accessibilityIncrement, accessibilityLabel, accessibilityLanguage, accessibilityNavigationStyle, accessibilityPath, accessibilityPerformEscape, accessibilityPerformMagicTap, accessibilityRespondsToUserInteraction, accessibilityScroll, accessibilityTextualContext, accessibilityTraits, accessibilityUserInputLabels, accessibilityValue, accessibilityViewIsModal, addObserverForKeyPathOptionsContext, attemptRecoveryFromErrorOptionIndex, attemptRecoveryFromErrorOptionIndexDelegateDidRecoverSelectorContextInfo, autoContentAccessingProxy, awakeAfterUsingCoder, awakeFromNib, class_objc, classForCoder, classForKeyedArchiver, copy, dealloc, debugDescription, description, dictionaryWithValuesForKeys, didChangeValueForKey, didChangeValueForKeyWithSetMutationUsingObjects, didChangeValuesAtIndexesForKey, doesNotRecognizeSelector, fileManagerShouldProceedAfterError, fileManagerWillProcessPath, finalize_objc, forwardingTargetForSelector, forwardInvocation, hash, indexOfAccessibilityElement, isAccessibilityElement, isEqual, isKindOfClass, isMemberOfClass, isProxy, methodForSelector, methodSignatureForSelector, mutableArrayValueForKey, mutableArrayValueForKeyPath, mutableCopy, mutableOrderedSetValueForKey, mutableOrderedSetValueForKeyPath, mutableSetValueForKey, mutableSetValueForKeyPath, observationInfo, observeValueForKeyPathOfObjectChangeContext, performSelector, performSelectorInBackgroundWithObject, performSelectorOnMainThreadWithObjectWaitUntilDone, performSelectorOnMainThreadWithObjectWaitUntilDoneModes, performSelectorOnThreadWithObjectWaitUntilDone, performSelectorOnThreadWithObjectWaitUntilDoneModes, performSelectorWithObject, performSelectorWithObjectAfterDelay, performSelectorWithObjectAfterDelayInModes, performSelectorWithObjectWithObject, prepareForInterfaceBuilder, provideImageDataBytesPerRowOrigin_Size_UserInfo, removeObserverForKeyPath, removeObserverForKeyPathContext, replacementObjectForCoder, replacementObjectForKeyedArchiver, respondsToSelector, self, setAccessibilityActivationPoint, setAccessibilityAttributedHint, setAccessibilityAttributedLabel, setAccessibilityAttributedUserInputLabels, setAccessibilityAttributedValue, setAccessibilityContainerType, setAccessibilityCustomActions, setAccessibilityCustomRotors, setAccessibilityDragSourceDescriptors, setAccessibilityDropPointDescriptors, setAccessibilityElements, setAccessibilityElementsHidden, setAccessibilityFrame, setAccessibilityHint, setAccessibilityLabel, setAccessibilityLanguage, setAccessibilityNavigationStyle, setAccessibilityPath, setAccessibilityRespondsToUserInteraction, setAccessibilityTextualContext, setAccessibilityTraits, setAccessibilityUserInputLabels, setAccessibilityValue, setAccessibilityViewIsModal, setIsAccessibilityElement, setNilValueForKey, setObservationInfo, setShouldGroupAccessibilityChildren, setValueForKey, setValueForKeyPath, setValueForUndefinedKey, setValuesForKeysWithDictionary, shouldGroupAccessibilityChildren, superclass, validateValueForKeyError, validateValueForKeyPathError, valueForKey, valueForKeyPath, valueForUndefinedKey, willChangeValueForKey, willChangeValueForKeyWithSetMutationUsingObjects, willChangeValuesAtIndexesForKeyprotected MPSCNNYOLOLossDescriptor(org.moe.natj.general.Pointer peer)
public MPSCNNLossDescriptor WHLossDescriptor()
The type of a loss filter.
This parameter specifies the type of a loss filter.
public MPSCNNLossDescriptor XYLossDescriptor()
The type of a loss filter.
This parameter specifies the type of a loss filter.
public static boolean accessInstanceVariablesDirectly()
public static MPSCNNYOLOLossDescriptor alloc()
public static MPSCNNYOLOLossDescriptor allocWithZone(org.moe.natj.general.ptr.VoidPtr zone)
public NSData anchorBoxes()
NSData containing the width and height for numberOfAnchorBoxes anchor boxes This NSData should have 2 float values per anchor box which represent the width and height of the anchor box. [@code] typedef struct anchorBox{ float width; float height; }anchorBox;
anchorBox_t gAnchorBoxes[MAX_NUM_ANCHOR_BOXES] = { {.width = 1.f, .height = 2.f}, {.width = 1.f, .height = 1.f}, {.width = 2.f, .height = 1.f}, }; NSData* labelsInputData = [NSData dataWithBytes: gAnchorBoxes length: MAX_NUM_ANCHOR_BOXES * sizeof(anchorBox)]; [@endcode]
public static boolean automaticallyNotifiesObserversForKey(java.lang.String key)
public static void cancelPreviousPerformRequestsWithTarget(java.lang.Object aTarget)
public static void cancelPreviousPerformRequestsWithTargetSelectorObject(java.lang.Object aTarget,
org.moe.natj.objc.SEL aSelector,
java.lang.Object anArgument)
public static NSArray<java.lang.String> classFallbacksForKeyedArchiver()
public static org.moe.natj.objc.Class classForKeyedUnarchiver()
public MPSCNNLossDescriptor classesLossDescriptor()
The type of a loss filter.
This parameter specifies the type of a loss filter.
public static MPSCNNYOLOLossDescriptor cnnLossDescriptorWithXYLossTypeWHLossTypeConfidenceLossTypeClassesLossTypeReductionTypeAnchorBoxesNumberOfAnchorBoxes(int XYLossType, int WHLossType, int confidenceLossType, int classesLossType, int reductionType, NSData anchorBoxes, long numberOfAnchorBoxes)
XYLossType - The type of spatial position loss filter.WHLossType - The type of spatial size loss filter.confidenceLossType - The type of confidence filter.classesLossType - The type of classes filter.reductionType - The type of a reduction operation to apply.anchorBoxes - This is an NSData which has an array of anchorBoxes defined as a struct{ float width; float height; };public MPSCNNLossDescriptor confidenceLossDescriptor()
The type of a loss filter.
This parameter specifies the type of a loss filter.
public java.lang.Object copyWithZone(org.moe.natj.general.ptr.VoidPtr zone)
copyWithZone in interface NSCopyingpublic static java.lang.String debugDescription_static()
public static java.lang.String description_static()
public static long hash_static()
public MPSCNNYOLOLossDescriptor init()
public static NSObject.Function_instanceMethodForSelector_ret instanceMethodForSelector(org.moe.natj.objc.SEL aSelector)
public static NSMethodSignature instanceMethodSignatureForSelector(org.moe.natj.objc.SEL aSelector)
public static boolean instancesRespondToSelector(org.moe.natj.objc.SEL aSelector)
public static boolean isSubclassOfClass(org.moe.natj.objc.Class aClass)
public static NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey(java.lang.String key)
public float maxIOUForObjectAbsence()
If the prediction IOU with groundTruth is lower than this value we consider it a confident object absence, default is 0.3
public float minIOUForObjectPresence()
If the prediction IOU with groundTruth is higher than this value we consider it a confident object presence, default is 0.7
public static MPSCNNYOLOLossDescriptor new_objc()
public long numberOfAnchorBoxes()
number of anchor boxes used to detect object per grid cell
public int reductionType()
ReductionType shared accross all losses (so they may generate same sized output)
public boolean rescore()
Rescore pertains to multiplying the confidence groundTruth with IOU (intersection over union) of predicted bounding box and the groundTruth boundingBox. Default is YES
public static boolean resolveClassMethod(org.moe.natj.objc.SEL sel)
public static boolean resolveInstanceMethod(org.moe.natj.objc.SEL sel)
public float scaleClass()
scale factor for no object classes loss and loss gradient default is 2.0
public float scaleNoObject()
scale factor for no object confidence loss and loss gradient default is 5.0
public float scaleObject()
scale factor for no object confidence loss and loss gradient default is 100.0
public float scaleWH()
scale factor for WH loss and loss gradient default is 10.0
public float scaleXY()
scale factor for XY loss and loss gradient default is 10.0
public void setAnchorBoxes(NSData value)
NSData containing the width and height for numberOfAnchorBoxes anchor boxes This NSData should have 2 float values per anchor box which represent the width and height of the anchor box. [@code] typedef struct anchorBox{ float width; float height; }anchorBox;
anchorBox_t gAnchorBoxes[MAX_NUM_ANCHOR_BOXES] = { {.width = 1.f, .height = 2.f}, {.width = 1.f, .height = 1.f}, {.width = 2.f, .height = 1.f}, }; NSData* labelsInputData = [NSData dataWithBytes: gAnchorBoxes length: MAX_NUM_ANCHOR_BOXES * sizeof(anchorBox)]; [@endcode]
public void setClassesLossDescriptor(MPSCNNLossDescriptor value)
The type of a loss filter.
This parameter specifies the type of a loss filter.
public void setConfidenceLossDescriptor(MPSCNNLossDescriptor value)
The type of a loss filter.
This parameter specifies the type of a loss filter.
public void setMaxIOUForObjectAbsence(float value)
If the prediction IOU with groundTruth is lower than this value we consider it a confident object absence, default is 0.3
public void setMinIOUForObjectPresence(float value)
If the prediction IOU with groundTruth is higher than this value we consider it a confident object presence, default is 0.7
public void setNumberOfAnchorBoxes(long value)
number of anchor boxes used to detect object per grid cell
public void setReductionType(int value)
ReductionType shared accross all losses (so they may generate same sized output)
public void setRescore(boolean value)
Rescore pertains to multiplying the confidence groundTruth with IOU (intersection over union) of predicted bounding box and the groundTruth boundingBox. Default is YES
public void setScaleClass(float value)
scale factor for no object classes loss and loss gradient default is 2.0
public void setScaleNoObject(float value)
scale factor for no object confidence loss and loss gradient default is 5.0
public void setScaleObject(float value)
scale factor for no object confidence loss and loss gradient default is 100.0
public void setScaleWH(float value)
scale factor for WH loss and loss gradient default is 10.0
public void setScaleXY(float value)
scale factor for XY loss and loss gradient default is 10.0
public static void setVersion_static(long aVersion)
public void setWHLossDescriptor(MPSCNNLossDescriptor value)
The type of a loss filter.
This parameter specifies the type of a loss filter.
public void setXYLossDescriptor(MPSCNNLossDescriptor value)
The type of a loss filter.
This parameter specifies the type of a loss filter.
public static org.moe.natj.objc.Class superclass_static()
public static long version_static()
public boolean reduceAcrossBatch()
If set to YES then the reduction operation is applied also across the batch-index dimension, ie. the loss value is summed over images in the batch and the result of the reduction is written on the first loss image in the batch while the other loss images will be set to zero. If set to NO, then no reductions are performed across the batch dimension and each image in the batch will contain the loss value associated with that one particular image. NOTE: If reductionType == MPSCNNReductionTypeNone, then this flag has no effect on results, that is no reductions are done in this case. NOTE: If reduceAcrossBatch is set to YES and reductionType == MPSCNNReductionTypeMean then the final forward loss value is computed by first summing over the components and then by dividing the result with: number of feature channels * width * height * number of images in the batch. The default value is NO.
public void setReduceAcrossBatch(boolean value)
If set to YES then the reduction operation is applied also across the batch-index dimension, ie. the loss value is summed over images in the batch and the result of the reduction is written on the first loss image in the batch while the other loss images will be set to zero. If set to NO, then no reductions are performed across the batch dimension and each image in the batch will contain the loss value associated with that one particular image. NOTE: If reductionType == MPSCNNReductionTypeNone, then this flag has no effect on results, that is no reductions are done in this case. NOTE: If reduceAcrossBatch is set to YES and reductionType == MPSCNNReductionTypeMean then the final forward loss value is computed by first summing over the components and then by dividing the result with: number of feature channels * width * height * number of images in the batch. The default value is NO.