Skip to main content

a pip install icdar_tools

Project description

These tools are to provide effort by researchers in creating their own working environment This is about dealing with {ICDAR} data It provides you with initial processing tools for training and testing data. It provides tools for calculating the text area using polygon of shapely. Save results from images and text locations as a prelude to calculating precision. And some other tools we will try to "more examples to explain the use later."

These tools have been quoted and written by the {EAST}. Where you can see the original files here. https://github.com/argman/EAST/

These tools depend on several libraries you must provide before use. Like:

-opencv-3.x.x
-numpy
-scipy
-matplotlib
-shapely

use Modules!

import icdar_tools

or

from icdar_tools import icdar
from icdar_tools import icd_util
from icdar_tools import locality_aware_nms
from icdar_tools import data_util
  • icdar.py

This module is very important as it is found to serve your time instead of betting a lot of effort and time in order to produce already existing tools, in order to handle the data. Here you will find everything you need, from the future ICDAR Data Processing

From loading the data and locating the texts inside the images and some other things. The following are examples of usage.

1:get_batch()

get_batch(num_workers, **kwargs)

The function works to get the coordinates of the text in the images Through text files with them in the same path It then returns those geometrical coordinates, image names, and images derived from the training images specified by the place of the text only.

use:

data_generator = icdar.get_batch(num_workers=num_readers,
                                         training_data_path='path/to_data/icdar15/train/'
                                         input_size=input_size,
                                         batch_size=batch_size_per_gpu * len(gpus))

reutrn

yield images, image_fns, score_maps, geo_maps, training_masks

2:load_annoataion()

text_polys, text_tags = icdar.load_annoataion(txt_file-name)

3:restore_rectangle_rbox()

text_box_restored = icdar.restore_rectangle_rbox(origin, geometry)

:

  • icd_util.py

1 - get_images() The input path should be images

images_list_fullName = icd_util.get_images(path/data/images/)

Repetition is a list of all images in the input path

2 -resize_image()

im_resized, (ratio_h, ratio_w) = icd_util.resize_image(image)
'''
resize image to a size multiple of 32 which is required by the network
:param im: the resized image
:param max_side_len: limit of max image size to avoid out of memory in gpu
:return: the resized image and the resize ratio
'''
  • The default setting of the function
    icd_util.resize_image(image, max_side_len=2400)
    

3 - detect()
Here is the conclusion of the model represented in the geometrical map of coordinates and score

Use the threshold to filter the results that look false The borders of the text boxes are then redrawn

return of these boxes and the time of implementation of this processe.

boxes, timer = icd_util.detect(score_map=score, geo_map=geometry, timer=timer)
'''
restore text boxes from score map and geo map
:param score_map:
:param geo_map:
:param timer:
:param score_map_thresh: threshhold for score map
:param box_thresh: threshhold for boxes
:param nms_thres: threshold for nms
:return: boxes and time out
'''

- The default setting of the function
icd_util.detect(score_map, geo_map, timer, score_map_thresh=0.8, box_thresh=0.1, nms_thres=0.2):
  • write_result()
    This function gets the image and its name
    The file name is written as the text location in the image

You get the text boxes that are expected for that image
writeing text locations in text files
drawing squares around those texts in the picture
See the font size of the box and font color through passes

color, thickness

Finally a place will be written those 'output_path/'

Images and text files are written into a single folder.

   icd_util.write_result(img ,boxes ,output_dir ,res_file ,img_fn)
  • The default setting of the function
  icd_util.write_result(img ,boxes ,output_dir ,res_file ,img_fn ,color=(255, 255, 0),thickness=1, skip = True)

...

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

icdar_tools-0.0.3.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

icdar_tools-0.0.3-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file icdar_tools-0.0.3.tar.gz.

File metadata

  • Download URL: icdar_tools-0.0.3.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.4.1 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.3

File hashes

Hashes for icdar_tools-0.0.3.tar.gz
Algorithm Hash digest
SHA256 407a555628fc465e4f9818e848e62f8647c033be5f8a93b49985a55fcc353c4a
MD5 99240c053d27951ad046ebfa62b4e502
BLAKE2b-256 9658fbf24846e02cb1ade859554f7d25903601ec4974ca44354753822cbe0efd

See more details on using hashes here.

File details

Details for the file icdar_tools-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: icdar_tools-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 14.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/40.4.1 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.3

File hashes

Hashes for icdar_tools-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 65b56f8d9b29175445cdbb2363a02468e7d841d99c7557f4a524e3c84dabd84e
MD5 4cf7cda22c5e6dea261fdc0c8baf0334
BLAKE2b-256 1dacd1e3f58a8371466824fd3f957fe757b8ca858634f8aa8b37fe88c3016bcb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page