better logs

This commit is contained in:
Abhinav 2022-04-11 16:06:44 +05:30
parent ffedf2e961
commit 60e81e9e84

View file

@ -78,6 +78,9 @@ class TesseractService implements TextDetectionService {
); );
} }
if (imageHeight > TESSERACT_MAX_IMAGE_DIMENSION) { if (imageHeight > TESSERACT_MAX_IMAGE_DIMENSION) {
console.log(
`original dimension (${imageBitmap.width}px,${imageBitmap.height}px)`
);
imageBitmap = resizeToSquare( imageBitmap = resizeToSquare(
imageBitmap, imageBitmap,
TESSERACT_MAX_IMAGE_DIMENSION TESSERACT_MAX_IMAGE_DIMENSION
@ -103,6 +106,9 @@ class TesseractService implements TextDetectionService {
const tesseractWorker = await this.getTesseractWorker(); const tesseractWorker = await this.getTesseractWorker();
const id = makeID(6); const id = makeID(6);
console.log(
`detecting text (${imageBitmap.width}px,${imageBitmap.height}px) fileType=${fileTypeInfo.exactType}`
);
console.time('detecting text ' + id); console.time('detecting text ' + id);
const detections = await tesseractWorker.recognize(file); const detections = await tesseractWorker.recognize(file);