-
This script is responsible for generating masks for testing images. It uses contour extraction algorithms and OCR to create high-quality text masks based on input images. The generated masks can then be used for subsequent model evaluation or defect analysis on documents.
-
Important: Before running the script, ensure that the file paths, especially for the image that requires mask generation, are correct.
- This script is intended for the model training process. It includes setting learning parameters, loading data, optimization, and calculating metrics such as loss and accuracy. The output consists of trained model weights that can be used for further inference on new data.
Important: Make sure that the paths to the dataset files (e.g., DATASET_DIR) are correctly specified to avoid errors during loading.
-
This script implements the main functionality of the program. At the end of the file, there are commented-out functions responsible for prediction and visualization of the model's results. These functions can be activated as needed to display predicted masks and analyze their correspondence to true data, allowing for a visual assessment of the model's performance.
-
Important: Before running the script, also check the path to the model: model.load_state_dict(torch.load(...)) to ensure that the model is loaded from the correct location.