Closed
Description
Bug description
Following #731, the function remap_boxes
and its associated test test_remap_boxes
that were introduced in #488 were removed. This prevents the correct remapping of the boxes after they were rotated (parameter straighten_pages
of OCRPredictor
set to True
).
Code snippet to reproduce the bug
from pathlib import Path
import matplotlib.pyplot as plt
from doctr.io import DocumentFile
from doctr.models.detection.zoo import detection_predictor
from doctr.models.predictor import OCRPredictor
from doctr.models.recognition.zoo import recognition_predictor
from doctr.utils.visualization import visualize_page
file = Path(r"myfile.jpg")
doc = DocumentFile.from_images(file)
det_bs=2
reco_bs=128
det_predictor = detection_predictor('db_resnet50', pretrained=True, batch_size=det_bs, assume_straight_pages=True)
reco_predictor = recognition_predictor('crnn_vgg16_bn', pretrained=True, batch_size=reco_bs)
predictor = OCRPredictor(det_predictor=det_predictor, reco_predictor=reco_predictor, assume_straight_pages=True, straighten_pages=True)
# Plot OCR output
out = predictor(doc)
fig = visualize_page(out.pages[0].export(), doc[0], interactive=False)
plt.show()
Error traceback
No error, however, the boxes that appear are misplaced.
Environment
Note: I pulled the last version from the repo but the DocTR version still appears as 0.4.1a0
.
DocTR version: 0.4.1a0
TensorFlow version: 2.5.0
PyTorch version: 1.9.1+cpu (torchvision 0.10.1+cpu)
OpenCV version: 4.5.2
OS: Could not collect
Python version: 3.8.7
Is CUDA available (TensorFlow): No
Is CUDA available (PyTorch): No
CUDA runtime version: 11.0.221
GPU models and configuration: Could not collect
Nvidia driver version: Could not collect
cuDNN version: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\bin\cudnn_ops_train64_8.dll