Giter VIP home page Giter VIP logo

prophesee-ai / prophesee-automotive-dataset-toolbox Goto Github PK

View Code? Open in Web Editor NEW
148.0 13.0 30.0 1.31 MB

A set of Python scripts to evaluate the Automotive Datasets provided by Prophesee

License: Apache License 2.0

Python 89.85% Jupyter Notebook 10.15%
machinelearning machine-learning-algorithms machine-learning dataset automotive event-based computer-vision pattern-recognition autonomous-driving perception

prophesee-automotive-dataset-toolbox's Introduction

Prophesee's Automotive Dataset Toolbox

Prophesee Automotive Dataset

This repository contains a set of Python scripts to evaluate the Automotive Datasets provided by Prophesee.

Requirements

The scripts can be launched with Python 2.x or Python 3.x:

  • io requires NumPy
  • visualize requires also OpenCV with python bindings.

You can install all the dependencies using pip:

pip install numpy
pip install opencv-python

Get the data

1 Megapixel Automotive Detection Dataset

Go to the dataset presentation page and download the dataset. The dataset is split between train, test and val folders. Files consist of 60 seconds recordings that were cut from longer recording sessions. Cuts from a single recording session are all in the same training split.

Bounding box annotations for 7 classes (pedestrians, two-wheelers, cars, trucks, buses, traffic signs, traffic lights) are obtained in a semi automated way. For more details, please refer to our NeurIPS paper. Also note that, as explained in the paper, the official evaluation code considers only 3 classes for mAP computation (pedestrians, two-wheelers, cars).

GEN1 Automotive Detection Dataset

Go to the dataset presentation page and download the dataset. (200G compressed and 750G uncompressed !). The dataset is split into 10 archive files that can be independently used (2 for testing and validation sets each and six for training set). Each archive contains up to 500 files and their annotations.

Please notice that compared to the 1Mpx dataset, the Gen1 dataset contains only annotations for pedestrians, and cars. Moreover, in contrast with the 1Mpx dataset, these labels were manually annotated. For more details, please refer to our article

Visualization

To view a few files and their annotation just use python3 dataset_visualization.py file_1_td.dat file_2_td.dat ... file_n_dat And it will display those events video in a grid. You can use it with any number of files, but a large number of them will make the display slow!

Reading files in python

There is a convenience class to read files that works both for the event .dat files and their annotations. A small tutorial can be found here

Running a baseline

Now you can start by running a baseline either by looking into the last results in event-based literature or by leveraging the e2vid project of the University of Zurich's Robotic and Perception Group to run a frame-based detection algorithm!

Evaluation using the COCO API

DISCLAIMER: New Dataset!

To account for the 1 Megapixel Automotive Detection Dataset described in our NeurIPS article: "Learning to Detect Objects with a 1 Megapixel Event Camera" by Etienne Perot, Pierre de Tournemire, Davide Nitti, Jonathan Masci and Amos Sironi, the format has slightly changed. Essentially ts has been renamed t in events and box events, alongside confidence is now class_confidence Also now, for comparison with our result inside this paper, you need to filter too small boxes and boxes appearing before 0.5s inside each recording. We provide such function as following example will show.

If you install the API from COCO you can use the provided helper function in metrics to get mean average precision metrics. This is a usage example if you saved your detection results in the same format as the Ground Truth:

import numpy as np
from src.metrics.coco_eval import evaluate_detection
from src.io.box_loading import reformat_boxes

RESULT_FILE_PATHS = ["file1_results_bbox.npy", "file2_results_bbox.npy"]
GT_FILE_PATHS = ["file1_bbox.npy", "file2_bbox.npy"]

result_boxes_list = [np.load(p) for p in RESULT_FILE_PATHS]
gt_boxes_list = [np.load(p) for p in GT_FILE_PATHS]

# For backward-compatibility
result_boxes_list = [reformat_boxes(p) for p in result_boxes_list]
gt_boxes_list = [reformat_boxes(p) for p in gt_boxes_list]

# For fair comparison with paper results
gt_boxes_list = map(filter_boxes, gt_boxes_list)
result_boxes_list = map(filter_boxes, result_boxes_list)

evaluate_detection(gt_boxes_list, result_boxes_list)

We provide a complete evaluator at src/psee_evaluator.py. Note that box filtering uses a diagonal threshold different for the 1 megapixel camera and for the qvga one (60 and 30).

Credit

When using those tools in an academic context, please cite the article "Learning to Detect Objects with a 1 Megapixel Event Camera" by Etienne Perot, Pierre de Tournemire, Davide Nitti, Jonathan Masci, Amos Sironi, In 34th Conference on Neural Information Processing Systems (NeurIPS) 2020

