https://www.youtube.com/watch?v=SfiqdooNBb8
Cheap diffraction grating and a cheap camera; basically, the idea would be to somehow use an IR sensitive camera (most are - at least in the far-mid range), an IR source (maybe an unfocused IR laser diode?), and a diffraction grating.
Ideally for the grating you'd use one for IR - but I haven't found one that wasn't reflective-based (instead of transmissive) - there's probably a good reason (likely having to do with cheap materials and IR absorption - which is why lenses and mirrors for laser cutters tend to be pretty pricey).
Anyhow - thems the basics. Take that, get an image from the camera, run a fourier transform on the data, get the peaks, then pass it thru a trained CNN (?) - heck, you might be able to forgo the transform part and just use the data from the camera directly (repurpose imagenet or something).
Yeah - I think this whole thing could be made an open-source project; probably even an instructable...? At the very least, it could become an interesting science fair project for some enterprising kid...