RED-7669: optimize OCR-module performance

* enable caches
This commit is contained in:
Kilian Schuettler 2023-11-24 10:21:55 +01:00
parent a50f54676e
commit 0264e28cc2
2 changed files with 7 additions and 4 deletions

View File

@ -10,7 +10,7 @@ deploy:
script: script:
- echo "Building with gradle version ${BUILDVERSION}" - echo "Building with gradle version ${BUILDVERSION}"
- gradle -Pversion=${BUILDVERSION} publish - gradle -Pversion=${BUILDVERSION} publish
- gradle bootBuildImage --cleanCache --publishImage -PbuildbootDockerHostNetwork=true -Pversion=${BUILDVERSION} - gradle bootBuildImage --publishImage -PbuildbootDockerHostNetwork=true -Pversion=${BUILDVERSION}
- echo "BUILDVERSION=$BUILDVERSION" >> version.env - echo "BUILDVERSION=$BUILDVERSION" >> version.env
artifacts: artifacts:
reports: reports:

View File

@ -62,7 +62,7 @@ public class ImageExtractionThread extends Thread {
} }
for (ExtractedImage image : extractedImages) { for (ExtractedImage image : extractedImages) {
imageProcessingQueue.put((UnprocessedImage) image); imageProcessingQueue.put(image);
logger.addImagesToProcess(image.pageNumber(), image.numberOnPage()); logger.addImagesToProcess(image.pageNumber(), image.numberOnPage());
} }
} }
@ -87,7 +87,8 @@ public class ImageExtractionThread extends Thread {
} }
for (ExtractedImage imageOnPage : imagesOnCurrentPage) { for (ExtractedImage imageOnPage : imagesOnCurrentPage) {
if (imageOnPage.width() > FULL_PAGE_IMAGE_THRESHOLD * page.getCropBox().getWidth() && imageOnPage.height() > FULL_PAGE_IMAGE_THRESHOLD * page.getCropBox().getHeight()) { if (imageOnPage.width() > FULL_PAGE_IMAGE_THRESHOLD * page.getCropBox().getWidth() && imageOnPage.height() > FULL_PAGE_IMAGE_THRESHOLD * page.getCropBox()
.getHeight()) {
return true; return true;
} }
} }
@ -95,7 +96,9 @@ public class ImageExtractionThread extends Thread {
//checking for intersections or direct alignment of images //checking for intersections or direct alignment of images
for (int j = 0; j < imagesOnCurrentPage.size(); j++) { for (int j = 0; j < imagesOnCurrentPage.size(); j++) {
for (int i = j + 1; i < imagesOnCurrentPage.size(); i++) { for (int i = j + 1; i < imagesOnCurrentPage.size(); i++) {
if (imagesOnCurrentPage.get(j).getImageCoordinatesInInitialUserSpace().aligns(imagesOnCurrentPage.get(i).getImageCoordinatesInInitialUserSpace(), IMAGE_ALIGNMENT_THRESHOLD)) { if (imagesOnCurrentPage.get(j)
.getImageCoordinatesInInitialUserSpace()
.aligns(imagesOnCurrentPage.get(i).getImageCoordinatesInInitialUserSpace(), IMAGE_ALIGNMENT_THRESHOLD)) {
// TODO: see if we can stitch aligning images using BufferedImage and skip the gs conversion entirely // TODO: see if we can stitch aligning images using BufferedImage and skip the gs conversion entirely
return true; return true;
} }