class_docstr: Box regression network.
docstr: Initialize BoxNet.
  
  Args:
    num_anchors: number of  anchors used.
    num_filters: number of filters for "intermediate" layers.
    min_level: minimum level for features.
    max_level: maximum level for features.
    act_type: String of the activation used.
    repeats: number of "intermediate" layers.
    separable_conv: True to use separable_conv instead of conv2D.
    survival_prob: if a value is set then drop connect will be used.
    data_format: string of 'channel_first' or 'channels_last'.
    grad_checkpoint: bool, If true, apply grad checkpoint for saving memory.
    name: Name of the layer.
    **kwargs: other parameters.
docstr_tok: ["Initialize","BoxNet",".","Args",":","num_anchors",":","number","of","anchors","used",".","num_filters",":","number","of","filters","for","``","intermediate","''","layers",".","min_level",":","minimum","level","for","features",".","max_level",":","maximum","level","for","features",".","act_type",":","String","of","the","activation","used",".","repeats",":","number","of","``","intermediate","''","layers",".","separable_conv",":","True","to","use","separable_conv","instead","of","conv2D",".","survival_prob",":","if","a","value","is","set","then","drop","connect","will","be","used",".","data_format",":","string","of","'channel_first","'","or","'channels_last","'",".","grad_checkpoint",":","bool",",","If","true",",","apply","grad","checkpoint","for","saving","memory",".","name",":","Name","of","the","layer",".","*","*","kwargs",":","other","parameters","."]
code: def __init__(
      self,
      num_anchors=9,
      num_filters=32,
      min_level=3,
      max_level=7,
      act_type="swish",
      repeats=4,
      separable_conv=True,
      survival_prob=None,
      data_format="channels_last",
      grad_checkpoint=False,
      name="box_net",
      **kwargs,
  ):
      """Initialize BoxNet.
  
      Args:
        num_anchors: number of  anchors used.
        num_filters: number of filters for "intermediate" layers.
        min_level: minimum level for features.
        max_level: maximum level for features.
        act_type: String of the activation used.
        repeats: number of "intermediate" layers.
        separable_conv: True to use separable_conv instead of conv2D.
        survival_prob: if a value is set then drop connect will be used.
        data_format: string of 'channel_first' or 'channels_last'.
        grad_checkpoint: bool, If true, apply grad checkpoint for saving memory.
        name: Name of the layer.
        **kwargs: other parameters.
      """
  
      super().__init__(name=name, **kwargs)
  
      self.num_anchors = num_anchors
      self.num_filters = num_filters
      self.min_level = min_level
      self.max_level = max_level
      self.repeats = repeats
      self.separable_conv = separable_conv
      self.survival_prob = survival_prob
      self.act_type = act_type
      self.data_format = data_format
      self.grad_checkpoint = grad_checkpoint
  
      self.conv_ops = []
      self.bns = []
  
      for i in range(self.repeats):
          # If using SeparableConv2D
          if self.separable_conv:
              self.conv_ops.append(
                  tf.keras.layers.SeparableConv2D(
                      filters=self.num_filters,
                      depth_multiplier=1,
                      pointwise_initializer=tf.initializers.variance_scaling(),
                      depthwise_initializer=tf.initializers.variance_scaling(),
                      data_format=self.data_format,
                      kernel_size=3,
                      activation=None,
                      bias_initializer=tf.zeros_initializer(),
                      padding="same",
                      name="box-%d" % i,
                  )
              )
          # If using Conv2d
          else:
              self.conv_ops.append(
                  tf.keras.layers.Conv2D(
                      filters=self.num_filters,
                      kernel_initializer=tf.random_normal_initializer(
                          stddev=0.01
                      ),
                      data_format=self.data_format,
                      kernel_size=3,
                      activation=None,
                      bias_initializer=tf.zeros_initializer(),
                      padding="same",
                      name="box-%d" % i,
                  )
              )
  
          bn_per_level = []
          for level in range(self.min_level, self.max_level + 1):
              bn_per_level.append(
                  utils.build_batch_norm(
                      data_format=self.data_format,
                      name="box-%d-bn-%d" % (i, level),
                  )
              )
          self.bns.append(bn_per_level)
  
      if self.separable_conv:
          self.boxes = tf.keras.layers.SeparableConv2D(
              filters=4 * self.num_anchors,
              depth_multiplier=1,
              pointwise_initializer=tf.initializers.variance_scaling(),
              depthwise_initializer=tf.initializers.variance_scaling(),
              data_format=self.data_format,
              kernel_size=3,
              activation=None,
              bias_initializer=tf.zeros_initializer(),
              padding="same",
              name="box-predict",
          )
      else:
          self.boxes = tf.keras.layers.Conv2D(
              filters=4 * self.num_anchors,
              kernel_initializer=tf.random_normal_initializer(
                  stddev=0.01
              ),
              data_format=self.data_format,
              kernel_size=3,
              activation=None,
              bias_initializer=tf.zeros_initializer(),
              padding="same",
              name="box-predict",
          )
  
imports: import functools
  from absl import logging
  import numpy
  import tensorflow
  import utils
  from .None import fpn_configs
label_desc: Use image node_id 1 to create a new BoxNet object from inherited base classes: tf.keras.layers with example: obj = BoxNet(num_anchors, num_filters, min_level, max_level, act_type, repeats, separable_conv, survival_prob, data_format, grad_checkpoint, name)