Spectral computed tomography (CT) material decomposition algorithms require accurate physics-based models or empirically derived models. This study investigates a machine learning algorithm and transfer learning techniques for Spectral CTimaging of K-edge contrast agents using simulated and experimental measurements. A feed forward multilayer perceptron was implemented and trained on data acquired using a step wedge phantom containing acrylic, aluminum, and gadolinium materials. The neural network estimator was evaluated by scanning a rod phantom with varying dilutions of gadolinium oxide nanoparticles and by scanning a rat leg specimen with injected nanoparticles on a bench-top photon-counting computed tomography system. The algorithm decomposed each spectral projection measurement into path lengths of acrylic and aluminum and mass lengths of gadolinium. Each basis material sinogram was reconstructed into basis material images using filtered backprojection. Machine learning techniques of data standardization, transfer learning from aggregated pixel data, and transfer learning from simulations were investigated to improve image quality. The algorithm was compared to a previously published empirical method based on a linear approximation and calibration error look-up tables. The combined transfer learning techniques did not improve quantification in the rod phantom and provided only a small qualitative improvement in ring artifacts. Transfer learning from aggregated pixel data and from simulations improved the qualitative image quality of the rat specimen, for which the calibration data were limited. Transfer learning from aggregated pixel data andsimulations estimated 3.26, 6.26, and 12.45mg/mL Gd concentrations compared to true 2.72, 5.44, and 10.88mg/mL concentrations in the rod phantom. Additionally, the neural networks were able to separate the soft tissue, bone, and gadolinium nanoparticles of the ex vivo rat leg specimen into the different basis images. The results demonstrate that empirical K-edge imaging from calibration measurements using machine learning and transfer learning is possible without explicit models of material attenuations, incident spectra, or the detector response.