agethen / RPAN

Our implementation of Recurrent Pose Attention in Du et al.: "RPAN: An End-to-End Recurrent Pose-attention Network for Action Recognition in Videos"
37 stars 15 forks source link

How to generate the annotation file like"example.csv" #3

Open sucaohan opened 5 years ago

sucaohan commented 5 years ago

Hello,I have downloaded the JHMDB dataset,but I don't know how to generate the annotation file like"example.csv",can you tell me?

agethen commented 5 years ago

Sorry for the late answer!

You will need to write your own script for that. The field id is the video name; actions is a collection of actions class ts te separated by ';', where ts is the start time and te the end time. Finally, length is the length of the video in seconds.

For many action recognition datasets, no ts or te are given, so you may just set them to 0.0 and the length of the video (in s).

Your code could look sth like this (python):

lines_annotation = [l.strip() for l in open( INPUT_FILE )]
output_file = open( OUTPUT_FILE, 'w' )

output_file.write( "id,actions,length\n" )
for l in lines_annotation:
  tokens = l.split( ... ) # Split by some character. Which one depends on dataset.
  video_name = tokens[ ... ]
  class_id = ...
  ts = ...
  te = ...
  len_in_s = ...
  output_file.write( video_name + "," + class_id + " " + ts +  " " + te + "," + len_in_s + "\n" )
output_file.close()