Skip to content

Commit

Permalink
Merge pull request #2 from arthurhenrique/perf-2
Browse files Browse the repository at this point in the history
chore(*): performance test 2
  • Loading branch information
arthurhenrique committed Nov 29, 2020
2 parents 5dc15a2 + f2c0ff2 commit 668dfcc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 21 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ POC to test lib tesseract with portuguese and english language.

edit: now just portuguese for performance:
[test perf](https://github.com/arthurhenrique/go-ocr/pull/1)
[test perf 2](https://github.com/arthurhenrique/go-ocr/pull/2)

## Notes

Expand Down
40 changes: 19 additions & 21 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,29 @@ func main() {
iterations := 50
total := time.Duration(0)

fileName := "files/bode.jpg"
bytesImage := convertToBytes(fileName)

tm := TextMethod{
Name: "tesseract",
Language: "por",
Variables: map[string]string{
"tessedit_pageseg_mode": "3", // auto page segmentation mode
"load_system_dawg": "0", // removing dict to increase recognition
"load_freq_dawg": "0",
},
Client: nil,
}
instance = gosseract.NewClient()
defer instance.Close()
tm.Client = instance

tm.tesseractSettings()

for i := 0; i < iterations; i++ {
start := time.Now()

fileName := "files/bode.jpg"

// fast model
// https://github.com/tesseract-ocr/tessdata_fast/raw/master/por.tra
instance = gosseract.NewClient()

tm := TextMethod{
Name: "tesseract",
Language: "por",
Variables: map[string]string{
"tessedit_pageseg_mode": "3", // auto page segmentation mode
"load_system_dawg": "0", // removing dict to increase recognition
"load_freq_dawg": "0",
},
Client: instance,
}
defer instance.Close()

// Handler tesseract's settings
tm.tesseractSettings()

bytesImage := convertToBytes(fileName)
object, err := tm.extract(bytesImage)
if err != nil {
return
Expand Down

0 comments on commit 668dfcc

Please sign in to comment.