Skip to content

A portrait image ranking system, used Python3.12.3, Flask3.0.3 and SQLite3.39.5

Notifications You must be signed in to change notification settings

TheHackOrg/portrait-image-ranking-system

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Intro

A portrait image ranking system, used Python3.12.3, Flask3.0.3 and SQLite3.39.5

Thanks for ELO rating algorithm :

  • $P(D) = \frac{1}{2} + \int_{0}^{D}{\frac{1}{\sqrt{2\pi}\sigma}e^{\frac{-x^2}{2\sigma^2}}dx}$, that's equal with the formula of $P(D) = \frac{1}{1 + 10^{\frac{D}{400}}}$, and be used to calculate the expected value of win
  • $R_n = R_o + K * (W - P(D))$, which be used to calculate the new ranking score

Screenshot

index.html

How to use it

  1. Install the project dependency.
pip3 install -r requirements.txt
  1. Create database tables, and the default database name is portrait_image.db.
class SQLite3DB:
    DATABASE_NAME = 'portrait_image.db'
class SQLite3DBTest:
    SQLite3DB.create_table()
  1. Store the all images of specifical folder into database, but before that, maybe you need to change the default image path.
class ImageTool:
    PORTRAIT_IMG_FOLDER = '/portrait_img_folder'
class SQLite3DBTest:
    SQLite3DB.store_img_into_db()
  1. Modify the default initial ranking of ELO ranking algorithm if you need, that according to the scale of the competition, etc.
DEFAULT_RANKING = 1400
  1. Run it, Have fun with it bro.
class WebControllerTest:
    WebController.app.run(host='0.0.0.0', port=80, debug=True)
python3 portrait_image_ranking_system.py

Question

There have two questions for you, maybe it's help you to understand the advantage and principle of ELO rating algorithm, and you can get answer in blogs of reference part.

  • Why do we use ELO instead of a traditional points-based system ?
  • What's the formula meaning of $P(D) = \frac{1}{2} + \int_{0}^{D}{\frac{1}{\sqrt{2\pi}\sigma}e^{\frac{-x^2}{2\sigma^2}}dx}$ ?

Reference

About

A portrait image ranking system, used Python3.12.3, Flask3.0.3 and SQLite3.39.5

Resources

Stars

Watchers

Forks