def __init__(self, weight=1.0):
    'Constructor for this class does following tasks, if not already downloaded        , it first downloads text detector dnn weights file from public URL        ands save it at USER_HOME/.katna directory, or /tmp/.katna directory.        After this initializer code initializes internal parameter:         min_confidence (for text detection)\n        '
    super().__init__(weight)
    self.min_confidence = config.TextDetector.min_confidence
    self.merge_threshold = config.TextDetector.merge_threshold
    self.layerNames = config.TextDetector.layerNames
    self.frozen_weights = config.TextDetector.frozen_weights
    self.cache_subdir = config.TextDetector.cache_subdir
    try:
        self.network_folder_path = os.path.join(os.path.expanduser('~'), '.katna')
        if (not os.access(self.network_folder_path, os.W_OK)):
            self.network_folder_path = os.path.join('/tmp', '.katna')
        self.datadir = os.path.join(self.network_folder_path, self.cache_subdir)
        if (not os.path.exists(self.datadir)):
            os.makedirs(self.datadir)
        self.network_file_path = os.path.join(self.datadir, self.frozen_weights)
        if (not os.path.exists(self.network_file_path)):
            self.download_data()
        self.net = cv2.dnn.readNet(self.network_file_path)
    except Exception:
        raise FileNotFoundError((self.frozen_weights + ' seems to be missing.                 Download the file and specify the full path                      while initializing TextDetector class'))
Constructor for this class does following tasks, if not already downloaded        , it first downloads text detector dnn weights file from public URL        ands save it at USER_HOME/.katna directory, or /tmp/.katna directory.        After this initializer code initializes internal parameter:         min_confidence (for text detection)
def __init__(self, weight=1.0):
    '\n        '
    super().__init__(weight)
    self.min_confidence = config.TextDetector.min_confidence
    self.merge_threshold = config.TextDetector.merge_threshold
    self.layerNames = config.TextDetector.layerNames
    self.frozen_weights = config.TextDetector.frozen_weights
    self.cache_subdir = config.TextDetector.cache_subdir
    try:
        self.network_folder_path = os.path.join(os.path.expanduser('~'), '.katna')
        if (not os.access(self.network_folder_path, os.W_OK)):
            self.network_folder_path = os.path.join('/tmp', '.katna')
        self.datadir = os.path.join(self.network_folder_path, self.cache_subdir)
        if (not os.path.exists(self.datadir)):
            os.makedirs(self.datadir)
        self.network_file_path = os.path.join(self.datadir, self.frozen_weights)
        if (not os.path.exists(self.network_file_path)):
            self.download_data()
        self.net = cv2.dnn.readNet(self.network_file_path)
    except Exception:
        raise FileNotFoundError((self.frozen_weights + ' seems to be missing.                 Download the file and specify the full path                      while initializing TextDetector class'))