A method , comprising: irradiating a first sample with a charged particle beam; detecting a first type emission from the first sample and forming one or more first spectra from the detected first type emission; identifying one or more first chemical elements within the first sample by processing the first spectra with a trained neural network, characterized by further comprising: detecting a second type emission from the first sample and displaying a sample image generated based on the detected second type emission; selecting one or more pixels in the sample image; displaying one or more of the first chemical elements corresponding to the selected pixels; responsive to the displayed chemical elements different from a known elemental composition of the first sample, retraining the trained neural network with spectra corresponding to the selected pixels and the known elemental composition; irradiating one or more locations of a second sample with the charged particle beam; acquiring one or more second spectra by detecting the first type emission from the second sample; and identifying one or more second chemical elements within the second sample by processing the second spectra with the retrained neural network. irradiating a first sample with a charged particle beam; detecting a first type emission from the first sample and forming one or more first spectra from the detected first type emission; identifying one or more first chemical elements within the first sample by processing the first spectra with a trained neural network, characterized by further comprising: detecting a second type emission from the first sample and displaying a sample image generated based on the detected second type emission; selecting one or more pixels in the sample image; displaying one or more of the first chemical elements corresponding to the selected pixels; responsive to the displayed chemical elements different from a known elemental composition of the first sample, retraining the trained neural network with spectra corresponding to the selected pixels and the known elemental composition; irradiating one or more locations of a second sample with the charged particle beam; acquiring one or more second spectra by detecting the first type emission from the second sample; and identifying one or more second chemical elements within the second sample by processing the second spectra with the retrained neural network. detecting a second type emission from the first sample and displaying a sample image generated based on the detected second type emission; selecting one or more pixels in the sample image; displaying one or more of the first chemical elements corresponding to the selected pixels; responsive to the displayed chemical elements different from a known elemental composition of the first sample, retraining the trained neural network with spectra corresponding to the selected pixels and the known elemental composition; irradiating one or more locations of a second sample with the charged particle beam; acquiring one or more second spectra by detecting the first type emission from the second sample; and identifying one or more second chemical elements within the second sample by processing the second spectra with the retrained neural network. <EOS>