SlowFast: input video for demo, but got KeyError:“Non-existent config key:DEMO.INPUT_VIDEO”
I want to input video for demo, so I change DEMO.DATA_SOURCE to my video path, run:
python tools/run_net.py --cfg demo/AVA/SLOWFAST_32x2_R101_50_50.yaml
but I got:
ValueError: Type mismatch (<class ‘int’> vs. <class ‘str’>) with values (0 vs. ./fight2.mp4) for config key: DEMO.DATA_SOURCE
Traceback
File "tools/run_net.py", line 37, in <module> main() File "tools/run_net.py", line 19, in main cfg = load_config(args) File "/home/nd/slowfast/slowfast/utils/parser.py", line 78, in load_config cfg.merge_from_file(args.cfg_file) File "/home/nd/anaconda3/envs/SlowFast/lib/python3.6/site-packages/fvcore/common/config.py", line 109, in merge_from_file self.merge_from_other_cfg(loaded_cfg) File "/home/nd/anaconda3/envs/SlowFast/lib/python3.6/site-packages/fvcore/common/config.py", line 120, in merge_from_other_cfg return super().merge_from_other_cfg(cfg_other) File "/home/nd/anaconda3/envs/SlowFast/lib/python3.6/site-packages/yacs/config.py", line 217, in merge_from_other_cfg _merge_a_into_b(cfg_other, self, self, []) File "/home/nd/anaconda3/envs/SlowFast/lib/python3.6/site-packages/yacs/config.py", line 464, in _merge_a_into_b _merge_a_into_b(v, b[k], root, key_list + [k]) File "/home/nd/anaconda3/envs/SlowFast/lib/python3.6/site-packages/yacs/config.py", line 460, in _merge_a_into_b v = _check_and_coerce_cfg_value_type(v, b[k], k, full_key) File "/home/nd/anaconda3/envs/SlowFast/lib/python3.6/site-packages/yacs/config.py", line 517, in _check_and_coerce_cfg_value_type original_type, replacement_type, original, replacement, full_key ValueError: Type mismatch (<class 'int'> vs. <class 'str'>) with values (0 vs. ./fight2.mp4) for config key: DEMO.DATA_SOURCESo I change add INPUT_VIDEO in DEMO part: INPUT_VIDEO:“./fight2.mp4”
then I got
KeyError:“Non-existent config key:DEMO.INPUT_VIDEO”
Any help would be appreciated
here is my config file:
slowfast/demo/AVA/SLOWFAST_32x2_R101_50_50.yaml
TRAIN:
ENABLE: False
DATASET: ava
BATCH_SIZE: 16
EVAL_PERIOD: 1
CHECKPOINT_PERIOD: 1
AUTO_RESUME: True
CHECKPOINT_FILE_PATH: "./SLOWFAST_32x2_R101_50_50.pkl" #path to pretrain model
CHECKPOINT_TYPE: pytorch
DATA:
NUM_FRAMES: 32
SAMPLING_RATE: 2
TRAIN_JITTER_SCALES: [256, 320]
TRAIN_CROP_SIZE: 224
TEST_CROP_SIZE: 256
INPUT_CHANNEL_NUM: [3, 3]
DETECTION:
ENABLE: True
ALIGNED: False
AVA:
BGR: False
DETECTION_SCORE_THRESH: 0.8
TEST_PREDICT_BOX_LISTS: ["person_box_67091280_iou90/ava_detection_val_boxes_and_labels.csv"]
SLOWFAST:
ALPHA: 4
BETA_INV: 8
FUSION_CONV_CHANNEL_RATIO: 2
FUSION_KERNEL_SZ: 5
RESNET:
ZERO_INIT_FINAL_BN: True
WIDTH_PER_GROUP: 64
NUM_GROUPS: 1
DEPTH: 101
TRANS_FUNC: bottleneck_transform
STRIDE_1X1: False
NUM_BLOCK_TEMP_KERNEL: [[3, 3], [4, 4], [6, 6], [3, 3]]
SPATIAL_DILATIONS: [[1, 1], [1, 1], [1, 1], [2, 2]]
SPATIAL_STRIDES: [[1, 1], [2, 2], [2, 2], [1, 1]]
NONLOCAL:
LOCATION: [[[], []], [[], []], [[6, 13, 20], []], [[], []]]
GROUP: [[1, 1], [1, 1], [1, 1], [1, 1]]
INSTANTIATION: dot_product
POOL: [[[2, 2, 2], [2, 2, 2]], [[2, 2, 2], [2, 2, 2]], [[2, 2, 2], [2, 2, 2]], [[2, 2, 2], [2, 2, 2]]]
MODEL:
NUM_CLASSES: 80
ARCH: slowfast
LOSS_FUNC: bce
DROPOUT_RATE: 0.5
HEAD_ACT: sigmoid
TEST:
ENABLE: False
DATASET: ava
BATCH_SIZE: 8
DATA_LOADER:
NUM_WORKERS: 2
PIN_MEMORY: True
DEMO:
ENABLE: True
LABEL_FILE_PATH: "./demo/AVA/ava.names"
DATA_SOURCE: "./fight2.mp4"
# INPUT_VIDEO: "./fight2.mp4"
OUTPUT_FILE: "./output.mp4"
# DISPLAY_WIDTH: 640
# DISPLAY_HEIGHT: 480
DETECTRON2_OBJECT_DETECTION_MODEL_CFG: "COCO-Detection/faster_rcnn_R_50_FPN_3x.yaml"
DETECTRON2_OBJECT_DETECTION_MODEL_WEIGHTS: "/home/nd/slowfast/demo/AVA/model_final_280758.pkl"
# DETECTRON2_OBJECT_DETECTION_MODEL_WEIGHTS: "detectron2://COCO-Detection/faster_rcnn_R_50_FPN_3x/137849458/model_final_280758.pkl"
NUM_GPUS: 1
NUM_SHARDS: 1
RNG_SEED: 0
OUTPUT_DIR: .
any help would be appreciated!
About this issue
- Original URL
- State: open
- Created 4 years ago
- Comments: 18 (3 by maintainers)
Hi @wtnan2003,
Thank you for playing with the PySlowFast codebase.
I do want to apologize for failing to inform you about the change in class name file format. Demo is a new and developing feature so everything is not entirely pushed and well-documented. We have plan to release this feature officially in a few weeks so we will publish all related files and documentations then. Off the bat, our class name files start with index 0 instead of 1. That might explain the wildly wrong results you see in the new demo. One other thing I want to add is that we have
TENSORBOARD.MODEL_VIS.TOPK_PREDS
param that can be changed to increase/decrease the number of predictions visualized. We also have new updates coming up for choosing predictions with threshold as well. So watch out for that 😃Regarding speed, the new demo version waits to collect all necessary frames (in this case 32x2 = 64 frames), make predictions and visualization on those frames and then display them. This causes some necessary delay since, say with a fps of 30 for the webcam, we need to wait > 2s just to collect enough frames to make the predictions and visualization. This was not a problem in the previous demo release since we visualize results to whatever frames we just capture (this means that results for frames 1…64 is visualized to 65…128, causing some mismatch problem in the visualization). If your webcam’s
fps
rate is very slow, I would suggest increasingDEMO.BUFFER_SIZE
parameter (which I believe is set to 0 by default). This basically use the last fewx
frames from the previous clip (the previous 64 frames) to make a prediction, so you can save some wait time capturing enough new frames. With that being said, we will have new updates in a few days to help with speed/delay.I’ll look into the small window size problem. Did you experience this with the old demo version?
@Priyabrata-M I just annotate three lines of TENSORBOARD Here is my SLOWFAST_32x2_R101_50_50.yaml file:
slowfast/demo/AVA/SLOWFAST_32x2_R101_50_50.yaml