{"id":17309843,"url":"https://github.com/bobld/rapidocrnet","last_synced_at":"2026-04-02T17:55:48.265Z","repository":{"id":252784868,"uuid":"838500964","full_name":"BobLd/RapidOcrNet","owner":"BobLd","description":"Cross-platform OCR processing using PaddleOCR ONNX models. Based on RapidAI's RapidOCR","archived":false,"fork":false,"pushed_at":"2026-03-29T09:16:19.000Z","size":39876,"stargazers_count":52,"open_issues_count":0,"forks_count":15,"subscribers_count":3,"default_branch":"master","last_synced_at":"2026-03-29T12:26:57.211Z","etag":null,"topics":["detection","dotnet","ocr","onnx","paddleocr","paddlepaddle","rapidocr","skiasharp"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BobLd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":"NOTICE.txt","maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-08-05T19:10:53.000Z","updated_at":"2026-03-29T09:11:08.000Z","dependencies_parsed_at":"2024-08-12T14:27:06.343Z","dependency_job_id":null,"html_url":"https://github.com/BobLd/RapidOcrNet","commit_stats":null,"previous_names":["bobld/rapidocrnet"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/BobLd/RapidOcrNet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BobLd%2FRapidOcrNet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BobLd%2FRapidOcrNet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BobLd%2FRapidOcrNet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BobLd%2FRapidOcrNet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BobLd","download_url":"https://codeload.github.com/BobLd/RapidOcrNet/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BobLd%2FRapidOcrNet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31312744,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T12:59:32.332Z","status":"ssl_error","status_checked_at":"2026-04-02T12:54:48.875Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["detection","dotnet","ocr","onnx","paddleocr","paddlepaddle","rapidocr","skiasharp"],"created_at":"2024-10-15T12:32:59.998Z","updated_at":"2026-04-02T17:55:48.258Z","avatar_url":"https://github.com/BobLd.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RapidOcrNet\nCross-platform OCR processing library using PaddleOCR ONNX models, and based on original code from RapidAI's [RapidOCR](https://github.com/RapidAI/RapidOCR).\n\nAvailable as NuGet package here https://www.nuget.org/packages/RapidOcrNet/\n\nThe code was optimised to remove dependencies on `System.Drawing` and `OpenCV`. The image processing is now done only using `SkiaSharp` and `PContourNet`.\n\nThe project now uses PP-OCR v5 models, but v4 and v3 models are also supported (see [here](https://github.com/BobLd/RapidOcrNet/issues/3)).\n\nAll ONNX models and files and can be downloaded from: https://github.com/RapidAI/RapidOCR/blob/main/python/rapidocr/default_models.yaml\nYou will need 4 different files for the code to work. Example below for PP-OCR v5 with latin language:\n- Detection: `ch_PP-OCRv5_mobile_det.onnx`\n- Classification: `ch_ppocr_mobile_v2.0_cls_infer.onnx`\n- Recognition: `latin_PP-OCRv5_rec_mobile_infer.onnx`\n- Model dictionary: `ppocrv5_latin_dict.txt`\n\n## Usage\n```csharp\nstring targetImg = \"image.png\";\n\nusing (var ocrEngin = new RapidOcr())\n{\n\tocrEngin.InitModels();\n\tusing (SKBitmap originSrc = SKBitmap.Decode(targetImg))\n\t{\n\t\tOcrResult ocrResult = ocrEngin.Detect(originSrc, RapidOcrOptions.Default);\n\t\tConsole.WriteLine(ocrResult.ToString());\n\t\tConsole.WriteLine(ocrResult.StrRes);\n\t\tConsole.WriteLine();\n\n\t\t// Draw bounding boxes\n\t\tforeach (var block in ocrResult.TextBlocks)\n\t\t{\n\t\t\tvar points = block.BoxPoints;\n\t\t\tusing (var canvas = new SKCanvas(originSrc))\n\t\t\tusing (var paint = new SKPaint() { Color = SKColors.Red })\n\t\t\t{\n\t\t\t\tcanvas.DrawLine(points[0], points[1], paint);\n\t\t\t\tcanvas.DrawLine(points[1], points[2], paint);\n\t\t\t\tcanvas.DrawLine(points[2], points[3], paint);\n\t\t\t\tcanvas.DrawLine(points[3], points[0], paint);\n\t\t\t}\n\t\t}\n\n\t\tusing (var fs = new FileStream(Path.ChangeExtension(targetImg, \"_ocr.png\"), FileMode.Create))\n\t\t{\n\t\t\toriginSrc.Encode(fs, SKEncodedImageFormat.Png, 100);\n\t\t}\n\t}\n}\n```\n\n## Custom options (including GPU acceleration)\nThe library supports custom session options for the ONNX runtime, which means that you can enable GPU \nacceleration if you have a compatible GPU and the necessary ONNX runtime providers installed. You can \ncreate a custom `SessionOptions` object (definition [here](https://onnxruntime.ai/docs/api/csharp/api/Microsoft.ML.OnnxRuntime.SessionOptions.html))\nand pass it to the `InitModels` method.\n```csharp\nstring targetImg = \"image.png\";\n\nusing (var ocrEngin = new RapidOcr())\n{   \n\tusing var sessionOptions = GetDefaultSessionOptions();\n\t\n\ttry { sessionOptions.AppendExecutionProvider_CUDA(); } // Add CUDA provider for GPU acceleration (NVIDIA GPUs)\n\tcatch { sessionOptions.AppendExecutionProvider_CPU(); } // Fallback to CPU if CUDA provider is not available\n\n\tocrEngin.InitModels(sessionOptions);\n\tusing (SKBitmap originSrc = SKBitmap.Decode(targetImg))\n\t{\n\t\t// Same as in the previous example\n\t}\n}\n```\n\n## Notice\nBased on source code originally developed in the RapidOCR project (Apache-2.0 license).\n- https://github.com/RapidAI/RapidOCR\n\nUses parts of source code originally developed in the PdfPig project (Apache-2.0 license).\n- https://github.com/UglyToad/PdfPig\n\nThe dependency on OpenCV was removed thanks to the PContour library and its C# port.\n- https://github.com/LingDong-/PContour\n- https://github.com/BobLd/PContourNet\n\nThe models made available are from the PaddleOCR project (Apache-2.0 license) and were downloaded from https://github.com/RapidAI/RapidOCR/blob/main/python/rapidocr/default_models.yaml\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbobld%2Frapidocrnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbobld%2Frapidocrnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbobld%2Frapidocrnet/lists"}