From 2711df47d33f8240610f6450fd5008d5aef5869a Mon Sep 17 00:00:00 2001 From: Farhan Hai Khan Date: Sat, 30 Nov 2024 12:02:26 +0000 Subject: [PATCH] docs: fix faulty code for prediction and recognition demos (#1800) --- docs/source/using_doctr/using_models.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/source/using_doctr/using_models.rst b/docs/source/using_doctr/using_models.rst index e6e5006f2..40a820cee 100644 --- a/docs/source/using_doctr/using_models.rst +++ b/docs/source/using_doctr/using_models.rst @@ -92,12 +92,12 @@ Detection predictors import numpy as np from doctr.models import detection_predictor - predictor = detection_predictor('db_resnet50') + model = detection_predictor('db_resnet50') dummy_img = (255 * np.random.rand(800, 600, 3)).astype(np.uint8) out = model([dummy_img]) You can pass specific boolean arguments to the predictor: - +* `pretrained`: if you want to use a model that has been pretrained on a specific dataset, setting `pretrained=True` this will load the corresponding weights. If `pretrained=False`, which is the default, would otherwise lead to a random initialization and would lead to no/useless results. * `assume_straight_pages`: if you work with straight documents only, it will fit straight bounding boxes to the text areas. * `preserve_aspect_ratio`: if you want to preserve the aspect ratio of your documents while resizing before sending them to the model. * `symmetric_pad`: if you choose to preserve the aspect ratio, it will pad the image symmetrically and not from the bottom-right. @@ -198,7 +198,7 @@ Recognition predictors import numpy as np from doctr.models import recognition_predictor - predictor = recognition_predictor('crnn_vgg16_bn') + model = recognition_predictor('crnn_vgg16_bn') dummy_img = (255 * np.random.rand(50, 150, 3)).astype(np.uint8) out = model([dummy_img])