An improved cosmological parameter inference scheme motivated by deep learning