Skip to content

Commit

Permalink
Update TuSimple dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
eric612 committed Mar 25, 2019
1 parent d3a2b60 commit 0916c07
Show file tree
Hide file tree
Showing 6 changed files with 3,743 additions and 1 deletion.
28 changes: 28 additions & 0 deletions data/tusimple/create_data.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
cur_dir=$(cd $( dirname ${BASH_SOURCE[0]} ) && pwd )
root_dir=$cur_dir/../..

cd $root_dir

redo=1
data_root_dir="/media/data/"
dataset_name="tusimple"
#mapfile="$root_dir/data/$dataset_name/labelmap.prototxt"
anno_type="lane_detection"
db="lmdb"
min_dim=0
max_dim=0
width=0
height=0
label_type="json"
extra_cmd="--encode-type=jpg --encoded"
if [ $redo ]
then
extra_cmd="$extra_cmd --redo"
fi
for subset in train
do
python $root_dir/scripts/create_annoset.py --anno-type=$anno_type \
--min-dim=$min_dim --max-dim=$max_dim --resize-width=$width --label-type=$label_type \
--resize-height=$height --check-label $extra_cmd $data_root_dir $root_dir/data/$dataset_name/$subset.txt \
$data_root_dir/$dataset_name/$db/$dataset_name"_"$subset"_"$db examples/$dataset_name
done
28 changes: 28 additions & 0 deletions data/tusimple/create_data_fisheye.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
cur_dir=$(cd $( dirname ${BASH_SOURCE[0]} ) && pwd )
root_dir=$cur_dir/../..

cd $root_dir

redo=1
data_root_dir="$HOME/"
dataset_name="fisheye"
mapfile="$root_dir/data/$dataset_name/labelmap_fisheye.prototxt"
anno_type="detection"
db="lmdb"
min_dim=0
max_dim=0
width=0
height=0

extra_cmd="--encode-type=jpg --encoded"
if [ $redo ]
then
extra_cmd="$extra_cmd --redo"
fi
for subset in test test_time_Afternoon test_time_Day test_time_Night test_weather_Cloudy test_weather_Normal test_weather_Rain trainval
do
python $root_dir/scripts/create_annoset.py --anno-type=$anno_type \
--label-map-file=$mapfile --min-dim=$min_dim --max-dim=$max_dim --resize-width=$width \
--resize-height=$height --check-label $extra_cmd $data_root_dir $root_dir/data/$dataset_name/$subset.txt \
$data_root_dir/$dataset_name/$db/$dataset_name"_"$subset"_"$db examples/$dataset_name
done
44 changes: 44 additions & 0 deletions data/tusimple/create_list.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/bin/bash
root_dir=/media/data/
#root_dir="../../data/VOCdevkit"
sub_dir=ImageSets/Main
bash_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
for dataset in train
do
dst_file=$bash_dir/$dataset.txt
if [ -f $dst_file ]
then
rm -f $dst_file
fi
for name in tusimple #VOC2007 VOC2012
do
if [[ $dataset == "test" && $name == "VOC2012" ]]
then
continue
fi
echo "Create list for $name $dataset..."
dataset_file=$root_dir/$name/$sub_dir/$dataset.txt

img_file=$bash_dir/$dataset"_img.txt"
cp $dataset_file $img_file
sed -i "s/^/$name\/JPEGImages\//g" $img_file
sed -i "s/$/.jpg/g" $img_file

label_file=$bash_dir/$dataset"_label.txt"
cp $dataset_file $label_file
sed -i "s/^/$name\/Annotations\//g" $label_file
sed -i "s/$/.json/g" $label_file

paste -d' ' $img_file $label_file $label_file2>> $dst_file

rm -f $label_file
rm -f $img_file
done
# Shuffle trainval file.
if [ $dataset == "train" ]
then
rand_file=$dst_file.random
cat $dst_file | perl -MList::Util=shuffle -e 'print shuffle(<STDIN>);' > $rand_file
mv $rand_file $dst_file
fi
done
Loading

0 comments on commit 0916c07

Please sign in to comment.