This repository has been archived by the owner on Oct 15, 2024. It is now read-only.
forked from pjreddie/darknet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprepare_dataset.sh
executable file
·62 lines (56 loc) · 1.66 KB
/
prepare_dataset.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
#!/bin/bash
# Set of training images overlap with all annotation
# Set of testing images overlap with all annotation
# There are annotations which has no corresponding images
# There are images that has no corresponding annotations
# This script SHOULD be modified as the syncing with the database gets better
ROOT_DIR=$(pwd)
TRAIN_LABEL_DIR="/home/dcsabai/video-analytics-train/DetectNetAnnotation/"
TRAIN_IMAGE_DIR="/home/dcsabai/ImageDataBase_NEW/train/images/"
VAL_LABEL_DIR="/home/dcsabai/video-analytics-train/DetectNetAnnotation/"
VAL_IMAGE_DIR="/home/dcsabai/ImageDataBase_NEW/val/images/"
rm data -r
mkdir data
cd data
mkdir train
cd train
echo "Synchronizing training images..."
rsync $TRAIN_IMAGE_DIR/ images -a --info=PROGRESS2,SYMSAFE
chown $USER:$USER images/
echo "Converting to JPG"
cd images
for f in $(ls); do
sudo mogrify -format jpg $f &
done
cd ..
find $(pwd)/images/ -name "*.jpg" > train.txt
echo "Synchronizing labels:" $VAL_LABEL_DIR
rsync $TRAIN_LABEL_DIR/ labels -a --info=PROGRESS2,SYMSAFE
echo "Preprocessing labels (takes 1-2 min)..."
cd labels
for f in $(ls); do
$ROOT_DIR/detectnet2yolo.py $f >> log &
done
echo
echo
cd $ROOT_DIR/data
mkdir val
cd val
echo "Synchronizing validation images..."
rsync $VAL_IMAGE_DIR/ images -a --info=PROGRESS2,SYMSAFE
chown $USER:$USER images/
echo "Converting to JPG"
cd images
for f in $(ls); do
sudo mogrify -format jpg $f &
done
cd ..
find $(pwd)/images/ -name "*.jpg" > val.txt
echo "Synchronizing labels:" $VAL_LABEL_DIR
rsync $VAL_LABEL_DIR/ labels -a --info=PROGRESS2,SYMSAFE
echo "Preprocessing labels (takes 1-2 min)..."
cd labels
for f in $(ls); do
$ROOT_DIR/detectnet2yolo.py $f >> log &
done
cd $ROOT_DIR