Open Tfyourhelp opened 2 years ago
Greetings,
Best regards.
PD. python was supposed created for NO-programmers sot they were able to make programs... paradox
I tried install easyocr by pip install easyocr but it didnt work . So i install by clone https://github.com/jaidedai/easyocr. And i tried pip uninstall and install again and it didnt work . Do that same with "re-install it" Do you know which easyocr version that have that attribute . Can you recommend me. plsss
error Traceback (most recent call last) Input In [40], in <cell line: 2>() 6 region = image[int(roi[0]):int(roi[2]),int(roi[1]):int(roi[3])] 7 reader = easyocr.Reader(['en']) ----> 8 ocr_result = reader.readtext(region) 9 print(ocr_result) 10 plt.imshow(cv2.cvtColor(region,cv2.COLOR_BGR2RGB))
File ~\ANPR\anprsys\lib\site-packages\easyocr\easyocr.py:385, in Reader.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) 379 ''' 380 Parameters: 381 image: file path or numpy-array or a byte stream object 382 ''' 383 img, img_cv_grey = reformat_input(image) --> 385 horizontal_list, free_list = self.detect(img, min_size, text_threshold,\ 386 low_text, link_threshold,\ 387 canvas_size, mag_ratio,\ 388 slope_ths, ycenter_ths,\ 389 height_ths,width_ths,\ 390 add_margin, False) 391 # get the 1st result from hor & free list as self.detect returns a list of depth 3 392 horizontal_list, free_list = horizontal_list[0], free_list[0]
File ~\ANPR\anprsys\lib\site-packages\easyocr\easyocr.py:275, in Reader.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) 272 if reformat: 273 img, img_cv_grey = reformat_input(img) --> 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) 279 horizontal_list_agg, free_list_agg = [], [] 280 for text_box in text_box_list:
File ~\ANPR\anprsys\lib\site-packages\easyocr\detection.py:95, in get_textbox(detector, image, canvas_size, mag_ratio, text_threshold, link_threshold, low_text, poly, device, optimal_num_chars) 93 result = [] 94 estimate_num_chars = optimal_num_chars is not None ---> 95 bboxes_list, polys_list = test_net(canvas_size, mag_ratio, detector, 96 image, text_threshold, 97 link_threshold, low_text, poly, 98 device, estimate_num_chars) 99 if estimate_num_chars: 100 polyslist = [[p for p, in sorted(polys, key=lambda x: abs(optimal_num_chars - x[1]))] 101 for polys in polys_list]
File ~\ANPR\anprsys\lib\site-packages\easyocr\detection.py:55, in test_net(canvas_size, mag_ratio, net, image, text_threshold, link_threshold, low_text, poly, device, estimate_num_chars) 52 score_link = out[:, :, 1].cpu().data.numpy() 54 # Post-processing ---> 55 boxes, polys, mapper = getDetBoxes( 56 score_text, score_link, text_threshold, link_threshold, low_text, poly, estimate_num_chars) 58 # coordinate adjustment 59 boxes = adjustResultCoordinates(boxes, ratio_w, ratio_h)
File ~\ANPR\anprsys\lib\site-packages\easyocr\craft_utils.py:236, in getDetBoxes(textmap, linkmap, text_threshold, link_threshold, low_text, poly, estimate_num_chars) 234 if poly and estimate_num_chars: 235 raise Exception("Estimating the number of characters not currently supported with poly.") --> 236 boxes, labels, mapper = getDetBoxes_core(textmap, linkmap, text_threshold, link_threshold, low_text, estimate_num_chars) 238 if poly: 239 polys = getPoly_core(boxes, labels, mapper, linkmap)
File ~\ANPR\anprsys\lib\site-packages\easyocr\craft_utils.py:31, in getDetBoxes_core(textmap, linkmap, text_threshold, link_threshold, low_text, estimate_num_chars) 28 ret, link_score = cv2.threshold(linkmap, link_threshold, 1, 0) 30 text_score_comb = np.clip(text_score + link_score, 0, 1) ---> 31 nLabels, labels, stats, centroids = cv2.connectedComponentsWithStats(text_score_comb.astype(np.uint8), connectivity=4) 33 det = [] 34 mapper = []
error: Unknown C++ exception from OpenCV code
- Can help me fix this!!!! plss
!pip install git+https://github.com/jaidedai/easyocr.git cd easyocr !python setup.py install import easyocr
detection_threshold = 0.7 image = image_np_with_detections scores = list(filter(lambda x: x> detection_threshold, detections['detection_scores'])) boxes = detections['detection_boxes'][:len(scores)] classes = detections['detection_classes'][:len(scores)] width = image.shape[1] height = image.shape[0] for idx, box in enumerate(boxes): print(box) roi = box*[height,width,height,width] print(roi) region = image[int(roi[0]):int(roi[2]),int(roi[1]):int(roi[3])] reader = easyocr.Reader(['en']) ocr_result = reader.readtext(region) print(ocr_result) plt.imshow(cv2.cvtColor(region,cv2.COLOR_BGR2RGB))
AttributeError Traceback (most recent call last) Input In [30], in <cell line: 2>() 5 print(roi) 6 region = image[int(roi[0]):int(roi[2]),int(roi[1]):int(roi[3])] ----> 7 reader = easyocr.Reader(['en']) 8 ocr_result = reader.readtext(region) 9 print(ocr_result)
AttributeError: module 'easyocr' has no attribute 'Reader'
pls help me