MCPcopy Index your code

hub / github.com/mindee/doctr / functions

Functions871 in github.com/mindee/doctr

↓ 35 callersMethodexport
Exports the object into a nested dict format
doctr/io/elements.py:45
↓ 22 callersMethodupdate
Update the state of the metric with new predictions Args: gt: list of groung-truth character sequences pred: list of
doctr/utils/metrics.py:76
↓ 21 callersFunctionload_pretrained_params
Load a set of parameters onto a model >>> from doctr.models import load_pretrained_params >>> load_pretrained_params(model, "https://yoursour
doctr/models/utils/pytorch.py:38
↓ 16 callersFunctionestimate_orientation
Estimate the angle of the general document orientation based on the lines of the document and the assumption that they should be horizontal.
doctr/models/_utils.py:34
↓ 15 callersFunctionr
(n)
docs/source/_static/js/custom.js:94
↓ 14 callersFunction_validate_dataset
(ds, input_size, batch_size=2, class_indices=False, is_polygons=False)
tests/pytorch/test_datasets_pt.py:14
↓ 14 callersFunction_validate_dataset_recognition_part
(ds, input_size, batch_size=2)
tests/pytorch/test_datasets_pt.py:50
↓ 14 callersFunctionconv_sequence_pt
Builds a convolutional-based layer sequence >>> from torch.nn import Sequential >>> from doctr.models import conv_sequence >>> module = S
doctr/models/utils/pytorch.py:86
↓ 13 callersFunctionrotate_sample
Rotate image around the center, interpolation=NEAREST, pad with 0 (black) Args: img: image to rotate geoms: array of geometries o
doctr/transforms/functional/pytorch.py:44
↓ 12 callersFunction_validate_dataset_detection_part
(ds, input_size, batch_size=2, is_polygons=False)
tests/pytorch/test_datasets_pt.py:75
↓ 11 callersFunctioncrop_bboxes_from_image
Crop a set of bounding boxes from an image Args: img_path: path to the image geoms: a array of polygons of shape (N, 4, 2) or of
doctr/datasets/utils.py:192
↓ 11 callersMethodfrom_images
Read an image file (or a collection of image files) and convert it into an image in numpy format >>> from doctr.io import DocumentFile
doctr/io/reader.py:63
↓ 11 callersMethodfrom_pdf
Read a PDF file >>> from doctr.io import DocumentFile >>> doc = DocumentFile.from_pdf("path/to/your/doc.pdf") Args:
doctr/io/reader.py:25
↓ 11 callersMethodshow
Overlay the result on a given image Args: interactive: whether the display should be interactive preserve_aspect_rati
doctr/io/elements.py:290
↓ 10 callersFunction_pct
(val)
scripts/evaluate_kie.py:18
↓ 10 callersFunction_pct
(val)
scripts/evaluate.py:18
↓ 9 callersMethod__init__
( self, dim: int, num_heads: int = 8, qkv_bias: bool = False, attn_dro
doctr/models/classification/vip/layers/pytorch.py:102
↓ 9 callersFunction_bf16_to_float32
(x: torch.Tensor)
doctr/models/utils/pytorch.py:33
↓ 9 callersMethodfrom_dict
(cls, save_dict: dict[str, Any], **kwargs)
doctr/io/elements.py:104
↓ 9 callersMethodrender
Renders the full text of the element
doctr/io/elements.py:96
↓ 9 callersFunctionrequires_package
package requirement helper Args: name: name of the package extra_message: additional message to display if the package is no
doctr/file_utils.py:15
↓ 8 callersMethodfrom_pretrained
Load pretrained parameters onto the model Args: path_or_url: the path or URL to the model parameters (checkpoint) **k
doctr/models/recognition/sar/pytorch.py:231
↓ 8 callersFunctionget_font
Resolves a compatible ImageFont for the system Args: font_family: the font family to use font_size: the size of the font upon ren
doctr/utils/fonts.py:14
↓ 8 callersFunctioninit_predictor
Initialize the predictor based on the request Args: request: input request Returns: Callable: the predictor
api/app/vision.py:28
↓ 8 callersFunctions
(e,t,o)
docs/source/_static/js/custom.js:94
↓ 8 callersMethodsummary
Computes the aggregated metrics Returns: a dictionary with the exact match score for the raw data, its lower-case counterpart, it
doctr/utils/metrics.py:99
↓ 7 callersMethod__init__
( self, value: str, confidence: float, geometry: BoundingBox | np.ndarray,
doctr/io/elements.py:81
↓ 7 callersFunctiondownload_from_url
Download a file using its URL >>> from doctr.models import download_from_url >>> download_from_url("https://yoursource.com/yourcheckpoint-you
doctr/utils/data.py:44
↓ 7 callersFunctioninvert_data_structure
Invert a list of dict of elements to a dict of list of elements and the other way around Args: x: a list of dictionaries with the same ke
doctr/models/_utils.py:213
↓ 7 callersFunctionpush_to_hf_hub
Save model and its configuration on HF hub >>> from doctr.models import login_to_hub, push_to_hf_hub >>> from doctr.models.recognition import
doctr/models/factory/hub.py:79
↓ 7 callersFunctionresolve_geometry
( geom: Any, )
api/app/utils.py:15
↓ 6 callersFunction_mobilenet_v3
( arch: str, pretrained: bool, rect_strides: list[str] | None = None, ignore_keys: list[str] |
doctr/models/classification/mobilenet/pytorch.py:75
↓ 6 callersMethodbox_score
Compute the confidence score for a polygon : mean of the p values on the polygon Args: pred (np.ndarray): p map returned by the m
doctr/models/detection/core.py:34
↓ 6 callersFunctioncrop_orientation_predictor
Crop orientation classification architecture. >>> import numpy as np >>> from doctr.models import crop_orientation_predictor >>> model =
doctr/models/classification/zoo.py:71
↓ 6 callersMethoddecode
Add positional information to the target sequence and pass it through the decoder.
doctr/models/recognition/parseq/pytorch.py:251
↓ 6 callersFunctiondetection_predictor
Text detection architecture. >>> import numpy as np >>> from doctr.models import detection_predictor >>> model = detection_predictor(arch
doctr/models/detection/zoo.py:68
↓ 6 callersMethodexport_as_xml
Export the page as XML (hOCR-format) convention: https://github.com/kba/hocr-spec/blob/master/1.2/spec.md Args: file_titl
doctr/io/elements.py:316
↓ 6 callersFunctionget_platform
()
scripts/collect_env.py:167
↓ 6 callersFunctionpage_orientation_predictor
Page orientation classification architecture. >>> import numpy as np >>> from doctr.models import page_orientation_predictor >>> model =
doctr/models/classification/zoo.py:94
↓ 6 callersMethodreset
(self)
doctr/utils/metrics.py:116
↓ 6 callersFunctionrun_and_parse_first_match
Runs command using run_lambda, returns the first regex match if it exists
scripts/collect_env.py:90
↓ 6 callersFunctionsynthesize_text_img
Generate a synthetic text image Args: text: the text to render as an image font_size: the size of the font font_family: t
doctr/datasets/generator/base.py:18
↓ 6 callersFunctiontensor_from_numpy
Read an image file as a PyTorch tensor Args: npy_img: image encoded as a numpy array of shape (H, W, C) in np.uint8 dtype: the de
doctr/io/image/pytorch.py:70
↓ 5 callersMethod__init__
( self, size: int | tuple[int, int], interpolation=F.InterpolationMode.BILINEAR,
doctr/transforms/modules/pytorch.py:46
↓ 5 callersFunction_check_doc_content
(doc_tensors, num_pages)
tests/common/test_io.py:11
↓ 5 callersFunctioncreate_obj_patch
Create a matplotlib patch for the element Args: geometry: bounding box (straight or rotated) of the element page_dimensions: dime
doctr/utils/visualization.py:112
↓ 5 callersFunctionexport_model_to_onnx
Export model to ONNX format. >>> import torch >>> from doctr.models.classification import resnet18 >>> from doctr.models.utils import exp
doctr/models/utils/pytorch.py:147
↓ 5 callersFunctionmultithread_exec
Execute a given function in parallel for each element of a given sequence >>> from doctr.utils.multithreading import multithread_exec >>> ent
doctr/utils/multithreading.py:18
↓ 5 callersFunctionocr_predictor
End-to-end OCR architecture using one model for localization, and another for text recognition. >>> import numpy as np >>> from doctr.models
doctr/models/zoo.py:63
↓ 5 callersFunctionread_img_as_tensor
Read an image file as a PyTorch tensor Args: img_path: location of the image file dtype: the desired data type of the output tens
doctr/io/image/pytorch.py:36
↓ 5 callersFunctionset_device_and_dtype
Set the device and dtype of a model and its batches >>> import torch >>> from torch import nn >>> from doctr.models.utils import set_devi
doctr/models/utils/pytorch.py:123
↓ 5 callersMethodsummary
Computes the aggregated metrics Returns: a tuple with the recall, precision and meanIoU scores
doctr/utils/metrics.py:288
↓ 4 callersMethod__init__
( self, num_layers: int, num_heads: int, d_model: int, vocab_size: int
doctr/models/modules/transformer/pytorch.py:148
↓ 4 callersMethod__repr__
(self)
doctr/utils/repr.py:32
↓ 4 callersFunction_move_to_device
Move the predictor to the desired device Args: predictor: the predictor to move Returns: Callable: the predictor moved to th
api/app/vision.py:16
↓ 4 callersMethod_sort_boxes
Sort bounding boxes from top to bottom, left to right Args: boxes: bounding boxes of shape (N, 4) or (N, 4, 2) (in case of rotate
doctr/models/builder.py:43
↓ 4 callersFunctioncrop_detection
Crop and image and associated bboxes Args: img: image to crop boxes: array of boxes to clip, absolute (int) or relative (float)
doctr/transforms/functional/pytorch.py:91
↓ 4 callersFunctiondecode_img_as_tensor
Read a byte stream as a PyTorch tensor Args: img_content: bytes of a decoded image dtype: the desired data type of the output ten
doctr/io/image/pytorch.py:53
↓ 4 callersFunctionencode_sequences
Encode character sequences using a given vocab as mapping Args: sequences: the list of character sequences of size N vocab: the o
doctr/datasets/utils.py:113
↓ 4 callersFunctionget_documents
Convert a list of UploadFile objects to lists of numpy arrays and their corresponding filenames Args: files: list of UploadFile objects
api/app/utils.py:23
↓ 4 callersFunctionget_language
Get languages of a text using langdetect model. Get the language with the highest probability or no language if only a few words or a low probabil
doctr/models/_utils.py:194
↓ 4 callersFunctionlogin_to_hub
Login to huggingface hub
doctr/models/factory/hub.py:36
↓ 4 callersMethodpolygon_to_box
Expand a polygon (points) by a factor unclip_ratio, and returns a polygon Args: points: The first parameter. Returns:
doctr/models/detection/differentiable_binarization/base.py:41
↓ 4 callersFunctionrecognition_predictor
Text recognition architecture. Example:: >>> import numpy as np >>> from doctr.models import recognition_predictor >>> mo
doctr/models/recognition/zoo.py:65
↓ 4 callersFunctionreparameterize
Fuse batchnorm and conv layers and reparameterize the model Args: model: the FAST model to reparameterize Returns: the repar
doctr/models/detection/fast/pytorch.py:292
↓ 4 callersFunctionsplit_crops
Split crops horizontally if they exceed a given aspect ratio. Args: crops: List of image crops (H, W, C). max_ratio: Aspect
doctr/models/recognition/predictor/_utils.py:16
↓ 4 callersMethodsynthesize
Synthesize the page from the predictions Args: **kwargs: keyword arguments passed to the `synthesize_page` method Return
doctr/io/elements.py:305
↓ 4 callersFunctiontensor_from_pil
Convert a PIL Image to a PyTorch tensor Args: pil_img: a PIL image dtype: the output tensor data type Returns: decod
doctr/io/image/pytorch.py:18
↓ 4 callersMethodupdate
Updates the metric Args: gts: a set of relative bounding boxes either of shape (N, 4) or (N, 5) if they are rotated ones
doctr/utils/metrics.py:265
↓ 4 callersMethodupdate
Updates the metric Args: gt_boxes: a set of relative bounding boxes either of shape (N, 4) or (N, 5) if they are rotated ones
doctr/utils/metrics.py:362
↓ 3 callersMethod__init__
( self, feature_extractor, vocab: str, rnn_units: int = 512, embedding
doctr/models/recognition/sar/pytorch.py:180
↓ 3 callersFunction_crnn
( arch: str, pretrained: bool, backbone_fn: Callable[[Any], nn.Module], pretrained_backbone: b
doctr/models/recognition/crnn/pytorch.py:239
↓ 3 callersFunction_dbnet
( arch: str, pretrained: bool, backbone_fn: Callable[[bool], nn.Module], fpn_layers: list[str]
doctr/models/detection/differentiable_binarization/pytorch.py:301
↓ 3 callersFunction_fast
( arch: str, pretrained: bool, backbone_fn: Callable[[bool], nn.Module], feat_layers: list[str
doctr/models/detection/fast/pytorch.py:331
↓ 3 callersMethod_fuse_bn_tensor
(self, conv: nn.Conv2d, bn: nn.BatchNorm2d)
doctr/models/modules/layers/pytorch.py:158
↓ 3 callersMethod_get_split
Determine how to split the height/width for the cross-shaped windows. Args: size: A tuple (h, w). Returns:
doctr/models/classification/vip/layers/pytorch.py:443
↓ 3 callersFunction_linknet
( arch: str, pretrained: bool, backbone_fn: Callable[[bool], nn.Module], fpn_layers: list[str]
doctr/models/detection/linknet/pytorch.py:263
↓ 3 callersFunction_mock_artefacts
(size=(1, 1), offset=(0, 0), confidence=0.8)
tests/common/test_io_elements.py:29
↓ 3 callersFunction_mock_blocks
(size=(1, 1), offset=(0, 0))
tests/common/test_io_elements.py:70
↓ 3 callersFunction_mock_lines
(size=(1, 1), offset=(0, 0))
tests/common/test_io_elements.py:43
↓ 3 callersFunction_mock_pages
(block_size=(1, 1), block_offset=(0, 0))
tests/common/test_io_elements.py:84
↓ 3 callersFunction_mock_prediction
(size=(1.0, 1.0), offset=(0, 0), confidence=0.9, objectness_score=0.9)
tests/common/test_io_elements.py:51
↓ 3 callersFunction_mock_words
(size=(1.0, 1.0), offset=(0, 0), confidence=0.9, objectness_score=0.9)
tests/common/test_io_elements.py:10
↓ 3 callersFunction_synthesize
( response: Image.Image, entry: dict[str, Any], w: int, h: int, draw_proba: bool = False,
doctr/utils/reconstitution.py:28
↓ 3 callersFunction_textnet
( arch: str, pretrained: bool, ignore_keys: list[str] | None = None, **kwargs: Any, )
doctr/models/classification/textnet/pytorch.py:106
↓ 3 callersFunction_tv_resnet
( arch: str, pretrained: bool, arch_fn, ignore_keys: list[str] | None = None, **kwargs: An
doctr/models/classification/resnet/pytorch.py:197
↓ 3 callersFunction_warn_rotation
(entry: dict[str, Any])
doctr/utils/reconstitution.py:21
↓ 3 callersFunctionbox_iou
Computes the IoU between two sets of bounding boxes Args: boxes_1: bounding boxes of shape (N, 4) in format (xmin, ymin, xmax, ymax)
doctr/utils/metrics.py:124
↓ 3 callersMethodbuild_target
Encode a list of gts sequences into a np array and gives the corresponding* sequence lengths. Args: gts: list of ground-t
doctr/models/recognition/parseq/base.py:17
↓ 3 callersFunctionconvert_to_relative_coords
Convert a geometry to relative coordinates Args: geoms: a set of polygons of shape (N, 4, 2) or of straight boxes of shape (N, 4)
doctr/utils/geometry.py:368
↓ 3 callersFunctionexpand_line
Expands a 2-point line, so that the first is on the edge. In other terms, we extend the line in the same direction until we meet one of the edges.
doctr/transforms/functional/base.py:49
↓ 3 callersMethodexport_as_xml
Export the page as XML (hOCR-format) convention: https://github.com/kba/hocr-spec/blob/master/1.2/spec.md Args: file_titl
doctr/io/elements.py:496
↓ 3 callersMethodfrom_pretrained
Load pretrained parameters onto the model Args: path_or_url: the path or URL to the model parameters (checkpoint) **k
doctr/models/classification/resnet/pytorch.py:156
↓ 3 callersMethodfrom_pretrained
Load pretrained parameters onto the model Args: path_or_url: the path or URL to the model parameters (checkpoint) **k
doctr/models/classification/vip/pytorch.py:233
↓ 3 callersFunctionget_img_shape
Get the shape of an image
doctr/io/image/pytorch.py:96
↓ 3 callersFunctionh
(e,t,o)
docs/source/_static/js/custom.js:94
↓ 3 callersFunctionmobilenet_v3_small_crop_orientation
MobileNetV3-Small architecture as described in `"Searching for MobileNetV3", <https://arxiv.org/pdf/1905.02244.pdf>`_. >>> import torch
doctr/models/classification/mobilenet/pytorch.py:231
↓ 3 callersFunctionmobilenet_v3_small_page_orientation
MobileNetV3-Small architecture as described in `"Searching for MobileNetV3", <https://arxiv.org/pdf/1905.02244.pdf>`_. >>> import torch
doctr/models/classification/mobilenet/pytorch.py:257
↓ 3 callersFunctionp
(e)
docs/source/_static/js/custom.js:94
↓ 3 callersFunctionpolygon_iou
Computes the IoU between two sets of rotated bounding boxes Args: polys_1: rotated bounding boxes of shape (N, 4, 2) polys_2: rot
doctr/utils/metrics.py:152
next →1–100 of 871, ranked by callers