Git Product home page Git Product logo

sasso-effe / cannypso Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 59.77 MB

Canny's hysteresis thresholds tuning with Particle Swarm Optimization

Python 98.05% JavaScript 0.15% HTML 0.02% CSS 0.03% Jupyter Notebook 0.07% C 1.56% Fortran 0.04% PowerShell 0.08% Batchfile 0.01%
canny-edge-detection canny-edge-detector edge-detection pso particle-swarm-optimization pso-algorithm hysteresis computer-vision

cannypso's Introduction

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.

cannypso's People

Contributors

sasso-effe avatar

Stargazers

 avatar  avatar

Watchers

 avatar

cannypso's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.