This section describes the steps if you would like to try TREBA on your own data.
- Preprocess your trajectory data into trajectories of length
T
. For our sample fly dataset,T=21
but you can set it to any length that is able to capture some unit of behavior in your dataset. - Create a new directory in
util/datasets
called DATASET_NAME, where DATASET_NAME is the name of your dataset. Insideutil/datasets/DATASET_NAME
, create files__init__.py
andcore.py
following the example we provide for the fly dataset.core.py
defines the states and actions for your dataset. Usually, the states are set as the detected keypoints for your dataset, and the actions are set as the change in state in one timestamp, but you should adapt this to your domain. If you are using task programming/label functions to supervise TREBA, also create a folder calledlabel_functions
. If you are using trajectory augmentations, create a folder calledaugmentations
. Note that programs and augmentations are optional for training TREBA, but if you would like to use them, here are additional notes:- The
label_functions
directory should contain__init__.py
andheuristic.py
. The programs/label functions will be coded inheuristic.py
. See the fly programs for examples on how to create your own programs. - The
augmentations
directory should contain__init__.py
andaugmentation_functions.py
. See the See the fly augmentations for examples on how to create your own trajectory augmentations.
- The
- Currently, the code supports datasets where action(t) = state(t+1) - state(t). However, if your actions are not defined as the change in state, you need to modify the
generate_rollout
function in treba model so that future states are properly updated when given current state and action. - Update
util/datasets/__init__.py
with your new dataset. - Create a config directory and file for your custom dataset following the instructions in config_setup.
- Train TREBA:
python run_single.py \
-d 0 \
--config_dir CONFIG_DIR_NAME
- Apply TREBA to your downstream tasks! We provide feature extraction scripts (feature_extraction.py) as well as instructions on running TREBA for behavior classification.