'프로그램 사용'에 해당되는 글 2199건

  1. 2024.01.02 tensorflow keras dataset
  2. 2024.01.02 tensorflow lite / mnist 학습
  3. 2023.12.27 tesseract 버전별 차이?
  4. 2023.12.27 tesseract 학습 데이터
  5. 2023.12.26 tesseract on arm
  6. 2023.12.21 tesseract ocr
  7. 2023.12.20 nnstreamer
  8. 2023.12.06 gst-device-monitor-1.0
  9. 2023.10.20 BGE / UPBGE(Blender game engine)
  10. 2023.10.11 libreoffice hwp 확장

자동완성으로 해보니 몇가지 나오는데 mnist 말고는 몰라서 찾아보는 중

>>> tf.keras.datasets.
tf.keras.datasets.boston_housing  tf.keras.datasets.cifar100        tf.keras.datasets.imdb            tf.keras.datasets.reuters         
tf.keras.datasets.cifar10         tf.keras.datasets.fashion_mnist   tf.keras.datasets.mnist

 

imdb는 영화 db

boston_housing은 statlib 사이트에서 정의된 보스톤 주택가격

reuter는 46 주제에 따른 11228 뉴스(로이터 뉴스) 인 듯.

This is a dataset of 11,228 newswires from Reuters, labeled over 46 topics.

