Structured learning for social group detection in crowds
Clone or download
Latest commit 4d3acb8 Sep 14, 2015
Type Name Latest commit message Commit time
Failed to load latest commit information.
mydata Update PUT YOUR DATASETS HERE Aug 11, 2014
.gitattributes :octocat: Added .gitattributes Aug 8, 2014
HValue.m commit 1 Aug 11, 2014 Update Sep 14, 2015
constraintFind.m commit 1 Aug 11, 2014
detectGroups.m commit 1 Aug 11, 2014
dtwk.m commit 1 Aug 11, 2014
featureMap.m commit 1 Aug 11, 2014
getClustersFromWindow.m commit 1 Aug 11, 2014
getFeaturesFromWindow.m commit 1 Aug 11, 2014
granger.m commit 1 Aug 11, 2014
heatMap.m commit 1 Aug 11, 2014
isClusterLegal.m commit 1 Aug 11, 2014
loadData.m commit 1 Aug 11, 2014
loadPreTrained.m commit 1 Aug 11, 2014
loss01.m commit 1 Aug 11, 2014
lossGM.m commit 1 Aug 11, 2014
lossM.m commit 1 Aug 11, 2014
main.m commit 1 Aug 11, 2014
prox.m commit 1 Aug 11, 2014
showClustering.m commit 1 Aug 11, 2014
test_struct_svm.m commit 1 Aug 11, 2014
trainFW.m commit 1 Aug 11, 2014


###structured learning for groups detection in crowd

Crowds are difficult to analyze, but the events worth to be understood are likely to be limited to the result of a cooperation between members of the same group. In this work, we propose a novel algorithm for detecting social groups in crowds by means of a Correlation Clustering procedure on people trajectories. The affinity between crowd members is learned through an online formulation of the Structural SVM framework and a set of specifically designed features characterizing both their physical and social identity, inspired by Proxemic theory, Granger causality, DTW and Heat-maps. To adhere to sociological observations, we introduce a loss function (G-MITRE) able to deal with the complexity of evaluating group detection performances. We show our algorithm achieves state-of-the-art results both in presence of complete trajectories and with tracklets provided by available detector/tracker systems.

###code and datasets

If you download this code you're half way ready to run it yourself! You'll first need to fetch some data as well.

In order to ease your first launch settings, we suggest you to download our datasets from ImageLab @ University of Modena. On these datasets we've already pretrained our model, so you'll just need to extract the zip file and put the content inside the 'mydata' folder. Suppose you've downloaded the datasets 'student003', starting from your main directory you should be able to see the following structure:

  • mydata > student003 > %06d.jpg (all the images)
  • mydata > student003 > trajectories.txt (your input file)
  • mydata > student003 > clusters.txt (your GT file, where groups are stored)
  • mydata > student003 > video_par.mat (some video settings)
  • mydata > student003.txt (pretrained parameters)
  • mydata > student003.mat (this is where the features, previously extracted, are saved)

If the file 'student003.mat' is missing, the system will just recompute the features and save it for the next time, so it's presence is not mandatory. For the datasets you download from our website, the algorithm has already a pretrained version. To exploit the pretrained version you have to set some parameter in Sec. 2 of the main code. Since each video has it's own parameters, you will also find a file named 'student003.txt' where you can copy/paste its content directly into the main code (from line 29 to 41, i.e. inside the "you can edit here!" part).

If you want to make new experiments on our datasets, you will probably have to recompute the features. Only then you'll be able to change the features employed, the length of the time window the training set size and so on. Of course, if you change the features, you might want to retrain your model as well!

Otherwise you can make up your dataset. For the code to run appropriately, you can just mimic the folder structure of one of our datasets. You will need the images, the input and the GT files as well as for the parameter mat file.

#####concluding remarks You may need to adjust matlab parallel jobs settings in order to run the code - but it will be just a matter of efficiency. Talking about efficiency: sorry the code is not optimized yet! If you find any bugs or need help in running the code, please contact one of the authors. Thank you!

###citation and contacts If you use this code, please cite the following article:

Solera, F.; Calderara, S.; Cucchiara, R., "Socially Constrained Structural Learning for Groups Detection in Crowd"
IEEE Transactions on Pattern Analysis and Machine Intelligence, Aug. 2015