Contacts

The code is open to contributions, so do not hesitate to ask questions, propose pull requests or create bug reports. For any other information or inquiries, contact us here

prophesee-automotive-dataset-toolbox's People

Contributors

dmigliore avatar etienne87 avatar laurentbristiel avatar lbristiel-psee avatar pierredet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

prophesee-automotive-dataset-toolbox's Issues

Label problem

Dear author:
While I use the code below to change the labels.npy to labels.txt(for yolo) I found something unusual:
label
In some label.txt xc is bigger than 1 just like this
QQ截图20240410214143
Is the problem of my code or the prime data has problem?
Thanks for your answer
Additionally an anomaly like x=1308 is a low-probability event,after add an conditional statement the problem in my earlier issue will be solved

About dataset_visualization.py

Hi,
I have a question about 'dataset_visualization.py'. If the file only visualize initial input datasets? If I try to object detection on GEN1, and want to visualize the results (include label and score..), how can I modify the code?
I don't know if I expressed myself clearly. Looking forward to your reply, thank you!

Weird results when evaluating GT bbox

Hi, first I'd like to thank you for releasing this wonderful work. I'm working on event-based detection on the 1Mpx dataset. As a sanity check, I ran the evaluation code provided in the README, and input the GT bbox as both the prediction result and the GT labels. I expected to see a 100 mAP, but it actually gives me 0.

After digging into the code, I think this is because of the hyper-parameter time_tol here. Since the annotation frequency of 1Mpx is 30/60 Hz, which is higher than the default time_tol=50000us = 20Hz, when we do _match_times(), the predicted boxes will be matched to the GT bboxes that is 1 frame before it. Thus, this mismatch results in 0 mAP. I change the time_tol to 5000us = 200Hz, and now I can get 100 mAP.

So I'm curious, when you evaluate your model, did you e.g. down-sample the annotation frequency, i.e. evaluate on less timestamps? (I didn't find it in the paper) If not, didn't you encounter this issue in the past?

when using dataset_visualization.py runing sometimes., this error occur?

Is the python version occur this?

.\src\io\psee_loader.py:139: RuntimeWarning: overflow encountered in long_scalars

count = (min(self._end, pos + batch * self._ev_size) - pos) // self._ev_size
.\src\io\psee_loader.py:156: RuntimeWarning: overflow encountered in long_scalars
self._file.seek(start + idx * self._ev_size)
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.1.3\plugins\python-ce\helpers\pydev\pydevd.py", line 1483, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
File "C:\Program Files\JetBrains\PyCharm Community Edition 2021.1.3\plugins\python-ce\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "/prophesee_toolbox/dataset_visualization.py", line 86, in
play_files_parallel(ARGS.records, skip=ARGS.skip, delta_t=ARGS.delta_t)
File "/prophesee_toolbox/dataset_visualization.py", line 52, in play_files_parallel
events = [video.load_delta_t(delta_t) for video in videos]
File "/prophesee_toolbox/dataset_visualization.py", line 52, in
events = [video.load_delta_t(delta_t) for video in videos]
File "\prophesee_toolbox\src\io\psee_loader.py", line 156, in load_delta_t
self._file.seek(start + idx * self._ev_size)
OSError: [Errno 22] Invalid argument

Torrent file for downloading datasets not working

Hello, thanks for the nice datasets. I am trying to download the 1 Megapixel Automotive Detection Dataset and the GEN1 Automotive Detection Dataset. While both datasets have a torrent file provided, I was not able to download the files using the torrent files. I wonder if there are any issues with the torrent files. While directly downloading from the owncloud repository is an option, it takes too long (as noted from another issue).

Question about bbox filtering and labels

