Human Pose (ECCV '14) - Training Data
Evaluation metrics
In the file ChalearnLAPEvaluation.py there are some methods for evaluation. The first important script allows to export the labels of a set of frames into a ground truth folder, to be used to get the final ovelap value. Let's assume that you use the sequences 1 to 3 for validation purposes, and have a folder valSamples with the files Seq01.zip to Seq03.zip as you downloaded from the training data set. We can create a ground truth folder gtData using:
>> from ChalearnLAPEvaluation import exportGT_Pose
>> exportGT_Pose(valSamples,gtData)
This method exports the label files and data files for each sample in the valSample folder to the gtData folder. This new ground truth folder will be used by evaluation methods.
For each RGB image, we need to store the binary mask predictions in a PNG file in the same format as the ground truth is provided. That is a PNG binary file for each RGB image and for each actor. This file must be named XX_YYYY_W_prediction.jpg where XX denotes the sequence, YYYY denotes the frame, W denotes the actor in the sequence (1 if its at the left part of the image, 2 if its at the right part). To make it easy, the class PoseSample allows to store this information for a given sample. Following the example from last section, we can store the predictions for sample using:
>> from ChalearnLAPSample import PoseSample
>> poseSample = PoseSample("SeqXX.zip")
Now, if our predictions are that we have not detected the head (limbid = 1) for the first actor in the scene in the frame of the sequence, and we want to store predictions in a certain folder valPredict, we can use the following code:
>> actionSample = poseSample("SeqXX.zip")
>> im1=numpy.zeros((360,480))
>> poseSample.exportPredictions(im1,framenumber=1,actorid=1,limbid=1,valPredict)
Assuming previous defined paths and objects, to evaluate the overlap for a single labeled sample prediction, that is, prediction for a sample from a set where labels are provided, we can use:
>> overlap=poseSample.evaluate(valPredict)
Once all predictions for a sequence are stored in pathPredIn using the above functions, the user can generate the panoramic 360*(480*14) pixels images by using the following call:
>> poseSample.convertPredictions(pathPredIn, pathPredOut)
Finally, to obtain the final score for all the predictions, in the same way performed in the Codalab platform, we use:
>> from ChalearnLAPEvaluation import exportGT_Pose
>> score=evalPose(valPredict,predData)