Total Variation Regularization for Compartmental Epidemic Models with Time-varying Dynamics