Datasets:
thompsonmj
commited on
Commit
•
1f3d066
1
Parent(s):
3f19446
Remove bash script
Browse files- download.sh +0 -100
download.sh
DELETED
@@ -1,100 +0,0 @@
|
|
1 |
-
#!/bin/bash
|
2 |
-
|
3 |
-
# Base URL of the Hugging Face repository
|
4 |
-
BASE_URL="https://huggingface.co/datasets/imageomics/KABR/resolve/main/KABR"
|
5 |
-
|
6 |
-
# Array of relative file paths
|
7 |
-
FILES=(
|
8 |
-
"README.txt"
|
9 |
-
"annotation/classes.json"
|
10 |
-
"annotation/distribution.xlsx"
|
11 |
-
"annotation/train.csv"
|
12 |
-
"annotation/val.csv"
|
13 |
-
"configs/I3D.yaml"
|
14 |
-
"configs/SLOWFAST.yaml"
|
15 |
-
"configs/X3D.yaml"
|
16 |
-
"dataset/image2video.py"
|
17 |
-
"dataset/image2visual.py"
|
18 |
-
"dataset/image/giraffes_md5.txt"
|
19 |
-
"dataset/image/giraffes_part_aa"
|
20 |
-
"dataset/image/giraffes_part_ab"
|
21 |
-
"dataset/image/giraffes_part_ac"
|
22 |
-
"dataset/image/giraffes_part_ad"
|
23 |
-
"dataset/image/giraffes.zip"
|
24 |
-
"dataset/image/zebras_grevys_md5.txt"
|
25 |
-
"dataset/image/zebras_grevys_part_aa"
|
26 |
-
"dataset/image/zebras_grevys_part_ab"
|
27 |
-
"dataset/image/zebras_grevys_part_ac"
|
28 |
-
"dataset/image/zebras_grevys_part_ad"
|
29 |
-
"dataset/image/zebras_grevys_part_ae"
|
30 |
-
"dataset/image/zebras_grevys_part_af"
|
31 |
-
"dataset/image/zebras_grevys_part_ag"
|
32 |
-
"dataset/image/zebras_grevys_part_ah"
|
33 |
-
"dataset/image/zebras_grevys_part_ai"
|
34 |
-
"dataset/image/zebras_grevys_part_aj"
|
35 |
-
"dataset/image/zebras_grevys_part_ak"
|
36 |
-
"dataset/image/zebras_grevys_part_al"
|
37 |
-
"dataset/image/zebras_grevys_part_am"
|
38 |
-
"dataset/image/zebras_plains_md5.txt"
|
39 |
-
"dataset/image/zebras_plains_part_aa"
|
40 |
-
"dataset/image/zebras_plains_part_ab"
|
41 |
-
"dataset/image/zebras_plains_part_ac"
|
42 |
-
"dataset/image/zebras_plains_part_ad"
|
43 |
-
"dataset/image/zebras_plains_part_ae"
|
44 |
-
"dataset/image/zebras_plains_part_af"
|
45 |
-
"dataset/image/zebras_plains_part_ag"
|
46 |
-
"dataset/image/zebras_plains_part_ah"
|
47 |
-
"dataset/image/zebras_plains_part_ai"
|
48 |
-
"dataset/image/zebras_plains_part_aj"
|
49 |
-
"dataset/image/zebras_plains_part_ak"
|
50 |
-
"dataset/image/zebras_plains_part_al"
|
51 |
-
)
|
52 |
-
|
53 |
-
# Loop through each relative file path
|
54 |
-
for FILE_PATH in "${FILES[@]}"; do
|
55 |
-
# Construct the full URL
|
56 |
-
FULL_URL="$BASE_URL/$FILE_PATH"
|
57 |
-
|
58 |
-
# Create the necessary directories based on the file path
|
59 |
-
mkdir -p "$(dirname "KABR_files/$FILE_PATH")"
|
60 |
-
|
61 |
-
# Download the file and save it with the preserved file path
|
62 |
-
curl -L -o "KABR_files/$FILE_PATH" "$FULL_URL"
|
63 |
-
|
64 |
-
done
|
65 |
-
|
66 |
-
ANIMALS=("giraffes" "zebras_grevys" "zebras_plains")
|
67 |
-
|
68 |
-
# Loop through each animal name
|
69 |
-
for ANIMAL in "${ANIMALS[@]}"; do
|
70 |
-
# Concatenate the split files into their archive.
|
71 |
-
PART_FILES="./KABR_files/dataset/image/${ANIMAL}_part_*"
|
72 |
-
if ls $PART_FILES 1> /dev/null 2>&1; then
|
73 |
-
cat $PART_FILES > "./KABR_files/dataset/image/${ANIMAL}.zip"
|
74 |
-
else
|
75 |
-
echo "No part files found for $ANIMAL."
|
76 |
-
continue
|
77 |
-
fi
|
78 |
-
|
79 |
-
# Calculate the MD5 sum of the ZIP file
|
80 |
-
ZIP_MD5=$(md5sum "./KABR_files/dataset/image/${ANIMAL}.zip" | awk '{ print $1 }')
|
81 |
-
|
82 |
-
# Read the expected MD5 sum from the associated txt file
|
83 |
-
EXPECTED_MD5=$(cat "./KABR_files/dataset/image/${ANIMAL}_md5.txt" | awk '{ print $1 }')
|
84 |
-
|
85 |
-
# Compare the calculated MD5 sum with the expected MD5 sum
|
86 |
-
if [ "$ZIP_MD5" == "$EXPECTED_MD5" ]; then
|
87 |
-
echo "MD5 sum for ${ANIMAL}.zip is correct."
|
88 |
-
# Delete the part files
|
89 |
-
rm $PART_FILES
|
90 |
-
unzip -d "./KABR_files/dataset/image/" "./KABR_files/dataset/image/${ANIMAL}.zip"
|
91 |
-
rm "./KABR_files/dataset/image/${ANIMAL}.zip"
|
92 |
-
rm "./KABR_files/dataset/image/${ANIMAL}_md5.txt"
|
93 |
-
else
|
94 |
-
echo "MD5 sum for ${ANIMAL}.zip is incorrect. Expected: $EXPECTED_MD5, but got: $ZIP_MD5."
|
95 |
-
echo "There may be data corruption. Please try to download and reconstruct the data again or reach out to the corresponding authors for assistance."
|
96 |
-
fi
|
97 |
-
|
98 |
-
done
|
99 |
-
|
100 |
-
echo "Download, reconstruction, extraction, and verification completed."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|