In this paper, we consider a backward problem for a time-fractional diffusion equation with variable coefficients in a general bounded domain. That is to determine the initial data from a noisy final data. Based on a series expression of the solution, a conditional stability for the initial data is given. Further, we propose a modified quasi-boundary value regularization method to deal with the backward problem and obtain two kinds of convergence rates by using an a priori regularization parameter choice rule and an a posteriori regularization parameter choice rule. Numerical examples in one-dimensional and two-dimensional cases are provided to show the effectiveness of the proposed methods.