A model-based library (MBL) method has already been established for the accurate measurement of the critical dimension (CD) of semiconductor linewidth using critical dimension scanning electron microscope (CD-SEM) images. In this work, the MBL method is further investigated by combining CD-SEM image simulation and a neural network algorithm. The secondary electron linescan profiles were first calculated using a Monte Carlo simulation method, enabling us to obtain the dependence of linescan profiles on the selected values of various geometrical parameters (e.g. top CD, sidewall angle and height) for Si and Au trapezoidal line structures. Machine learning methods have then been applied to predict the linescan profiles from a randomly selected training set of the calculated profiles. The predicted results agree very well with the calculated profiles with the standard deviations of 0.1% and 6% for the relative error distributions of Si and Au line structures, respectively. The findings show that the machine learning methods can be practically applied to the MBL method for reducing the library size, accelerating the construction of the MBL database and enriching the content of the available MBL database.