Skip to content
Snippets Groups Projects
Commit c5a3c756 authored by Alain KOMATY's avatar Alain KOMATY
Browse files

fixed the environemnt issue

parent 5aa01350
No related branches found
No related tags found
No related merge requests found
...@@ -43,38 +43,51 @@ This repository is organised as follows: ...@@ -43,38 +43,51 @@ This repository is organised as follows:
1. Download the database from the following link: https://www.idiap.ch/en/dataset/phymatt 1. Download the database from the following link: https://www.idiap.ch/en/dataset/phymatt
2. Create a list of the videos to be used for the experiment. The list should contain the path for each video you want in the experiment. If you want all videos, you can use the following command: 2. Update conda using:
``` bash
mamba update -n base -c conda-forge conda mamba
```
3. Create a new conda environment using the provided environment file `environment.yml`:
``` bash
mamba env create -f environment.yml
``````
4. Activate the environment:
``` bash
conda activate bob_hyg_mask
```
5. Create a list of the videos to be used for the experiment. The list should contain the path for each video you want in the experiment. If you want all videos, you can use the following command:
``` bash ``` bash
find <path_to_database> -name "*.mp4" > <path_to_list> find <path_to_database> -name "*.mp4" > <path_to_list>
``` ```
3. Run the frames extraction code as follows: 6. Run the frames extraction code as follows:
``` bash ``` bash
python preprocessor/extract_frames.py -l <path_to_list> -o <path_to_output_folder>` python preprocessor/extract_frames.py -l <path_to_list> -o <path_to_output_folder>`
``` ```
4. Run the database organization code as follows: 7. Run the database organization code as follows:
``` bash ``` bash
python database/create_database_dataframe.py --frames_list --output_path -metadata_filename -save_mode --min_face_size` python database/create_database_dataframe.py --frames_list --output_path -metadata_filename -save_mode --min_face_size`
``` ```
5. Run the pipeline as follows: 8. Run the pipeline as follows:
``` bash ``` bash
python pipeline_vuln.py --database_path --output_path --metadata_filename --save_mode --min_face_size --attack_type --attack_params --attac python pipeline_vuln.py --database_path --output_path --metadata_filename --save_mode --min_face_size --attack_type --attack_params --attac
``` ```
6. Once you have the score files, namely the `score-dev.csv`, you can use the script `utils/split_scores.sh` to split the scores into bona-fide and attack scores. The script will create three files: `scores-dev_print-attack.csv`, `scores-dev_replay-attack.csv` and `scores-dev_hyg-maks.csv`. 9. Once you have the score files, namely the `score-dev.csv`, you can use the script `utils/split_scores.sh` to split the scores into bona-fide and attack scores. The script will create three files: `scores-dev_print-attack.csv`, `scores-dev_replay-attack.csv` and `scores-dev_hyg-maks.csv`.
7. Activate your `bob` environment:
```bash
conda activate bob
```
8. You can then use these files to compute the metrics as follows: 10. You can then use these files to compute the metrics as follows:
```bash ```bash
bob vuln metrics scores-dev_print-attack.csv scores-dev_replay-attack.csv scores-dev_hyg-maks.csv bob vuln metrics scores-dev_print-attack.csv scores-dev_replay-attack.csv scores-dev_hyg-maks.csv
......
...@@ -23,8 +23,6 @@ import pandas as pd ...@@ -23,8 +23,6 @@ import pandas as pd
from bob.bio.face.annotator import MTCNN from bob.bio.face.annotator import MTCNN
from bob.io.base import load from bob.io.base import load
SCENARIOS=["normal_light", "low_light", "angle_var_right_left", "angle_var_up_down"]
def detect_faces(frame, min_face_size): def detect_faces(frame, min_face_size):
"""_summary_ """_summary_
This function detects faces in frames of videos, it fills them into the list 'nb_detected_faces'. This function detects faces in frames of videos, it fills them into the list 'nb_detected_faces'.
...@@ -38,6 +36,11 @@ def detect_faces(frame, min_face_size): ...@@ -38,6 +36,11 @@ def detect_faces(frame, min_face_size):
return nb_detected_faces, probs, boxes, landmarks return nb_detected_faces, probs, boxes, landmarks
def create_metadata_file(frames_list, output_path, metadata_filename, save_mode, min_face_size): def create_metadata_file(frames_list, output_path, metadata_filename, save_mode, min_face_size):
# Check if output path exists
if not os.path.exists(output_path):
os.makedirs(output_path)
# Open the file containing the list of frames
my_file = open(frames_list, "r") my_file = open(frames_list, "r")
metadata = [] metadata = []
...@@ -55,7 +58,7 @@ def create_metadata_file(frames_list, output_path, metadata_filename, save_mode, ...@@ -55,7 +58,7 @@ def create_metadata_file(frames_list, output_path, metadata_filename, save_mode,
session = filename_split[7] session = filename_split[7]
frame_nb = filename_split[-1].split(".")[0].split("-")[-1] frame_nb = filename_split[-1].split(".")[0].split("-")[-1]
reference_id = '_'.join((filename_split[0])) # Should be replaced by template_id reference_id = '_'.join((filename_split[0])) # Should be replaced by template_id
frame = load(os.path.join(path, filename)) frame = load(line)
nb_detected_faces, probs, boxes, landmarks = detect_faces(frame, min_face_size) nb_detected_faces, probs, boxes, landmarks = detect_faces(frame, min_face_size)
metadata.append( metadata.append(
...@@ -79,21 +82,12 @@ def create_metadata_file(frames_list, output_path, metadata_filename, save_mode, ...@@ -79,21 +82,12 @@ def create_metadata_file(frames_list, output_path, metadata_filename, save_mode,
'landmarks': landmarks, 'landmarks': landmarks,
} }
) )
if save_mode == 'frame':
df_frame = pd.DataFrame(metadata[-1])
metadata_filename = filename.split('.')[0]
# Save the dataframe into pickle
df.to_pickle(os.path.join(os.path.join(output_path, "frames"), '.'.join((metadata_filename, 'pkl'))))
my_file.close() my_file.close()
# Put your list in a dataframe # Put your list in a dataframe
df = pd.DataFrame(metadata) df = pd.DataFrame(metadata)
# Save the dataframe into pickle
if save_mode == 'batch': df.to_pickle(os.path.join(output_path, '.'.join((metadata_filename, 'pkl'))))
batch_idx = frames_list.split('/')[-1].split('.')[0].split('_')[-1]
metadata_filename = metadata_filename + '_'+ str(batch_idx)
# Save the dataframe into pickle
df.to_pickle(os.path.join(output_path, '.'.join((metadata_filename, 'pkl'))))
if __name__ == '__main__': if __name__ == '__main__':
...@@ -101,10 +95,9 @@ if __name__ == '__main__': ...@@ -101,10 +95,9 @@ if __name__ == '__main__':
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()
# Add an argument with a default value # Add an argument with a default value
parser.add_argument('-f', '--frames_list', default='/idiap/user/akomaty/projects/soteria/scripts/data/all_print_attack_frames.txt', help='A path to a file containing the list of frames.') parser.add_argument('-f', '--frames_list', help='A path to a file containing the list of frames.')
parser.add_argument( '-o' ,'--output_path', default='/idiap/project/soteria/soteria_database_frames', help='The output path where you want to save your pickled metadata.') parser.add_argument( '-o' ,'--output_path', help='The output path where you want to save your pickled metadata.')
parser.add_argument('-m' ,'--metadata_filename', default='metadata_df_frames',help='name of the pickled metadata file.') parser.add_argument('-m' ,'--metadata_filename', default='metadata_df_frames',help='name of the pickled metadata file.')
parser.add_argument('-s' ,'--save_mode', default='batch', choices=['batch', 'frame'], help='Choose if you want to save one pickled file per list of frames ("batch"), or you want to save one pickled file per frame ("frame").')
parser.add_argument('-z' ,'--min_face_size', default=40, help=' Minimum face size to be detected.') parser.add_argument('-z' ,'--min_face_size', default=40, help=' Minimum face size to be detected.')
# Parse the arguments # Parse the arguments
......
name: bob_hyg_mask
channels:
- https://www.idiap.ch/software/bob/conda
- conda-forge
dependencies:
- _libgcc_mutex=0.1=conda_forge
- _openmp_mutex=4.5=2_kmp_llvm
- abseil-cpp=20220623.0=h93e1e8c_5
- absl-py=1.2.0=pyhd8ed1ab_0
- aiohttp=3.8.1=py39hb9d737c_1
- aiosignal=1.2.0=pyhd8ed1ab_0
- alsa-lib=1.2.8=h166bdaf_0
- anyio=3.6.2=pyhd8ed1ab_0
- aom=3.4.0=h27087fc_1
- argon2-cffi=21.3.0=pyhd8ed1ab_0
- argon2-cffi-bindings=21.2.0=py39hb9d737c_3
- arrow-cpp=10.0.1=h27aab58_4_cpu
- asttokens=2.1.0=pyhd8ed1ab_0
- astunparse=1.6.3=pyhd8ed1ab_0
- async-timeout=4.0.2=pyhd8ed1ab_0
- attr=2.5.1=h166bdaf_1
- attrs=22.1.0=pyh71513ae_1
- aws-c-auth=0.6.21=hd93a3ba_3
- aws-c-cal=0.5.20=hff2c3d7_3
- aws-c-common=0.8.5=h166bdaf_0
- aws-c-compression=0.2.16=hf5f93bc_0
- aws-c-event-stream=0.2.17=h57874a7_1
- aws-c-http=0.7.0=h96ef541_0
- aws-c-io=0.13.12=h57ca295_1
- aws-c-mqtt=0.7.13=h0b5698f_12
- aws-c-s3=0.2.1=h82cbbf9_4
- aws-c-sdkutils=0.1.7=hf5f93bc_0
- aws-checksums=0.1.14=h6027aba_0
- aws-crt-cpp=0.18.16=h26430d7_8
- aws-sdk-cpp=1.9.379=h32f6703_7
- babel=2.11.0=pyhd8ed1ab_0
- backcall=0.2.0=pyh9f0ad1d_0
- backports=1.0=py_2
- backports.functools_lru_cache=1.6.4=pyhd8ed1ab_0
- beautifulsoup4=4.11.1=pyha770c72_0
- bleach=5.0.1=pyhd8ed1ab_0
- blinker=1.4=py_1
- blosc=1.21.1=h83bc5f7_3
- bob.bio.base=7.1.0=np122py39ha9b4201_0
- bob.bio.face=7.1.2=py39hb6b4a9b_0
- bob.bio.video=6.1.1=py39h5e91936_0
- bob.extension=7.0.3=py39h5300674_0
- bob.io.base=5.0.2=py39h2761e7f_0
- bob.learn.em=3.2.0=np122py39h2cb5f17_0
- bob.measure=6.0.2=py39ha6266be_0
- bob.pad.base=5.0.4=py39hba019c8_0
- bob.pad.face=4.1.1=py39heb51839_0
- bob.pipelines=3.0.3=np122py39ha758e9a_0
- bokeh=2.4.3=pyhd8ed1ab_3
- brotli=1.0.9=h166bdaf_7
- brotli-bin=1.0.9=h166bdaf_7
- brotlipy=0.7.0=py39hb9d737c_1004
- brunsli=0.1=h9c3ff4c_0
- bzip2=1.0.8=h7f98852_4
- c-ares=1.18.1=h7f98852_0
- c-blosc2=2.3.1=h7a311fb_0
- ca-certificates=2022.12.7=ha878542_0
- cached-property=1.5.2=hd8ed1ab_1
- cached_property=1.5.2=pyha770c72_1
- cachetools=5.2.0=pyhd8ed1ab_0
- cairo=1.16.0=ha61ee94_1012
- certifi=2022.12.7=pyhd8ed1ab_0
- cffi=1.15.1=py39he91dace_0
- cfitsio=4.1.0=hd9d235c_0
- charls=2.3.4=h9c3ff4c_0
- charset-normalizer=2.1.1=pyhd8ed1ab_0
- click=8.1.3=py39hf3d152e_0
- click-plugins=1.1.1=py_0
- cloudpickle=2.1.0=pyhd8ed1ab_0
- colorama=0.4.5=pyhd8ed1ab_0
- contourpy=1.0.6=py39hf939315_0
- cryptography=39.0.0=py39h079d5ae_0
- cudatoolkit=11.7.0=hd8887f6_10
- cudnn=8.4.1.50=hed8a83a_0
- cycler=0.11.0=pyhd8ed1ab_0
- cytoolz=0.12.0=py39hb9d737c_0
- dask=2022.9.2=pyhd8ed1ab_0
- dask-core=2022.9.2=pyhd8ed1ab_0
- dask-glm=0.2.0=py_1
- dask-jobqueue=0.8.1=pyhd8ed1ab_0
- dask-labextension=6.0.0=pyhd8ed1ab_0
- dask-ml=2022.5.27=pyhd8ed1ab_0
- dav1d=1.0.0=h166bdaf_1
- dbus=1.13.6=h5008d03_3
- debugpy=1.6.3=py39h5a03fae_1
- decorator=5.1.1=pyhd8ed1ab_0
- defusedxml=0.7.1=pyhd8ed1ab_0
- distributed=2022.9.2=pyhd8ed1ab_0
- entrypoints=0.4=pyhd8ed1ab_0
- executing=1.2.0=pyhd8ed1ab_0
- expat=2.5.0=h27087fc_0
- ffmpeg=4.4.2=gpl_hfe78399_107
- fftw=3.3.10=nompi_ha7695d1_103
- flatbuffers=22.12.06=hcb278e6_2
- flit-core=3.8.0=pyhd8ed1ab_0
- font-ttf-dejavu-sans-mono=2.37=hab24e00_0
- font-ttf-inconsolata=3.000=h77eed37_0
- font-ttf-source-code-pro=2.038=h77eed37_0
- font-ttf-ubuntu=0.83=hab24e00_0
- fontconfig=2.14.1=hc2a2eb6_0
- fonts-conda-ecosystem=1=0
- fonts-conda-forge=1=0
- fonttools=4.37.1=py39hb9d737c_0
- freeglut=3.2.2=h9c3ff4c_1
- freetype=2.12.1=hca18f0e_0
- frozenlist=1.3.1=py39hb9d737c_0
- fsspec=2022.7.1=pyhd8ed1ab_0
- future=0.18.2=py39hf3d152e_5
- gast=0.4.0=pyh9f0ad1d_0
- gettext=0.21.1=h27087fc_0
- gflags=2.2.2=he1b5a44_1004
- giflib=5.2.1=h36c2ea0_2
- glib=2.74.1=h6239696_1
- glib-tools=2.74.1=h6239696_1
- glog=0.6.0=h6f12383_0
- gmp=6.2.1=h58526e2_0
- gnutls=3.7.7=hf3e180e_0
- google-auth=2.11.0=pyh6c4a22f_0
- google-auth-oauthlib=0.4.6=pyhd8ed1ab_0
- google-pasta=0.2.0=pyh8c360ce_0
- graphite2=1.3.13=h58526e2_1001
- greenlet=1.1.2=py39h5a03fae_2
- grpc-cpp=1.51.1=h27aab58_0
- grpcio=1.51.1=py39h8c60046_0
- gst-plugins-base=1.21.3=h4243ec0_1
- gstreamer=1.21.3=h25f0c4b_1
- gstreamer-orc=0.4.33=h166bdaf_0
- h5py=3.7.0=nompi_py39hd51670d_101
- harfbuzz=5.1.0=hf9f4e7c_0
- hdf5=1.12.2=nompi_h4df4325_101
- heapdict=1.0.1=py_0
- icu=70.1=h27087fc_0
- idna=3.3=pyhd8ed1ab_0
- imagecodecs=2022.8.8=py39h6e07900_4
- imageio=2.22.4=pyhfa7a67d_1
- imageio-ffmpeg=0.4.7=pyhd8ed1ab_0
- importlib-metadata=4.11.4=py39hf3d152e_0
- importlib_metadata=4.11.4=hd8ed1ab_0
- importlib_resources=5.10.0=pyhd8ed1ab_0
- ipdb=0.13.9=pyhd8ed1ab_0
- ipykernel=6.17.1=pyh210e3f2_0
- ipython=8.6.0=pyh41d4057_1
- ipython_genutils=0.2.0=py_1
- jack=1.9.21=h583fa2b_2
- jasper=2.0.33=ha77e612_0
- jedi=0.18.1=pyhd8ed1ab_2
- jinja2=3.1.2=pyhd8ed1ab_1
- joblib=1.1.0=pyhd8ed1ab_0
- jpeg=9e=h166bdaf_2
- json5=0.9.5=pyh9f0ad1d_0
- jsonschema=4.17.1=pyhd8ed1ab_0
- jupyter-server-proxy=3.2.2=pyhd8ed1ab_0
- jupyter_client=7.3.4=pyhd8ed1ab_0
- jupyter_core=5.0.0=py39hf3d152e_0
- jupyter_server=1.23.3=pyhd8ed1ab_0
- jupyterlab=3.5.0=pyhd8ed1ab_0
- jupyterlab_pygments=0.2.2=pyhd8ed1ab_0
- jupyterlab_server=2.16.3=pyhd8ed1ab_0
- jxrlib=1.1=h7f98852_2
- keras=2.11.0=pyhd8ed1ab_0
- keras-preprocessing=1.1.2=pyhd8ed1ab_0
- keyutils=1.6.1=h166bdaf_0
- kiwisolver=1.4.4=py39hf939315_0
- krb5=1.20.1=h81ceb04_0
- lame=3.100=h7f98852_1001
- lcms2=2.12=hddcbb42_0
- ld_impl_linux-64=2.36.1=hea4e1c9_2
- lerc=4.0.0=h27087fc_0
- libabseil=20220623.0=cxx17_h48a1fff_5
- libaec=1.0.6=h9c3ff4c_0
- libarrow=10.0.1=h86614e7_4_cpu
- libavif=0.10.1=h166bdaf_1
- libblas=3.9.0=16_linux64_mkl
- libbrotlicommon=1.0.9=h166bdaf_7
- libbrotlidec=1.0.9=h166bdaf_7
- libbrotlienc=1.0.9=h166bdaf_7
- libcap=2.66=ha37c62d_0
- libcblas=3.9.0=16_linux64_mkl
- libclang=15.0.7=default_had23c3d_0
- libclang13=15.0.7=default_h3e3d535_0
- libcrc32c=1.1.2=h9c3ff4c_0
- libcups=2.3.3=h36d4200_3
- libcurl=7.87.0=hdc1c0ab_0
- libdb=6.2.32=h9c3ff4c_0
- libdeflate=1.13=h166bdaf_0
- libdrm=2.4.112=h166bdaf_0
- libedit=3.1.20191231=he28a2e2_2
- libev=4.33=h516909a_1
- libevent=2.1.10=h28343ad_4
- libffi=3.4.2=h7f98852_5
- libflac=1.4.2=h27087fc_0
- libgcc-ng=12.1.0=h8d9b700_16
- libgcrypt=1.10.1=h166bdaf_0
- libgfortran-ng=12.1.0=h69a702a_16
- libgfortran5=12.1.0=hdcd56e2_16
- libglib=2.74.1=h606061b_1
- libglu=9.0.0=he1b5a44_1001
- libgoogle-cloud=2.5.0=h21dfe5b_1
- libgpg-error=1.46=h620e276_0
- libgrpc=1.51.1=h30feacc_0
- libiconv=1.17=h166bdaf_0
- libidn2=2.3.3=h166bdaf_0
- liblapack=3.9.0=16_linux64_mkl
- liblapacke=3.9.0=16_linux64_mkl
- libllvm11=11.1.0=hf817b99_3
- libllvm14=14.0.6=he0ac6c6_0
- libllvm15=15.0.7=hadd5161_0
- libnghttp2=1.51.0=hff17c54_0
- libnsl=2.0.0=h7f98852_0
- libogg=1.3.4=h7f98852_1
- libopencv=4.6.0=py39h04bf7ee_4
- libopus=1.3.1=h7f98852_1
- libpciaccess=0.16=h516909a_0
- libpng=1.6.39=h753d276_0
- libpq=15.1=hb675445_3
- libprotobuf=3.21.12=h3eb15da_0
- libsndfile=1.2.0=hb75c966_0
- libsodium=1.0.18=h36c2ea0_1
- libsqlite=3.40.0=h753d276_0
- libssh2=1.10.0=hf14f497_3
- libstdcxx-ng=12.1.0=ha89aaad_16
- libsystemd0=252=h2a991cd_0
- libtasn1=4.19.0=h166bdaf_0
- libthrift=0.16.0=he500d00_2
- libtiff=4.4.0=h0e0dad5_3
- libtool=2.4.7=h27087fc_0
- libudev1=252=h166bdaf_0
- libunistring=0.9.10=h7f98852_0
- libutf8proc=2.8.0=h166bdaf_0
- libuuid=2.32.1=h7f98852_1000
- libuv=1.44.2=h166bdaf_0
- libva=2.15.0=h166bdaf_0
- libvorbis=1.3.7=h9c3ff4c_0
- libvpx=1.11.0=h9c3ff4c_3
- libwebp-base=1.2.4=h166bdaf_0
- libxcb=1.13=h7f98852_1004
- libxkbcommon=1.0.3=he3ba5ed_0
- libxml2=2.10.3=h7463322_0
- libzlib=1.2.13=h166bdaf_4
- libzopfli=1.0.3=h9c3ff4c_0
- llvm-openmp=14.0.4=he0ac6c6_0
- llvmlite=0.38.1=py39h7d9a04d_0
- locket=1.0.0=pyhd8ed1ab_0
- lz4=4.0.0=py39h029007f_2
- lz4-c=1.9.3=h9c3ff4c_1
- lzo=2.10=h516909a_1000
- magma=2.5.4=h6103c52_2
- markdown=3.4.1=pyhd8ed1ab_0
- markupsafe=2.1.1=py39hb9d737c_1
- matplotlib=3.6.2=py39hf3d152e_0
- matplotlib-base=3.6.2=py39hf9fd14e_0
- matplotlib-inline=0.1.6=pyhd8ed1ab_0
- mistune=2.0.4=pyhd8ed1ab_0
- mkl=2022.1.0=h84fe81f_915
- mpg123=1.31.2=hcb278e6_0
- msgpack-python=1.0.4=py39hf939315_0
- multidict=6.0.2=py39hb9d737c_1
- multipledispatch=0.6.0=py_0
- munkres=1.1.4=pyh9f0ad1d_0
- mysql-common=8.0.32=ha901b37_0
- mysql-libs=8.0.32=hd7da12d_0
- nbclassic=0.4.8=pyhd8ed1ab_0
- nbclient=0.7.0=pyhd8ed1ab_0
- nbconvert=7.2.5=pyhd8ed1ab_0
- nbconvert-core=7.2.5=pyhd8ed1ab_0
- nbconvert-pandoc=7.2.5=pyhd8ed1ab_0
- nbformat=5.7.0=pyhd8ed1ab_0
- nccl=2.14.3.1=h0800d71_0
- ncurses=6.3=h27087fc_1
- nest-asyncio=1.5.6=pyhd8ed1ab_0
- nettle=3.8.1=hc379101_1
- networkx=2.8.6=pyhd8ed1ab_0
- ninja=1.11.0=h924138e_0
- nodejs=18.12.1=h8839609_0
- notebook=6.5.2=pyha770c72_1
- notebook-shim=0.2.2=pyhd8ed1ab_0
- nspr=4.35=h27087fc_0
- nss=3.82=he02c5a1_0
- numba=0.55.2=py39h66db6d7_0
- numexpr=2.7.3=py39hde0f152_1
- numpy=1.22.4=py39hc58783e_0
- oauthlib=3.2.0=pyhd8ed1ab_0
- opencv=4.6.0=py39hf3d152e_4
- openh264=2.3.0=h27087fc_0
- openjpeg=2.5.0=h7d73246_1
- openssl=3.0.7=h0b41bf4_1
- opt_einsum=3.3.0=pyhd8ed1ab_1
- orc=1.8.2=hfdbbad2_0
- p11-kit=0.24.1=hc5aa10d_0
- packaging=21.3=pyhd8ed1ab_0
- pandas=1.5.2=py39h4661b88_0
- pandoc=2.19.2=ha770c72_0
- pandocfilters=1.5.0=pyhd8ed1ab_0
- parquet-cpp=1.5.1=2
- parso=0.8.3=pyhd8ed1ab_0
- partd=1.3.0=pyhd8ed1ab_0
- pcre=8.45=h9c3ff4c_0
- pcre2=10.40=hc3806b6_0
- pexpect=4.8.0=pyh1a96a4e_2
- pickleshare=0.7.5=py_1003
- pillow=9.2.0=py39hd5dbb17_2
- pip=22.2.2=pyhd8ed1ab_0
- pixman=0.40.0=h36c2ea0_0
- pkgutil-resolve-name=1.3.10=pyhd8ed1ab_0
- platformdirs=2.5.2=pyhd8ed1ab_1
- ply=3.11=py_1
- portaudio=19.6.0=h583fa2b_7
- prometheus_client=0.15.0=pyhd8ed1ab_0
- prompt-toolkit=3.0.32=pyha770c72_0
- protobuf=4.21.12=py39h227be39_0
- psutil=5.9.1=py39hb9d737c_0
- pthread-stubs=0.4=h36c2ea0_1001
- ptyprocess=0.7.0=pyhd3deb0d_0
- pulseaudio=16.1=ha8d29e2_1
- pure_eval=0.2.2=pyhd8ed1ab_0
- py-opencv=4.6.0=py39hef51801_4
- pyarrow=10.0.1=py39h94a43e9_4_cpu
- pyasn1=0.4.8=py_0
- pyasn1-modules=0.2.7=py_0
- pycparser=2.21=pyhd8ed1ab_0
- pygments=2.13.0=pyhd8ed1ab_0
- pyjwt=2.4.0=pyhd8ed1ab_0
- pyparsing=3.0.9=pyhd8ed1ab_0
- pyqt=5.15.7=py39h18e9c17_0
- pyqt5-sip=12.11.0=py39h5a03fae_0
- pyrsistent=0.19.2=py39hb9d737c_0
- pysocks=1.7.1=py39hf3d152e_5
- pytables=3.7.0=py39h6a7961f_3
- python=3.9.15=hba424b6_0_cpython
- python-dateutil=2.8.2=pyhd8ed1ab_0
- python-fastjsonschema=2.16.2=pyhd8ed1ab_0
- python-flatbuffers=2.0=pyhd8ed1ab_0
- python_abi=3.9=2_cp39
- pytorch=1.12.1=cpu_py39h3439074_1
- pytorch-lightning=1.5.10=pyhd8ed1ab_0
- pytz=2022.2.1=pyhd8ed1ab_0
- pyu2f=0.1.5=pyhd8ed1ab_0
- pywavelets=1.3.0=py39hd257fcd_1
- pyyaml=6.0=py39hb9d737c_4
- pyzmq=24.0.1=py39headdf64_1
- qt-main=5.15.6=hf6cd601_5
- re2=2022.06.01=h27087fc_0
- readline=8.1.2=h0f457ee_0
- requests=2.28.1=pyhd8ed1ab_0
- requests-oauthlib=1.3.1=pyhd8ed1ab_0
- rsa=4.9=pyhd8ed1ab_0
- s2n=1.3.31=h3358134_0
- scikit-image=0.19.3=py39h1832856_1
- scikit-learn=1.1.2=py39he5e8d7e_0
- scipy=1.9.3=py39hddc5342_2
- send2trash=1.8.0=pyhd8ed1ab_0
- setuptools=59.5.0=py39hf3d152e_0
- simpervisor=0.4=pyhd8ed1ab_0
- sip=6.6.2=py39h5a03fae_0
- six=1.16.0=pyh6c4a22f_0
- sleef=3.5.1=h9b69904_2
- snappy=1.1.9=hbd366e4_1
- sniffio=1.3.0=pyhd8ed1ab_0
- sortedcontainers=2.4.0=pyhd8ed1ab_0
- soupsieve=2.3.2.post1=pyhd8ed1ab_0
- sqlalchemy=1.4.44=py39hb9d737c_0
- sqlite=3.40.0=h4ff8645_0
- stack_data=0.6.0=pyhd8ed1ab_0
- svt-av1=1.2.1=h27087fc_0
- tabulate=0.8.10=pyhd8ed1ab_0
- tbb=2021.5.0=h924138e_1
- tblib=1.7.0=pyhd8ed1ab_0
- tensorboard=2.11.2=pyhd8ed1ab_0
- tensorboard-data-server=0.6.1=py39h3ccb8fc_4
- tensorboard-plugin-wit=1.8.1=pyhd8ed1ab_0
- tensorflow=2.11.0=cpu_py39h4655687_0
- tensorflow-base=2.11.0=cpu_py39h9b4020c_0
- tensorflow-estimator=2.11.0=cpu_py39hf050123_0
- termcolor=1.1.0=pyhd8ed1ab_3
- terminado=0.17.0=pyh41d4057_0
- threadpoolctl=3.1.0=pyh8a188c0_0
- tifffile=2022.8.12=pyhd8ed1ab_0
- tinycss2=1.2.1=pyhd8ed1ab_0
- tk=8.6.12=h27826a3_0
- toml=0.10.2=pyhd8ed1ab_0
- tomli=2.0.1=pyhd8ed1ab_0
- toolz=0.12.0=pyhd8ed1ab_0
- torchmetrics=0.9.3=pyhd8ed1ab_0
- torchvision=0.13.0=cpu_py39hedfcc36_0
- tornado=6.1=py39hb9d737c_3
- tqdm=4.64.0=pyhd8ed1ab_0
- traitlets=5.5.0=pyhd8ed1ab_0
- typing-extensions=4.3.0=hd8ed1ab_0
- typing_extensions=4.3.0=pyha770c72_0
- tzdata=2022c=h191b570_0
- unicodedata2=14.0.0=py39hb9d737c_1
- urllib3=1.26.11=pyhd8ed1ab_0
- wcwidth=0.2.5=pyh9f0ad1d_2
- webencodings=0.5.1=py_1
- websocket-client=1.4.2=pyhd8ed1ab_0
- werkzeug=2.2.2=pyhd8ed1ab_0
- wheel=0.37.1=pyhd8ed1ab_0
- wrapt=1.14.1=py39hb9d737c_0
- x264=1!164.3095=h166bdaf_2
- x265=3.5=h924138e_3
- xarray=2022.6.0=pyhd8ed1ab_1
- xcb-util=0.4.0=h166bdaf_0
- xcb-util-image=0.4.0=h166bdaf_0
- xcb-util-keysyms=0.4.0=h166bdaf_0
- xcb-util-renderutil=0.3.9=h166bdaf_0
- xcb-util-wm=0.4.1=h166bdaf_0
- xorg-fixesproto=5.0=h7f98852_1002
- xorg-inputproto=2.3.2=h7f98852_1002
- xorg-kbproto=1.0.7=h7f98852_1002
- xorg-libice=1.0.10=h7f98852_0
- xorg-libsm=1.2.3=hd9c2040_1000
- xorg-libx11=1.7.2=h7f98852_0
- xorg-libxau=1.0.9=h7f98852_0
- xorg-libxdmcp=1.1.3=h7f98852_0
- xorg-libxext=1.3.4=h7f98852_1
- xorg-libxfixes=5.0.3=h7f98852_1004
- xorg-libxi=1.7.10=h7f98852_0
- xorg-libxrender=0.9.10=h7f98852_1003
- xorg-renderproto=0.11.1=h7f98852_1002
- xorg-xextproto=7.3.0=h7f98852_1002
- xorg-xproto=7.0.31=h7f98852_1007
- xz=5.2.6=h166bdaf_0
- yaml=0.2.5=h7f98852_2
- yarl=1.7.2=py39hb9d737c_2
- zeromq=4.3.4=h9c3ff4c_1
- zfp=1.0.0=h27087fc_1
- zict=2.2.0=pyhd8ed1ab_0
- zipp=3.8.1=pyhd8ed1ab_0
- zlib=1.2.13=h166bdaf_4
- zlib-ng=2.0.6=h166bdaf_0
- zstd=1.5.2=h6239696_4
- pip:
- av==10.0.0
- ffmpeg-python==0.2.0
- pydeprecate==0.3.1
This diff is collapsed.
...@@ -29,11 +29,15 @@ def extract_frames(video_list, output_path, max_number_of_frames): ...@@ -29,11 +29,15 @@ def extract_frames(video_list, output_path, max_number_of_frames):
for video_path in fp: for video_path in fp:
video_path = video_path.strip() video_path = video_path.strip()
myvid = VideoAsArray(video_path, max_number_of_frames=max_number_of_frames) myvid = VideoAsArray(video_path, max_number_of_frames=max_number_of_frames)
type_ = video_path.split("/")[-2]
id = video_path.split("/")[-1].split("_")[0]
filename=video_path.split("/")[-1].split(".")[0]
id_path = os.path.join(output_path, type_, id)
if not os.path.exists(id_path):
os.makedirs(id_path)
index = 0 index = 0
for frame in myvid: for frame in myvid:
id = video_path.split("/")[-2] dest_file_path = os.path.join(id_path, filename + "_frame-" + str(index)+ '.jpg')
filename=video_path.split("/")[-1].split(".")[0]
dest_file_path = os.path.join(os.path.join(output_path, id), filename + "_frame-" + str(index)+ '.jpg')
matplotlib.image.imsave(dest_file_path, to_matplotlib(frame)) matplotlib.image.imsave(dest_file_path, to_matplotlib(frame))
index +=1 index +=1
......
/idiap/resource/database/PHyMAtt/attack/hyg_mask_attack/1_Redmi6pro_Front_ATTACK_hyg-mask_set-4_2023-02-41T15-19-15.mp4
/idiap/resource/database/PHyMAtt/attack/hyg_mask_attack/2_Redmi6pro_Front_ATTACK_hyg-mask_set-4_2023-02-41T15-21-40.mp4
/idiap/resource/database/PHyMAtt/attack/hyg_mask_attack/3_Redmi6pro_Front_ATTACK_hyg-mask_set-4_2023-02-41T15-23-35.mp4
/idiap/resource/database/PHyMAtt/attack/hyg_mask_attack/4_iPhone12_Front_ATTACK_hyg-mask_set-4_2023-02-10T14-25-54.mp4
/idiap/resource/database/PHyMAtt/attack/print_attack/1_iPhone12_Front_ATTACK_a1-print_2022-12-14T14-13-05.mp4
/idiap/resource/database/PHyMAtt/attack/print_attack/2_iPhone12_Front_ATTACK_a1-print_2022-12-14T14-13-21.mp4
/idiap/resource/database/PHyMAtt/attack/print_attack/3_iPhone12_Front_ATTACK_a1-print_2022-12-14T14-13-36.mp4
/idiap/resource/database/PHyMAtt/attack/print_attack/4_iPhone12_Front_ATTACK_a1-print_2022-12-14T14-13-51.mp4
/idiap/resource/database/PHyMAtt/attack/replay_attack/1_iPhone6s_front_ATTACK_replay-attack_1_Redmi6pro_iPhone12_s1.mp4
/idiap/resource/database/PHyMAtt/attack/replay_attack/2_iPhone12_front_ATTACK_replay-attack_1_iPhone6s_Redmi9A_s1.mp4
/idiap/resource/database/PHyMAtt/attack/replay_attack/3_iPhone6s_front_ATTACK_replay-attack_1_iPhone12_Redmi9A_s1.mp4
/idiap/resource/database/PHyMAtt/attack/replay_attack/4_iPhone12_front_ATTACK_replay-attack_1_iPhone6s_Redmi9A_s1.mp4
/idiap/resource/database/PHyMAtt/bonafide/1_iPhone12_Front_BONAFIDE_indoor-normal-light_s1_2022-09-09T12-07-58.mp4
/idiap/resource/database/PHyMAtt/bonafide/2_iPhone12_Front_BONAFIDE_indoor-normal-light_s1_2022-09-09T12-21-16.mp4
/idiap/resource/database/PHyMAtt/bonafide/3_iPhone12_Front_BONAFIDE_indoor-normal-light_s1_2022-09-09T12-33-49.mp4
/idiap/resource/database/PHyMAtt/bonafide/4_iPhone12_Front_BONAFIDE_indoor-normal-light_s1_2022-09-12T07-20-18.mp4
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment