1. <strong id="7actg"></strong>
    2. <table id="7actg"></table>

    3. <address id="7actg"></address>
      <address id="7actg"></address>
      1. <object id="7actg"><tt id="7actg"></tt></object>

        docTROCR 文檔文本識別庫

        聯(lián)合創(chuàng)作 · 2023-09-29 23:11

        由 TensorFlow 2 和 PyTorch 提供支持,任何人都可以無縫訪問光學(xué)字符識別

        OCR_example

        獲取預(yù)訓(xùn)練模型

        使用兩階段方法在 docTR 中實(shí)現(xiàn)端到端 OCR:文本檢測(定位單詞),然后文本識別(識別單詞中的所有字符)。因此,可以從可用實(shí)現(xiàn)列表中選擇用于文本檢測的架構(gòu)和用于文本識別的架構(gòu)。

        from doctr.models import ocr_predictor
        
        model = ocr_predictor(det_arch='db_resnet50', reco_arch='crnn_vgg16_bn', pretrained=True)
        

        讀取文件

        可以從 PDF 或圖像解釋文檔:

        from doctr.io import DocumentFile
        # PDF
        pdf_doc = DocumentFile.from_pdf("path/to/your/doc.pdf").as_images()
        # Image
        single_img_doc = DocumentFile.from_images("path/to/your/img.jpg")
        # Webpage
        webpage_doc = DocumentFile.from_url("https://www.yoursite.com").as_images()
        # Multiple page images
        multi_img_doc = DocumentFile.from_images(["path/to/page1.jpg", "path/to/page2.jpg"])
        

        以默認(rèn)的預(yù)訓(xùn)練模型為例:

        from doctr.io import DocumentFile
        from doctr.models import ocr_predictor
        
        model = ocr_predictor(pretrained=True)
        # PDF
        doc = DocumentFile.from_pdf("path/to/your/doc.pdf").as_images()
        # Analyze
        result = model(doc)
        

        安裝

        安裝 docTR 需要 Python 3.6(或更高版本)和 pip。

        由于使用了 weasyprint,如果沒有運(yùn)行在 Linux 系統(tǒng)之上,將需要額外的依賴項(xiàng)。

        對于 macOS 用戶,可以按如下方式安裝它們:

        brew install cairo pango gdk-pixbuf libffi
        

        對于 Windows 用戶,這些依賴項(xiàng)包含在 GTK 中。

        最新版本

        可以使用 pypi 安裝最新版本的軟件包,如下所示:

        pip install python-doctr
        
        瀏覽 22
        點(diǎn)贊
        評論
        收藏
        分享

        手機(jī)掃一掃分享

        編輯 分享
        舉報(bào)
        評論
        圖片
        表情
        推薦
        點(diǎn)贊
        評論
        收藏
        分享

        手機(jī)掃一掃分享

        編輯 分享
        舉報(bào)
        1. <strong id="7actg"></strong>
        2. <table id="7actg"></table>

        3. <address id="7actg"></address>
          <address id="7actg"></address>
          1. <object id="7actg"><tt id="7actg"></tt></object>
            男女爽啪啪gif动态第140期 | 免费无人区一区二区三区 | 国产精品久久久久久久妇女 | A片无遮挡性高爱潮视频播放 | 92看片淫黄大片看国产片图片 | 精品一区二区视频 | 成人免费看片 98欧美 91狠狠干 | 无码欧美人XXXXX日本无码 | 爱豆传媒麻豆传媒久久久资源网 | 草草影院最新地址 |