Methods and systems for training a neural network are provided. One system includes one or more components executed by one or more computer subsystems. The one or more components include a neural network configured for determining inverted features of input images in a training set for a specimen input to the neural network, a forward physical model configured for reconstructing the input images from the inverted features thereby generating a set of output images corresponding to the input images in the training set, and a residue layer configured for determining differences between the input images in the training set and their corresponding output images in the set. The one or more computer subsystems are configured for altering one or more parameters of the neural network based on the determined differences thereby training the neural network.
Please help me write a proper abstract based on the patent claims. CLAIM: 1. A system configured to train a neural network, comprising: one or more computer subsystems; and one or more components executed by the one or more computer subsystems, wherein the one or more components comprise: a neural network configured for determining inverted features of input images in a training set for a specimen input to the neural network; a forward physical model configured for reconstructing the input images from the inverted features thereby generating a set of output images corresponding to the input images in the training set; and a residue layer configured for determining differences between the input images in the training set and their corresponding output images in the set; wherein the one or more computer subsystems are configured for altering one or more parameters of the neural network based on the determined differences thereby training the neural network. 2. The system of claim 1, wherein the neural network is configured as a convolutional neural network. 3. The system of claim 1, wherein the neural network is configured as a fully convolutional model. 4. The system of claim 1, wherein the neural network is configured as a deep generative model. 5. The system of claim 1, wherein the neural network is configured as a generative adversarial net. 6. The system of claim 1, wherein the neural network is configured as a conditional generative adversarial net. 7. The system of claim 1, wherein the neural network is configured as a generative adversarial network and variational autoencoder. 8. The system of claim 1, wherein a part of the neural network is configured as a convolutional neural network. 9. The system of claim 1, wherein the forward physical model is configured as a differentiable forward physical model. 10. The system of claim 1, wherein the forward physical model is implemented or approximated as an additional neural network. 11. The system of claim 1, wherein the forward physical model comprises model parameters corresponding to imaging parameters used for generating the input images for the specimen. 12. The system of claim 1, wherein the forward physical model comprises model parameters corresponding to physical parameters involved in generating the input images for the specimen. 13. The system of claim 1, wherein the forward physical model comprises at least one adjustable model parameter. 14. The system of claim 1, wherein the forward physical model comprises at least one fixed model parameter. 15. The system of claim 1, wherein the one or more computer subsystems are further configured to input a runtime image for the specimen or another specimen into the trained neural network such that the trained neural network determines the inverted features for the runtime image, and wherein the inverted features are features of an optically corrected version of the runtime image. 16. The system of claim 1, wherein the one or more computer subsystems are further configured to input a runtime image for the specimen or another specimen into the trained neural network such that the trained neural network determines the inverted features for the runtime image, and wherein the inverted features are features of an amplitude and phase version of the runtime image. 17. The system of claim 1, wherein the one or more computer subsystems are further configured to input a runtime image for the specimen or another specimen into the trained neural network such that: the trained neural network determines the inverted features for the runtime image; the forward physical model reconstructs the runtime image from the inverted features determined for the runtime image; and the residue layer determines differences between the runtime image and the reconstructed runtime image, wherein the inverted features are features of an optically corrected version of the runtime image, and wherein the differences between the runtime image and the reconstructed runtime image are features of a residue image. 18. The system of claim 1, wherein the input images are generated by an electron beam based imaging system. 19. The system of claim 1, wherein the input images are generated by an optical based imaging system. 20. The system of claim 1, wherein the input images are generated by an inspection system. 21. The system of claim 1, wherein the input images are generated by a metrology system. 22. The system of claim 1, wherein the specimen is a wafer. 23. The system of claim 1, wherein the specimen is a reticle. 24. The system of claim 1, wherein the one or more computer subsystems are further configured to input a runtime image for the specimen or another specimen into the trained neural network such that the trained neural network determines the inverted features for the runtime image, wherein the inverted features are features of an optically corrected version of the runtime image, and wherein the one or more computer subsystems are further configured for detecting a defect on the specimen or the other specimen based on the optically corrected version of the runtime image. 25. The system of claim 1, wherein the one or more computer subsystems are further configured to input a runtime image for the specimen or another specimen into the trained neural network such that the trained neural network determines the inverted features for the runtime image, wherein the inverted features are features of an optically corrected version of the runtime image, wherein the one or more computer subsystems are further configured for classifying a defect detected in the runtime image or the optically corrected version of the runtime image, and wherein said classifying is performed based on the optically corrected version of the runtime image. 26. The system of claim 1, wherein the one or more computer subsystems are further configured to input a runtime image for the specimen or another specimen into the trained neural network such that the trained neural network determines the inverted features for the runtime image, wherein the inverted features are features of an optically corrected version of the runtime image, and wherein the one or more computer subsystems are further configured for measuring one or more features of the specimen or the other specimen or a defect detected on the specimen or the other specimen based on the optically corrected version of the runtime image. 27. The system of claim 1, wherein the one or more computer subsystems are further configured to input a stack of runtime images for the specimen or another specimen into the trained neural network such that the trained neural network determines the inverted features for the stack of runtime images, wherein the inverted features are phase information for the stack of runtime images, and wherein the one or more computer subsystems are further configured for increasing selectivity for defects on the specimen or the other specimen based on the phase information. 28. The system of claim 1, wherein the one or more computer subsystems are further configured for determining one or more adjustments for one or more parameters used for generating the input images based on results of the training. 29. A system configured to train a neural network, comprising: an imaging subsystem configured for generating images of a specimen; one or more computer subsystems configured for acquiring the images and generating a training set of input images from the acquired images; and one or more components executed by the one or more computer subsystems, wherein the one or more components comprise: a neural network configured for determining inverted features of the input images in the training set for the specimen input to the neural network; a forward physical model configured for reconstructing the input images from the inverted features thereby generating a set of output images corresponding to the input images in the training set; and a residue layer configured for determining differences between the input images in the training set and their corresponding output images in the set; wherein the one or more computer subsystems are configured for altering one or more parameters of the neural network based on the determined differences thereby training the neural network. 30. A non-transitory computer-readable medium, storing program instructions executable on one or more computer systems for performing a computer-implemented method for training a neural network, wherein the computer-implemented method comprises: determining inverted features of input images in a training set for a specimen by inputting the training set of input images to a neural network; reconstructing the input images from the inverted features by inputting the inverted features into a forward physical model thereby generating a set of output images corresponding to the input images in the training set; determining differences between the input images in the training set and their corresponding output images in the set; and altering one or more parameters of the neural network based on the determined differences thereby training the neural network, wherein said determining the inverted features, reconstructing the input images, determining the differences, and altering the one or more parameters are performed by one or more computer systems, wherein one or more components are executed by the one or more computer systems, and wherein the one or more components comprise the neural network and the forward physical model. 31. A computer-implemented method for training a neural network, comprising: determining inverted features of input images in a training set for a specimen by inputting the training set of input images to a neural network; reconstructing the input images from the inverted features by inputting the inverted features into a forward physical model thereby generating a set of output images corresponding to the input images in the training set; determining differences between the input images in the training set and their corresponding output images in the set; and altering one or more parameters of the neural network based on the determined differences thereby training the neural network, wherein said determining the inverted features, reconstructing the input images, determining the differences, and altering the one or more parameters are performed by one or more computer systems, wherein one or more components are executed by the one or more computer systems, and wherein the one or more components comprise the neural network and the forward physical model.