  We introduce a family of dimensions, which we call the $\Phi$-intermediate
dimensions, that lie between the Hausdorff and box dimensions and generalise
the intermediate dimensions introduced by Falconer, Fraser and Kempton. This is
done by restricting the relative sizes of the covering sets in a way that
allows for greater refinement than in the definition of the intermediate
dimensions. We also extend the theory from Euclidean space to a wider class of
metric spaces. We prove that these dimensions can be used to 'recover the
interpolation' between the Hausdorff and box dimensions of compact subsets for
which the intermediate dimensions are discontinuous at $\theta=0$, thus
providing finer geometric information about such sets. We prove continuity-like
results involving the Assouad and lower dimensions, which give a sharp general
lower bound for the intermediate dimensions that is positive for all $\theta
\in (0,1]$ for sets with positive box dimension. We also prove H\"older
distortion estimates, a mass distribution principle, and a Frostman type lemma,
which we use to study dimensions of product sets.
