-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfetch_data.sh
More file actions
86 lines (74 loc) · 2.33 KB
/
fetch_data.sh
File metadata and controls
86 lines (74 loc) · 2.33 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/bash
# Default values
dataset_type="coco"
output_folder="data"
dataset_percentage="full"
# Function to display script usage
function display_help {
echo "Usage: $0 [OPTIONS]"
echo "Options:"
echo " -t, --type TYPE Specify dataset type ('coco' or 'yolo', default: 'coco')"
echo " -o, --output FOLDER Specify output folder (default: 'data')"
echo " -p, --percentage PERC Specify dataset percentage ('full' or 'subset', default: 'full')"
echo " -h, --help Display this help message"
exit 0
}
# Parse command-line arguments
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
-t|--type)
dataset_type="$2"
shift
shift
;;
-o|--output)
output_folder="$2"
shift
shift
;;
-p|--percentage)
dataset_percentage="$2"
shift
shift
;;
-h|--help)
display_help
;;
*)
echo "Unknown option: $1"
exit 1
;;
esac
done
# Validate dataset type
if [[ ! "$dataset_type" =~ ^(coco|yolo)$ ]]; then
echo "Invalid dataset type. Use 'coco' or 'yolo'."
exit 1
fi
# Define URLs based on the dataset type
if [ "$dataset_type" == "coco" ]; then
if [ "$dataset_percentage" == "full" ]; then
url="https://universe.roboflow.com/ds/vunUxYLq9j?key=jDCfG8KbT0"
elif [ "$dataset_percentage" == "subset" ]; then
url="https://aml-2023.s3.eu-north-1.amazonaws.com/final-project/coco_garbage_subset_10_percent.zip"
fi
elif [ "$dataset_type" == "yolo" ]; then
echo "yolo dataset"
if [ "$dataset_percentage" == "full" ]; then
url="https://universe.roboflow.com/ds/UoC75yslyT?key=V3X5ZOBCmH"
elif [ "$dataset_percentage" == "subset" ]; then
echo "Subset dataset"
url="https://aml-2023.s3.eu-north-1.amazonaws.com/final-project/yolo_garbage_subset_10_percent.zip"
fi
fi
echo "Downloading $dataset_percentage $dataset_type data from $url"
# Download the 2data2 using curl, save it to roboflow.zip
curl -L "$url" > roboflow.zip
# Create the output folder
mkdir -p "$output_folder"
# Extract the content of roboflow.zip
unzip -d "$output_folder" -qq roboflow.zip
# Remove the downloaded zip file
rm roboflow.zip
echo "Data downloaded and extracted into $output_folder"