I have have questions about the default filtering of bbox labels and bbox labels in general:

  • These line of code suggest that if 'GEN1' is used, the min_box_side parameter is larger than for 'GEN4'. The GEN4 resolution is much higher, which is why I am a bit confused about this choice. Is there a specific reason for this?
  • In your Neurips paper, there is no mention of the min_box_side filter. Was this filter used for evaluation? If yes, which value was used?
  • In the GEN1 dataset I noticed that some bounding boxes are partially outside the camera frame. Is this intentional? (I don't remember in which files this was the case).

Thank you for your work!

trouble reading the data

Hi,
I am trying to visualize the data using code you have provided. The events and boxes are coming up empty. Any idea why?
events = videos.load_delta_t(delta_t) box_events = box_videos.load_delta_t(delta_t) for index, (evs, boxes) in enumerate(zip(events, box_events)):

thank you for your help

The detection algorithm

Hello,I am interseted in your paper, this is so interseting.
But I do not find the RED algorithm you proposed in the repo, the codes in the src are only related to the dataset.
If I want to verify the performance, what should I do? Could you give me some suggestions.
Hope for your reply.

Availability of GPS data

Hi there,
I would be interested in the GPS data besides the annotation for cars/pedestrians. Is there any chance to access these data?

Many thanks,
Tobias

how to change the dat to frame

dear author
I just download zhe testfileslist02.7z as my dataset.So how can I change the dat files to image frames
Thanks for your answer

How to visualize in linux?

When I run "dataset_visuallization.py", the error is :

qt.qpa.xcb: could not connect to display xx.xxx.xxx.xxx:0.0 ( xx.xxx.xxx.xxx is my ip)
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/ma-user/anaconda3/envs/openmmlab/lib/python3.7/site-packages/cv2/qt/plugins" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: xcb, eglfs, minimal, minimalegl, offscreen, vnc.

Aborted

How can I solve it?

training result on Gen1

Hi,

I used your example code train_detection.py to reproduce RED model on Gen1 dataset, using this command:
python train_detection.py ./log/ ./data/Gen1_event_cube/ --classes pedestrian car

The model is Vanilla model in your metavision lib.
After training 20 epochs, I used this command to evaluate:
python train_detection.py ./log/ ./data/Gen1_event_cube/ --just_test --checkpoint ./log/checkpoints/epoch=14-step=483206.ckpt

Got 0.53 mAP, much higher than your paper reported. The dataset is downloaded directly from your website.
.
But I also tried to reproduce your result on Gen4 dataset and got a similar result as you reported. So what could be the problem on Gen1?Or did you retrain your model on Gen1?

Dataset format issues

This code is used to read files in. dat format, but the format of the dataset I downloaded is. h5. May I ask what operation is required to read the. h5 format dataset through this code, or how to obtain the. dat format from the. h5 format dataset

Problem with psee_evaluator

When I run psee_evaluator.py I always get this error:

C:\Event_Camera\AI\prophesee-automotive-dataset-toolbox\src>python psee_evaluator.py gt_folder=C:\Event_Camera\AI\prophesee-automotive-dataset-toolbox\testfilelist02\gt dt_folder=C:\Event_Camera\AI\prophesee-automotive-dataset-toolbox\testfilelist02\2 There are 0 GT bboxes and 0 PRED bboxes creating index...
index created!
Loading and preparing results...
Traceback (most recent call last):
File "psee_evaluator.py", line 49, in main() File "psee_evaluator.py", line 45, in main evaluate_folders(opt.dt_folder, opt.gt_folder, opt.camera)
File "psee_evaluator.py", line 36, in evaluate_folders
evaluate_detection(gt_boxes_list, result_boxes_list)
File "C:\Event_Camera\AI\prophesee-automotive-dataset-toolbox\src\metrics\coco_eval.py", line 52, in evaluate_detection _coco_eval(flattened_gt, flattened_dt, height, width, labelmap=classes)
File "C:\Event_Camera\AI\prophesee-automotive-dataset-toolbox\src\metrics\coco_eval.py", line 109, in _coco_eval coco_pred = coco_gt.loadRes(results)
File "C:\Users\X\AppData\Local\Programs\Python\Python38\lib\site-packages\pycocotools\coco.py", line 329, in loadRes if 'caption' in anns[0]:
IndexError: list index out of range

I just put one .npy file from testfilelist02 dataset to
C:\Event_Camera\AI\prophesee-automotive-dataset-toolbox\testfilelist02\gt
C:\Event_Camera\AI\prophesee-automotive-dataset-toolbox\testfilelist02\2
folders.

And also I tryed to to evaluate my .npy (after passed .DAT file from dataset) file with .npy file from testfilelist02 , but anyway I receive this issue.
Python version 3.8.10.

How to solve this issue?

Thanks!

Issue in data read

Hi, I was trying to display the data but it is giving me an error that the index is out of range. Can you please help me to address this? I am using google colab.
image

resolution problem

Dear author
while i use the code below to transfer the dat to image I found something unusual:
The code is below:

QQ截图20240407154952
But one error made that x=1308 out of index,however in papers the 1MPX dataset's resolution is 1280x720。is this just an incorrect data produced by camera or the resolution is not 1280*720

Error while loading a dat file

Hi, I was trying to visualize a .dat file from Prophesee_dataset_car_n and your visualization file is giving me an error like this.
image
Can you please help me to figure it out? Thanks

labels on Gen1

Hi,

Gen1 has the following labels:
LABELMAP_LARGE = ['pedestrian', 'two wheeler', 'car', 'truck', 'bus', 'traffic sign', 'traffic light']

but only seems to be using the following labels:
LABELMAP = ["car", "pedestrian"]

Why is this happening?

1 Megapixel Automotive Detection Dataset

Hello, thanks for your sharing. I have some questions about 1 Megapixel Automotive Detection Dataset. Could you help me on that?

1. When I used your dataset visualization toolbox, I found that some labels are not aligned and some events are just like mosaic. Here are some examples and I am confused of that. I wonder whether you have cleaned the data in certain way before training?

图片1

2. Since the 1 Megapixel Automotive Detection Dataset only provides event data without rgb, I cannot distinguish day/night data. I wonder whether there is a way that I can pick out the event data recorded in the night.

Thanks a lot!

failed to get_size()

video = PSEELoader(file_path) video.get_size()

[None, None]

when I tried to get the size of NCARS datasets, it got None.

Does the 1 Megapixel Automotive Detection Dataset only contains 7GB data for training?

Hello, I'd like to download the 1 Megapixel Automotive Detection Dataset at https://kdrive.infomaniak.com/app/share/975517/52c7b51a-488e-42d8-a44f-e004f4bd0f08/files/51. There are only three .7z packages divided into train, val, and test. But the train dataset is only 7 GB and the val dataset is 39GB. Have I downloaded the correct dataset? Or the dataset is intact?Why the val dataset is larger than training dataset?

Performance of RED on other platforms

Good afternoon,

Did you perform any test over your RED algorithm on other platforms? Like V100, A100, and so on... If yes, is it possible to share them?

Is it possible to obtain object tracking annotations on Gen1/1Mpx?

Hi, I wonder if it's possible to get object tracking annotations on Gen1 or 1Mpx dataset? I read the NeurIPS paper of 1Mpx dataset, in Section 5.1 page 7, the paper says "we compute the Intersection over Union (IoU) between 1000 ground truth tracks from the validation set and the predicted boxes". However, according to both papers, only t, (x, y, h, w), class_id are provided as annotations. So I wonder how are you able to extract GT tracks of objects?

I inspect the annotation npy files of Gen1 test set, there is indeed a field called track_id. However, I don't think that's useful as it seems to be unique for each object bbox (see below). I haven't downloaded 1Mpx as it's much larger, so not sure if it's provided there. Thanks in advance!

img

The ground truth bounding boxes seems not aglin well with objects in 1 Mpx Dataset

Hi,
I found that in the 1 Mpx dataset, the provided annotations are offset from the actual positions of the objects, especially for objects at the edges of the images, as shown in Fig.1 below. This miss aglinement occurs on almost all samples.

What could be the possible reasons for this?
It feels like the calibration isn't done between the DVS and RGB camera.

Another question about 1Mpx dataset is there are no annotations for some objects, i.e., annotations are missing for some objects, as shown in Fig.2 below. I think it will be a huge problem for object detection training, as the features that should be objects will be trained as background.

Following is my code for visualization

import cv2
from src.io.psee_loader import PSEELoader
from src.visualize import vis_utils as vis


events_fname = '/Datasets/GEN4/trainfilelist00/train/moorea_2019-02-19_002_td_183500000_243500000_td.dat'
bbox_fname = events_fname[:-7] + '_bbox.npy'

video = PSEELoader(events_fname)
box_video = PSEELoader(bbox_fname)

height, width = video.get_size()
print(height, width)
labelmap = vis.LABELMAP if height == 240 else vis.LABELMAP_LARGE

cv2.namedWindow('out', cv2.WINDOW_NORMAL)
while not video.done:
    delta_t = 20e3
    events = video.load_delta_t(delta_t)
    box_events = box_video.load_delta_t(delta_t)
    im = vis.make_binary_histo(events, img=None, width=width, height=height)
    vis.draw_bboxes(im, box_events, labelmap=labelmap)
    cv2.imshow('out', im)
    cv2.waitKey(10)
    if not box_events.size == 0:
        cv2.waitKey(0)
        pass
cv2.destroyAllWindows()

Fig.1
The miss-aglined results is shown below:
image

Fig.2
Example for missing annotations is shown below. There should be bounding box for pedestrians where indicated by green arrows, but missing. You can reproduce this situation in GEN4/trainfilelist05/train/moorea_2019-06-21_000_2013500000_2073500000_td.dat

image

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.