PlantCV's binary threshold (https://plantcv.readthedocs.io/en/stable/binary_threshold/) would be able to segment the handwriting. Then, you could use autocrop (https://plantcv.readthedocs.io/en/stable/auto_crop/) to grab each line of text individually for training.
An example:
enter image description here
img, path, filename = pcv.readimage("./lQkrHG19.png")
threshold_light = pcv.threshold.binary(gray_img=img, threshold=220, object_type='dark')