The median grain size of rock is the main basis for the identification of sedimentary facies, and the variation of the median grain size of rock can be used to obtain the stratum sedimentary rhythm and thus to classify the flow unit. Therefore, the median grain size of rock is an extremely important parameter for reservoir evaluation. However, there is no petrophysical method that can directly evaluate the median grain size of rock in the logging data. The predecessors used natural gamma logging data to calculate the median rock grain size (Md) based on linear and statistical analysis for medium-high porosity and permeability sandstone reservoirs work. However, for low-permeability sandstone reservoirs, the error in the fitted median grain size of rock using linear multiple regression methods is too large for the calculated results to be applied. Therefore, the calculation of the median grain size of low-permeability sandstone reservoirs is a difficult problem to be solved. In this paper, the sensitivity logging parameters of median rock grain size are optimized for low permeability sandstone reservoirs using principal component analysis obtained the grain size direction correlation curves (DEN, CNL,GR, and RD) in the study area, and the corresponding loss and activation functions are selected based on the learning characteristics of the nonlinear mapping of the logging data and the BP neural network to ensure that overfitting occurs. The best model was obtained by using decision tree, support vector machine, shallow and deep neural networks to model the median rock grain size and predict neighboring wells, and a comparative analysis showed that for the problem of predicting the median rock grain size in low-permeability sandstone reservoirs, the deep neural network improved significantly over the shallow one and was much stronger than other machine learning methods. The best model obtained a coefficient of determination (
R
2
) of 0.9831. Machine learning of median grain size from conventional logging data was systematically carried out through conventional logging sensitivity curve optimization, algorithm modeling, network parameter optimization, median grain size prediction, and validation, and the relative error in its quantitative prediction met application requirements. This method takes into account the nonlinear mapping relationship between the logging data and the fitting of small sample data and provides a systematic way of thinking for the logging curve to predict the grain size of low-permeability sandstone.