Skip to content

Commit

Permalink
feat extractor scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
v-iashin committed Oct 27, 2020
1 parent c200e70 commit 932f57a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
29 changes: 15 additions & 14 deletions filling_level/r21d_rgb/extract_video_features.sh
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
#!/bin/bash
DEVICE=$1
# the same as =$2 but removes trailing slash in the path
DATA_ROOT=${2%/}

# you may want to switch it to `anaconda3` if you install anaconda instead of miniconda
source ~/miniconda3/etc/profile.d/conda.sh

# path to corsmal dataset without trailing slash (`/`) e.g. folder should have 1/ 2/ 3/ ... 12/ folders
DATA_ROOT="/home/nvme/vladimir/corsmal" # ---- NO TRAILING '/' i.e. not '.....mal/'

# making sure we are not in 'base' or any other
conda deactivate
conda deactivate

# make sure to install it first (follow the guidelines in `./video_features` folder in README.md)
conda activate r21d

# form paths for feature extraction (will be saved to ./filepaths)
python ./form_filenames.py --data_root $DATA_ROOT
# change dir to `./video_features` folder
# also patching the video_features code by creating tmp dir otherwise will fail with system error
cd ./video_features && mkdir ./tmp

# moving to `./video_features` folder
cd ./video_features

for container_id in {1..12}
for container_dir in *$DATA_ROOT/
do
/home/vladimir/miniconda3/envs/r21d/bin/python main.py \
# take only the last folder in the path which is the container id
container_id="$(basename $container_dir)"

# run feature extraction
python main.py \
--feature_type r21d_rgb \
--device_ids 0 1 \
--device_ids $DEVICE \
--on_extraction save_numpy \
--file_with_video_paths "../filepaths/"$container_id"_rgb_file_paths.txt" \
--video_paths $(find $DATA_ROOT/$container_id/rgb/ -name "*.mp4")\
--output_path "../r21d_rgb_features/"$container_id"/r21d_rgb"
done
2 changes: 1 addition & 1 deletion filling_level/vggish/extract_video_features.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ python main.py \
--feature_type vggish \
--device_ids $DEVICE \
--on_extraction save_numpy \
--video_paths $(find $DATA_ROOT -name "*.wav")\
--video_paths $(find $DATA_ROOT/$container_id/audio -name "*.wav")\
--output_path "../vggish_features/"$container_id"/vggish"
done

0 comments on commit 932f57a

Please sign in to comment.