[링크 : https://www.tensorflow.org/api_docs/python/tf/keras/datasets/boston_housing/load_data]

[링크 : https://www.tensorflow.org/api_docs/python/tf/keras/datasets]

 

cifar10은 10개 클래스니까.. 결과도 MNIST 처럼 10개로 나올 것 같고..

The CIFAR-10 dataset consists of 60000 32x32 colour images in 10 classes, with 6000 images per class. There are 50000 training images and 10000 test images.

[링크 : https://www.tensorflow.org/datasets/catalog/cifar10?hl=en]

 

This dataset is just like the CIFAR-10, except it has 100 classes containing 600 images each. There are 500 training images and 100 testing images per class. The 100 classes in the CIFAR-100 are grouped into 20 superclasses. Each image comes with a "fine" label (the class to which it belongs) and a "coarse" label (the superclass to which it belongs).

[링크 : https://www.tensorflow.org/datasets/catalog/cifar100?hl=en]

[링크 : https://www.tensorflow.org/datasets/catalog/fashion_mnist?hl=en]

[링크 : https://www.tensorflow.org/datasets/catalog/emnist?hl=en]

'프로그램 사용 > yolo_tensorflow' 카테고리의 다른 글

주피터 노트북 프로젝트(?) 실행하기  (0) 2024.01.02
i.mx8mp gopoint 실행 경로  (0) 2024.01.02
tensorflow lite / mnist 학습  (0) 2024.01.02
yolo-label  (0) 2022.03.22
tflite bazel rpi3b+  (0) 2022.01.27
Posted by 구차니

신기하네.. 그냥 알아서 받네?

>>> mnist = tf.keras.datasets.mnist
>>> (train_images, train_labels), (test_images, test_labels) = mnist.load_data()
Downloading data from https://storage.googleapis.com/tensorflow/tf-keras-datasets/mnist.npz
11490434/11490434 [==============================] - 1s 0us/step

 

학습하고 tflite 파일로 저장하기

import tensorflow as tf
import numpy as np

mnist = tf.keras.datasets.mnist
(train_images, train_labels), (test_images, test_labels) = mnist.load_data()

train_images = train_images.astype(np.float32) / 255.0
test_images = test_images.astype(np.float32) / 255.0

model = tf.keras.Sequential([
  tf.keras.layers.InputLayer(input_shape=(28, 28)),
  tf.keras.layers.Reshape(target_shape=(28, 28, 1)),
  tf.keras.layers.Conv2D(filters=12, kernel_size=(3, 3), activation='relu'),
  tf.keras.layers.MaxPooling2D(pool_size=(2, 2)),
  tf.keras.layers.Flatten(),
  tf.keras.layers.Dense(10)
])

model.compile(optimizer='adam',
              loss=tf.keras.losses.SparseCategoricalCrossentropy(
                  from_logits=True),
              metrics=['accuracy'])
model.fit(
  train_images,
  train_labels,
  epochs=5,
  validation_data=(test_images, test_labels)
)

# 일반 모델로 변환
converter = tf.lite.TFLiteConverter.from_keras_model(model)
tflite_model = converter.convert()

# 요건 차이 없음
# converter = tf.lite.TFLiteConverter.from_keras_model(model)
# converter.optimizations = [tf.lite.Optimize.DEFAULT]
# tflite_model_quant = converter.convert()

# quant 를 하려면 아래 코드 실행해야 함
def representative_data_gen():
  for input_value in tf.data.Dataset.from_tensor_slices(train_images).batch(1).take(100):
    yield [input_value]

converter = tf.lite.TFLiteConverter.from_keras_model(model)
converter.optimizations = [tf.lite.Optimize.DEFAULT]
converter.representative_dataset = representative_data_gen
converter.target_spec.supported_ops = [tf.lite.OpsSet.TFLITE_BUILTINS_INT8]
converter.inference_input_type = tf.uint8
converter.inference_output_type = tf.uint8
tflite_model_quant = converter.convert()

# 파일로 저장하기
import pathlib

tflite_models_dir = pathlib.Path("/tmp/mnist_tflite_models/")
tflite_models_dir.mkdir(exist_ok=True, parents=True)

# Save the unquantized/float model:
tflite_model_file = tflite_models_dir/"mnist_model.tflite"
tflite_model_file.write_bytes(tflite_model)

# Save the quantized model:
tflite_model_quant_file = tflite_models_dir/"mnist_model_quant.tflite"
tflite_model_quant_file.write_bytes(tflite_model_quant)

[링크 : https://www.tensorflow.org/lite/performance/post_training_integer_quant?hl=ko]

 

netron을 통해 생성한걸 보는데 quant나 그냥이나 어째 차이가 없냐?

 

 

+

quantization 하면 uint8로 변경된다.

 

그나저나, MNIST에 대해서 오해가 있었다.

출력이 [1,10] 인데 0~9 까지의 숫자에 대한 필기 데이터베이스지 알파벳이 아니란 것 -_-!

그래서 출력이 딱 10개인 건 당연하다는 것..

[링크 : https://en.wikipedia.org/wiki/MNIST_database]

 

+

EMNIST 라고 알파벳 손글씨가 따로 있다.

[링크 : https://www.nist.gov/itl/products-and-services/emnist-dataset]

[링크 : https://www.tensorflow.org/datasets/catalog/emnist?hl=ko]

'프로그램 사용 > yolo_tensorflow' 카테고리의 다른 글

i.mx8mp gopoint 실행 경로  (0) 2024.01.02
tensorflow keras dataset  (0) 2024.01.02
yolo-label  (0) 2022.03.22
tflite bazel rpi3b+  (0) 2022.01.27
bazel cross compile  (0) 2022.01.27
Posted by 구차니

왼쪽은 PC(ubuntu 22.04)

오른쪽은 arm에서 소스 받아서 직접 빌드.

동일한 tessdata 를 이용했는데 인식율에 차이가 어마어마하게 난다 -_-

 

$ tesseract --dpi 132 스크린샷\ 2023-12-26\ 17-19-43.png - -v
tesseract 4.1.1
 leptonica-1.82.0
  libgif 5.1.9 : libjpeg 8d (libjpeg-turbo 2.1.1) : libpng 1.6.37 : libtiff 4.3.0 : zlib 1.2.11 : libwebp 1.2.2 : libopenjp2 2.4.0
 Found AVX2
 Found AVX
 Found FMA
 Found SSE
 Found libarchive 3.6.0 zlib/1.2.11 liblzma/5.2.5 bz2lib/1.0.8 liblz4/1.9.3 libzstd/1.4.8
Warning:guessing pitch as xheight on row 1, block 1
Pec ea a

ach Seer

OEE PC LU)

Pee at Pere EEC
Rae ientcee Prete meee ceed

aa MEL ig
Pace
Pace Cra ur ue ecg

feta
Reset

ERTL Ee a Peay



# ./tesseract /home/root/a.png - -v
tesseract 5.3.3
 leptonica-1.84.0
  libjpeg 6b (libjpeg-turbo 2.1.5.1) : libpng 1.6.39 : zlib 1.2.13 : libopenjp2 2.5.0
 Found NEON
 Found libarchive 3.6.2 zlib/1.2.13 liblzma/5.4.4 bz2lib/1.0.8 libzstd/1.5.4
 Found libcurl/8.0.1 OpenSSL/3.1.3 zlib/1.2.13 libidn2/2.3.4
Error in pixReadMemTiff: function not present
Error in pixReadMem: tiff: no pix returned
Error in pixaGenerateFontFromString: pix not made
Error in bmfCreate: font pixa not made
Estimating resolution as 132
Warning:guessing pitch as xheight on row 1, block 1
1.MX8MP Evaluation Kit

.MxeMP 1.50 GHz

2020-06-07 2848 MB RAM

> Console Options wait, 65535 means
Select Language <Standard English> Reset

> Device Manager
> Boot Manager
> Boot Maintenance Manager

Continue
Reset

ay=Move Highlight <Enter>=Select Entry

 

--dpi 옵션 유용..한가?

[링크 : https://simmigyeong.tistory.com/3]

'프로그램 사용 > tesseract ocr' 카테고리의 다른 글

tesseract 학습 데이터  (0) 2023.12.27
tesseract on arm  (0) 2023.12.26
tesseract ocr  (0) 2023.12.21
번호판 인식(tesseract)  (0) 2021.10.14
Posted by 구차니

strace로 추적해보니 신기한(?) 파일 발견

eng는 그냥 data인데

osd.traineddata는 Matlab v4 mat-file로 나온다. 맞나.. 우연인가?

 

$ ls -alh /usr/share/tesseract-ocr/4.00/tessdata
합계 15M
drwxr-xr-x 4 root root 4.0K 12월 21 10:48 .
drwxr-xr-x 3 root root 4.0K  5월 30  2023 ..
drwxr-xr-x 2 root root 4.0K  5월 30  2023 configs
-rw-r--r-- 1 root root 4.0M  9월 16  2017 eng.traineddata
-rw-r--r-- 1 root root  11M  9월 16  2017 osd.traineddata
-rw-r--r-- 1 root root  572  2월  9  2022 pdf.ttf
drwxr-xr-x 2 root root 4.0K  5월 30  2023 tessconfigs

$ file *.traineddata
eng.traineddata: data
osd.traineddata: Matlab v4 mat-file (little endian) , text, rows 4294967295, columns 4294967295, imaginary


$ tree /usr/share/tesseract-ocr/4.00/tessdata
.
├── configs
│   ├── alto
│   ├── ambigs.train
│   ├── api_config
│   ├── bigram
│   ├── box.train
│   ├── box.train.stderr
│   ├── digits
│   ├── get.images
│   ├── hocr
│   ├── inter
│   ├── kannada
│   ├── linebox
│   ├── logfile
│   ├── lstm.train
│   ├── lstmbox
│   ├── lstmdebug
│   ├── makebox
│   ├── pdf
│   ├── quiet
│   ├── rebox
│   ├── strokewidth
│   ├── tsv
│   ├── txt
│   ├── unlv
│   └── wordstrbox
├── eng.traineddata
├── osd.traineddata
├── pdf.ttf
└── tessconfigs
    ├── batch
    ├── batch.nochop
    ├── matdemo
    ├── msdemo
    ├── nobatch
    └── segdemo

2 directories, 34 files

 

kor 은 15메가

[링크 : https://github.com/tesseract-ocr/tessdata]

 

 

+

실행하니 당연히(?) tesseract용 데이터가 없다고 오류가 발생한다.

혹시나 해서 변수는 확인해도 비어있고

pc에서 복사해서 설정해주니 ok

~/tesseract-main/build/bin# ./tesseract /home/root/a.png -
Error in pixReadMemTiff: function not present
Error in pixReadMem: tiff: no pix returned
Error in pixaGenerateFontFromString: pix not made
Error in bmfCreate: font pixa not made
Error opening data file ./eng.traineddata
Please make sure the TESSDATA_PREFIX environment variable is set to your "tessdata" directory.
Failed loading language 'eng'
Tesseract couldn't load any languages!
Could not initialize tesseract.
root@imx8mpevk:~/tesseract-main/build/bin# echo $TESSDATA_PREFIX

# export TESSDATA_PREFIX=/home/root/tessdata

 

아래 이미지를 인식시킴(pc는 dpi가 이상하다고 인식을 못함)

 

의외로 잘 인식한다.

그런데 pc 에서는 인식을 이상하게 했지만 0.2초

i.mx8 에서는 인식을 잘했지만 1.6초. 흐음.. 실시간으로 돌리기에는 무리군..

# time ./tesseract /home/root/a.png -
Error in pixReadMemTiff: function not present
Error in pixReadMem: tiff: no pix returned
Error in pixaGenerateFontFromString: pix not made
Error in bmfCreate: font pixa not made
Estimating resolution as 132
Warning:guessing pitch as xheight on row 1, block 1
1.MX8MP Evaluation Kit

.MxeMP 1.50 GHz

2020-06-07 2848 MB RAM

> Console Options wait, 65535 means
Select Language <Standard English> Reset

> Device Manager
> Boot Manager
> Boot Maintenance Manager

Continue
Reset

ay=Move Highlight <Enter>=Select Entry

real 0m1.646s
user 0m1.578s
sys 0m0.060s

'프로그램 사용 > tesseract ocr' 카테고리의 다른 글

tesseract 버전별 차이?  (0) 2023.12.27
tesseract on arm  (0) 2023.12.26
tesseract ocr  (0) 2023.12.21
번호판 인식(tesseract)  (0) 2021.10.14
Posted by 구차니

빌드 하려고 해도 빡세다

 

tesseact 빌드 하려니 leptonica라는게 필요하다고 에러나고

# cmake ..
-- Configuring tesseract version 5.3.3...
-- IPO / LTO not supported: <Change Dir: /home/root/tesseract-main/build/CMakeFiles/_CMakeLTOTest-CXX/bin

Run Build Command(s):/usr/bin/make -f Makefile && /usr/bin/cmake -S/home/root/tesseract-main/build/CMakeFiles/_CMakeLTOTest-CXX/src -B/home/root/tesseract-main/build/CMakeFiles/_CMakeLTOTest-CXX/bin --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/root/tesseract-main/build/CMakeFiles/_CMakeLTOTest-CXX/bin/CMakeFiles /home/root/tesseract-main/build/CMakeFiles/_CMakeLTOTest-CXX/bin//CMakeFiles/progress.marks
/usr/bin/make  -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/root/tesseract-main/build/CMakeFiles/_CMakeLTOTest-CXX/bin'
/usr/bin/make  -f CMakeFiles/foo.dir/build.make CMakeFiles/foo.dir/depend
make[2]: Entering directory '/home/root/tesseract-main/build/CMakeFiles/_CMakeLTOTest-CXX/bin'
cd /home/root/tesseract-main/build/CMakeFiles/_CMakeLTOTest-CXX/bin && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/root/tesseract-main/build/CMakeFiles/_CMakeLTOTest-CXX/src /home/root/tesseract-main/build/CMakeFiles/_CMakeLTOTest-CXX/src /home/root/tesseract-main/build/CMakeFiles/_CMakeLTOTest-CXX/bin /home/root/tesseract-main/build/CMakeFiles/_CMakeLTOTest-CXX/bin /home/root/tesseract-main/build/CMakeFiles/_CMakeLTOTest-CXX/bin/CMakeFiles/foo.dir/DependInfo.cmake
make[2]: Leaving directory '/home/root/tesseract-main/build/CMakeFiles/_CMakeLTOTest-CXX/bin'
/usr/bin/make  -f CMakeFiles/foo.dir/build.make CMakeFiles/foo.dir/build
make[2]: Entering directory '/home/root/tesseract-main/build/CMakeFiles/_CMakeLTOTest-CXX/bin'
[ 25%] Building CXX object CMakeFiles/foo.dir/foo.cpp.o
/usr/bin/c++   -flto=auto -fno-fat-lto-objects -o CMakeFiles/foo.dir/foo.cpp.o -c /home/root/tesseract-main/build/CMakeFiles/_CMakeLTOTest-CXX/src/foo.cpp
[ 50%] Linking CXX static library libfoo.a
/usr/bin/cmake -P CMakeFiles/foo.dir/cmake_clean_target.cmake
/usr/bin/cmake -E cmake_link_script CMakeFiles/foo.dir/link.txt --verbose=1
"CMAKE_CXX_COMPILER_AR-NOTFOUND" cr libfoo.a CMakeFiles/foo.dir/foo.cpp.o
Error running link command: No such file or directory
make[2]: *** [CMakeFiles/foo.dir/build.make:100: libfoo.a] Error 2
make[2]: Leaving directory '/home/root/tesseract-main/build/CMakeFiles/_CMakeLTOTest-CXX/bin'
make[1]: *** [CMakeFiles/Makefile2:88: CMakeFiles/foo.dir/all] Error 2
make[1]: Leaving directory '/home/root/tesseract-main/build/CMakeFiles/_CMakeLTOTest-CXX/bin'
make: *** [Makefile:94: all] Error 2

>
-- CMAKE_SYSTEM_PROCESSOR=<aarch64>
-- LTO build is not supported on arm/RBPi.
-- Could NOT find Leptonica (missing: Leptonica_DIR)
-- Checking for module 'lept>=1.74'
--   No package 'lept' found
CMake Error at CMakeLists.txt:404 (message):
  Cannot find required library Leptonica.  Quitting!


-- Configuring incomplete, errors occurred!
See also "/home/root/tesseract-main/build/CMakeFiles/CMakeOutput.log".
See also "/home/root/tesseract-main/build/CMakeFiles/CMakeError.log".

[링크 : https://github.com/tesseract-ocr/tesseract]

 

leptonica 라는거 빌드하려니 이젠 openjp2가 없다고 -_-

# cmake ..
-- Could NOT find GIF (missing: GIF_LIBRARY GIF_INCLUDE_DIR) (Required is at least version "5")
-- Could NOT find TIFF (missing: TIFF_LIBRARY TIFF_INCLUDE_DIR) 
-- Could NOT find WebP (missing: WebP_DIR)
-- WebP_INCLUDE_DIR : WebP_INCLUDE_DIR-NOTFOUND
WebP_MUX_INCLUDE_DIR: WebP_MUX_INCLUDE_DIR-NOTFOUND
WebP_LIBRARY: WebP_LIBRARY-NOTFOUND
WebP_MUX_LIBRARY: WebP_MUX_LIBRARY-NOTFOUND
CMake Error at /usr/lib/openjpeg-2.5/OpenJPEGTargets.cmake:95 (message):
  The imported target "openjp2_static" references the file

     "/usr/lib/libopenjp2.a"

  but this file does not exist.  Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained

     "/usr/lib/openjpeg-2.5/OpenJPEGTargets.cmake"

  but not all the files it references.

Call Stack (most recent call first):
  /usr/lib/openjpeg-2.5/OpenJPEGConfig.cmake:28 (include)
  CMakeLists.txt:186 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/root/leptonica-master/build/CMakeFiles/CMakeOutput.log".

 

귀찮으니(!) 걍 주석으로 막고 인자가 3개인 녀석으로 강제 빌드!

//#if OPJ_VERSION_MINOR == 0                                                
//    opj_stream_set_user_data(l_stream, fp);                               
//#else                                                                  
    opj_stream_set_user_data(l_stream, fp,                               
                             (opj_stream_free_user_data_fn)NULL);        
//#endif                                                    

[링크 : https://github.com/danbloomberg/leptonica]

[링크 : http://www.leptonica.org/]

 

openjpeg는 별다른 에러없이 빌드 완료

[링크 : https://github.com/uclouvain/openjpeg]

 

leptonica 에서

src/jp2kio.c 에서 아래의 부분에서 MINOR가 0으로 되면서 구버전(?) 소스를 호출하는지 함수의 형태가 달라서 에러난다.

/home/root/leptonica-master/src/jp2kio.c: In function 'opjCreateStream':
/home/root/leptonica-master/src/jp2kio.c:938:5: error: too few arguments to function 'opj_stream_set_user_data'
  938 |     opj_stream_set_user_data(l_stream, fp);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~

 

tesseract 다시 하려니 pangocairo 패키지가 없다고 에러.. 젠장.. 이거 이전에 weston 할때

개고생(?) 시키던 이름이 악몽으로 떠오르는데?

--   No package 'pangocairo' found

 

meson 깔고

# pip3 install meson
Collecting meson
  Downloading meson-1.3.0-py3-none-any.whl (976 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 976.4/976.4 kB 3.5 MB/s eta 0:00:00
Installing collected packages: meson
Successfully installed meson-1.3.0

 

pango 빌드 하려는데 git 필요하대서 git 깔고

WARNING: CMake Toolchain: Failed to determine CMake compilers state
Run-time dependency fribidi found: NO (tried pkgconfig and cmake)
Looking for a fallback subproject for the dependency fribidi

../meson.build:218:14: ERROR: Git program not found, cannot download fribidi.wrap via git.

 

아래 링크에서 받아서 빌드..

$ wget https://www.kernel.org/pub/software/scm/git/git-2.43.0.tar.gz

 

pango 다시 빌드하는데 ninja 없으면 배쨈! 시전하고

$ mkdir build
$ cd build
$ meson ..
ERROR: Could not detect Ninja v1.8.2 or newer

 

ninja 빌드하고 설치하려는데 또 백태클 -_-

그러니 cmake를 멀리하고

 12%] Building CXX object CMakeFiles/libninja.dir/src/dyndep_parser.cc.o
In file included from /home/root/ninja-master/build/_deps/googletest-src/googletest/src/gtest-all.cc:42:
/home/root/ninja-master/build/_deps/googletest-src/googletest/src/gtest-death-test.cc: In function 'bool testing::internal::StackGrowsDown()':
/home/root/ninja-master/build/_deps/googletest-src/googletest/src/gtest-death-test.cc:1301:24: error: 'dummy' may be used uninitialized [-Werror=maybe-uninitialized]
 1301 |   StackLowerThanAddress(&dummy, &result);
      |   ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~

 

파이썬으로 빌드하는게 낫....

# python3 configure.py --bootstrap

[링크 : https://github.com/ninja-build/ninja]

 

다시 pango으로 돌아와서

$ meson ..
Found ninja-1.12.0.git at /usr/bin/ninja
WARNING: Running the setup command as `meson [options]` instead of `meson setup [options]` is ambiguous and deprecated.

 

build 안에서 ninja 치니 알아서 빌드. + 설치

~/pango-main/build# ninja
~/pango-main/build# ninja install

 

pango도 했는데 tesseract 다시 빌드 하려니 안된다 -_-

그냥 설치하는게 아니라 패키지로 만들어서 했어야 했나?

-- Checking for modules 'pango>=1.38.0;cairo;pangoft2;pangocairo;fontconfig'
--   No package 'pango' found
--   No package 'pangoft2' found
--   No package 'pangocairo' found

 

귀찮으니(!) cmake에서 패키지 확인하지 않도록 수정

~/tesseract-main/build# vi ../src/training/CMakeLists.txt
  if(PKG_CONFIG_FOUND OR SW_BUILD)
                   
    if(PKG_CONFIG_FOUND)  
      pkg_check_modules(
        PANGO                            
        REQUIRED
        IMPORTED_TARGET    
#        pango>=1.38.0
#        cairo       
#        pangoft2              
#        pangocairo
        fontconfig)  
    endif()

 

[ 95%] Building CXX object src/training/CMakeFiles/pango_training.dir/pango/ligature_table.cpp.o
In file included from /home/root/tesseract-main/src/training/pango/ligature_table.cpp:24:
/home/root/tesseract-main/src/training/pango/pango_font_info.h:27:10: fatal error: pango/pango-font.h: No such file or directory
   27 | #include "pango/pango-font.h"
      |          ^~~~~~~~~~~~~~~~~~~~

[ 96%] Building CXX object src/training/CMakeFiles/pango_training.dir/pango/tlog.cpp.o
In file included from /home/root/tesseract-main/src/training/pango/stringrenderer.cpp:20:
/home/root/tesseract-main/src/training/pango/stringrenderer.h:33:10: fatal error: pango/pango-layout.h: No such file or directory
   33 | #include "pango/pango-layout.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [src/training/CMakeFiles/pango_training.dir/build.make:118: src/training/CMakeFiles/pango_training.dir/pango/stringrenderer.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from /home/root/tesseract-main/src/training/pango/ligature_table.cpp:24:
/home/root/tesseract-main/src/training/pango/pango_font_info.h:27:10: fatal error: pango/pango-font.h: No such file or directory
   27 | #include <pango/pango-font.h>
      |          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [src/training/CMakeFiles/pango_training.dir/build.make:90: src/training/CMakeFiles/pango_training.dir/pango/ligature_table.cpp.o] Error 1
In file included from /home/root/tesseract-main/src/training/pango/pango_font_info.cpp:32:
/home/root/tesseract-main/src/training/pango/pango_font_info.h:27:10: fatal error: pango/pango-font.h: No such file or directory
   27 | #include <pango/pango-font.h>
      |          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.

 

아마 패키지에서 배째는거 같은데 수작업으로 변경.. -_-

#include "pango/pango-font.h"
#include "pango/pango.h"
#include "pango/pangocairo.h"

#include <pango/pango-font.h>
#include <pango/pango.h>
#include <pango/pangocairo.h>

 

밑도 끝도 없네 -_-

[ 96%] Building CXX object src/training/CMakeFiles/pango_training.dir/pango/pango_font_info.cpp.o
In file included from /usr/local/include/pango/pango-font.h:25,
                 from /usr/local/include/pango/pango-attributes.h:25,
                 from /usr/local/include/pango/pango-layout.h:25,
                 from /home/root/tesseract-main/src/training/pango/stringrenderer.h:33,
                 from /home/root/tesseract-main/src/training/pango/stringrenderer.cpp:20:
/usr/local/include/pango/pango-coverage.h:25:10: fatal error: glib-object.h: No such file or directory
   25 | #include <glib-object.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [src/training/CMakeFiles/pango_training.dir/build.make:118: src/training/CMakeFiles/pango_training.dir/pango/stringrenderer.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from /usr/local/include/pango/pango-font.h:25,
                 from /home/root/tesseract-main/src/training/pango/pango_font_info.h:27,
                 from /home/root/tesseract-main/src/training/pango/ligature_table.cpp:24:
/usr/local/include/pango/pango-coverage.h:25:10: fatal error: glib-object.h: No such file or directory
   25 | #include <glib-object.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [src/training/CMakeFiles/pango_training.dir/build.make:90: src/training/CMakeFiles/pango_training.dir/pango/ligature_table.cpp.o] Error 1
In file included from /usr/local/include/pango/pango-font.h:25,
                 from /home/root/tesseract-main/src/training/pango/pango_font_info.h:27,
                 from /home/root/tesseract-main/src/training/pango/pango_font_info.cpp:32:
/usr/local/include/pango/pango-coverage.h:25:10: fatal error: glib-object.h: No such file or directory
   25 | #include <glib-object.h>
      |          ^~~~~~~~~~~~~~~
compilation terminated.

 

[ 96%] Building CXX object src/training/CMakeFiles/pango_training.dir/pango/stringrenderer.cpp.o
In file included from /usr/local/include/pango/pango-coverage.h:25,
                 from /usr/local/include/pango/pango-font.h:25,
                 from /usr/local/include/pango/pango-attributes.h:25,
                 from /usr/local/include/pango/pango-layout.h:25,
                 from /home/root/tesseract-main/src/training/pango/stringrenderer.h:33,
                 from /home/root/tesseract-main/src/training/pango/stringrenderer.cpp:20:
/usr/include/glib-2.0/glib-object.h:24:10: fatal error: gobject/gbinding.h: No such file or directory
   24 | #include <gobject/gbinding.h>
      |          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [src/training/CMakeFiles/pango_training.dir/build.make:118: src/training/CMakeFiles/pango_training.dir/pango/stringrenderer.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from /usr/local/include/pango/pango-coverage.h:25,
                 from /usr/local/include/pango/pango-font.h:25,
                 from /home/root/tesseract-main/src/training/pango/pango_font_info.h:27,
                 from /home/root/tesseract-main/src/training/pango/ligature_table.cpp:24:
/usr/include/glib-2.0/glib-object.h:24:10: fatal error: gobject/gbinding.h: No such file or directory
   24 | #include <gobject/gbinding.h>
      |          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [src/training/CMakeFiles/pango_training.dir/build.make:90: src/training/CMakeFiles/pango_training.dir/pango/ligature_table.cpp.o] Error 1
In file included from /usr/local/include/pango/pango-coverage.h:25,
                 from /usr/local/include/pango/pango-font.h:25,
                 from /home/root/tesseract-main/src/training/pango/pango_font_info.h:27,
                 from /home/root/tesseract-main/src/training/pango/pango_font_info.cpp:32:
/usr/include/glib-2.0/glib-object.h:24:10: fatal error: gobject/gbinding.h: No such file or directory
   24 | #include <gobject/gbinding.h>
      |          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.

 

inclue path를 찾는데 Makefile에 없어서 뒤져보니.. 저게 맞길..

# grep -rn "\-I" .
./CMakeFiles/libtesseract.dir/flags.make:7:CXX_INCLUDES = -I/home/root/tesseract-main/include -I/home/root/tesseract-main/src/arch -I/home/root/tesseract-main/src/ccmain -I/home/root/tesseract-main/src/ccstruct -I/home/root/tesseract-main/src/ccutil -I/home/root/tesseract-main/src/classify -I/home/root/tesseract-main/src/cutil -I/home/root/tesseract-main/src/dict -I/home/root/tesseract-main/src/lstm -I/home/root/tesseract-main/src/opencl -I/home/root/tesseract-main/src/textord -I/home/root/tesseract-main/src/viewer -I/home/root/tesseract-main/src/wordrec -I/home/root/tesseract-main/src/training -I/home/root/tesseract-main/src -I/usr/local/include/leptonica -I/home/root/tesseract-main/build -I/home/root/tesseract-main/build/include
./CMakeFiles/tesseract.dir/flags.make:7:CXX_INCLUDES = -I/usr/local/include/leptonica -I/home/root/tesseract-main/build -I/home/root/tesseract-main/build/include -I/home/root/tesseract-main/include -I/home/root/tesseract-main/src/arch -I/home/root/tesseract-main/src/ccmain -I/home/root/tesseract-main/src/ccstruct -I/home/root/tesseract-main/src/ccutil -I/home/root/tesseract-main/src/classify -I/home/root/tesseract-main/src/cutil -I/home/root/tesseract-main/src/dict -I/home/root/tesseract-main/src/lstm -I/home/root/tesseract-main/src/opencl -I/home/root/tesseract-main/src/textord -I/home/root/tesseract-main/src/viewer -I/home/root/tesseract-main/src/wordrec -I/home/root/tesseract-main/src/training

'프로그램 사용 > tesseract ocr' 카테고리의 다른 글

tesseract 버전별 차이?  (0) 2023.12.27
tesseract 학습 데이터  (0) 2023.12.27
tesseract ocr  (0) 2023.12.21
번호판 인식(tesseract)  (0) 2021.10.14
Posted by 구차니

오픈소스 OCR로 우분투에 패키지로 설치가 가능하고

gimagereader 라는 frontend도 있으니 참고를..

[링크 : https://sourceforge.net/projects/gimagereader/]

 

간단한 사용법은 아래와 같이 파일명 - -l eng 해주면 되는데, 아마 -를 넣어서 stdout으로 출력하라는걸지도?

$ tesseract images/eurotext.png - -l eng

[링크 : https://tesseract-ocr.github.io/tessdoc/Command-Line-Usage.html]

 

psm은 어떤식으로 읽을지 모드를 설정해주는데 OSD(Orientation and Script Detection) 이라는게

있냐 없냐로, 2문자 까지 인식하게 할 순 있다(--psm 1)

+

psm 10으로 하면 단문자도 인식하게 설정이 가능하다

$ tesseract --help-extra
Usage:
  tesseract --help | --help-extra | --help-psm | --help-oem | --version
  tesseract --list-langs [--tessdata-dir PATH]
  tesseract --print-parameters [options...] [configfile...]
  tesseract imagename|imagelist|stdin outputbase|stdout [options...] [configfile...]

OCR options:
  --tessdata-dir PATH   Specify the location of tessdata path.
  --user-words PATH     Specify the location of user words file.
  --user-patterns PATH  Specify the location of user patterns file.
  --dpi VALUE           Specify DPI for input image.
  -l LANG[+LANG]        Specify language(s) used for OCR.
  -c VAR=VALUE          Set value for config variables.
                        Multiple -c arguments are allowed.
  --psm NUM             Specify page segmentation mode.
  --oem NUM             Specify OCR Engine mode.
NOTE: These options must occur before any configfile.

Page segmentation modes:
  0    Orientation and script detection (OSD) only.
  1    Automatic page segmentation with OSD.
  2    Automatic page segmentation, but no OSD, or OCR. (not implemented)
  3    Fully automatic page segmentation, but no OSD. (Default)
  4    Assume a single column of text of variable sizes.
  5    Assume a single uniform block of vertically aligned text.
  6    Assume a single uniform block of text.
  7    Treat the image as a single text line.
  8    Treat the image as a single word.
  9    Treat the image as a single word in a circle.
 10    Treat the image as a single character.
 11    Sparse text. Find as much text as possible in no particular order.
 12    Sparse text with OSD.
 13    Raw line. Treat the image as a single text line,
       bypassing hacks that are Tesseract-specific.

OCR Engine modes: (see https://github.com/tesseract-ocr/tesseract/wiki#linux)
  0    Legacy engine only.
  1    Neural nets LSTM engine only.
  2    Legacy + LSTM engines.
  3    Default, based on what is available.

Single options:
  -h, --help            Show minimal help message.
  --help-extra          Show extra help for advanced users.
  --help-psm            Show page segmentation modes.
  --help-oem            Show OCR Engine modes.
  -v, --version         Show version information.
  --list-langs          List available languages for tesseract engine.
  --print-parameters    Print tesseract parameters.

[링크 : https://kokokorin-bigbox.tistory.com/53]

 

테스트 해보니 1 문자는 어떻게 하든 안되는 것 같은데 회피가 가능하려나?

 

 

$ tesseract a5.png - --psm 3
Warning: Invalid resolution 0 dpi. Using 70 instead.
Estimating resolution as 406
ak

$ tesseract a5.png - --psm 2
Warning: Invalid resolution 0 dpi. Using 70 instead.
Estimating resolution as 406
Orientation: 0
WritingDirection: 0
TextlineOrder: 2
Deskew angle: 0.0000

$ tesseract a5.png - --psm 1
Warning: Invalid resolution 0 dpi. Using 70 instead.
Estimating resolution as 406
Too few characters. Skipping this page
OSD: Weak margin (0.00) for 2 blob text block, but using orientation anyway: 0
ak


$ tesseract a5.png - --psm 0
Warning: Invalid resolution 0 dpi. Using 70 instead.
Estimating resolution as 406
Too few characters. Skipping this page
Warning. Invalid resolution 0 dpi. Using 70 instead.
Too few characters. Skipping this page
Error during processing.

 

 

 

$ tesseract a6.png - --psm 0
Warning: Invalid resolution 0 dpi. Using 70 instead.
Estimating resolution as 294
Too few characters. Skipping this page
Warning. Invalid resolution 0 dpi. Using 70 instead.
Too few characters. Skipping this page
Error during processing.

$ tesseract a6.png - --psm 1
Warning: Invalid resolution 0 dpi. Using 70 instead.
Estimating resolution as 294
Too few characters. Skipping this page
OSD: Weak margin (0.00) for 1 blob text block, but using orientation anyway: 0
Empty page!!
Estimating resolution as 294
Too few characters. Skipping this page
OSD: Weak margin (0.00) for 1 blob text block, but using orientation anyway: 0
Empty page!!

$ tesseract a6.png - --psm 2
Warning: Invalid resolution 0 dpi. Using 70 instead.
Estimating resolution as 294
Empty page!!

$ tesseract a6.png - --psm 3
Warning: Invalid resolution 0 dpi. Using 70 instead.
Estimating resolution as 294
Empty page!!
Estimating resolution as 294
Empty page!!

'프로그램 사용 > tesseract ocr' 카테고리의 다른 글

tesseract 버전별 차이?  (0) 2023.12.27
tesseract 학습 데이터  (0) 2023.12.27
tesseract on arm  (0) 2023.12.26
번호판 인식(tesseract)  (0) 2021.10.14
Posted by 구차니

Neural Network gstreamer인가?

 

NNStreamer provides a set of GStreamer plugins so developers may apply neural networks, attach related frameworks (including ROSIIOFlatBuffers, and Protocol Buffers), and manipulate tensor data streams in GStreamer pipelines easily and execute such pipelines efficiently

[링크 : https://nnstreamer.ai/#get-started]

'프로그램 사용 > gstreamer' 카테고리의 다른 글

gstreamer parse_launch  (0) 2024.01.11
gst-device-monitor-1.0  (0) 2023.12.06
gstremaer videobox + videomixer  (0) 2023.04.10
gst-inspector.c  (0) 2023.04.06
gstreamer videomixer 반쪽 성공  (0) 2023.03.27
Posted by 구차니

v4l2src 관련해서 기존에 웹캠에서 지원하는 모드들 찾는다고 고생했는데 간단한 유틸리티를 알게 됨 -_-

 

$ man gst-device-monitor-1.0
SYNOPSIS
       gst-device-monitor-1.0 [DEVICE_CLASSES[:FILTER_CAPS]] [DEVICE_CLASSES[:FILTER_CAPS]]

 

$ gst-device-monitor-1.0 Video/Source
Probing devices...


Device found:

name  : 720p HD Camera
class : Video/Source
caps  : image/jpeg, width=1280, height=720, framerate=30/1
        image/jpeg, width=640, height=480, framerate=30/1
        image/jpeg, width=640, height=360, framerate=30/1
        image/jpeg, width=352, height=288, framerate=30/1
        image/jpeg, width=320, height=240, framerate=30/1
        image/jpeg, width=160, height=120, framerate=30/1
        video/x-raw, format=YUY2, width=1280, height=720, framerate=10/1
        video/x-raw, format=YUY2, width=640, height=480, framerate=30/1
        video/x-raw, format=YUY2, width=640, height=360, framerate=30/1
        video/x-raw, format=YUY2, width=352, height=288, framerate=30/1
        video/x-raw, format=YUY2, width=320, height=240, framerate=30/1
        video/x-raw, format=YUY2, width=160, height=120, framerate=30/1
properties:
object.path = v4l2:/dev/video0
device.api = v4l2
media.class = Video/Source
device.product.id = 308
device.vendor.id = 11134
api.v4l2.path = /dev/video0
api.v4l2.cap.driver = uvcvideo
api.v4l2.cap.card = "720p\ HD\ Camera:\ 720p\ HD\ Camera"
api.v4l2.cap.bus_info = usb-0000:00:14.0-6
api.v4l2.cap.version = 6.2.16
api.v4l2.cap.capabilities = 84a00001
api.v4l2.cap.device-caps = 04200001
device.id = 33
node.name = v4l2_input.pci-0000_00_14.0-usb-0_6_1.0
node.description = "720p\ HD\ Camera"
factory.name = api.v4l2.source
node.pause-on-idle = false
factory.id = 10
client.id = 32
clock.quantum-limit = 8192
media.role = Camera
node.driver = true
object.id = 35
object.serial = 35
gst-launch-1.0 pipewiresrc path=35 ! ...

'프로그램 사용 > gstreamer' 카테고리의 다른 글

gstreamer parse_launch  (0) 2024.01.11
nnstreamer  (0) 2023.12.20
gstremaer videobox + videomixer  (0) 2023.04.10
gst-inspector.c  (0) 2023.04.06
gstreamer videomixer 반쪽 성공  (0) 2023.03.27
Posted by 구차니
프로그램 사용/Blender2023. 10. 20. 20:16

2.8에서는 삭제되어 2.79 까지만 남아있는 듯. 현재 3.x대로 이행되었으니 흔적도 없이 사라졌을 것 같다.

Following its removal from the official version of Blender, an unofficial fork of the game engine source code was created, named UPBGE.[4] This was done with the aim of maintaining and modernizing the engine. Since then, UPBGE has been updated with support for Blender's new realtime renderer, Eevee, and runs on top of Blender 3.0 source code.[5]

[링크 : https://en.wikipedia.org/wiki/Blender_Game_Engine]

[링크 : https://upbge.org/#/]

 

망할(!) GPL 때문에 없어질 수 밖에 없었을 듯.

그래서 unity가 신명나게 욕 먹고 대안으로 떠오르는게 BGE가 아니라 godot 게임엔진이 뜨는 듯

내장된 'Game engine save as runtime' 애드온을 사용하면 Windows용으로 빌드할 수 있다.

애드온으로 실행 파일을 만든 때에 GPL 라이선스에 따라 소스 코드를 무조건 까야 한다. BGE 라이센스 참고(영문). 요약하자면, 소프트웨어 및 소스 코드는 GNU GPL에 결합되어 있지만, 블렌더 파일(모델, 텍스처, 소리)은 그렇지 않다.

게임을 구성하는 파이썬 스크립트의 경우 개발자의 지적 재산은 맞지만 내부 에드온으로 빌드하면 GPL 소스 코드와 섞이기 때문에 그 권리가 모호해지는 문제가 있다. 즉, 빌드된 게임 프로그램이 GPL이 되어 버린다.

[링크 : https://namu.wiki/w/BGE]

 

The Godot Engine is a free, all-in-one, cross-platform game engine that makes it easy for you to create 2D and 3D games.

[링크 : https://godotengine.org/]

'프로그램 사용 > Blender' 카테고리의 다른 글

blender cad  (0) 2024.05.07
blender render node  (0) 2024.03.20
blender on macos  (0) 2022.05.24
big bunny blender project file  (0) 2022.05.22
블렌더 강좌? (유료)  (0) 2021.08.07
Posted by 구차니

한동안 신경끄고 살았는데

hwpx라는 사악한(!) 확장자도 추가되었다는걸 새삼 알게됨 -_-

 

[링크 : https://extensions.libreoffice.org/en/extensions/show/27504]

 

+

23.10.24

다운받아서 설치하니 java 11 없다고 배짼다. 깔아야 하나 -_-

 

openjsdk-11 으로는 안되니 패스~

$ sudo apt-get install openjdk-11-jdk

[링크 : https://codechacha.com/ko/ubuntu-install-open-jdk11/]

 

libreoffice-java-common 이라는 패키지로 별도의 java가 제공된다고.. 뭥미

$ sudo apt install libreoffice-java-common

[링크 : https://forums.zotero.org/discussion/97427/issue-with-libre-office-plugin-on-ubuntu-22-04]

Posted by 구차니