parameters: (self, boxes)
return_statement: return assignment
docstring: Assign boxes to priors for training.
  
          # Arguments
              boxes: Box, numpy tensor of shape (num_boxes, 4 + num_classes),
                  num_classes without background.
  
          # Return
              assignment: Tensor with assigned boxes,
                  numpy tensor of shape (num_boxes, 4 + num_classes + 8),
                  priors in ground truth are fictitious,
                  assignment[:, -8] has 1 if prior should be penalized
                      or in other words is assigned to some ground truth box,
                  assignment[:, -7:] are all 0. See loss for more details.
docstring_summary: Assign boxes to priors for training.
docstring_tokens: Assign boxes to priors for training .
function: def assign_boxes(self, boxes):
          """Assign boxes to priors for training.
  
          # Arguments
              boxes: Box, numpy tensor of shape (num_boxes, 4 + num_classes),
                  num_classes without background.
  
          # Return
              assignment: Tensor with assigned boxes,
                  numpy tensor of shape (num_boxes, 4 + num_classes + 8),
                  priors in ground truth are fictitious,
                  assignment[:, -8] has 1 if prior should be penalized
                      or in other words is assigned to some ground truth box,
                  assignment[:, -7:] are all 0. See loss for more details.
          """
          assignment = np.zeros((self.num_priors, 4 + self.num_classes + 8))
          assignment[:, 4] = 1.0
          if len(boxes) == 0:
              return assignment
          encoded_boxes = np.apply_along_axis(self.encode_box, 1, boxes[:, :4])
          encoded_boxes = encoded_boxes.reshape(-1, self.num_priors, 5)
          best_iou = encoded_boxes[:, :, -1].max(axis=0)
          best_iou_idx = encoded_boxes[:, :, -1].argmax(axis=0)
          best_iou_mask = best_iou > 0
          best_iou_idx = best_iou_idx[best_iou_mask]
          assign_num = len(best_iou_idx)
          encoded_boxes = encoded_boxes[:, best_iou_mask, :]
          assignment[:, :4][best_iou_mask] = encoded_boxes[best_iou_idx,
                                                           np.arange(assign_num),
                                                           :4]
          assignment[:, 4][best_iou_mask] = 0
          assignment[:, 5:-8][best_iou_mask] = boxes[best_iou_idx, 4:]
          assignment[:, -8][best_iou_mask] = 1
          return assignment
function_tokens: def assign_boxes ( self , boxes ) : assignment = np . zeros ( ( self . num_priors , 4 + self . num_classes + 8 ) ) assignment [ : , 4 ] = 1.0 if len ( boxes ) == 0 : return assignment encoded_boxes = np . apply_along_axis ( self . encode_box , 1 , boxes [ : , : 4 ] ) encoded_boxes = encoded_boxes . reshape ( - 1 , self . num_priors , 5 ) best_iou = encoded_boxes [ : , : , - 1 ] . max ( axis = 0 ) best_iou_idx = encoded_boxes [ : , : , - 1 ] . argmax ( axis = 0 ) best_iou_mask = best_iou > 0 best_iou_idx = best_iou_idx [ best_iou_mask ] assign_num = len ( best_iou_idx ) encoded_boxes = encoded_boxes [ : , best_iou_mask , : ] assignment [ : , : 4 ] [ best_iou_mask ] = encoded_boxes [ best_iou_idx , np . arange ( assign_num ) , : 4 ] assignment [ : , 4 ] [ best_iou_mask ] = 0 assignment [ : , 5 : - 8 ] [ best_iou_mask ] = boxes [ best_iou_idx , 4 : ] assignment [ : , - 8 ] [ best_iou_mask ] = 1 return assignment