To improve the positioning accuracy of range-independent positioning algorithms in wireless sensor networks, a DV-Hop localization algorithm (DDCO) based on deep learning and improved crayfish optimization was proposed. Firstly, the dual communication radius subdivision of the minimum number of hops is introduced to reduce the error due to the number of hops; then the trained deep neural network model is used to correct the estimated distance to reduce the distance estimation error; finally, the random center of gravity inverse learning and the improved crayfish algorithm with nonlinear function are introduced to calculate the coordinates of the unknown nodes, and the global optimization capability of the intelligent algorithm is used to reduce the error generated by the DNN. The simulation results show that the positioning error of the DDCO algorithm is reduced by 54.4%, 23.4%, and 10.5%, respectively, compared with DV-Hop and other comparison algorithms under different communication radii. Under different beacon node densities, the error decreases by 46.2%, 24.2%, and 10.6%, respectively. Under different node densities, the error decreases by 49.6%, 30.3%, and 17.3%, respectively.