Tesseract make training missing ground truth for training - tesseract

I'm trying to train Tesseract with image and i found this https://github.com/tesseract-ocr/tesstrain
I've followed the instructions on how to train images but I keep on getting this error
Tesseract Open Source OCR Engine v5.0.0-alpha-635-g90405 with Leptonica
Page 1
Warning: Invalid resolution 0 dpi. Using 70 instead.
find data/foo-ground-truth -name '*.lstmf' | python3 shuffle.py 0 > "data/foo/all-lstmf"
Error: missing ground truth for training
Makefile:147: recipe for target 'data/foo/list.train' failed
make: *** [data/foo/list.train] Error 1
It keeps on showing this error Error: missing ground truth for training
command i used make training
the image and ground truth text are from the same repo ocrd-testset.zip
what could possibly the solution to fix this?
EDIT:
Sorry forgot to mention that I only used 1 pair of training image from the ocrd-testset.zip

I followed the instructions in https://github.com/tesseract-ocr/tesstrain on Windows10.
It keeps on showing this error Error: missing ground truth for training at first. It because the code don't work on Windows:
(ALL_LSTMF): $(patsubst %.gt.txt,%.lstmf,$(shell find $(GROUND_TRUTH_DIR) -name '*.gt.txt'))
#mkdir -p $(OUTPUT_DIR)
find $(GROUND_TRUTH_DIR) -name '*.lstmf' | python3 shuffle.py $(RANDOM_SEED) > "$#"
and I change it to :
$(ALL_LSTMF): $(patsubst %.gt.txt,%.lstmf,$(wildcard $(GROUND_TRUTH_DIR)/*.gt.txt))
#mkdir -p $(OUTPUT_DIR)
find $(GROUND_TRUTH_DIR) -name '*.lstmf' -exec echo {} \; | sort -R -o "$#"
Then the error disappeared.
The changed code comes from the old version of tesseract-ocr/tesstrain. It should work on both linux and windows.Maybe you could try it.

Related

Simulink: fatal error: MQTTAsync.h: No such file or directory

I am trying to build an MQTT system on a raspberry pi. I was studying about MQTT and read about it a lot. I found a set of MQTT blocks in the Simulink Raspberry Pi Hardware Support Package that I assumed I could directly use. I configured an MQTT server and got all the right credentials and everything but I am now stuck on one part that has left me stumped.
I keep getting this error saying that "fatal error: MQTTAsync.h: No such file or directory". I have looked a lot trying to find anything that might help me but I couldn't. I don't know where to get the necessary files that I need or if there is any solution to sort this. I'm sharing the entire snippet of the error if that is of any help. Thanks in advance.
I apologize I'm not able to get to the whole error into a code block
Error executing command "touch -c /home/pi/MATLAB_ws/R2022a/C/Users/User/Documents/MATLAB/Project_RPi_ert_rtw/*.*;make -f Project_RPi.mk all MATLAB_WORKSPACE="/home/pi/MATLAB_ws/R2022a" -C /home/pi/MATLAB_ws/R2022a/C/Users/User/Documents/MATLAB/Project_RPi_ert_rtw LC_ALL=C". Details:
STDERR: In file included from /home/pi/MATLAB_ws/R2022a/C/ProgramData/MATLAB/SupportPackages/R2022a/toolbox/realtime/targets/linux/src/MW_MQTT.c:5:
/home/pi/MATLAB_ws/R2022a/C/ProgramData/MATLAB/SupportPackages/R2022a/toolbox/realtime/targets/linux/include/MW_MQTT.h:49:10: fatal error: MQTTAsync.h: No such file or directory
#include <MQTTAsync.h>
^~~~~~~~~~~~~
compilation terminated.
make: *** [Project_RPi.mk:411: MW_MQTT.c.o] Error 1
STDOUT: make: Entering directory '/home/pi/MATLAB_ws/R2022a/C/Users/User/Documents/MATLAB/Project_RPi_ert_rtw'
gcc -c -MMD -MP -MF"MW_MQTT.c.dep" -MT"MW_MQTT.c.o" -O2 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DMW_CAN_BITRATE=500000 -DMW_CAN_ALLOWALLMSGS=1 -DMW_NUM_MQTT_SUBSCRIBE=1 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DTID01EQ=0 -D__linux__ -DARM_PROJECT -D_USE_TARGET_UDP_ -D_RUNONTARGETHARDWARE_BUILD_ -DSTACK_SIZE=64 -DRT -DMODEL=Project_RPi -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0 -I/home/pi/MATLAB_ws/R2022a/C/Users/User/Documents/MATLAB -I/home/pi/MATLAB_ws/R2022a/C/ProgramData/MATLAB/SupportPackages/R2022a/toolbox/realtime/targets/linux/include -I/home/pi/MATLAB_ws/R2022a/C/ProgramData/MATLAB/SupportPackages/R2022a/toolbox/target/shared/svd/include -I/home/pi/MATLAB_ws/R2022a/C/ProgramData/MATLAB/SupportPackages/R2022a/toolbox/realtime/targets/raspi/include -I/home/pi/MATLAB_ws/R2022a/C/Users/User/Documents/MATLAB/Project_RPi_ert_rtw -I/home/pi/MATLAB_ws/R2022a/C/Program_Files/MATLAB/R2022a/extern/include -I/home/pi/MATLAB_ws/R2022a/C/Program_Files/MATLAB/R2022a/simulink/include -I/home/pi/MATLAB_ws/R2022a/C/Program_Files/MATLAB/R2022a/rtw/c/src -I/home/pi/MATLAB_ws/R2022a/C/Program_Files/MATLAB/R2022a/rtw/c/src/ext_mode/common -I/home/pi/MATLAB_ws/R2022a/C/Program_Files/MATLAB/R2022a/rtw/c/ert -I/home/pi/MATLAB_ws/R2022a/C/Program_Files/MATLAB/R2022a/toolbox/coder/rtiostream/src/utils -I/home/pi/MATLAB_ws/R2022a/C/Program_Files/MATLAB/R2022a/toolbox/target/codertarget/rtos/inc -o "MW_MQTT.c.o" "/home/pi/MATLAB_ws/R2022a/C/ProgramData/MATLAB/SupportPackages/R2022a/toolbox/realtime/targets/linux/src/MW_MQTT.c"
make: Leaving directory '/home/pi/MATLAB_ws/R2022a/C/Users/User/Documents/MATLAB/Project_RPi_ert_rtw'

Raspberry Pi 4 saving corrupt h264 files?

I've been able to record .h264 files without a problem, both using raspivid and through Python, but whatever I try, I can't convert them to a .mp4, .mkv or .avi file.
I've tried converting using MP4box (suggested in several places) and mkvmerge, but to no avail.
When I use MP4box (MP4box -add <source.h264> <dest.mp4>), I get :
AVC-H264 import - frame size 1920 x 1080 at 25.000 FPS
WARNING: NAL Unit type 0 not handled - adding5/100)
AVC Import results: 44 samples - Slices: 3 I 41 P 0 B - 0 SEI - 3 IDR
Saving video.mp4: 0.500 secs Interleaving
Then I try to play this file using VLC, it doesn't give an error, but shows garbled data.
To be clear, the camera works fine (shows perfect video using Python code and raspistill outputs a perfect jpg file). I tried a different camera as well.
An attempt with mkvmerge :
pi#raspberrypi:~/cam $ raspivid -o test.h264 -fps 30 -t 15000 -w 1920 -h 1080
pi#raspberrypi:~/cam $ mkvmerge --default-duration 0:30p -o video.mkv test.h264
mkvmerge v31.0.0 ('Dolores In A Shoestand') 32-bit
'test.h264': Using the demultiplexer for the format 'AVC/h.264'.
'test.h264' track 0: Using the output module for the format 'AVC/h.264 (unframed)'.
The file 'video.mkv' has been opened for writing.
Error: 'test.h264' track 0: mkvmerge encountered broken or unparsable data in this AVC/h.264 video track. Either your file is damaged (which mkvmerge cannot cope with yet) or this is a bug in mkvmerge itself. The error message was:
Success
pi#raspberrypi:~/cam $
This is on a Raspberry Pi 4.
A sample file can be found here : https://filebin.net/c40usz0crhgggadf
Created with : raspivid -t 30000 -w 640 -h 480 -fps 25 -b 1200000 -p 0,0,640,480 -o pivideo.h264
I'm going to respond to this myself. After doing an 'apt-get upgrade', the problem is gone.
If anyone wants to figure this out to find the root cause, this is what apt-get did :
The following packages will be upgraded:
bind9-host bluez-firmware firmware-atheros firmware-brcm80211 firmware-libertas firmware-misc-nonfree firmware-realtek libbind9-161 libdns-export1104 libdns1104 libgs9 libgs9-common libisc-export1100 libisc1100 libisccc161
libisccfg163 liblwres161 libraspberrypi-bin libraspberrypi-dev libraspberrypi-doc libraspberrypi0 pi-bluetooth raspberrypi-bootloader raspberrypi-kernel raspberrypi-kernel-headers raspi-config rpd-plym-splash
The following packages will be DOWNGRADED:
python3-pgzero
27 upgraded, 0 newly installed, 1 downgraded, 0 to remove and 0 not upgraded.

Failed do_rootfs for agl-demo-platform

I am building Yocto for AGL image (for more details: automotivelinux.org).
The below error occurred during the build progress (do_rootfs).
In packagegroup-agl-demo-platform.bb, declared packagegroup-agl-image-ivi as a runtime dependent package.
RDEPENDS_${PN} += "\
packagegroup-agl-image-ivi \
"
I can build successfully the packagegroup-agl-image-ivi separately. But when building the whole agl-demo-platform image, happened as follows:
ERROR: agl-demo-platform-1.0-r0 do_rootfs: Unable to install packages. Command '/LTSI4.9/LTSI4.4/build/tmp/work/m3ulcb-agl-linux/agl-demo-platform/1.0-r0/opkg.conf -t /LTSI4.9/build/tmp/work/m3ulcb-agl-linux/agl-demo-platform/1.0-r0/temp/ipktemp/ -o /LTSI4.9/build/tmp/work/m3ulcb-agl-linux/agl-demo-platform/1.0-r0/rootfs --force_postinstall --prefer-arch-to-version install
run-postinsts
screen
kernel-modules
packagegroup-agl-devel
packagegroup-core-eclipse-debug
mc packagegroup-core-tools-profile
kernel-module-vsp2 kernel-module-pvrsrvkm
kernel-module-vspm-if
opkg packagegroup-core-tools-debug
psplash kernel-module-vspm
packagegroup-core-ssh-openssh
packagegroup-agl-demo-platform
omx-user-module kernel-devicetree'
returned 1:
Solver encountered 1 problem(s):
Problem 1/1:
- package packagegroup-agl-demo-platform-1.0-r0.all requires packagegroup-agl-image-ivi, but none of the providers can be installed
Solution 1:
- do not ask to install a package providing packagegroup-agl-demo-platform
ERROR: agl-demo-platform-1.0-r0 do_rootfs: Function failed: do_rootfs
ERROR: Logfile of failure stored in: /LTSI4.9/build/tmp/work/m3ulcb-agl-linux/agl-demo-platform/1.0-r0/temp/log.do_rootfs.14498
ERROR: Task (/LTSI4.9/meta-agl-demo/recipes-platform/images/agl-demo-platform.bb:do_rootfs) failed with exit code '1'
Can anyone help me out in this case ?
I tried 02 ways as follows. They did work.
First method, I cleaned all relative packages and rebuild the whole image.
$ bitbake -c cleanall -c cleansstate <recipes>
recipes consisted of all dependent & runtime dependent packages. But it was a little bit confused to inexperienced users to determine which ones.
Second method, I wiped out the build/tmp/, cache/, sstate-cache/ folders, and re-build all Yocto packages.
There were nothing happening any more. It was really a bad idea if be in critical period of time, but if have free time, be helpful.

Install CLAPACK-3.2.1 in fedora 23

Hi I use fedora23 to calculate matrix.
So I am trying to install CLAPACK-3.2.1 to my computer.
In the procedure,
1. download clapack.tgz (version 3.2.1) from www.netlib.org/clapack -> done
2. cd CLAPACK-3.2.1 and cp make.inc.example make.inc -> done
3. make f2clib -> done properly
4. make blaslib -> done properly
5. make (this takes a while) -> problem starts here.
in a procedure of make, there are two errors. The error message is this.
make[2]: Leaving directory '/home/optics/CLAPACK/TESTING/EIG'
NEP: Testing Nonsymmetric Eigenvalue Problem routines
./xeigtstz < nep.in > znep.out 2>&1
/bin/sh: line 1: 9412 Segmentation fault (core dumped) ./xeigtstz < nep.in > znep.out 2>&1
Makefile:438: recipe for target 'znep.out' failed
make[1]: *** [znep.out] Error 139
make[1]: Leaving directory '/home/optics/CLAPACK/TESTING'
Makefile:44: recipe for target 'lapack_testing' failed
make: *** [lapack_testing] Error 2
==============================================================================
I cannot understand this. Please help me dealing with these errors.
I have also encountered this problem and was able to resolve it by increasing the stack size using ulimit as suggested here. The following worked for me:
$ sudo ulimit -s 100000
Followed by running make as usual. If you would like a primer on what this command does, check out this question: What does “ulimit -s unlimited” do?. Basically, it increases the limits on the scratch space in memory allocated to a thread.
In Kubuntu 17.10 it worked in this way:
ulimit -s unlimited

Tesseract index >= 0 && index < size_used_:Error:Assert failed Error

I successfully wrote the traineddata file for a new tesseract language, but when I was finished, I continue to get the following error:
index >= 0 && index < size_used_:Error:Assert failed:in file ../ccutil/genericvector.h, line 657
However, this even happens when I run tesseract on an image I trained with! I am confused as to what is going on, as I would expect that the error should not occur if I run tesseract on the training set.
This error is being caused to the lack of a lang.shapetable file in your lang.traineddata file.
Make sure that you generate the shapetable:
shapeclustering -F font_properties -U unicharset lang.font.exp0.box.tr
This will create a file named shapetable. You will need to rename this to lang.shapetable before you can combine everything:
combine_tessdata lang.
That error indicates your training failed => you overlooked some error message during training.