Replies: 17 comments 39 replies
-
Amazing. I've been also trying to apply more advanced genetic algorithms. I'm looking forward to seeing more updates from your side. |
Beta Was this translation helpful? Give feedback.
-
So, in the new version, I used the geneticalgorithm2 library.
Just know some points about the above:
You can change it for your approach in many ways you want. Know I declared my objective function which was my goal to optimize it:
My hyper parameters file was different from yolo default file and I opened it in this part as hyp. You can load yolo hyp.yaml to run GA for them. I will continue this idea for creating better GA in this discussion. |
Beta Was this translation helpful? Give feedback.
-
Same .. I have not modified anything
…On Fri, 12 May, 2023, 6:11 pm Shayan Mousavinia, ***@***.***> wrote:
Greeting @PraveenMNaik <https://github.com/PraveenMNaik>
Would you please share your GA configs?
—
Reply to this email directly, view it on GitHub
<#11124 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ASCK3BSN6G6XBMF4RN3MT6TXFYVY7ANCNFSM6AAAAAAVS52E5Y>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Thank you sir for your response I will definitely give a try...ping back to
you Sir, if any doubts
…On Fri, 12 May, 2023, 6:59 pm Shayan Mousavinia, ***@***.***> wrote:
Another fact that you need to consider it, is which hyper parameters you
want to tune.
As you know, a huge amount of our population are created with random
values and it will be hard to imagine we can have a set from random values
which all of them have appropriate amount for out training results.
Due to this attitude, I suggest you to split hyper parameters into some
group and in every evolution procedure, just tune that specific group.
Let's check below sample.
meta = {
'lr0': (False, 1e-5, 1e-1), # initial learning rate (SGD=1E-2, Adam=1E-3)
'lrf': (False, 0.01, 1.0), # final OneCycleLR learning rate (lr0 * lrf)
'momentum': (False, 0.6, 0.98), # SGD momentum/Adam beta1
'weight_decay': (False, 0.0, 0.001), # optimizer weight decay
'warmup_epochs': (False, 0.0, 5.0), # warmup epochs (fractions ok)
'warmup_momentum': (False, 0.0, 0.95), # warmup initial momentum
'warmup_bias_lr': (False, 0.0, 0.2), # warmup initial bias lr
'box': (False, 0.02, 0.2), # box loss gain
'cls': (False, 0.2, 4.0), # cls loss gain
'cls_pw': (False, 0.5, 2.0), # cls BCELoss positive_weight
'obj': (False, 0.2, 4.0), # obj loss gain (scale with pixels)
'obj_pw': (False, 0.5, 2.0), # obj BCELoss positive_weight
'iou_t': (False, 0.1, 0.7), # IoU training threshold
'anchor_t': (False, 2.0, 8.0), # anchor-multiple threshold
'anchors': (False, 2.0, 10.0), # anchors per output grid (0 to ignore)
'fl_gamma': (False, 0.0, 2.0), # focal loss gamma (efficientDet default gamma=1.5)
'hsv_h': (True, 0.0, 0.1), # image HSV-Hue augmentation (fraction)
'hsv_s': (True, 0.0, 0.9), # image HSV-Saturation augmentation (fraction)
'hsv_v': (True, 0.0, 0.9), # image HSV-Value augmentation (fraction)
'degrees': (True, 0.0, 45.0), # image rotation (+/- deg)
'translate': (True, 0.0, 0.9), # image translation (+/- fraction)
'scale': (True, 0.0, 0.9), # image scale (+/- gain)
'shear': (True, 0.0, 10.0), # image shear (+/- deg)
'perspective': (True, 0.0, 0.001), # image perspective (+/- fraction), range 0-0.001
'flipud': (True, 0.0, 1.0), # image flip up-down (probability)
'fliplr': (True, 0.0, 1.0), # image flip left-right (probability)
'mosaic': (True, 0.0, 1.0), # image mixup (probability)
'mixup': (True, 0.0, 1.0), # image mixup (probability)
'copy_paste': (True, 0.0, 1.0)} # segment copy-paste (probability)
In this part we just plan to run our evolution code just on augmentations'
hyper parameters(from hsv_h to copy_paste).
After reaching appropriate values for this parameters, we will set their
flag to 'False' and set other hyper parameters flag like lr0, lrf and etc
to 'True'
Just remember that, every hyper parameters which their flag is 'False'
will be have static value and we will read their value form hyp.yaml
file(likes hyp.scratch-low.yaml).
—
Reply to this email directly, view it on GitHub
<#11124 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ASCK3BVTKUZOIC6IK4NTMW3XFY3J5ANCNFSM6AAAAAAVS52E5Y>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Sir, how about other configuration like
mutation_rate_min = 0.01
mutation_rate_max = 0.5 (0.8 in case of master repo since they use mutation only)
crossover_rate_min = 0.5
crossover_rate_max = 1
min_elite_size = 2
max_elite_size = 5
tournament_size_min = 2
tournament_size_max = 10
for my dataset... can this be same as mentioned in your repo.
Sir which algorithm is used for selecting the child generated
…On Sun, May 14, 2023 at 1:02 AM Shayan Mousavinia ***@***.***> wrote:
Hi again @PraveenMNaik <https://github.com/PraveenMNaik>
You need to use --data coco.yaml or --data coco128.yaml when you try to
run train.py.
Those flag will be download coco and coco 128 dataset which have yolo v5
annotation's format.
—
Reply to this email directly, view it on GitHub
<#11124 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ASCK3BQOQIU4FAIBDUJZRUTXF7OWFANCNFSM6AAAAAAVS52E5Y>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Sir this I am running on local machine...colab is slow, hence switched to
this
…On Tue, 16 May, 2023, 1:39 pm Shayan Mousavinia, ***@***.***> wrote:
I think you said you are using COLAB for run this GA.
Would you please share it with with me for checking this issue?
For other config, you can use default values.
—
Reply to this email directly, view it on GitHub
<#11124 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ASCK3BSI2RRFJV4QPH5LFT3XGMY2DANCNFSM6AAAAAAVS52E5Y>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Sir email please
…On Thu, May 18, 2023 at 9:54 PM Shayan Mousavinia ***@***.***> wrote:
Of course,
Please share your data set in google drive with me.
I will check it ASAP.
—
Reply to this email directly, view it on GitHub
<#11124 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ASCK3BWJGF7ROU6VBWJRUJLXGZEM3ANCNFSM6AAAAAAVS52E5Y>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Sir,
I have shared all the files.
Regards,
…On Thu, May 18, 2023 at 9:59 PM Shayan Mousavinia ***@***.***> wrote:
***@***.***
—
Reply to this email directly, view it on GitHub
<#11124 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ASCK3BX5CHBGGRGIE5ZTJL3XGZFAHANCNFSM6AAAAAAVS52E5Y>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
@PraveenMNaik |
Beta Was this translation helpful? Give feedback.
-
For other questions you asked:
|
Beta Was this translation helpful? Give feedback.
-
What settings would you advise for 1700 images (training set) (only one class, around 30-60k instances) , I have 3 A-100 (40gb) but I don't want it to run more than a week ? |
Beta Was this translation helpful? Give feedback.
-
@PraveenMNaik did you asked something? |
Beta Was this translation helpful? Give feedback.
-
Sir,
Welcome back, greetings of the day.
I tried your code for the configuration mentioned with same dataset.
However, my training results are in the range of 78 to 83% for ***@***.*** for
newGA and old GA.
When observed the results of your csv file, it has started from 50%+ to 80%
+ for ***@***.***,,, why is this difference.
Kindly let me know..... i used the dataset of same what u have used.
…On Wed, Jun 14, 2023 at 12:41 AM Shayan Mousavinia ***@***.***> wrote:
@PraveenMNaik <https://github.com/PraveenMNaik> did you asked something?
—
Reply to this email directly, view it on GitHub
<#11124 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ASCK3BQH4W4KJ22N24I7A5DXLC3PJANCNFSM6AAAAAAVS52E5Y>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Hi Sir, |
Beta Was this translation helpful? Give feedback.
-
Ok ...hmmm.... for example if pop size=50 and in training session if i keep
evolve as 300 i expect it to complete it by 300 generations. But, in my
case it doesn't happen. Am I right?
…On Tue, Oct 3, 2023 at 9:40 PM Shayan Mousavinia ***@***.***> wrote:
it's weird.
I just ran it on colab
<https://colab.research.google.com/drive/1dXVWgjOQb5OVDgkhxcO8pGHTsd1fczn-?usp=sharing>
and everything worked fine.
Be aware that the config was pop_size = 6.
Please check it and you are free to share your issue on colab with me.
—
Reply to this email directly, view it on GitHub
<#11124 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ASCK3BSAIYU36WP22A7IFNTX5Q2GHAVCNFSM6AAAAAAVS52E52VHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM3TCNZXGYZTK>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Oh... that's informative.. .thanks
…On Tue, 3 Oct, 2023, 9:55 pm Shayan Mousavinia, ***@***.***> wrote:
No! That is not correct.
Check this:
#11124 (reply in thread)
<#11124 (reply in thread)>
If your evolve value is 300 and pop size is 50, you need to train 300*50
models.
So, your evolve.csv will have 15000 rows.
The definition of generation in GA which has crossover + mutation(like my
GA) is kind of different from GA that only has mutation(like yolo GA).
In GAs which has crossover + mutation, because of having population, every
generation will have population_size member; So, whenever we want to go to
another generation, we will need to train our model in every member of our
current population.
In GAs which only has mutation, we do not have any population!(seems like
our population_size is 1); Based on this perspective, our train count will
be equal to our generation size!
If you want to use my GA with pop size=50 and want to only train 300
models, you are need to set evolve = (300/50).
Feel free to ask any qesution.
—
Reply to this email directly, view it on GitHub
<#11124 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ASCK3BX3HN27EW6V4UGQAHDX5Q37XAVCNFSM6AAAAAAVS52E52VHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM3TCNZXHAZDE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
By the way ....how about variable length genetic algorithm....u have any
idea of implementation...
On Tue, 3 Oct, 2023, 9:56 pm praveen naik, ***@***.***>
wrote:
… Oh... that's informative.. .thanks
On Tue, 3 Oct, 2023, 9:55 pm Shayan Mousavinia, ***@***.***>
wrote:
> No! That is not correct.
>
> Check this:
> #11124 (reply in thread)
> <#11124 (reply in thread)>
>
> If your evolve value is 300 and pop size is 50, you need to train 300*50
> models.
> So, your evolve.csv will have 15000 rows.
>
> The definition of generation in GA which has crossover + mutation(like my
> GA) is kind of different from GA that only has mutation(like yolo GA).
>
> In GAs which has crossover + mutation, because of having population,
> every generation will have population_size member; So, whenever we want to
> go to another generation, we will need to train our model in every member
> of our current population.
> In GAs which only has mutation, we do not have any population!(seems like
> our population_size is 1); Based on this perspective, our train count will
> be equal to our generation size!
>
> If you want to use my GA with pop size=50 and want to only train 300
> models, you are need to set evolve = (300/50).
>
> Feel free to ask any qesution.
>
> —
> Reply to this email directly, view it on GitHub
> <#11124 (reply in thread)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ASCK3BX3HN27EW6V4UGQAHDX5Q37XAVCNFSM6AAAAAAVS52E52VHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM3TCNZXHAZDE>
> .
> You are receiving this because you were mentioned.Message ID:
> ***@***.***>
>
|
Beta Was this translation helpful? Give feedback.
-
Greeting,
So, long time age I started to use evolotion part in yolo; Howerver, it just contatins mutation part.
That's why I said to myself, why shouldn't we have a more perfect model?
For this reason, I prepared the following code, which, in addition to mutation , also contains cross-over, which we usually use in our genetic algorithms. I hope it will be useful for you too.
hyperparameters, the initial population, and the evolution loop:
evaluate_fitness:
I have plan to add this code in train.py too; I will post it here ASAP :)
Beta Was this translation helpful? Give feedback.
All reactions