lava-nc / lava-dl

Deep Learning library for Lava
https://lava-nc.org
BSD 3-Clause "New" or "Revised" License
149 stars 71 forks source link

Update utils.py with temporal_NMS and utility functions #272

Open danielbdr opened 8 months ago

danielbdr commented 8 months ago

temporal_NMS class extends the static frame NMS considering successive frames. Improves accuracy by 2.5%-3% mAP over the static NMS on DBBK100 dataset

Other utility functions:

Issue Number:

Objective of pull request:

Pull request checklist

Your PR fulfills the following requirements:

Pull request type

Please check your PR type:

What is the current behavior?

-

What is the new behavior?

-

Does this introduce a breaking change?

Supplemental information

danielbdr commented 8 months ago

tests

cd /home/dbendaya/work/ContinualLearning/tinyYolov3_lava/YOLOsdnn/loihi8YOLO/

import sys
path = ['/home/dbendaya/work/ContinualLearning/tinyYolov3_lava/YOLOsdnn/',
        '/home/dbendaya/work/ContinualLearning/prophesee-automotive-dataset-toolbox/']
sys.path.extend(path)

from object_detection.boundingbox.utils import temporal_NMS, storeData, accuracy
from tqdm import tqdm
import numpy as np
T = 10
t_nms = temporal_NMS(16)
accuracy_t_nms = []
for k in tqdm(range(13), desc='loading BDD_on_yolo2hd predictions-accuracy tests on NMS methods:'):
    [inputs, targets, bboxes, predictions, counts] = storeData.load('tinyYolo_dump%02d.pkl'%k)
    t_nms.reset()
    detections_frame = [t_nms(predictions[..., t]) for t in range(T)]
    accuracy_t_nms.append(accuracy(detections_frame, bboxes))

print(accuracy_t_nms, np.array(accuracy_t_nms).mean(), sep='\n')