Added: 2 years ago
From: hmortensen2907
Views: 4,302
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (11)

Sign In or Sign Up now to post a comment!
  • Ten days of CPU time? Let me just say, you don't know what you are doing. 4000 triangles? Too many. ( You might as well break the image into a 63x63 grid.) Also, RGB distance is a bad fitness metric.

    Your population size should be 8 to 10 thousand candidates. You should only process for approx 100 to 200 generations. (Remember - the power of GAs lies in crossover.)

    I am working on an image regression GA now. I will show you how it is done.

  • @otonanoC Yes, 4000 triangles, I wanted to keep the size of the triangles down (resolution), but wanted to have enough to cover the whole image.

    For the RGB distance, it was one of my first GA's and I just wanted to have a fitness function I knew would work.. What would you use?

    You have had success with huge population sizes? In all litterature I have read they all recomend 15-50.. But I see your point.

    Thanks for your feedback.

  • @TheQuantumNoise I did it all from scratch in C++ (anythin new I do in C#, it's a lot simpler). I can make the code available from my homepage the-blue-pixel. I don't know why I never uploaded it? I know there still are some bugs tho' but other projects have pushed it aside ;) Often my projects only gets to a proof of concept stage and nothing more :/

    The more we share the more we can achive.!!!!

  • Um, whats the fitness function exactly? Do you compare every pixel and grade fitness on closness, or what? And what is the time it takes to simulate a single generation.

  • a single generation took about one or two minute if I remember correct.

    The fitnessfunction was calculated as the distance between the generated picture and the target. So yes, I did compaire every pixel and graded the closeness.

    Fittness = sum(sqrt(dr^2+dg^2+db^2))

    So nothing special.

  • could you tell me more about de GA like: population size, crossover probability, mutation rate, what kind of selection and crossover you used and the fitness function. and how you represent the cromosom.e thank you : ) nice work

    PD. sorry for my english XP

  • Thanks for the nice comment lugomar,

    I have looked at my code and can see that all the parameters were set via parameters to the program, so I do not have the exact settings. :( sorry. But I typical use a setting of:

    Population size is 25.

    Mutate around 1-3%

    Crossover 85-95%

    Substitution rate 1%

    Selection is done using Gaussian random numbers.

  • The genes are represented by a simple struct: struct Agene { double cost; int nrTris; tri* tris;// pointer til et array af tri structs }; struct tri { floatTriSize;//Factor from normalized triangle floatxPos; floatyPos; longcolIndex;// palIndex has to be within the pallette size };
  • The cross over function was simply done by swapping triangles in the tris list in the struct.

    I did find an error looking trough the code, I found that the triangles were not able to rotate trough evolution, so all triangles have the same orientation as when created. This is probably why the animation looks a bit like strange and not as dynamic as you would expect.

  • Additional info:

    The program was changed to work on multiple cores/CPUs, but it has only been tested on a 4 core machine, but should handle up to 2000 processors. :) Each core is given a gene to evaluate, and when done given a new until there are no more genes in the generation. So if there are more cores than genes in a population then they are not used.

    Hope this was the information you wanted. - hmortensen2907

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more