def __detect_text(self):
    'Internal function to detect text bounding boxes from input image.\n        Returns list of bounding boxes of each detected text field in input image.\n\n        :param image: image file in numpy array/opencv format\n        :type image: numpy array\n        :param output_image: image file in numpy array/opencv format\n        :type output_image: numpy array\n\n        :return: output image with the list of text boxes\n        :rtype: file, list\n        '
    (H, W) = self.image.shape[:2]
    rW = (W / 320)
    rH = (H / 320)
    image = cv2.resize(self.image, (320, 320))
    (H, W) = image.shape[:2]
    blob = cv2.dnn.blobFromImage(self.image, 1.0, (W, H), (123.68, 116.78, 103.94), swapRB=True, crop=False)
    self.net.setInput(blob)
    (scores, geometry) = self.net.forward(self.layerNames)
    (rects, confidences) = self.__decode_predictions(scores, geometry)
    boxes = non_max_suppression(np.array(rects), probs=confidences)
    text_rects = []
    for (startX, startY, endX, endY) in boxes:
        startX = int((startX * rW))
        startY = int((startY * rH))
        endX = int((endX * rW))
        endY = int((endY * rH))
        cv2.rectangle(self.image, (startX, startY), (endX, endY), (0, 0, 255), 3)
        text_rects.append([startX, startY, endX, endY])
    text_rects = sorted(text_rects, key=(lambda item: item[0]))
    final_rects = text_rects
    if (len(text_rects) > 0):
        final_rects = self.__merge_boxes(text_rects)
    return final_rects
Internal function to detect text bounding boxes from input image.
Returns list of bounding boxes of each detected text field in input image.

:param image: image file in numpy array/opencv format
:type image: numpy array
:param output_image: image file in numpy array/opencv format
:type output_image: numpy array

:return: output image with the list of text boxes
:rtype: file, list
def __detect_text(self):
    'Internal function to detect text bounding boxes from input image.\n        Returns list of bounding boxes of each detected text field in input image.\n\n        :param image: image file in numpy array/opencv format\n        :type image: numpy array\n        :param output_image: image file in numpy array/opencv format\n        :type output_image: numpy array\n\n        :return: output image with the list of text boxes\n        :rtype: file, list\n        '
    (H, W) = self.image.shape[:2]
    rW = (W / 320)
    rH = (H / 320)
    image = cv2.resize(self.image, (320, 320))
    (H, W) = image.shape[:2]
    blob = cv2.dnn.blobFromImage(self.image, 1.0, (W, H), (123.68, 116.78, 103.94), swapRB=True, crop=False)
    self.net.setInput(blob)
    (scores, geometry) = self.net.forward(self.layerNames)
    (rects, confidences) = self.__decode_predictions(scores, geometry)
    boxes = non_max_suppression(np.array(rects), probs=confidences)
    text_rects = []
    for (startX, startY, endX, endY) in boxes:
        startX = int((startX * rW))
        startY = int((startY * rH))
        endX = int((endX * rW))
        endY = int((endY * rH))
        cv2.rectangle(self.image, (startX, startY), (endX, endY), (0, 0, 255), 3)
        text_rects.append([startX, startY, endX, endY])
    text_rects = sorted(text_rects, key=(lambda item: item[0]))
    final_rects = text_rects
    if (len(text_rects) > 0):
        final_rects = self.__merge_boxes(text_rects)
    return final_rects