Update main.py

Issues 30 and 40 are resolved
pull/41/head
vahidrezanezhad 4 years ago committed by GitHub
parent a7c92c92ff
commit 0f09f4a1f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -3,6 +3,7 @@
__version__ = '1.0' __version__ = '1.0'
import os import os
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
import sys import sys
import cv2 import cv2
import numpy as np import numpy as np
@ -17,8 +18,9 @@ import math
from shapely import geometry from shapely import geometry
from sklearn.cluster import KMeans from sklearn.cluster import KMeans
import gc import gc
from keras import backend as K
import tensorflow as tf import tensorflow as tf
tf.get_logger().setLevel('ERROR')
from keras import backend as K
from scipy.signal import find_peaks from scipy.signal import find_peaks
from scipy.ndimage import gaussian_filter1d from scipy.ndimage import gaussian_filter1d
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
@ -29,8 +31,10 @@ from multiprocessing import Process, Queue, cpu_count
import datetime import datetime
with warnings.catch_warnings(): warnings.filterwarnings('ignore')
warnings.simplefilter("ignore")
##with warnings.catch_warnings():
##warnings.simplefilter("ignore",category=RuntimeWarning)
__doc__ = \ __doc__ = \
""" """
@ -2063,6 +2067,7 @@ class textline_detector:
t2=time.time() t2=time.time()
try:
# extract text regions and corresponding contours and surrounding box # extract text regions and corresponding contours and surrounding box
text_regions=self.extract_text_regions(image_page) text_regions=self.extract_text_regions(image_page)
@ -2080,6 +2085,12 @@ class textline_detector:
K.clear_session() K.clear_session()
gc.collect() gc.collect()
except:
text_regions=None
contours=[]
t3=time.time() t3=time.time()

Loading…
Cancel
Save