|
| 1 | +# Parameter settings |
| 2 | +FV_GMM_NCOMPONENTS = 256 |
| 3 | +FASTFV_KNN = 5 |
| 4 | + |
| 5 | +# uncomment next three lines to enable flann |
| 6 | +#FASTFV_FLANN_NTREES = 4 |
| 7 | +#FASTFV_FLANN_NCOMPARISONS = 32 |
| 8 | +#FASTFV_QUANTIZER = --enableflann $(FASTFV_FLANN_NTREES) $(FASTFV_FLANN_NCOMPARISONS) |
| 9 | + |
| 10 | +# comment next line to disable s-t grids |
| 11 | +FV_SPATIO_TEMPORAL_GRIDS = --enablespatiotemporalgrids |
| 12 | + |
| 13 | +# comment next line and uncomment the one after to use yael |
| 14 | +FV = $(FASTFV) |
| 15 | +#FV = ../yaelfv.py |
| 16 | + |
| 17 | +# Tools paths |
| 18 | +FASTVIDEOFEAT = ../../bin/fastvideofeat |
| 19 | +FASTFV = ../../bin/fastfv |
| 20 | +YAELDIR = ../../bin/dependencies/yael/yael |
| 21 | +export PYTHONPATH := $(shell pwd)/$(YAELDIR):$(PYTHONPATH) |
| 22 | + |
| 23 | +# repro below |
| 24 | +clipFile = allClips.txt |
| 25 | +allClips = $(shell cat $(clipFile)) |
| 26 | + |
| 27 | +videoDir = data/dataset/avi |
| 28 | +evalDir = data/dataset/testTrainMulti_7030_splits |
| 29 | +recodedDir = data/dataset/avi_recoded |
| 30 | + |
| 31 | +dataset = $(addprefix $(videoDir)/, $(allClips)) |
| 32 | +features = $(addprefix data/features/, $(addsuffix .txt, $(allClips))) |
| 33 | +features_sampled = data/features_sampled.txt |
| 34 | +vocabs = $(addprefix data/vocabs/, 10-105.hog.gmm 106-213.hog.gmm 214-309.mbhx.gmm 310-405.mbhy.gmm) |
| 35 | +fisher_vectors = $(addprefix data/fisher_vectors/, $(addsuffix .txt, $(allClips))) |
| 36 | +kernel = data/kernel.txt |
| 37 | +classification = data/classification.txt |
| 38 | +report = data/report.txt |
| 39 | +artefactDirs = data/features data/vocabs data/fisher_vectors data/dataset/avi_recoded logs/features logs/fisher_vectors logs/vocabs logs/recoding |
| 40 | + |
| 41 | +log = $(subst data, logs, $@).log |
| 42 | +vocab = $(basename $(basename $(notdir $(1)))) $(1) |
| 43 | + |
| 44 | +all: $(report) |
| 45 | + echo "Report on HMDB-51 classification task." |
| 46 | + echo "Reported accuracies are accuracies on dataset splits." |
| 47 | + echo "" |
| 48 | + cat $(report) |
| 49 | + |
| 50 | +$(artefactDirs) data/dataset: |
| 51 | + mkdir -p $@ |
| 52 | + |
| 53 | +$(dataset): $(videoDir) |
| 54 | + |
| 55 | +$(features): $(dataset) | $(artefactDirs) |
| 56 | + ffmpeg -y -an -i $(videoDir)/$(basename $(notdir $@)) -vcodec libxvid -q:v 1 $(recodedDir)/$(basename $(notdir $@)) > $(subst features,recoding, $(log)) 2>&1 |
| 57 | + $(FASTVIDEOFEAT) $(recodedDir)/$(basename $(notdir $@)) > $@ 2> $(log) |
| 58 | + |
| 59 | +$(features_sampled): $(features) |
| 60 | + awk '{ if (rand() <= .01) print }' data/features/* > $@ |
| 61 | + |
| 62 | +$(vocabs): $(features_sampled) |
| 63 | + cat $(features_sampled) | ../../src/gmm_train.py --gmm_ncomponents $(FV_GMM_NCOMPONENTS) --vocab $(call vocab, $@) > $(log) 2>&1 |
| 64 | + |
| 65 | +$(fisher_vectors): $(features) $(vocabs) |
| 66 | + cat $(subst fisher_vectors,features, $@) | $(FV) --xpos 0 --ypos 1 --tpos 2 --knn $(FASTFV_KNN) $(FASTFV_QUANTIZER) $(FV_SPATIO_TEMPORAL_GRIDS) $(foreach g, $(vocabs), --vocab $(call vocab, $(g))) > $@ 2> $(log) |
| 67 | + |
| 68 | +$(kernel) : $(fisher_vectors) |
| 69 | + ../dot_kernel.py data/fisher_vectors $(clipFile) > $@ |
| 70 | + |
| 71 | +$(classification) : $(kernel) |
| 72 | + cat $(kernel) | ./classify.py $(evalDir) $(clipFile) > $@ |
| 73 | + |
| 74 | +$(report): $(classification) |
| 75 | + ../report.py > $@ |
| 76 | + |
| 77 | +$(videoDir): | data/dataset |
| 78 | + wget http://www.rarlab.com/rar/rarlinux-3.9.1.tar.gz |
| 79 | + wget http://serre-lab.clps.brown.edu/wp-content/uploads/2013/10/hmdb51_org.rar |
| 80 | + wget http://serre-lab.clps.brown.edu/wp-content/uploads/2013/10/test_train_splits.rar |
| 81 | + mkdir -p $(videoDir) |
| 82 | + tar -C data/dataset -xf rarlinux-3.9.1.tar.gz |
| 83 | + data/dataset/rar/unrar x test_train_splits.rar data/dataset |
| 84 | + data/dataset/rar/unrar x hmdb51_org.rar $(videoDir) |
| 85 | + data/dataset/rar/unrar x '$(videoDir)/*.rar' $(videoDir) |
| 86 | + find $(videoDir) -name '*.avi' -exec bash -c 'mv "{}" $(videoDir)/$$(echo $$(basename "{}") | sed "s/[][;()&?!]/_/g")' \; 2> /dev/null |
| 87 | + rm rarlinux-3.9.1.tar.gz hmdb51_org.rar test_train_splits.rar $(videoDir)/*.rar |
| 88 | + |
| 89 | +clean: |
| 90 | + rm -rf $(artefactDirs) $(features_sampled) $(kernel) $(classification) $(report) |
0 commit comments