Speak to your son's doctor and get a referral to a therapist.
He needs to be informed that upskirting and taking nude pictures is a serious crime, for which he could go to adult jail.
Get your niece other housing, pronto. You are responsible for her safety, and at present, she is not safe. You could also already be charged with child endangerment by allowing this to happen. Destroy the photos, take his phone away, and get him therapy- but get her alternative housing, today.