The complete workflow of the proposed book spine recognition system is depicted in
Figure 7. As an integrated framework, it connects the CBAM-enhanced YOLOv11 segmentation model introduced in
Section 2.4 with the hyperparameter-optimized PaddleOCR recognition module to be elaborated in this section. The pipeline begins with an input image of bookshelves, which is first processed by the improved YOLOv11 model to locate and segment all detectable book spines. Each segmented spine region is then cropped into a single image and passed sequentially through a series of optimized OCR components—including RecAug data enhancement, loss.alpha tuning, threshold parameter adjustment, input size optimization, and character set expansion—collectively improving PaddleOCR’s detection and recognition accuracy. The final output is structured textual information extracted from the book spines, ready for further application. This integrated approach effectively addresses common challenges such as dense arrangement, curved text, and special symbols in real library environments.
2.5.1. Introduction to PaddleOCR Hyperparameters
The text recognition component employs the PP-OCRv5 general scene text recognition model from the PaddleOCR v3.0 framework. This model’s hyperparameter system covers two main modules: text detection and recognition. The tuning of PaddleOCR Hyperparameters [
20,
21] directly affects its performance in the library book spine scenario.
In the text detection part (det_xxx.yml), key parameters include the following:
loss.alpha (binary image loss weight, enhancing the ability to detect curved text edges, but too high a value can cause instability during training);
loss.beta (threshold image loss weight, adjusting this helps improve the model’s adaptability to uneven lighting);
loss.ohem_ratio (hard example mining ratio, controlling the extent to which the model focuses on difficult samples);
Data augmentation strategy (rotation, cropping, and other transformations must be prioritized to simulate spine tilt and local occlusion);
Post-processing parameters (including postprocess.thresh to control binary confidence, box_thresh to constrain the average confidence of the detection box, and max_candidates to limit the maximum number of detections—in dense spine scenes, these need to be increased to avoid missed detections).
In the text recognition part (rec_xxx.yml), core parameters to focus on include:
Learning rate decay strategy (Cosine decay can smooth convergence and improve training effectiveness);
RecAug data augmentation (its built-in random perspective transformation and motion blur significantly improve robustness in recognizing curved text);
Character dictionary path (must be extended to include common special symbols found on book spines, such as ISBN separators);
Input image size (rec_image_shape) (adjusting height and width can impact the balance between detail perception and inference speed).
These hyperparameters together form the key dimensions of model-specific performance. To address the challenges present in library book spine images, such as curved text, dense arrangements, and lighting variations, systematic joint optimization must be performed to improve both detection accuracy and recognition precision.
2.5.3. Targeted Optimization Process for Key Hyperparameters in the Library Scenario
To ensure that PaddleOCR achieves optimal performance in complex library book spine scenarios, this paper adopts the control variable method, using Character Error Rate (CER) and F1 score for curved text line recognition as core evaluation metrics. The optimization process involves multiple rounds of iterative optimization of key hyperparameters, based on the baseline model pretrained on the book spine dataset, which has the following performance: CER = 8.6%, F1 = 89.7%.
The baseline model hyperparameter configuration: loss.alpha = 5; rec_image_shape = [3, 32, 320]; no use of RecAug data augmentation strategy; character dictionary = the official default dictionary (ppocr_keys_v1.txt).
The first round of optimization chooses to switch to the RecAug data augmentation strategy to enhance the model’s ability to adapt to curved deformations and complex lighting in book spines. Specifically, this involves enabling the RecAug strategy under dataset.transform in the configuration file rec_xxx.yml.
After optimization, the ability to recognize curved text significantly improved, with CER dropping from 8.6% to 5.8%, and the F1 score of the model increased by 2.4%, proving that this optimization strategy has a significant effect on recognizing curved, deformed book spines.
The second round of optimization involved adjusting the loss weight, loss.alpha. The baseline parameter was 5, and adjusting it to an appropriate value can significantly enhance the model’s focus on curved text edges, improving the accuracy of the detection boxes, and thus improving the F1 score. The results from multiple tests are shown in
Table 1:
As evidenced by the table above, in the library scenario, the model’s F1-score peaks when the loss.alpha parameter is optimally adjusted to 8. Since this parameter primarily governs the weight of the binarization map loss, it does not significantly impact the CER. These results demonstrate that this optimization strategy markedly mitigates missed detections.
In the third optimization round, adjustments were made to the postprocess.thresh and box_thresh parameters in the configuration file det_r50_db.yml. Fine-tuning these parameters to their optimal values was observed to substantially enhance the quality of the final detection boxes. The results from multiple adjustment tests are shown in
Table 2:
Test results indicate that increasing postprocess.thresh from the baseline of 0.3 to 0.4 and box_thresh from 0.6 to 0.7 effectively filters out low-confidence false detection boxes caused by paper textures and light reflections. This optimization significantly purifies the detection output, reducing the Character Error Rate (CER) by 0.5% and increasing the F1-score by 1.1%, demonstrating substantial model improvement.
The fourth optimization round involved expanding the dictionary character set to address Out-of-Vocabulary (OOV) issues in PaddleOCR when processing library spine-specific characters (such as special symbols, publisher logos, and artistic fonts). This aims to eliminate inevitable recognition errors caused by dictionary limitations. We first extensively analyzed recognition results from the baseline general model applied to library spine content, identifying the most frequent recognition error cases. After examining approximately 200 real-world library scene recognition results, we found the following characters most prone to misrecognition: (¬, ©,
®, ™, §, ¶, 【, 】, ※, /, ○, ◎, ●, etc.). These characters were added to the official PaddleOCR dictionary file ppocr_keys_v1.txt. As shown in
Figure 8, symbols such as (○, ◎) that were previously misidentified are now correctly recognized:
Next, a large online Unicode character table was referenced, and about 6000 characters from the CJK symbols and punctuation (Unicode range: U+3000–U+303F), general punctuation (Unicode range: U+2000–U+206F), letter-like symbols (Unicode range: U+2100–U+214F), and mathematical operators (Unicode range: U+2200–U+22FF) were added to the ppocr_keys_v1.txt file to expand the character dictionary. After expansion, tests on the same data showed that the average CER decreased from 5.3% to 3.6%, and the F1 score improved from 94.8% to 95.2%, indicating that this optimization had significant effectiveness.
The Fifth Round of Optimization involves adjusting the input image size (rec_image_shape). The baseline parameter is [3, 32, 320], and multiple tests with different height configurations were performed. The results are shown in
Table 3:
From the data, it is evident that since book spines are typically narrow and elongated, the performance of the model is maximized when the rec_image_shape is adjusted from [3, 32, 320] to [3, 48, 320]. In this case, the F1 score increased from 95.2% to 95.7%, and the CER decreased by 0.4%.
The detailed comparison between baseline and optimized hyperparameter values is summarized in
Table 4 Through iterative experimentation, we found that increasing loss.alpha to 0.8 better balanced the detection and recognition tasks in our book spine scenario. Similarly, adjusting box_thresh to 0.7 effectively reduced false positives while maintaining recall. The modification of rec_image_shape from [3, 48, 320] to [3, 48, 320] better accommodated the aspect ratio characteristics of book spine text.
After the five rounds of targeted optimization, the performance of the PaddleOCR model in the book spine recognition task significantly improved, with the character error rate reduced by 5.4% and the F1 score increased by 6%. This provides an effective technical solution for constructing an efficient and accurate library automation management system.