Skip to content

Dataset creation

RoboTuan edited this page May 3, 2021 · 15 revisions

Create the dataset from the recorded frames

In this section there are the several steps needed to obtain the bounding boxes from a recorded sequence.

After you recorded the sequences with the mods, you will need to copy inside the sequence folders their relative log_%d.txt and peds_%d.txt files. Example: your just recorded the sequence "seq_3_day_60", this means that you will need to copy the log_4.txt and peds_4.txt files in that folder. To build the raw dataset instead, you will need to create a base directory for this task and transfer inside it the follders of the recorded sequences (such as seq_3_day_60 which is the fourth sequence, starting from 0, recorded at day time with double cameras, that is 60 FPS). After doing so, you will need to launch the "add_sequence.sh" script with the proper input arguments as is it explained below. This script handles other python scripts and will save the bounding boxes in the directories "bboxes_cam%d" for the first and second camera (if present). On top of that, it also saves the raw video for each camera as well as the video with the bounding boxes. These are meant to be used only for debugging. Then, you will still need to manually verify if the selected bounding boxes should be discarded or not for each ped. In the future we will add more rules to properly select "good" bounding boxes with less human supervision. The information for the joints at each frame for each ped are still avaiable as in the original work.


We now provide some information about the main scripts and their actions. They were adapted from this work and they share the same structure.

  • add_sequence.sh: this script handles the execution of the main other scripts (double_camera.sh, from_csv_to_json.py, from_frame_to_mp4.py, save_bboxes.py, visualize.py).
    • usage example: ./add_sequence.sh -p /path/to/raw_sequences/folder/ -s seq_3_day_60
  • double_camera.sh: it is responsible for separating the two camera views frames (if present) in different folders.
    • it accept as option -f 30 for videos with single camera
    • usage example: ./double_camera -p /path/to/sequence/ -f 60
  • from_csv_to_json.py: it transforms the csv coordinates in a json file for each camera, discarding some of the original columns.
    • it accept as option --path_to_coords that is the path to the coordinate csv file of a sequence
    • usage example: python from_csv_to_json.py --path_to_coords path/to/the/coord.csv
  • from_frame_to_mp4.py: it combines the jpeg frames of a camera into an mp4 video.
    • it accept as options --input, that is the folder of the frames of camera in a recorded sequence, and output which is the output video.
    • usage example: python from_frame_to_mp4.py --input /path/to/sequences/seq_0_60/cam2/*.jpeg --output /path/to/sequences/seq_0_60/cam2.mp4
  • save_bboxes.py: this script saves the bounding boxes that have an intersection area with the other ones in the same frame less than 60% of the original area. It works together with pose.py and joint.py.
    • requires Python >= 3.6 (see requirements.txt for more details)
    • usage example: python save_bboxes.py --in_frames_path path/to/sequences/sequence_5_60/cam1/ --json_file_path path/to/sequences/sequence_5_day_60/seq_5_day_cam1.json --out_bboxes_path path/to/sequences/sequence_5_60/bboxes_cam1/
  • visualize.py: Python script that provides a visual representation of the annotations.
    • requires Python >= 3.6 (see requirements.txt for more details)
    • usage example: python visualize.py --in_mp4_file_path path/to/sequences/sequence_5_60/cam1.mp4/ --json_file_path path/to/sequences/sequence_5_day_60/seq_5_day_cam1.json --out_mp4_file_path path/to/sequences/sequence_5_60/ann_cam1.mp4

All the other included scripts support the main ones or are basic statistics and simple checks.

Clone this wiki locally