Skip to content
Masoud Masoumi Moghadam edited this page Mar 17, 2024 · 6 revisions

Satisfy the requirements.


The API is developed with the fastAPI framework. The database Postgres is used in development.

To initialize the program, you should go through this procedure.

  1. Install Postgres and requirements.txt

  2. configure a .env file.

MODE=development # or test
DEV_USERNAME=user1
DEV_PASSWORD=********
DEV_HOST=localhost
DEV_DB=volleyball_development
DEV_PORT=5432
DEV_DRIVER=postgresql
TEST_DB_URL=sqlite:///./vb.db
  1. configure db_conf.
development:
  user: "user2"
  password: "*********"
  db: "VB1"
  host: "localhost"
  port: 5432
  dialect: 'postgresql'
  driver: 'psycopg2'
test:
  user: "user1"
  password: "********"
  db: "VB_test"
  host: "localhost"
  port: 5432
  dialect: 'postgresql'
  driver: 'psycopg2'

  1. configure the setup.yaml file. before running main.py we should assign a match_id to the game.

To get that court_json file, you should run /home/masoud/Desktop/projects/volleyball_analytics/src/gui/court_annotation.py and input the video path to it, then it automatically finds the court corners, and the court attack field. adjust the corners, then press s on the keyboard. it outputs the JSON file.

base_dir is the base path to save the video outputs.

match_id: 1
court_json: '/home/masoud/Desktop/projects/volleyball_analytics/conf/court.json'
base_dir: "/media/masoud/HDD-8TB/DATA/volleyball/"
  1. configure ml_models.yaml. This file holds the names of the models and their path to find them.

  2. run make install. it installs the requirements.

  3. on .env change the mode to test and then run make test to run the backend unit-tests.

Start the program


  1. Create a db in PostgreSQL with the name DEV_DB.
  2. change the MODE in the .env file to development.
  3. Run this command: uvicorn src.backend.app.app:app to start the API listening to requests.
  4. to seed the data to db, just run the script src.api_init_data.py.
  5. Now you can run the main.py and save the rally videos into db.
Clone this wiki locally