From ecf8d244147f127004e93ed87893ae93c2cc7cf1 Mon Sep 17 00:00:00 2001 From: Enhao Zhang Date: Sun, 13 Aug 2023 16:48:13 -0700 Subject: [PATCH] add config.json --- README.md | 2 +- config.json | 6 ++++++ equi_app/views.py | 7 ++++--- equi_site/settings.py | 5 +++-- 4 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 config.json diff --git a/README.md b/README.md index 842fdea..cbfd468 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ A prototype implementation of EQUI-VOCAL, which is a system to automatically synthesize compositional queries over videos from limited user interactions. See the [technical report](https://arxiv.org/abs/2301.00929) and the [website](https://db.cs.washington.edu/projects/visualworld/) for more details. # Download resources -Download [training videos](http://clevrer.csail.mit.edu/) at Dataset → Training Videos\ +Download [training videos](http://clevrer.csail.mit.edu/) at Dataset → Training Videos Create new folder equi_app/static/equi_app/clevrer and place downloaded videos in it diff --git a/config.json b/config.json new file mode 100644 index 0000000..7a72eca --- /dev/null +++ b/config.json @@ -0,0 +1,6 @@ +{ + "_comments": "This is the configuration file for the EQUI-VOCAL system. Please fill in the following information. The db_name is the name of your database. The db_user is the user name of your database. The input_dir is the directory where you put your input files.", + "db_name": "myinner_db", + "db_user": "zhangenhao", + "input_dir": "/Users/zhangenhao/Desktop/UW/Research/equi-vocal-demo/EQUI-VOCAL/inputs" +} \ No newline at end of file diff --git a/equi_app/views.py b/equi_app/views.py index 7f36520..bfe6c6b 100644 --- a/equi_app/views.py +++ b/equi_app/views.py @@ -1,4 +1,5 @@ import random +from django.conf import settings from django.shortcuts import render from django.http import HttpResponse, JsonResponse from django.template import loader @@ -11,7 +12,7 @@ import time import datetime import sys -sys.path.append("/gscratch/balazinska/enhaoz/complex_event_video") +# sys.path.append("/gscratch/balazinska/enhaoz/complex_event_video") from src.synthesize import test_algorithm_interactive from src.utils import str_to_program_postgres @@ -101,7 +102,7 @@ def get(self, request, format=None): predicate_dict = [{"name": "Near", "parameters": [1], "nargs": 2}, {"name": "Far", "parameters": [3], "nargs": 2}, {"name": "LeftOf", "parameters": None, "nargs": 2}, {"name": "Behind", "parameters": None, "nargs": 2}, {"name": "RightOf", "parameters": None, "nargs": 2}, {"name": "FrontOf", "parameters": None, "nargs": 2}, {"name": "RightQuadrant", "parameters": None, "nargs": 1}, {"name": "LeftQuadrant", "parameters": None, "nargs": 1}, {"name": "TopQuadrant", "parameters": None, "nargs": 1}, {"name": "BottomQuadrant", "parameters": None, "nargs": 1}, {"name": "Color", "parameters": ["gray", "red", "blue", "green", "brown", "cyan", "purple", "yellow"], "nargs": 1}, {"name": "Shape", "parameters": ["cube", "sphere", "cylinder"], "nargs": 1}, {"name": "Material", "parameters": ["metal", "rubber"], "nargs": 1}] - input_dir = "/gscratch/balazinska/enhaoz/complex_event_video/inputs" + input_dir = json.load(open(os.path.join(settings.BASE_DIR, 'config.json')))['input_dir'] dataset_name = "demo_queries_scene_graph" query_str = example_query["query_str"] # query_str = 'Conjunction(Conjunction(Color_red(o0), Color_yellow(o1)), LeftOf(o0, o1)); RightOf(o0, o1)' @@ -184,7 +185,7 @@ def post(self, request, format=None): init_labeled_index = example_query["init_labeled_index"][run_id] predicate_dict = [{"name": "Near", "parameters": [1], "nargs": 2}, {"name": "Far", "parameters": [3], "nargs": 2}, {"name": "LeftOf", "parameters": None, "nargs": 2}, {"name": "Behind", "parameters": None, "nargs": 2}, {"name": "RightOf", "parameters": None, "nargs": 2}, {"name": "FrontOf", "parameters": None, "nargs": 2}, {"name": "RightQuadrant", "parameters": None, "nargs": 1}, {"name": "LeftQuadrant", "parameters": None, "nargs": 1}, {"name": "TopQuadrant", "parameters": None, "nargs": 1}, {"name": "BottomQuadrant", "parameters": None, "nargs": 1}, {"name": "Color", "parameters": ["gray", "red", "blue", "green", "brown", "cyan", "purple", "yellow"], "nargs": 1}, {"name": "Shape", "parameters": ["cube", "sphere", "cylinder"], "nargs": 1}, {"name": "Material", "parameters": ["metal", "rubber"], "nargs": 1}] - input_dir = "/gscratch/balazinska/enhaoz/complex_event_video/inputs" + input_dir = json.load(open(os.path.join(settings.BASE_DIR, 'config.json')))['input_dir'] dataset_name = "user_study_queries_scene_graph" query_str = example_query["query_str"] # query_str = 'Conjunction(Conjunction(Color_red(o0), Color_yellow(o1)), LeftOf(o0, o1)); RightOf(o0, o1)' diff --git a/equi_site/settings.py b/equi_site/settings.py index 47ae8fe..d34daa9 100644 --- a/equi_site/settings.py +++ b/equi_site/settings.py @@ -12,6 +12,7 @@ from pathlib import Path import os +import json # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent @@ -89,8 +90,8 @@ DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', - 'NAME': 'myinner_db', - 'USER': 'zhangenhao', + 'NAME': json.load(open(os.path.join(BASE_DIR, 'config.json')))['db_name'], + 'USER': json.load(open(os.path.join(BASE_DIR, 'config.json')))['db_user'], 'HOST': '127.0.0.1', 'PORT': '5432', }