forked from open-mmlab/OpenPCDet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bash_data.sh
88 lines (71 loc) · 3.4 KB
/
bash_data.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
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
87
88
#!/bin/bash
################################
# README
# This .sh file is to:
# 1. Download the client data (if not downloaded)
# 2. Preprocess the client data (downsample + filter the data)
################################
################################
# Setup anaconda3
# https://stackoverflow.com/a/70293309
################################
source ~/anaconda3/bin/activate
conda init bash
echo " "
conda activate openpcdet
################################
# hyperparameters
################################
ORI_PLY_DIR="data_raw/techpartnerfile/techpartnerfile-ply"
PLY_DIR="data_raw/techpartnerfile/preprocessed_techpartnerfile-ply"
LABEL_DIR="data_raw/techpartnerfile/techpartnerfile_label"
################################
# create directory data_raw to store raw data
################################
if [ -d "data_raw" ]; then
echo -e "directory data_raw has been created previously.\n"
else
mkdir -p "data_raw"
echo -e "Created directory data_raw\n"
fi
################################
# Get ready client dataset
################################
if [ -d "data_raw/techpartnerfile" ]; then
echo -e "The client data has been downloaded previously.\n"
else
cd "data_raw"
echo -e "The client data zip file does not exists. Downloading now...\n"
################################
# download ply file
################################
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=1-p9g4AVO9fxhwYtI-Ab3Se1Mbw7_gW46' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=1-p9g4AVO9fxhwYtI-Ab3Se1Mbw7_gW46" -O "techpartnerfile-ply.zip" && rm -rf /tmp/cookies.txt || exit 1
unzip "techpartnerfile-ply.zip" -d "techpartnerfile" || exit 1
################################
# download labels
################################
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=14pAHVEho2CAXkcPxmzuEJP3CvI6AwExH' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=14pAHVEho2CAXkcPxmzuEJP3CvI6AwExH" -O "techpartnerfile_label.zip" && rm -rf /tmp/cookies.txt || exit 1
unzip "techpartnerfile_label.zip" -d "techpartnerfile" || exit 1
cd ../
echo " "
################################
# batch preprocessing of data
################################
python3 batch_preprocess.py --input-dir $ORI_PLY_DIR --output-dir $PLY_DIR || exit 1
################################
# split the data (if necessary)
################################
python3 batch_split.py --ply_dir $PLY_DIR --label_dir $LABEL_DIR || exit 1
################################
# Fix the label path name in the json label, in case multiple people did the labelling -> insonsistency in root directory
################################
python3 batch_fix_label.py --ply_dir $PLY_DIR --label_dir $LABEL_DIR || exit 1
################################
# Augmentation
################################
python3 batch_augment.py --ply_dir $PLY_DIR --label_dir $LABEL_DIR || exit 1
fi
################################
# deactivate conda environment
################################
conda deactivate