Accurately estimating the state of charge (SOC) of lithium-ion batteries by the battery management system (BMS) is crucial for safe electric vehicle (EV) operations. This paper proposes a SOC estimation method for lithium-ion batteries based on a deep feed-forward neural network (DFFNN) optimized with a relevant attention mechanism and stochastic weight (RAS) algorithms. The relevant attention mechanism extracts useful features from the input data. Then, the stochastic weight algorithm randomly updates the weights and biases, rather than keeping them constant, for the DFFNN to estimate the SOC using full-scale input data and solve the gradient problem. To estimate the SOC by adaptively correcting each state's probability and error covariance quantities while maintaining robustness against spontaneous error noise and spikes, a shifting-step unscented Kalman filter (SUKF) based on a Bayesian transformation is proposed. With its transfer learning mechanism, the RAS optimization solves the gradient problems and enhances the DFFNN's generalizability to various working conditions, providing more accurate estimates at a lower training cost. Furthermore, based on the findings and comparisons, the results of the proposed RAS-DFFNN-SUKF model show that it has the overall best mean absolute error, root mean square error, and mean absolute percentage error values of 0.03854%, 0.05238%, and 0.18853%, respectively, which shows that it is reliable and adaptable enough for practical BMS applications in EVs by ensuring fast and accurate SOC estimation.