提交 b7854948 编写于 作者: L LKKlein

move from deploy to thirdparty

上级 70eb5932
...@@ -30,6 +30,7 @@ echo "export GOROOT=/usr/local/go" >> ~/.bashrc ...@@ -30,6 +30,7 @@ echo "export GOROOT=/usr/local/go" >> ~/.bashrc
echo "export PATH=$PATH:$GOROOT/bin" >> ~/.bashrc echo "export PATH=$PATH:$GOROOT/bin" >> ~/.bashrc
# 配置GOPATH,即go相关package的安装目录,可自定义一个目录 # 配置GOPATH,即go相关package的安装目录,可自定义一个目录
echo "export GOPATH=$HOME/golang" >> ~/.bashrc echo "export GOPATH=$HOME/golang" >> ~/.bashrc
echo "export PATH=$PATH:$GOPATH/bin" >> ~/.bashrc
# 配置GOPROXY,即go mod包管理器的下载代理,同时打开mod模式 # 配置GOPROXY,即go mod包管理器的下载代理,同时打开mod模式
echo "export GO111MODULE=on" >> ~/.bashrc echo "export GO111MODULE=on" >> ~/.bashrc
echo "export GOPROXY=https://mirrors.aliyun.com/goproxy/" >> ~/.bashrc echo "export GOPROXY=https://mirrors.aliyun.com/goproxy/" >> ~/.bashrc
...@@ -196,7 +197,7 @@ souce ~/.bashrc ...@@ -196,7 +197,7 @@ souce ~/.bashrc
确保C推理库已配置到环境变量,然后直接执行安装命令 确保C推理库已配置到环境变量,然后直接执行安装命令
```shell ```shell
go get -u github.com/PaddlePaddle/PaddleOCR/deploy/paddleocr-go go get -u github.com/PaddlePaddle/PaddleOCR/thirdparty/paddleocr-go
``` ```
### 2.2 相关使用API ### 2.2 相关使用API
...@@ -204,7 +205,7 @@ go get -u github.com/PaddlePaddle/PaddleOCR/deploy/paddleocr-go ...@@ -204,7 +205,7 @@ go get -u github.com/PaddlePaddle/PaddleOCR/deploy/paddleocr-go
在go中使用import引入包 在go中使用import引入包
```go ```go
import github.com/PaddlePaddle/PaddleOCR/deploy/paddleocr-go/ocr import github.com/PaddlePaddle/PaddleOCR/thirdparty/paddleocr-go/ocr
``` ```
- 预测结果结构体 - 预测结果结构体
...@@ -258,28 +259,33 @@ func (ocr *OCRSystem) StartServer(port string) ...@@ -258,28 +259,33 @@ func (ocr *OCRSystem) StartServer(port string)
## 3. 预测demo ## 3. 预测demo
### 3.1 修改预测配置 ### 3.1 生成预测demo
当前给定的配置文件`config/conf.yaml`中,包含了默认的OCR预测配置参数,可根据个人需要更改相关参数。 以下两种方式均可生成预测demo文件,任选其一即可
比如,将`use_gpu`改为`false`,使用CPU执行预测;将`det_model_dir`, `rec_model_dir`, `cls_model_dir`都更改为自己的本地模型路径,也或者是更改字典`rec_char_dict_path`的路径,这四个路径如果配置http链接,会自动下载到本地目录。另外,配置参数包含了预测引擎、检测模型、检测阈值、方向分类模型、识别模型及阈值的相关参数,具体参数的意义可参见[PaddleOCR](https://github.com/PaddlePaddle/PaddleOCR/blob/develop/doc/doc_ch/whl.md#%E5%8F%82%E6%95%B0%E8%AF%B4%E6%98%8E)
### 3.2 编译预测demo - 通过下载`paddleocr-go`代码并编译
- 下载`paddleocr-go`代码
```shell ```shell
git clone https://github.com/PaddlePaddle/PaddleOCR git clone https://github.com/PaddlePaddle/PaddleOCR
cd PaddleOCR/deploy/paddleocr-go cd PaddleOCR/thirdparty/paddleocr-go
# 确保C动态库路径已在环境变量中,执行以下命令生成ppocr-go文件
go build ppocr-go.go
``` ```
- 编译demo - 通过go package自动安装
```shell ```shell
# 确保C动态库路径已在环境变量中 # 执行后会自动在$GOPATH/bin下生成ppocr-go文件,如果配置了PATH=$PATH:$GOPATH/bin,以下预测命令可以去掉`./`,直接执行ppocr-go
go build ppocr-go.go go get -u github.com/PaddlePaddle/PaddleOCR/thirdparty/paddleocr-go
``` ```
### 3.2 修改预测配置
当前给定的配置文件`config/conf.yaml`中,包含了默认的OCR预测配置参数,可根据个人需要更改相关参数。
比如,将`use_gpu`改为`false`,使用CPU执行预测;将`det_model_dir`, `rec_model_dir`, `cls_model_dir`都更改为自己的本地模型路径,也或者是更改字典`rec_char_dict_path`的路径,这四个路径如果配置http链接,会自动下载到本地目录。另外,配置参数包含了预测引擎、检测模型、检测阈值、方向分类模型、识别模型及阈值的相关参数,具体参数的意义可参见[PaddleOCR](https://github.com/PaddlePaddle/PaddleOCR/blob/develop/doc/doc_ch/whl.md#%E5%8F%82%E6%95%B0%E8%AF%B4%E6%98%8E)
### 3.3 执行预测demo ### 3.3 执行预测demo
预测demo提供了三种预测方式,分别是单张图预测、文件夹批量预测、OCR Server预测。三者命令行优先级依次降低。 预测demo提供了三种预测方式,分别是单张图预测、文件夹批量预测、OCR Server预测。三者命令行优先级依次降低。
......
module github.com/PaddlePaddle/PaddleOCR/deploy/paddleocr-go module github.com/PaddlePaddle/PaddleOCR/thirdparty/paddleocr-go
go 1.14 go 1.14
......
github.com/LKKlein/gocv v0.28.0 h1:1MMvs9uYf+QGPi86it2pUmN8RRoyMnPLUefKB/Jf1Q0= github.com/LKKlein/gocv v0.28.0 h1:1MMvs9uYf+QGPi86it2pUmN8RRoyMnPLUefKB/Jf1Q0=
github.com/LKKlein/gocv v0.28.0/go.mod h1:MP408EL7eakRU3vzjsozzfELSX7HDDGdMpWANV1IOHY= github.com/LKKlein/gocv v0.28.0/go.mod h1:MP408EL7eakRU3vzjsozzfELSX7HDDGdMpWANV1IOHY=
github.com/PaddlePaddle/PaddleOCR v1.1.0 h1:zmPevInTs5P+ctSokI9sWQLTThmJBUCo/JCLbB5xbps=
github.com/ctessum/go.clipper v0.0.0-20200522184404-9c744fa3e86c h1:VXCsVlam0R2Yl7VET2GxZBPdOa7gFRexyhfWb9v9QtM= github.com/ctessum/go.clipper v0.0.0-20200522184404-9c744fa3e86c h1:VXCsVlam0R2Yl7VET2GxZBPdOa7gFRexyhfWb9v9QtM=
github.com/ctessum/go.clipper v0.0.0-20200522184404-9c744fa3e86c/go.mod h1:KRMo3PCsooJP3LmCwKI76dkd7f3ki3zwYLHR7Iwbi5k= github.com/ctessum/go.clipper v0.0.0-20200522184404-9c744fa3e86c/go.mod h1:KRMo3PCsooJP3LmCwKI76dkd7f3ki3zwYLHR7Iwbi5k=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
......
...@@ -16,7 +16,7 @@ import ( ...@@ -16,7 +16,7 @@ import (
"strings" "strings"
"github.com/LKKlein/gocv" "github.com/LKKlein/gocv"
"github.com/PaddlePaddle/PaddleOCR/deploy/paddleocr-go/paddle" "github.com/PaddlePaddle/PaddleOCR/thirdparty/paddleocr-go/paddle"
) )
type PaddleModel struct { type PaddleModel struct {
......
...@@ -7,7 +7,7 @@ import ( ...@@ -7,7 +7,7 @@ import (
"sort" "sort"
"github.com/LKKlein/gocv" "github.com/LKKlein/gocv"
"github.com/PaddlePaddle/PaddleOCR/deploy/paddleocr-go/paddle" "github.com/PaddlePaddle/PaddleOCR/thirdparty/paddleocr-go/paddle"
clipper "github.com/ctessum/go.clipper" clipper "github.com/ctessum/go.clipper"
) )
......
...@@ -3,7 +3,7 @@ package main ...@@ -3,7 +3,7 @@ package main
import ( import (
"flag" "flag"
"log" "log"
"github.com/PaddlePaddle/PaddleOCR/deploy/paddleocr-go/ocr" "github.com/PaddlePaddle/PaddleOCR/thirdparty/paddleocr-go/ocr"
) )
var ( var (
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册