DroneDetectionThesis/Drone-detection-dataset

How to open bounding box annotations in Python SciPy?

Opened this issue · 8 comments

Hi:

I am trying to import .mat ground truth annotations files in a Python environment using the scipy.io.loadmat command.

import scipy.io as io
file_content = io.loadmat("V_DRONE_094_LABELS.mat")

By doing this we've got the following contents:

>>> file_content
{'__header__': b'MATLAB 5.0 MAT-file, Platform: PCWIN64, Created on: Wed Apr  1 22:45:27 2020', '__version__': '1.0', '__globals__': [], 'None': MatlabOpaque([(b'gTruth', b'MCOS', b'groundTruth', array([[3707764736],
       [         2],
       [         1],
       [         1],
       [         1],
       [         5]], dtype=uint32))],
             dtype=[('s0', 'O'), ('s1', 'O'), ('s2', 'O'), ('arr', 'O')]), '__function_workspace__': array([[ 0,  1, 73, ...,  0,  0,  0]], dtype=uint8)}

That is, the file contains a dictionary with five keys: ['__header__', '__version__', '__globals__', 'None', '__function_workspace__']

The element labeled as None has a gTruth and groundTruth. But they are of bytes type (b'gTruth'). We have not found a way of accesing to this information.

MatlabOpaque([(b'gTruth', b'MCOS', b'groundTruth', array([[3707764736],
       [         2],
       [         1],
       [         1],
       [         1],
       [         5]], dtype=uint32))],
             dtype=[('s0', 'O'), ('s1', 'O'), ('s2', 'O'), ('arr', 'O')])

Do you know any way for correctly loading the mat annotations files in Python env?

Thank you for your answer, Fredrik.
I think this information about how data is organized is very useful. Unfortunately, the images you've attached in your answer by e-mail are not visible from GitHub interface.

If you could re-send the same e-mail with the attached images to my address (dpereira@gradiant.org), It would be great.

Hello, I'm also trying to export this data using Python. Does anyone fond a solution to do it correctly?

I sent an email, but it may not have reached you if the email address does not match what is listed on GitHub. In your answer I can see only @.***

Therefore, just in case, I will write, also make sure that you can send all the materials to sasha.zadorojnii2013@yandex.ru

Hello, we tried to export annotations with Python some time ago, but in the end, we couldn’t achieve it. The method that worked for us was using Matlab with the Computer Vision toolbox. Of course, that requires a license. If you’re part of an academic institution, you might be able to obtain one... Regards.

Hello! Thanks for the comment regarding the use of this dataset and the time saved! Then we will have to purchase a license in this case:)