Giter Site home page Giter Site logo

Comments (3)

rkcosmos avatar rkcosmos commented on August 27, 2024 1

Hi, you can now choose your gpu by

reader = easyocr.Reader(['en'], gpu = 'your choice here')

from easyocr.

rkcosmos avatar rkcosmos commented on August 27, 2024

OK, will add this feature soon. In the mean time, you can use cpu by using

reader = easyocr.Reader(['en'], gpu = False)

from easyocr.

akbir avatar akbir commented on August 27, 2024

Hi tried this but still had issues:

/katakana/notebooks/vision/ocr_hybrid.py in easy_ocr_no_table(img, device)
     69     img = prep_img_for_easyocr(img)
     70     img = remove_table_from_scan(img)
---> 71     result = run_easy_ocr(img, device)
     72     return result
     73 

~/katakana/notebooks/vision/ocr_hybrid.py in run_easy_ocr(img, device)
     60     if easyocr_reader is None:
     61         load_easyocr_reader(device)  # to prevent slow import
---> 62     result = easyocr_reader.readtext(
     63         img, link_threshold=0.99, text_threshold=0.7, add_margin=0.02
     64     )

~/.local/lib/python3.8/site-packages/easyocr/easyocr.py in readtext(self, image, decoder, beamWidth, batch_size, workers, allowlist, blocklist, detail, rotation_info, paragraph, min_size, contrast_ths, adjust_contrast, filter_ths, text_threshold, low_text, link_threshold, canvas_size, mag_ratio, slope_ths, ycenter_ths, height_ths, width_ths, y_ths, x_ths, add_margin, output_format)
    383         img, img_cv_grey = reformat_input(image)
    384 
--> 385         horizontal_list, free_list = self.detect(img, min_size, text_threshold,\
    386                                                  low_text, link_threshold,\
    387                                                  canvas_size, mag_ratio,\

~/.local/lib/python3.8/site-packages/easyocr/easyocr.py in detect(self, img, min_size, text_threshold, low_text, link_threshold, canvas_size, mag_ratio, slope_ths, ycenter_ths, height_ths, width_ths, add_margin, reformat, optimal_num_chars)
    273             img, img_cv_grey = reformat_input(img)
    274 
--> 275         text_box_list = get_textbox(self.detector, img, canvas_size, mag_ratio,
    276                                     text_threshold, link_threshold, low_text,
    277                                     False, self.device, optimal_num_chars)

~/.local/lib/python3.8/site-packages/easyocr/detection.py in get_textbox(detector, image, canvas_size, mag_ratio, text_threshold, link_threshold, low_text, poly, device, optimal_num_chars)
     92     result = []
     93     estimate_num_chars = optimal_num_chars is not None
---> 94     bboxes_list, polys_list = test_net(canvas_size, mag_ratio, detector,
     95                                        image, text_threshold,
     96                                        link_threshold, low_text, poly,

~/.local/lib/python3.8/site-packages/easyocr/detection.py in test_net(canvas_size, mag_ratio, net, image, text_threshold, link_threshold, low_text, poly, device, estimate_num_chars)
     43     # forward pass
     44     with torch.no_grad():
---> 45         y, feature = net(x)
     46 
     47     boxes_list, polys_list = [], []

/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py in _call_impl(self, *input, **kwargs)
    887             result = self._slow_forward(*input, **kwargs)
    888         else:
--> 889             result = self.forward(*input, **kwargs)
    890         for hook in itertools.chain(
    891                 _global_forward_hooks.values(),

/usr/local/lib/python3.8/dist-packages/torch/nn/parallel/data_parallel.py in forward(self, *inputs, **kwargs)
    151         for t in chain(self.module.parameters(), self.module.buffers()):
    152             if t.device != self.src_device_obj:
--> 153                 raise RuntimeError("module must have its parameters and buffers "
    154                                    "on device {} (device_ids[0]) but found one of "
    155                                    "them on device: {}".format(self.src_device_obj, t.device))

RuntimeError: module must have its parameters and buffers on device cuda:0 (device_ids[0]) but found one of them on device: cuda:3

from easyocr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.