-
Notifications
You must be signed in to change notification settings - Fork 1
/
collect.sh
51 lines (42 loc) · 1.23 KB
/
collect.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
# read number of samples from input argument
# (if not provided, default to 100)
# (if provided, check if it is a number)
# (if not a number, default to 100)
# (if a number, check if it is positive)
# (if not positive, default to 100)
# (if positive, use it)
if [ -z "$1" ]; then
number_of_samples=20
else
if ! [[ "$1" =~ ^[0-9]+$ ]]; then
number_of_samples=20
else
if [ "$1" -le 0 ]; then
number_of_samples=20
else
number_of_samples="$1"
fi
fi
fi
cd data/ || return
# create a array of labels
labels=( "A" "E" "I" "O" "U" )
for label in "${labels[@]}"; do
echo "####################################################"
echo "Alert!!! Data collection for label: $label"
echo "Press enter to start recording"
read -r
# create a directory for each label
folder_name="vowel_${label}"
mkdir -p "${folder_name}"
python3 ../collect_data_new.py --label "${label}" --samples "${number_of_samples}"
# move all files with the label to the directory
mv "$label"* "${folder_name}"
## two blank lines between each label
echo ""
echo ""
echo "Collecting data for label: $label done"
done
echo "All done"
cd .. || exit # From data