This is an anofficial implementation of Seq-nms. The original paper is here. The original code is here.
The reason of re-implementing this algorithm is to combine it with YOLO. We like to see the difference between the original detection results and the updated detection results.
python setup.py build_ext --inplace
More details can be found in the original repo.
The dataset structure is as follows:
seq-nms
├── dataset/
│ ├── images/ # original images
│ │ ├── 0.jpg
│ │ ├── 1.jpg
├───|── detected_images/ # yolo detected images
│ │ ├── 0.jpg
│ │ ├── 1.jpg
│ |── yolo_labels/ # yolo detected labels
│ ├── 0.txt
│ ├── 1.txt
The main program is find_seq.py
, which is based on the original function seq_nms.py
. To run the main program, use the following command:
python find_seq.py --img [IMAGE FOLDER] --yolo [YOLO DETECTION FOLDER]
We provide 4 frames for better visualization. These 4 frames are come from our koala detection dataset. Without using seq-nms, our detector is struggle for detecting the class we are interested in. Using seq-nms, we can use the frame with higher confidence to boost the ones with lower confidence.
To run the main program and generate the new detection results, use the following command:
python find_seq.py --img dataset/detected_images --yolo dataset/yolo_labels/
It will create a new folder called updated_labels
which contains the updated detection results. We show the comparison between the original detection results and the updated detection results in the following figure.
Each row is a frame. We start the frame from index 0. The maximum number of bbox for each frame is 4 here. We name each bbox in the first row like 0_0, 0_1,..0_4
. We separate classes by different colors. The last 2 white boxes in frame 3 means bbox with 0 coordinates, confidence and label.