The model-based library (MBL) method has already been established for the accurate measurement of critical dimension (CD) of semiconductor linewidth from a critical dimension scanning electron microscope (CD-SEM) image. In this work the MBL method has been further investigated by combing the CD-SEM image simulation with a neural network algorithm. The secondary electron linescan profiles were calculated at first by a Monte Carlo simulation method, enabling 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. The machine learning methods have then been applied to predicate 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 deviation of 0.1% and 6% for the relative error distributions of Si and Au line structures, respectively. This result shows that the machine learning methods can be practically applied to the MBL method for the purpose of reducing the library size, accelerating the construction of the MBL database and enriching the content of an available MBL database.