NOTES ON C3D
The C3D project pages:
http://www.cs.dartmouth.edu/~dutran/c3d/ The source code: https://github.com/facebook/C3D
Download the source code and make:
cp Makefile.config.example Makefile.config make clean make
set the paths:
export DYLDFALLBACKLIBRARYPATH=/usr/local/cuda/lib:$HOME/anaconda/lib:/usr/local/lib:/usr/lib export DYLDLIBRARYPATH=$DYLDLIBRARY_PATH:/usr/local/cuda/lib/
We tried the C3D feature extraction on video frames using CPU. 1. prepare the data
the videos are decoded to frames:
ffmpeg '-i' '/Users/Anna/workspace/C3D/examples/c3dfeatureextraction/UCF11updatedfrm/basketball/vshooting25/vshooting2506.mpg' '-filtercomplex' 'fps=fps=24.000000' '-q' '5' '-strict' 'experimental' '/Users/Anna/workspace/C3D/examples/c3dfeatureextraction/UCF11updatedfrm/basketball/vshooting25/vshooting25_06/%06d.jpg' '-threads' '0'
the following input files are needed:
inputlistfrm.txt outputlistprefix.txt c3dsport1mfeatureextractorfrm.prototxt
array1=("$filename/ 1 0") array2=("$filename/000001") echo $array1 >> inputlistfrm.txt echo $array2 >> outputlistprefix.txt
- generate the C3D feature
run the command line:
GLOGlogtosterr=1 ../../build/tools/extractimagefeatures.bin prototxt/c3dsport1mfeatureextractorfrm.prototxt conv3ddeepnetAsport1miter1900000 -1 50 1 prototxt/outputlist_prefix.txt fc7-1 fc6-1 prob
When we set multiple batches, there is an error:
F0914 17:45:44.359544 287137792 videodatalayer.cpp:123] Check failed: read_status Testing must not miss any example
A temporal solution is do one batch every time, using shell script to read a batch of files to the input list.
for((i=1;i<=2550;i=i+50))
do j=49
num=$(($i+$j))
sed -n ''$i','$num'p' prototxt/inputlistfrm1.txt > prototxt/inputlistfrm.txt sed -n ''$i','$num'p' prototxt/outputlistprefix1.txt > prototxt/outputlistprefix.txt
GLOGlogtosterr=1 ../../build/tools/extractimagefeatures.bin prototxt/c3dsport1mfeatureextractorfrm.prototxt conv3ddeepnetAsport1miter1900000 -1 50 1 prototxt/outputlist_prefix.txt fc7-1 fc6-1 prob
done
3.We prefer that the output features are in decimal instead of binary,so modify the file src/caffe/util/image_io.cpp:
f = fopen(fnblob.cstr(), "w"); ... fprintf(f,"%d,%d,%d,%d,%d",n,c,l,h,w); for(int i=0;i<(n * c * l * h * w);i++) {fprintf(f,",%lf",buff[i]);} fclose(f);