Fixed mAP calculation for CRNN layer during training

This commit is contained in:
AlexeyAB
2019-03-05 02:15:44 +03:00
parent ef803e05df
commit b751bac175
6 changed files with 70 additions and 52 deletions

View File

@ -8,7 +8,7 @@
* [Explanations in issues](https://github.com/AlexeyAB/darknet/issues?q=is%3Aopen+is%3Aissue+label%3AExplanations)
0. [Improvements in this repository](#improvements-in-this-repository)
1. [How to use](#how-to-use)
1. [How to use](#how-to-use-on-the-command-line)
2. [How to compile on Linux](#how-to-compile-on-linux)
3. How to compile on Windows
* [Using vcpkg](#how-to-compile-on-windows-using-vcpkg)

View File

@ -0,0 +1,50 @@
#!/bin/bash
dataset=$1
w=$2
h=$3
# Parameters: Human3, CarScale, Human6, Biker
#w=480
#h=640
IFS=','
export LC_NUMERIC="en_US.UTF-8"
wd=`pwd`
dataset_path="data/$dataset"
class_id=0
num=1
mkdir data
wget http://cvlab.hanyang.ac.kr/tracker_benchmark/seq/$dataset.zip
unzip -o $dataset.zip -d data
sed -i.bak 's/\o11/,/g' $dataset_path/groundtruth_rect.txt
sed -i.bak 's/\o11/,/g' $dataset_path/groundtruth_rect.txt
dos2unix $dataset_path/groundtruth_rect.txt
while read -r left right width height; do
filename=$(printf "$dataset_path/img/%04d.txt" $num)
#rm $filename.txt
echo "$class_id " > $filename
printf "%.5f " "$(($((left + width/2)) * 100000 / $w))e-5" >> $filename
printf "%.5f " "$(($((right + height/2)) * 100000 / $h))e-5" >> $filename
printf "%.5f " "$(($((width)) * 100000 / $w))e-5" >> $filename
printf "%.5f " "$(($((height)) * 100000 / $h))e-5" >> $filename
num=$((num + 1))
done < $dataset_path/groundtruth_rect.txt
echo "$dataset" > $dataset_path/otb.names
find $dataset_path/img -name \*.jpg > data/$dataset/train.txt
echo "classes = 1" > data/otb_$dataset.data
echo "train = data/$dataset/train.txt" >> data/otb_$dataset.data
echo "valid = data/$dataset/train.txt" >> data/otb_$dataset.data
echo "names = $dataset_path/otb.names" >> data/otb_$dataset.data
echo "backup = backup/" >> data/otb_$dataset.data
echo "results= results/" >> data/otb_$dataset.data

View File

@ -0,0 +1,18 @@
echo Run install_cygwin.cmd before:
rem http://cvlab.hanyang.ac.kr/tracker_benchmark/datasets.html
c:\cygwin64\bin\bash -l -c "cd %CD:\=/%/; echo $PWD"
c:\cygwin64\bin\dos2unix "%CD:\=/%/otb_get_labels.sh"
c:\cygwin64\bin\bash -l -c "cd %CD:\=/%/; %CD:\=/%/otb_get_labels.sh Suv 320 240"
c:\cygwin64\bin\bash -l -c "cd %CD:\=/%/; %CD:\=/%/otb_get_labels.sh Liquor 640 480"
c:\cygwin64\bin\bash -l -c "cd %CD:\=/%/; %CD:\=/%/otb_get_labels.sh Freeman4 360 240"
c:\cygwin64\bin\bash -l -c "cd %CD:\=/%/; %CD:\=/%/otb_get_labels.sh Human3 480 640"
pause

View File

@ -1,22 +0,0 @@
echo Run install_cygwin.cmd before:
rem http://cvlab.hanyang.ac.kr/tracker_benchmark/datasets.html
c:\cygwin64\bin\bash -l -c "cd %CD:\=/%/; echo $PWD"
c:\cygwin64\bin\wget http://cvlab.hanyang.ac.kr/tracker_benchmark/seq/Human3.zip
c:\cygwin64\bin\unzip -o "%CD:\=/%/Human3.zip"
c:\cygwin64\bin\dos2unix "%CD:\=/%/windows_otb_get_labels.sh"
c:\cygwin64\bin\bash -l -c "cd %CD:\=/%/; %CD:\=/%/windows_otb_get_labels.sh"
rem c:\cygwin64\bin\find "%CD:\=/%/img" -name \*.jpg > otb_train.txt
pause

View File

@ -1,28 +0,0 @@
#!/bin/bash
export LC_NUMERIC="en_US.UTF-8"
wd=`pwd`
IFS=','
dataset="Human3"
class_id=0
w=480
h=640
num=1
while read -a line; do
filename=$(printf "$dataset/img/%04d.txt" $num)
#rm $filename.txt
echo "$class_id " > $filename
printf "%.5f " "$(($((line[0] + line[2]/2)) * 100000 / $w))e-5" >> $filename
printf "%.5f " "$(($((line[1] + line[3]/2)) * 100000 / $h))e-5" >> $filename
printf "%.5f " "$(($((line[2])) * 100000 / $w))e-5" >> $filename
printf "%.5f " "$(($((line[3])) * 100000 / $h))e-5" >> $filename
num=$((num + 1))
done < $dataset/groundtruth_rect.txt
echo "$dataset" > $dataset/otb.names
find $dataset/img -name \*.jpg > otb_train.txt

View File

@ -263,7 +263,7 @@ void forward_crnn_layer_gpu(layer l, network_state state)
s.train = state.train;
s.workspace = state.workspace;
s.net = state.net;
if(!state.train) s.index = state.index; // use TC only for detection
//if(!state.train) s.index = state.index; // don't use TC at all (especially without cuda_convert_f32_to_f16() )
int i;
layer input_layer = *(l.input_layer);
layer self_layer = *(l.self_layer);