Skip to content

Commit

Permalink
remove: unused imports
Browse files Browse the repository at this point in the history
  • Loading branch information
MehmedGIT committed Aug 16, 2024
1 parent a18307d commit 0ba6839
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 53 deletions.
6 changes: 1 addition & 5 deletions ocrd_cis/ocropy/binarize.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
from __future__ import absolute_import
from logging import Logger
from typing import Optional

import cv2
import numpy as np
from PIL import Image
from os.path import abspath, dirname, join

from typing import Union, Optional

#import kraken.binarization

from ocrd_utils import getLogger
from ocrd_models.ocrd_page import AlternativeImageType, OcrdPage
Expand Down
14 changes: 6 additions & 8 deletions ocrd_cis/ocropy/clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from logging import Logger
from typing import Optional

from os.path import join
import numpy as np
from PIL import Image, ImageStat, ImageOps
from shapely.geometry import Polygon
Expand All @@ -12,19 +11,18 @@
from ocrd import Processor
from ocrd.processor import OcrdPageResult, OcrdPageResultImage
from ocrd_utils import (
getLogger,
coordinates_of_segment,
polygon_from_points,
bbox_from_polygon,
coordinates_of_segment,
crop_image,
getLogger,
image_from_polygon,
polygon_from_points,
polygon_mask,
crop_image,
)

from .common import array2pil, determine_zoom, pil2array
from .ocrolib import midrange, morph
from .common import (
# binarize,
array2pil, determine_zoom, pil2array)


class OcropyClip(Processor):
logger: Logger
Expand Down
10 changes: 2 additions & 8 deletions ocrd_cis/ocropy/denoise.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
from __future__ import absolute_import

from typing import Optional
from logging import Logger
from os.path import join

from ocrd_utils import getLogger
from ocrd_models.ocrd_page import (
AlternativeImageType, OcrdPage
)
from ocrd_models.ocrd_page import AlternativeImageType, OcrdPage
from ocrd import Processor
from ocrd.processor import OcrdPageResult, OcrdPageResultImage

from .common import (
# binarize,
determine_zoom, remove_noise)
from .common import determine_zoom, remove_noise

class OcropyDenoise(Processor):
logger: Logger
Expand Down
8 changes: 1 addition & 7 deletions ocrd_cis/ocropy/deskew.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
from __future__ import absolute_import

from typing import Optional
from logging import Logger
from os.path import join

from ocrd_utils import getLogger
from ocrd_models.ocrd_page import (
PageType,
AlternativeImageType,
OcrdPage
)
from ocrd_models.ocrd_page import AlternativeImageType, OcrdPage, PageType
from ocrd import Processor
from ocrd.processor import OcrdPageResult, OcrdPageResultImage

Expand Down
12 changes: 3 additions & 9 deletions ocrd_cis/ocropy/dewarp.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
from __future__ import absolute_import

from typing import Optional
from logging import Logger
from os.path import join

from typing import Optional
import numpy as np

from ocrd_utils import getLogger
from ocrd_models.ocrd_page import (
AlternativeImageType,
OcrdPage
)
from ocrd import Processor
from ocrd.processor import OcrdPageResult, OcrdPageResultImage
from ocrd_utils import getLogger
from ocrd_models.ocrd_page import AlternativeImageType, OcrdPage

from .ocrolib import lineest
from .common import array2pil, check_line, determine_zoom, pil2array
Expand Down
12 changes: 2 additions & 10 deletions ocrd_cis/ocropy/recognize.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,8 @@

from rapidfuzz.distance import Levenshtein

from ocrd_utils import (
getLogger,
coordinates_for_segment,
polygon_from_bbox,
points_from_polygon,
)
from ocrd_models.ocrd_page import (
TextEquivType, OcrdPage,
CoordsType, GlyphType, WordType
)
from ocrd_utils import coordinates_for_segment, getLogger, points_from_polygon, polygon_from_bbox
from ocrd_models.ocrd_page import CoordsType, GlyphType, OcrdPage, TextEquivType, WordType
from ocrd import Processor
from ocrd.processor import OcrdPageResult

Expand Down
1 change: 0 additions & 1 deletion ocrd_cis/ocropy/resegment.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from typing import Optional
from logging import Logger
from os.path import join

import numpy as np
from skimage import draw, segmentation
Expand Down
1 change: 0 additions & 1 deletion ocrd_cis/ocropy/segment.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from typing import Optional
from logging import Logger
from os.path import join
import itertools

import numpy as np
Expand Down
9 changes: 5 additions & 4 deletions ocrd_cis/ocropy/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
from typing import Optional
from logging import Logger
from sys import exit
from os import getcwd, makedirs, remove
from os import makedirs, remove
from os.path import abspath, dirname, exists, join, isfile
import tempfile

from ocrd_models import OcrdPage
from ocrd import Processor, Workspace
Expand All @@ -32,7 +31,9 @@ def resize_keep_ratio(image, baseheight=48):

class OcropyTrain(Processor):
logger: Logger
modelpath: str
old_cwd: str
outputpath: str

@property
def executable(self):
Expand Down Expand Up @@ -75,8 +76,8 @@ def process_workspace(self, workspace: Workspace) -> None:
f"on {len(self.filelist)} file pairs")
rtrain(self.filelist, self.modelpath, self.outputpath, self.parameter['ntrain'])
# deletefiles(self.filelist)
def process_page_pcgts(self, *input_pcgts : Optional[OcrdPage], page_id : Optional[str] = None) -> OcrdPageResult:

def process_page_pcgts(self, *input_pcgts: Optional[OcrdPage], page_id: Optional[str] = None) -> OcrdPageResult:
"""
Extracts pairs of plaintext and cropped image files for each text line
in the PAGE file (to be used during training).
Expand Down

0 comments on commit 0ba6839

Please sign in to comment.