add the missing import and format some codes

add the missing import and format some codes
This commit is contained in:
shaohua.zhang 2020-07-17 13:48:08 +08:00 committed by GitHub
parent 26219d5f44
commit 2f87ed81d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -16,7 +16,7 @@ import math
import cv2 import cv2
import numpy as np import numpy as np
import json import json
import sys
class EASTProcessTrain(object): class EASTProcessTrain(object):
def __init__(self, params): def __init__(self, params):
@ -78,7 +78,7 @@ class EASTProcessTrain(object):
dst_polys = [] dst_polys = []
rand_degree_ratio = np.random.rand() rand_degree_ratio = np.random.rand()
rand_degree_cnt = 1 rand_degree_cnt = 1
if rand_degree_ratio > 0.333 and rand_degree_ratio < 0.666: if 0.333 < rand_degree_ratio < 0.666:
rand_degree_cnt = 2 rand_degree_cnt = 2
elif rand_degree_ratio > 0.666: elif rand_degree_ratio > 0.666:
rand_degree_cnt = 3 rand_degree_cnt = 3
@ -138,7 +138,7 @@ class EASTProcessTrain(object):
continue continue
if p_area > 0: if p_area > 0:
#'poly in wrong direction' #'poly in wrong direction'
if tag == False: if not tag:
tag = True #reversed cases should be ignore tag = True #reversed cases should be ignore
poly = poly[(0, 3, 2, 1), :] poly = poly[(0, 3, 2, 1), :]
validated_polys.append(poly) validated_polys.append(poly)