DroneDetectionThesis / Drone-detection-dataset

Dataset containing IR, visible and audio data to be used to train drone detection systems.
Creative Commons Zero v1.0 Universal
121 stars 28 forks source link

How to open bounding box annotations in Python SciPy? #3

Open daniperfer opened 6 months ago

daniperfer commented 6 months ago

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?

DroneDetectionThesis commented 6 months ago

No, unfortunately I don't since I only used Matlab for my thesis.

But anyway, this is how the data is organized:

[image: bild.png]

[image: bild.png]

[image: bild.png]

[image: bild.png]

So first column of the LabelData is the time stamp of the image in the video. Then in the next coulmn you have the coordinates of the area of the targets of airplane type (note that in some videos there are several targets at once, for example in IR_DRONE_143.mp4). Next are the columns with birds, drones and helicopter type targets respectively.

Hope you can figure out how to import the dataset into Python!

Best regards, Fredrik

Den ons 21 feb. 2024 kl 10:48 skrev Dani Pereira @.***>:

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?

— Reply to this email directly, view it on GitHub https://github.com/DroneDetectionThesis/Drone-detection-dataset/issues/3, or unsubscribe https://github.com/notifications/unsubscribe-auth/APSY4W2GUVBUS5ESOWXXTIDYUW7IDAVCNFSM6AAAAABDSWUISSVHI2DSMVQWIX3LMV43ASLTON2WKOZSGE2DMMRYG44DGMQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

daniperfer commented 6 months ago

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.

Alexander-Zadorozhnyy commented 1 month ago

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

DroneDetectionThesis commented 1 month ago

Hi!

If you send an e-mail directly to @.***, I can reply with some images regarding the organization of the data (attaching images is apparently not possible if done through GitHub). I have sent this to a few people before, but have not received any feedback thereafter (which I have interpreted as a sign that they have succeeded with the import into Python).

Best regards, Fredrik

Den mån 22 juli 2024 kl 16:26 skrev Alexander Zadorozhnyy < @.***>:

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

— Reply to this email directly, view it on GitHub https://github.com/DroneDetectionThesis/Drone-detection-dataset/issues/3#issuecomment-2243097763, or unsubscribe https://github.com/notifications/unsubscribe-auth/APSY4W2AA2FE3MEO52ZAHX3ZNUJBRAVCNFSM6AAAAABDSWUISSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBTGA4TONZWGM . You are receiving this because you commented.Message ID: @.*** com>

Alexander-Zadorozhnyy commented 1 month ago

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

daniperfer commented 1 month ago

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.

Alexander-Zadorozhnyy commented 1 month ago

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:)

DroneDetectionThesis commented 1 month ago

Alexander Your mail got stuck in the junk-mail-folder, so I didn't see it until now.

Dani Thank you for the guidance!

Best regards, Fredrik

Den tis 23 juli 2024 kl 09:40 skrev Alexander Zadorozhnyy < @.***>:

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:)

— Reply to this email directly, view it on GitHub https://github.com/DroneDetectionThesis/Drone-detection-dataset/issues/3#issuecomment-2244481227, or unsubscribe https://github.com/notifications/unsubscribe-auth/APSY4W6DX7CYISNYFUK76P3ZNYCFHAVCNFSM6AAAAABDSWUISSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENBUGQ4DCMRSG4 . You are receiving this because you commented.Message ID: @.*** com>