This folder contains a simple webcam demo where you can perform real-time SGG. First, make sure that you have downloaded or trained a model in SGDet mode, currently only sgdet is supported for demo. To run the demo you'll need to:
-
Install the codebase, refer to INSTALL.md
-
Train a SGDet model and save the results files in the
./checkpoints/
folder -
Get the path to the config file used for training, for instance
./configs/VG150/baseline/e2e_relation_X_101_32_8_FPN_1x.yaml
-
Get the path of the dict file with class names, it should be under
./datasets/vg/
and be named something likeVG-SGG-dicts.json
-
Get the path of your trained weights, for instance
./checkpoints/upload_causal_motif_sgdet/model_0028000.pth
-
OPTIONAL: if you want to spice it up, you can add a real-time tracker on top of the object detection to track relations between the same objects through time with boxmot (
pip install boxmot
). You can then activate it with argument--tracking
. -
OPTIONAL: you can also configure the box and rel confidence threshold, by default I put 0.1 for the relation and 0.5 for the boxes, if no relation or too many relations are shown, try to adjust those thresholds with the arguments
--rel_conf
and--box_conf
.
You can run the demo as follows:
python webcam_demo.py --classes PATH_TO_CLASSES_DICT_FILE.json --config YOUR_CONFIG_FILE_HERE.yml --weights YOUR_WEIGHTS_FILE.pth --tracking # only activate tracking if boxmot is installed