This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Serving TensorBoard on localhost; to expose to the network, use a proxy or pass --bind_all | |
| TensorBoard 2.10.1 at http://localhost:6006/ (Press CTRL+C to quit) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Tensorboard --logdir Models\08_handwriting_recognition_torch\202303142139\logs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # create callbacks | |
| earlyStopping = EarlyStopping(monitor='val_CER', patience=20, mode="min", verbose=1) | |
| modelCheckpoint = ModelCheckpoint(configs.model_path + '/model.pt', monitor='val_CER', mode="min", save_best_only=True, verbose=1) | |
| tb_callback = TensorBoard(configs.model_path + '/logs') | |
| reduce_lr = ReduceLROnPlateau(monitor='val_CER', factor=0.9, patience=10, verbose=1, mode='min', min_lr=1e-6) | |
| model2onnx = Model2onnx( | |
| saved_model_path=configs.model_path + '/model.pt', | |
| input_shape=(1, configs.height, configs.width, 3), | |
| verbose=1, | |
| metadata={"vocab": configs.vocab} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # put on cuda device if available | |
| if torch.cuda.is_available(): | |
| network = network.cuda() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # uncomment to print network summary, torchsummaryX package is required | |
| summary(network, torch.zeros((1, configs.height, configs.width, 3))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| loss = CTCLoss(blank=len(configs.vocab)) | |
| optimizer = optim.Adam(network.parameters(), lr=configs.learning_rate) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| network = Network(len(configs.vocab), activation='leaky_relu', dropout=0.3) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Augment training data with random brightness, rotation and erode/dilate | |
| train_dataProvider.augmentors = [ | |
| RandomBrightness(), | |
| RandomErodeDilate(), | |
| RandomSharpen(), | |
| RandomRotate(angle=10), | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Split the dataset into training and validation sets | |
| train_dataProvider, test_dataProvider = data_provider.split(split = 0.9) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for _ in data_provider: | |
| pass |