# automatically generated by the FlatBuffers compiler, do not modify

# namespace: MNN

import flatbuffers
from flatbuffers.compat import import_numpy
np = import_numpy()

class DetectionPostProcessParam(object):
    __slots__ = ['_tab']

    @classmethod
    def GetRootAs(cls, buf, offset=0):
        n = flatbuffers.encode.Get(flatbuffers.packer.uoffset, buf, offset)
        x = DetectionPostProcessParam()
        x.Init(buf, n + offset)
        return x

    @classmethod
    def GetRootAsDetectionPostProcessParam(cls, buf, offset=0):
        """This method is deprecated. Please switch to GetRootAs."""
        return cls.GetRootAs(buf, offset)
    # DetectionPostProcessParam
    def Init(self, buf, pos):
        self._tab = flatbuffers.table.Table(buf, pos)

    # DetectionPostProcessParam
    def MaxDetections(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(4))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
        return 0

    # DetectionPostProcessParam
    def MaxClassesPerDetection(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(6))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
        return 0

    # DetectionPostProcessParam
    def DetectionsPerClass(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(8))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
        return 0

    # DetectionPostProcessParam
    def NmsScoreThreshold(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(10))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
        return 0.0

    # DetectionPostProcessParam
    def IouThreshold(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(12))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Float32Flags, o + self._tab.Pos)
        return 0.0

    # DetectionPostProcessParam
    def NumClasses(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(14))
        if o != 0:
            return self._tab.Get(flatbuffers.number_types.Int32Flags, o + self._tab.Pos)
        return 0

    # DetectionPostProcessParam
    def UseRegularNms(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(16))
        if o != 0:
            return bool(self._tab.Get(flatbuffers.number_types.BoolFlags, o + self._tab.Pos))
        return False

    # DetectionPostProcessParam
    def CenterSizeEncoding(self, j):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
        if o != 0:
            a = self._tab.Vector(o)
            return self._tab.Get(flatbuffers.number_types.Float32Flags, a + flatbuffers.number_types.UOffsetTFlags.py_type(j * 4))
        return 0

    # DetectionPostProcessParam
    def CenterSizeEncodingAsNumpy(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
        if o != 0:
            return self._tab.GetVectorAsNumpy(flatbuffers.number_types.Float32Flags, o)
        return 0

    # DetectionPostProcessParam
    def CenterSizeEncodingLength(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
        if o != 0:
            return self._tab.VectorLen(o)
        return 0

    # DetectionPostProcessParam
    def CenterSizeEncodingIsNone(self):
        o = flatbuffers.number_types.UOffsetTFlags.py_type(self._tab.Offset(18))
        return o == 0

def DetectionPostProcessParamStart(builder): builder.StartObject(8)
def Start(builder):
    return DetectionPostProcessParamStart(builder)
def DetectionPostProcessParamAddMaxDetections(builder, maxDetections): builder.PrependInt32Slot(0, maxDetections, 0)
def AddMaxDetections(builder, maxDetections):
    return DetectionPostProcessParamAddMaxDetections(builder, maxDetections)
def DetectionPostProcessParamAddMaxClassesPerDetection(builder, maxClassesPerDetection): builder.PrependInt32Slot(1, maxClassesPerDetection, 0)
def AddMaxClassesPerDetection(builder, maxClassesPerDetection):
    return DetectionPostProcessParamAddMaxClassesPerDetection(builder, maxClassesPerDetection)
def DetectionPostProcessParamAddDetectionsPerClass(builder, detectionsPerClass): builder.PrependInt32Slot(2, detectionsPerClass, 0)
def AddDetectionsPerClass(builder, detectionsPerClass):
    return DetectionPostProcessParamAddDetectionsPerClass(builder, detectionsPerClass)
def DetectionPostProcessParamAddNmsScoreThreshold(builder, nmsScoreThreshold): builder.PrependFloat32Slot(3, nmsScoreThreshold, 0.0)
def AddNmsScoreThreshold(builder, nmsScoreThreshold):
    return DetectionPostProcessParamAddNmsScoreThreshold(builder, nmsScoreThreshold)
def DetectionPostProcessParamAddIouThreshold(builder, iouThreshold): builder.PrependFloat32Slot(4, iouThreshold, 0.0)
def AddIouThreshold(builder, iouThreshold):
    return DetectionPostProcessParamAddIouThreshold(builder, iouThreshold)
def DetectionPostProcessParamAddNumClasses(builder, numClasses): builder.PrependInt32Slot(5, numClasses, 0)
def AddNumClasses(builder, numClasses):
    return DetectionPostProcessParamAddNumClasses(builder, numClasses)
def DetectionPostProcessParamAddUseRegularNms(builder, useRegularNms): builder.PrependBoolSlot(6, useRegularNms, 0)
def AddUseRegularNms(builder, useRegularNms):
    return DetectionPostProcessParamAddUseRegularNms(builder, useRegularNms)
def DetectionPostProcessParamAddCenterSizeEncoding(builder, centerSizeEncoding): builder.PrependUOffsetTRelativeSlot(7, flatbuffers.number_types.UOffsetTFlags.py_type(centerSizeEncoding), 0)
def AddCenterSizeEncoding(builder, centerSizeEncoding):
    return DetectionPostProcessParamAddCenterSizeEncoding(builder, centerSizeEncoding)
def DetectionPostProcessParamStartCenterSizeEncodingVector(builder, numElems): return builder.StartVector(4, numElems, 4)
def StartCenterSizeEncodingVector(builder, numElems):
    return DetectionPostProcessParamStartCenterSizeEncodingVector(builder, numElems)
def DetectionPostProcessParamEnd(builder): return builder.EndObject()
def End(builder):
    return DetectionPostProcessParamEnd(builder)