Skip to content

Canny's hysteresis thresholds tuning with Particle Swarm Optimization

Notifications You must be signed in to change notification settings

sasso-effe/cannyPSO

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mygif

cannyPSO

Given a training set of images associated with their own optimal edge maps, find the best pair of thresholds for Canny's hysteresis step using Particle Swarm Optimzation (PSO).

Particles' velocities are calculated as:

velocity[t] = inertia + personalInfluence + socialInfluence + randomComponent

where:

  • inertia = w * r0 * velocity[t-1] is the influence of the previous velocity
    • w is an hyperparameter
    • r0 is a random number between 0 and 1
  • personalInfluence = c1 * r1 * (personalBestPosition - currentPosition) is the influence of the individualistic component of the particle to reach the minimum
    • c1 is an hyperparameter
    • r1 is a random number between 0 and 1
    • personalBestPosition is the position with the minimum objective function visited by the particle
  • socialInfluence = c2 * r2 * (globalBestPosition - currentPosition) is the influence of the social component of the particle to follow other particles
    • c2 is an hyperparameter
    • r2 is a random number between 0 and 1
    • globalBestPosition is the position with the minimum objective function visited by any particle
  • randomComponent = [rx, ry] is a random vector
    • rx and ry are random integer numbers between -10 and 10

It is a quite classic velocity implementation, but with the addition of randomComponent to help the swarm to avoid local minima, which are very frequent in the objective function used.