Skip to content
Snippets Groups Projects
user avatar
Low authored
a823cd7b
History
# Create environment with dependencies
conda env create -f environment.yml
conda activate i3d_extract
pip install -r requirements.txt

The main python file is: predict_videos.py takes a directory path contains videos and write their spottings to csv files, and save embeddings.
 --datasetname: According to the dataset name, video name without ".mp4" is founded in the code. It will be used as output file names. Default datasetname is meinedgs. It's format is like 1179805_1b1.masked.mp4 and produce 1179805_1b1. Please feel free to edit lines 235-243 according to your format.
 --checkpoint_path: Path to checkpoint.
 --word_data_json: A path to a json file contains class ids and class (gloss) names.
 --dataset_path: Path to dataset. The code will process all the videos in the directory.
 --confidence: This is for output_dir/pred_glosses_confidences_filtered folder which contains predictions as csv file. It should be between 0-1. Only predictions above this threshold will be saved separately.
 --output_dir: Path to save outputs. Some folders will be created in this folder. 
    - output_dir/pred_glosses_confidences contains a csv file with all class predictions for each frame.
    - output_dir/pred_glosses_confidences_filtered contains a csv file with only predictions over a threshold (--confidence)
    - output_dir/embs contains I3D embeddings as numpy array with (T-15, 1024) dimension. T is the total number of frames in the video.

 --save_embds: 0 or 1. 0 does not save embeddings, 1 saves.
 
 **Note: you can look at predict_videos.py for other parameters. But probably you do not need to change them.

# Running example
python predict_videos.py --datasetname meinedgs --checkpoint_path meinedgs_i3d.pth.tar --word_data_json meinedgs_vocab.json --dataset_path videos --output_dir output --confidence 0.5 --save_embds 1