Converting MPII annotation .mat to .csv

As I am aiming to train DLC model on a specific “acitivity” of MPII human pose dataset, I wanna to convert the .mat MPII annotation file to a .csv file including the information of activity type. Afterwards i will delete all not desired activities and bring it in the desired .csv format which DLC uses.

I am trying hard but failing so far - any idea of doing this .mat --> .csv conversion?

I’m not sure; the .mat is a matlab filetype, so I would look there for mat to csv.

Did you see my question to you? Pretrained resnet on MPII human pose data

also, the CSV files are not used in the network training, they are just for you to easily look at them. The h5 file is used. In 2.0.4 we have a function to convert csv to h5 though:

Signature: deeplabcut.convertcsv2h5(config, userfeedback=True, scorer=None)
Convert (image) annotation files in folder labeled-data from csv to h5.
This function allows the user to manually edit the csv (e.g. to correct the scorer name and then convert it into hdf format).
WARNING: conversion might corrupt the data.

config : string
    Full path of the config.yaml file as a string.

userfeedback: bool, optional
    If true the user will be asked specifically for each folder in labeled-data if the containing csv shall be converted to hdf format.
scorer: string, optional
    If a string is given, then the scorer/annotator in all csv and hdf files that are changed, will be overwritten with this name.


Convert csv annotation files for reaching-task project into hdf.


Convert csv annotation files for reaching-task project into hdf while changing the scorer/annotator in all annotation files to Albert!


I’m afraid you will have to edit this yourself; there is no functionality for this in DLC. (you can look of course at the code in to see how we create the mat file.

Hey guys, thanks for your help! I got the conversion mat2csv running:
It copies all images + annotations of one activity (golf) of MPII dataset in the correct format of DLC-annotation.csv. Then I use deeplabcut.convertcsv2h5 which works perfectly :slight_smile:


I started training with the pretrained ImageNet resnet models and I am wondering if it even works with DLC as the 183 golf pictures from MPII datasets varying in size from 640x480 to 1920x1080 with the people being placed all over the picture. ResNets need a dataset with the same image input size right? MPII dataset provides information of location and bounding box of the annotated person - should I use it or does DLC take care of itself? If yes, how does DLC do it :)?

DLC takes care of it - your images can be different sizes, but be sure to change the max_input_size: if your images are >1500 pixels, as those are not used to avoid GPU memory crashes! The default is now 1500 (it was previously 1000, btw); this is in pose_config.yaml

Wow thats cool! Yeah i already put max_input_size=2000. Lets see if it crashes :slight_smile: Thanks!

1 Like

For such large images, make sure you use auto-cropping augmentation!