Thank you for the reply! Since posting this I have seen that train_one_epoch() function, and actually, multiple slightly different versions of it that people had implemented. It was hard to figure out which one to go by.
In any event my code now essentially just does what that one does, and it’s good to know others had done similar (and that I’m not doing something wrong). I had also discovered since posting this that my training results were suffering thanks to my annotations being slightly incorrect for the training images I was using.