LoGS: Visual Localization via Gaussian Splatting with Fewer Training Images