marker icon indicating copy to clipboard operation
marker copied to clipboard

Detecting bboxes faile with overflow in scalar multiply.

Open AverageGuy opened this issue 1 year ago • 0 comments

Running on Mint 21. GPU 12 GB Nvidia card. Installed as per the instructions. I'm getting the following attempting to read a one page pdf document. The file I'm working with is a 4 page document. My first attempt was successful reading the first page by setting max files to 1. I use tkpdf to extract page 1 and it also converted OK. Page 2 worked. Page 3 failed: Loaded texify model to cuda with torch.float16 dtype Detecting bboxes: 100%|█████████████████████████████████████████████████████| 1/1 [00:01<00:00, 1.63s/it] Recognizing Text: 100%|███████████████████████████████████████████████████| 10/10 [00:07<00:00, 1.37it/s] Detecting bboxes: 100%|█████████████████████████████████████████████████████| 1/1 [00:01<00:00, 1.87s/it] /home/jwl/.local/lib/python3.10/site-packages/surya/postprocessing/heatmap.py:111: RuntimeWarning: overflow encountered in scalar multiply niter = int(math.sqrt(size * min(w, h) / (w * h)) * 2) Traceback (most recent call last): File "/home/jwl/.local/bin/marker_single", line 8, in <module> sys.exit(main()) File "/home/jwl/.local/lib/python3.10/site-packages/convert_single.py", line 28, in main full_text, images, out_meta = convert_single_pdf(fname, model_lst, max_pages=args.max_pages, langs=langs, batch_multiplier=args.batch_multiplier, start_page=args.start_page) File "/home/jwl/.local/lib/python3.10/site-packages/marker/convert.py", line 98, in convert_single_pdf surya_layout(doc, pages, layout_model, batch_multiplier=batch_multiplier) File "/home/jwl/.local/lib/python3.10/site-packages/marker/layout/layout.py", line 24, in surya_layout layout_results = batch_layout_detection(images, layout_model, processor, detection_results=text_detection_results, batch_size=int(get_batch_size() * batch_multiplier)) File "/home/jwl/.local/lib/python3.10/site-packages/surya/layout.py", line 191, in batch_layout_detection result = parallel_get_regions(preds[i], orig_sizes[i], id2label, detection_results[i] if detection_results else None) File "/home/jwl/.local/lib/python3.10/site-packages/surya/layout.py", line 167, in parallel_get_regions bboxes = get_regions_from_detection_result(detection_results, heatmaps, orig_size, id2label, File "/home/jwl/.local/lib/python3.10/site-packages/surya/layout.py", line 41, in get_regions_from_detection_result bboxes = get_detected_boxes(heatmap) File "/home/jwl/.local/lib/python3.10/site-packages/surya/postprocessing/heatmap.py", line 171, in get_detected_boxes boxes, labels, confidences = detect_boxes(textmap, text_threshold, low_text) File "/home/jwl/.local/lib/python3.10/site-packages/surya/postprocessing/heatmap.py", line 111, in detect_boxes niter = int(math.sqrt(size * min(w, h) / (w * h)) * 2) ValueError: math domain error Page 4 worked also. Unfortunately pages 3 and 4 have the data I need. Thanks Jim.

Even though it converted page 4, it scrambled the data and dropped some of it also. The data was in a table which was delimited by whitespace only.

AverageGuy avatar Jun 04 '24 12:06 AverageGuy