def __del__( self ): # Save best population. self.experiment.saveBest() # Cleanup HyperNEAT. neat.cleanup() # Exit evolve thread. try: self.evolve_thread.terminate() self.evolve_thread.wait( 5000 ) except NameError: print "Evolve thread not created yet, thus not destroyed."
import gui.PopulationModel print "-------------------------------------------------------------------" print "DISTORTING IMAGE" # Load the file and generate the network. print "-------------------------------------------------------------------" print "Loading network..." neat.initialize() population = neat.load(argv[1]) individual = population.getIndividual(0, population.getGenerationCount() - 1) network = individual.spawnFastPhenotypeStack() # Open the input image. print "-------------------------------------------------------------------" print "Distorting image..." distortion = gui.PopulationModel.PopulationItem() application = QApplication(argv) image_map = QPixmap(argv[2]) distorted_image_map = distortion.distort(image_map, network) distorted_image = QImage(distorted_image_map) distorted_image.save(argv[3]) # Cleanup. print "-------------------------------------------------------------------" print "Done, cleaning up." print "-------------------------------------------------------------------" neat.cleanup()
import gui.PopulationModel print "-------------------------------------------------------------------" print "DISTORTING IMAGE" # Load the file and generate the network. print "-------------------------------------------------------------------" print "Loading network..." neat.initialize() population = neat.load( argv[1] ) individual = population.getIndividual( 0, population.getGenerationCount() - 1 ) network = individual.spawnFastPhenotypeStack() # Open the input image. print "-------------------------------------------------------------------" print "Distorting image..." distortion = gui.PopulationModel.PopulationItem() application = QApplication( argv ) image_map = QPixmap( argv[2] ) distorted_image_map = distortion.distort( image_map, network ) distorted_image = QImage( distorted_image_map ) distorted_image.save( argv[3] ) # Cleanup. print "-------------------------------------------------------------------" print "Done, cleaning up." print "-------------------------------------------------------------------" neat.cleanup()