This paper proposes a near-field shape neural network (NSNN) to determine the shape of a sound-soft cavity based on a single source and several measurements placed on a curve inside the cavity. The NSNN employs the near-field measurements as input, and the output is the shape parameters of the cavity. The self-attention mechanism is employed to obtain the feature information of the near-field data, as well as the correlations among them. The weights and biases of the NSNN are updated through the gradient descent algorithm, which minimizes the error of the reconstructed shape of the cavity. We prove that the loss function sequence related to the weights is a monotonically bounded non-negative sequence, which indicates the convergence of the NSNN. Numerical experiments show that the shape of the cavity can be effectively reconstructed with the NSNN.