欢迎来到源码之家!

当前位置:

> 源码分享>

一个使用TensorFlow实现的高效精准的Python EAST文本检测器

  • 软件大小: 1.97MB
  • 文件类型: .zip
  • 软件类别: Python
  • 软件语言: 简体中文
  • 更新时间: 2024-05-14
内容介绍
‘‘‘
this file is modified from keras implemention of data process multi-threading
see https://github.com/fchollet/keras/blob/master/keras/utils/data_utils.py
‘‘‘
import time
import numpy as np
import threading
import multiprocessing
try:
    import queue
except ImportError:
    import Queue as queue


class GeneratorEnqueuer():
    “““Builds a queue out of a data generator.

    Used in ‘fit_generator‘ ‘evaluate_generator‘ ‘predict_generator‘.

    # Arguments
        generator: a generator function which endlessly yields data
        use_multiprocessing: use multiprocessing if True otherwise threading
        wait_time: time to sleep in-between calls to ‘put()‘
        random_seed: Initial seed for workers
            will be incremented by one for each workers.
    “““

    def __init__(self generator
                 use_multiprocessing=False
                 wait_time=0.05
                 random_seed=None):
        self.wait_time = wait_time
        self._generator = generator
        self._use_multiprocessing = use_multiprocessing
        self._threads = []
        self._stop_event = None
        self.queue = None
        self.random_seed = random_seed

    def start(self workers=1 max_queue_size=10):
        “““Kicks off threads which add data from the generator into the queue.

        # Arguments
            workers: number of worker threads
            max_queue_size: queue size
                (when full threads could block on ‘put()‘)
        “““

        def data_generator_task():
            while not self._stop_event.is_set():
                try:
                    if self._use_multiprocessing or self.queue.qsize()                         generator_output = next(self._generator)
                        self.queue.put(generator_output)
                    else:
                        time.sleep(self.wait_time)
                except Exception:
                    self._stop_event.set()
                    raise

        try:
            if self._use_multiprocessing:
                self.queue = multiprocessing.Queue(maxsize=max_queue_size)
                self._stop_event = multiprocessing.Event()
            else:
                self.queue = queue.Queue()
                self._stop_event = threading.Event()

            for _ in range(workers):
                if self._use_multiprocessing:
                    # Reset random seed else all children processes
                    # share the same seed
                    np.random.seed(self.random_seed)
                    thread = multiprocessing.Process(target=data_generator_task)
                    thread.daemon = True
                    if self.random_seed is not None:
                        self.random_seed += 1
                else:
                    thread = threading.Thread(target=data_generator_task)
                self._threads.append(thread)
                thread.start()
        except:
            self.stop()
            raise

    d

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2017-08-27 03:10  EAST-master\
     文件        1219  2017-08-27 03:10  EAST-master\.gitignore
     文件       35141  2017-08-27 03:10  EAST-master\LICENSE
     文件           0  2017-08-27 03:10  EAST-master\__init__.py
     文件        4280  2017-08-27 03:10  EAST-master\data_util.py
     目录           0  2017-08-27 03:10  EAST-master\demo_images\
     文件      338376  2017-08-27 03:10  EAST-master\demo_images\img_10.jpg
     文件      117772  2017-08-27 03:10  EAST-master\demo_images\img_14.jpg
     文件      229940  2017-08-27 03:10  EAST-master\demo_images\img_2.jpg
     文件      213424  2017-08-27 03:10  EAST-master\demo_images\img_26.jpg
     文件      174745  2017-08-27 03:10  EAST-master\demo_images\img_75.jpg
     文件      728640  2017-08-27 03:10  EAST-master\demo_images\web-demo.png
     文件         171  2017-08-27 03:10  EAST-master\deploy.sh
     文件        7441  2017-08-27 03:10  EAST-master\eval.py
     文件       30634  2017-08-27 03:10  EAST-master\icdar.py
     目录           0  2017-08-27 03:10  EAST-master\lanms\
     文件          11  2017-08-27 03:10  EAST-master\lanms\.gitignore
     文件        4397  2017-08-27 03:10  EAST-master\lanms\.ycm_extra_conf.py
     文件         365  2017-08-27 03:10  EAST-master\lanms\Makefile
     文件         572  2017-08-27 03:10  EAST-master\lanms\__init__.py
     文件         245  2017-08-27 03:10  EAST-master\lanms\__main__.py
     文件        1596  2017-08-27 03:10  EAST-master\lanms\adaptor.cpp
     目录           0  2017-08-27 03:10  EAST-master\lanms\include\
     目录           0  2017-08-27 03:10  EAST-master\lanms\include\clipper\
     文件      141939  2017-08-27 03:10  EAST-master\lanms\include\clipper\clipper.cpp
     文件       15320  2017-08-27 03:10  EAST-master\lanms\include\clipper\clipper.hpp
     目录           0  2017-08-27 03:10  EAST-master\lanms\include\pybind11\
     文件       18075  2017-08-27 03:10  EAST-master\lanms\include\pybind11\attr.h
     文件        4299  2017-08-27 03:10  EAST-master\lanms\include\pybind11\buffer_info.h
     文件       87115  2017-08-27 03:10  EAST-master\lanms\include\pybind11\cast.h
     文件        6596  2017-08-27 03:10  EAST-master\lanms\include\pybind11\chrono.h
............此处省略37个文件信息
下载地址
下载错误? 【投诉报错】

一个使用TensorFlow实现的高效精准的Python EAST文本检测器

下载声明

☉ 解压密码: www.zzjlb.com。[ 如果不正确 ]请联系站长。
☉ 推荐使用 [ 迅雷] 下载,使用 [ WinRAR v5] 以上版本解压本站软件。
☉ 如果遇到不能下载的情况,请联系站长解决。
☉ 下载本站资源,如果服务器暂不能下载请过一段时间重试。
☉ 如果遇到什么问题,请加本站QQ群提出,我将尽可能解决。
☉ 本站分享的一些商业软件是供学习研究之用,如用于商业用途,请购买正版。
☉ 本站分享的资源来源互联网,版权归原作者所有。