example_pipeline.sh 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. set -e
  2. example_dir=/scratch2/whavard/CODE/LAAC/URUMETRICS/dat/data_set/recordings/original/renamed;
  3. dataset="URUMETRICS-TEST"
  4. # For each example directory (i.e. name of the directory is a date, 20221001, 20221002, etc.)
  5. for dir_name in $example_dir/*; do
  6. today=$( basename $dir_name );
  7. # Clone data set
  8. echo -e "\tCloning..."
  9. datalad install -r git@gin.g-node.org:/LAAC-LSCP/${dataset}.git
  10. cd ${dataset}
  11. # Unlock necessary file (metadata, messages, and metrics)
  12. echo -e "\tUnlocking..."
  13. datalad get extra/messages/definition
  14. datalad get extra/metrics && datalad unlock extra/metrics
  15. datalad get metadata && datalad unlock metadata
  16. # Prepare repository (create necessary directories)
  17. echo -e "\tPreparing..."
  18. python -u scripts/URUMETRICS-CODE/import_data/prepare_data_set.py
  19. # Copy data
  20. echo -e "\tCopying data"
  21. mkdir -p recordings/raw/${today}
  22. cp ${example_dir}/${today}/*.wav recordings/raw/${today}
  23. cp ${example_dir}/${today}/VTC_${today}.rttm annotations/vtc/raw
  24. cp ${example_dir}/${today}/VTC_${today}.vcm annotations/vcm/raw
  25. cp ${example_dir}/${today}/ALICE_${today}.txt annotations/alice/raw
  26. # Save raw data
  27. echo -e "\tSaving and pushing recordings and annotations"
  28. datalad save recordings -m "Added new recordings for date ${today}"
  29. datalad save annotations/*/raw -m "Added raw annotations for date ${today}"
  30. datalad push --to origin
  31. # Import recordings
  32. echo -e "\tImporting new recordings"
  33. python -u scripts/URUMETRICS-CODE/import_data/import_recordings.py --experiment Uruguayan_Chatbot_2022
  34. # Compute acoustic annotations
  35. echo -e "\tComputing acoustic annotations"
  36. python -u scripts/URUMETRICS-CODE/acoustic_annotations/compute_acoustic_annotations.py --path-vtc ./annotations/vtc/raw/VTC_${today}.rttm --path-recordings ./recordings/raw/ --save-path ./annotations/acoustic/raw
  37. # Import annotations
  38. echo -e "\tImporting VTC/VCM/ALICE/ACOUSTIC annotations"
  39. python -u scripts/URUMETRICS-CODE/import_data/import_annotations.py --annotation-type VTC --annotation-file VTC_${today}.rttm
  40. python -u scripts/URUMETRICS-CODE/import_data/import_annotations.py --annotation-type VCM --annotation-file VTC_${today}.vcm
  41. python -u scripts/URUMETRICS-CODE/import_data/import_annotations.py --annotation-type ALICE --annotation-file ALICE_${today}.txt
  42. python -u scripts/URUMETRICS-CODE/import_data/import_annotations.py --annotation-type ACOUSTIC --annotation-file VTC_${today}.csv
  43. # Compute turn annotations
  44. echo -e "\tComputing CONVERSATIONS annotations"
  45. python scripts/URUMETRICS-CODE/turn_annotations/compute_turn_annotations.py --save-path ./annotations/conversations/raw --save-name CONV_${today}
  46. # Import turn annotations
  47. echo -e "\tImporting CONVERSATIONS annotations"
  48. python -u scripts/URUMETRICS-CODE/import_data/import_annotations.py --annotation-type CONVERSATIONS --annotation-file CONV_${today}.csv
  49. # Compute metrics
  50. echo -e "\tComputing metrics"
  51. python -u scripts/URUMETRICS-CODE/compute_metrics/metrics.py
  52. # Generating messages
  53. echo -e "\tGenerating messages"
  54. python -u scripts/URUMETRICS-CODE/generate_messages/messages.py --date ${today}
  55. # Save data
  56. echo -e "\tSaving and pushing"
  57. datalad save annotations/*/raw -m "Imported derived raw annotations for date ${today}"
  58. datalad save annotations/*/converted -m "Converted annotations for date ${today}"
  59. datalad save metadata -m "Updated metadata for date ${today}"
  60. datalad save extra/metrics -m "Computed new metrics for date ${today}"
  61. datalad save extra/messages/generated -m "Message generated for date ${today}"
  62. datalad save .
  63. datalad push --to origin
  64. # Uninstalling
  65. echo -e "\tUninstalling"
  66. git annex dead here
  67. datalad push --to origin
  68. cd ..
  69. datalad remove -d ${dataset}
  70. done;