我在做什么:
使用docker从源代码编译tesseract,并将其部署为lambda层。它被另一个lambda消耗。
问题
根据tesseract wiki的多线程,应禁止批量生产:
默认构建会创建一个Tesseract可执行文件,该可执行文件适用于 处理单个图像。然后,Tesseract使用4个CPU内核来获得 尽早获得OCR。
用于批量生产具有数百或数千个默认图像的图像 这是不好的,因为多线程执行的开销非常大。 最好运行Tesseract的单线程实例,这样 每个可用的CPU内核都会处理不同的图像。
cd tesseract
./autogen.sh
mkdir -p bin/release
cd bin/release
../../configure --disable-openmp --disable-shared 'CXXflaGS=-g -O2 -fno-math-errno -Wall -Wextra -Wpedantic'
# Build tesseract and training tools. Run `make` if you don't need the training tools.
make training
cd ../..
由于无服务器自动创建新实例来处理负载,因此应在生产中禁用多线程吗?