0

I'm new to this kind of image processing work. And I want to build an MPII dataset described hereclass for training a pytorch network on it. I tend to work with Python 3.6 and pytorch 1.4

The problem is mainly from that MPII dataset annotation (download here) is in .mat form, which I'm not very familiar with. There are also some implementations I found on Github, like this deep high resolution net, and also this Microsoft MPII dataset for python. The latter is actually adopted in many implementations on the MPII dataset, but it's way too old. It's built with pytorch==0.4.0 and python2, creating a lot of environmental conflict problems.

What I want to do now is just to build a simple pytorch dataset which can automatically extract the joint positions in the 'annotation/' directory, and combine it with the specific image in 'image/' directory. I hope the return value is just a dictionary with these two items, that's all I need.

I also noticed that many researchers tend to convert the original '.mat' annotation file to '.json' format. I think this will make it much easier to operate, but there is some troubles when I'm trying to do this.

Python 3.6.10 |Anaconda, Inc.| (default, Jan  7 2020, 21:14:29)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import json
>>> from scipy.io import loadmat
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/billy/miniconda3/envs/datasci/lib/python3.6/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "/home/billy/miniconda3/envs/datasci/lib/python3.6/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/home/billy/miniconda3/envs/datasci/lib/python3.6/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/home/billy/miniconda3/envs/datasci/lib/python3.6/json/encoder.py", line 180, in default
  File "/home/billy/miniconda3/envs/datasci/lib/python3.6/json/encoder.py", line 180, in default
    o.__class__.__name__)
TypeError: Object of type 'bytes' is not JSON serializable

I also saw this question on this site, but I am not sure I understand what is wrong... I 'd appreciate any help very much!!

Rashed Hasan
  • 3,721
  • 11
  • 40
  • 82

1 Answers1

0

You probably would have solved this problem since 9 months have passed, but my simple solution to these kind of environment/installation problems is to utilize virtual or online environments. One example is the Google Colab. You could convert to .json format using tools instead of you local environment, and apply the converted file on you ML application.

Scott
  • 4,974
  • 6
  • 35
  • 62
krenerd
  • 741
  • 4
  • 22