Improving distance measurements in large imaging surveys is a major challenge to better reveal the distribution of galaxies on a large scale and to link galaxy properties with their environments . As recently shown , photometric redshifts can be efficiently combined with the cosmic web extracted from overlapping spectroscopic surveys to improve their accuracy . In this paper we apply a similar method using a new generation of photometric redshifts based on a convolution neural network ( CNN ) . The CNN is trained on the SDSS images with the main galaxy sample ( SDSS-MGS , r \leq 17.8 ) and the GAMA spectroscopic redshifts up to r \sim 19.8 . The mapping of the cosmic web is obtained with 680,000 spectroscopic redshifts from the MGS and BOSS surveys . The redshift probability distribution functions ( PDF ) , which are well calibrated ( unbiased and narrow , \leq 120 Mpc ) , intercept a few cosmic web structures along the line of sight . Combining these PDFs with the density field distribution provides new photometric redshifts , z _ { web } , whose accuracy is improved by a factor of two ( i.e. , \sigma \sim 0.004 ( 1 + z ) ) for galaxies with r \leq 17.8 . For half of them , the distance accuracy is better than 10 cMpc . The narrower the original PDF , the larger the boost in accuracy . No gain is observed for original PDFs wider than 0.03 . The final z _ { web } PDFs also appear well calibrated . The method performs slightly better for passive galaxies than star-forming ones , and for galaxies in massive groups since these populations better trace the underlying large-scale structure . Reducing the spectroscopic sampling by a factor of 8 still improves the photometric redshift accuracy by 25 % . Finally , extending the method to galaxies fainter than the MGS limit still improves the redshift estimates for 70 % of the galaxies , with a gain in accuracy of 20 % at low z where the resolution of the cosmic web is the highest . As two competing factors contribute to the performance of the method , the photometric redshift accuracy and the resolution of the cosmic web , the benefit of combining cosmological imaging surveys with spectroscopic surveys at higher redshift remains to be evaluated .