Surface-wave inversion is a non-linear and ill-conditioned problem usually solved through deterministic or global optimization approaches. Here, we present an alternative method based on machine learning. Under the assumption of a local onedimensional model, we train a residual neural network to predict the non-linear mapping between the full dispersion image and the model space, parameterized in terms of shear wave velocity and layer thicknesses. On the one hand, compared to standard convolutional neural networks, the residual network prevents the vanishing gradient problem when training a deep network. On the other hand, the use of the full dispersion image avoids the time-consuming and often ambiguous picking procedure and allows considering higher modes in the inversion framework. One key aspect of any machine learning inversion strategy is the definition of an appropriate training set. In this case, the models forming the training and validation examples are uniformly drawn from previously defined ranges that cover a wide range of possible near-surface layered Vs models. The reflectivity method constitutes the forward modelling operator that converts the model parameters into the observed shot gathers. The inversion also includes a Monte Carlo simulation strategy that propagates onto the model space the uncertainties related to noise in the data and the modelling error introduced by the network approximation. We first discuss synthetic inversions to assess the applicability of the proposed method and to analyse the effect of erroneous model parameterizations. The inversion results are also benchmarked with those provided by a more standard approach in which the particle swarm optimization algorithm inverts the fundamental mode only. Then, we discuss a field data application. Our tests confirm that the residual neural network inversion provides accurate model estimations and reliable uncertainty appraisals. One of the main benefits of the proposed approach is that once the network is trained it provides the near-surface shear wave velocity profile in near real-time.