tesseract-ocr / tesstrain

Train Tesseract LSTM with make
Apache License 2.0
599 stars 178 forks source link

make tesseract-langdata error #387

Open Roboxkin opened 2 months ago

Roboxkin commented 2 months ago

I'm trying to create language data as the instructions say, but I can't do it Is there a way to solve this problem? Thank you

Screenshot

(.venv) PS D:\ocr\tesstrain> make tesseract-langdata You are using make version: 4.4.1 There is an error in the command syntax. make: *** [Makefile:424: data/langdata/radical-stroke.txt] Error 1

stweil commented 2 months ago

I'm afraid that this part of the Makefile never worked in the Windows command line. Either try to fetch the missing files manually (without make – you have to figure out how to do that for yourself). Or try to fix the problem with the Makefile. Or take the easy way and run the training in WSL.

zdenop commented 2 months ago

It works for me on Windows:

> git clone --depth=1 https://github.com/tesseract-ocr/tesstrain
Cloning into 'tesstrain'...
remote: Enumerating objects: 34, done.
remote: Counting objects: 100% (34/34), done.
remote: Compressing objects: 100% (30/30), done.
remote: Total 34 (delta 3), reused 12 (delta 0), pack-reused 0
Receiving objects: 100% (34/34), 5.29 MiB | 220.00 KiB/s, done.
Resolving deltas: 100% (3/3), done.
>cd tesstrain

>make tesseract-langdata
You are using make version: 4.4.1
wget -O data/langdata/radical-stroke.txt 'https://github.com/tesseract-ocr/langdata_lstm/raw/main/radical-stroke.txt'
--2024-04-25 09:12:49--  https://github.com/tesseract-ocr/langdata_lstm/raw/main/radical-stroke.txt
Connecting to 10.204.10.7:3128... connected.
Proxy request sent, awaiting response... 302 Found
Location: https://raw.githubusercontent.com/tesseract-ocr/langdata_lstm/main/radical-stroke.txt [following]
--2024-04-25 09:12:50--  https://raw.githubusercontent.com/tesseract-ocr/langdata_lstm/main/radical-stroke.txt
Connecting to 10.204.10.7:3128... connected.
Proxy request sent, awaiting response... 200 OK
Length: 330874 (323K) [text/plain]
Saving to: 'data/langdata/radical-stroke.txt'

data/langdata/radical-stroke. 100%[=================================================>] 323,12K  1,54MB/s    in 0,2s

2024-04-25 09:12:50 (1,54 MB/s) - 'data/langdata/radical-stroke.txt' saved [330874/330874]

wget -O data/langdata/Arabic.unicharset 'https://github.com/tesseract-ocr/langdata_lstm/raw/main/Arabic.unicharset'
--2024-04-25 09:12:50--  https://github.com/tesseract-ocr/langdata_lstm/raw/main/Arabic.unicharset
Connecting to 10.204.10.7:3128... connected.
Proxy request sent, awaiting response... 302 Found
Location: https://raw.githubusercontent.com/tesseract-ocr/langdata_lstm/main/Arabic.unicharset [following]
--2024-04-25 09:12:51--  https://raw.githubusercontent.com/tesseract-ocr/langdata_lstm/main/Arabic.unicharset
Connecting to 10.204.10.7:3128... connected.
Proxy request sent, awaiting response... 200 OK
...
stweil commented 2 months ago

I can reproduce the error. It is reported by a wrong mkdir (the default one from DOS/Windows).

@zdenop, are you using the mkdir from coreutils? How did you install it?

zdenop commented 2 months ago

From git:

>where mkdir
c:\Program Files\Git\usr\bin\mkdir.exe

>echo %PATH%
C:\Program Files\Git\cmd;C:\Python\Python311\Scripts\;C:\Python\Python311\;c:\Program Files\Git\usr\bin;c:\Program Files\Git\mingw64\bin;...

I put git dirs at the beginning of PATH variable, so I can use Linux tools on windows.

Readme covers this:

  1. Install Git SCM to Windows - it provides a lot of linux utilities on Windows (e.g. find, unzip, rm) and put C:\Program Files\Git\usr\bin to the beginning of your PATH variable (temporarily you can do it in cmd with set PATH=C:\Program Files\Git\usr\bin;%PATH% - unfortunately there are several Windows tools with the same name as on linux (find, sort) with different behavior/functionality and there is need to avoid them during training.
Roboxkin commented 2 months ago

Из git:

>where mkdir
c:\Program Files\Git\usr\bin\mkdir.exe

>echo %PATH%
C:\Program Files\Git\cmd;C:\Python\Python311\Scripts\;C:\Python\Python311\;c:\Program Files\Git\usr\bin;c:\Program Files\Git\mingw64\bin;...

Я помещаю git dirs в начало переменной PATH, чтобы можно было использовать инструменты Linux в Windows.

Readme охватывает это:

  1. Установите Git SCM в Windows — он предоставляет множество утилит Linux для Windows (например, find, unzip, rm) и поместите C:\Program Files\Git\usr\bin в начало переменной PATH (временно вы можете сделать это в cmd с набором PATH=C:\Program Files\Git\usr\bin;%PATH% - к сожалению, существует несколько инструментов Windows с тем же именем, что и в Linux (найти, сортировать), с различным поведением/функциональностью, и их необходимо избегать их во время тренировки.

Thank you very much for the tip!!! This works great!!! Problem solved! Have a good day

Roboxkin commented 2 months ago
(.venv) PS D:\ocr\tesstrain> make tesseract-langdata
You are using make version: 4.4.1
wget -O data/langdata/radical-stroke.txt 'https://github.com/tesseract-ocr/langdata_lstm/raw/main/radical-stroke.txt'
--2024-04-25 12:53:22--  https://github.com/tesseract-ocr/langdata_lstm/raw/main/radical-stroke.txt
Resolving github.com (github.com)... 140.82.121.4
Connecting to github.com (github.com)|140.82.121.4|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://raw.githubusercontent.com/tesseract-ocr/langdata_lstm/main/radical-stroke.txt [following]
--2024-04-25 12:53:23--  https://raw.githubusercontent.com/tesseract-ocr/langdata_lstm/main/radical-stroke.txt
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 185.199.108.133, 185.199.109.133, 185.199.110.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.108.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 330874 (323K) [text/plain]
Saving to: 'data/langdata/radical-stroke.txt'

data/langdata/radical-stroke.txt         100%[===============================================================================>] 323,12K  1,63MB/s    in 0,2s    

2024-04-25 12:53:23 (1,63 MB/s) - 'data/langdata/radical-stroke.txt' saved [330874/330874]

......
(.venv) PS D:\ocr\tesstrain>
stweil commented 2 months ago

Can we close this issue?