I resample the test set in the same way as training, I change the imbal_class_counts to imbal_class_counts = [100, 1000] * 5. The test accuracy was 25% after 30 epochs and the training loss was close to zero.