There are two methods. There are different algorithms for pitch detection in the MIR module, but you need to research and adjust this based on your own business situation;
Another method can use spectral features to classify guitar pitch data. Generally speaking, CNN may have a better effect, but you can also try other networks such as LSTM.