-
Notifications
You must be signed in to change notification settings - Fork 6
API
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.
-
Install Postgres and requirements.txt
-
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
- 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'
- configure the
setup.yaml
file. before runningmain.py
we should assign amatch_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/"
-
configure
ml_models.yaml
. This file holds the names of the models and their path to find them. -
run
make install
. it installs the requirements. -
on
.env
change the mode totest
and then runmake test
to run the backend unit-tests.
- Create a db in PostgreSQL with the name
DEV_DB
. - change the
MODE
in the.env
file todevelopment
. - Run this command:
uvicorn src.backend.app.app:app
to start the API listening to requests. - to seed the data to db, just run the script
src.api_init_data.py
. - Now you can run the
main.py
and save the rally videos into db.