コード例 #1
0
ファイル: sel_op.py プロジェクト: saffsd/imgevolve
"""
by Marco Lui
This experiment varies the selection operator, rendering each image for 
5000 generations using each operator.
"""
from imgevolve import main, default, cleanup
import os

if __name__ == "__main__":
  gens = 5000
  for file in ['ml.bmp', 'lena.jpg', 'starry.jpg']:
    for op in ['roulette', 'tournament', 'rank']:
      basename = os.path.splitext(file)[0]
      dirname = 'render_test/%s_%s_%d'%(basename,op,gens)
      cleanup(dirname)
      options=default._replace( gens=gens
                              , output_freq=100
                              , output_dir=dirname
                              , sel_op=op
                              )
      main(options, file, dirname+'.svg')

コード例 #2
0
ファイル: fivek_gens.py プロジェクト: saffsd/imgevolve
"""
by Marco Lui
This experiment renders each target image specified using each of the 4 
fitness functions, for 5000 generations. It assumes that the target images
are in the same folder as the program.
"""
from imgevolve import main, default, cleanup
import os

if __name__ == "__main__":
  gens = 5000
  for file in ['ml.bmp', 'lena.jpg', 'starry.jpg']:
    for alg in ['rms', 'percept', 'square', 'abs']:
      basename = os.path.splitext(file)[0]
      dirname = 'render_test/%s_%s_%d'%(basename,alg,gens)
      cleanup(dirname)
      options=default._replace( gens=gens
                              , output_freq=100
                              , output_dir=dirname
                              , eval_func = alg
                              )
      main(options, file, dirname+'.svg')