AlexeyAB / darknet

YOLOv4 / Scaled-YOLOv4 / YOLO - Neural Networks for Object Detection (Windows and Linux version of Darknet )
http://pjreddie.com/darknet/
Other
21.7k stars 7.96k forks source link

The problem of detecting one object as two objects. #5010

Open yacad opened 4 years ago

yacad commented 4 years ago

Hello @AlexeyAB or who ever wishes to assist me.

I would like to solve the problem of detecting one object as two objects(ex. car, truck) as shown below.

image

I also tested pjreddie's darknet but I had no such problem.

This may not be a problem. However, I am having trouble with tracking etc. because of this problem.

Please let me know how to solve it.

AlexeyAB commented 4 years ago
yacad commented 4 years ago

Thanks for your reply @AlexeyAB.

Try to run detection with flag -letter_box : The problem was not solved.

Do you use default yolov3.cfg/yolov3.weights? Try to use this model: https://github.com/AlexeyAB/darknet#pre-trained-models : Improvements were made, but the problem was not resolved.

I downloaded a new version today and tested it again.

  1. Download the latest program. $ git clone https://github.com/AlexeyAB/darknet.git
  2. After modifying Makefile, make. $ make
  3. Download weights. $ wget https://pjreddie.com/media/files/yolov3.weights
  4. Run ./darknet detector demo cfg / coco.data cfg / yolov3.cfg yolov3.weights ../video/videodemo.mp4 -thresh 0.3

Likewise, as shown in the figure below, there was a problem of detecting one object as two objects (eg, car, truck). image

I also tested again pjreddie's darknet but I had no such problem.(same yolov3.cfg, yolov3.weights) pjreddie's darknet is expressed as ',' or car and truck are alternately expressed, but there was no such problem.

What is the problem? Or is this not a problem?

Please help.

AlexeyAB commented 4 years ago

Attach 3 files in zip-archive

  1. source image
  2. image with detections by using https://github.com/AlexeyAB/darknet
  3. image with detections by using https://github.com/pjreddie/darknet
yacad commented 4 years ago

Thanks for your reply @AlexeyAB.

I tested with the same file(yolov3.cfg, yolov3.weights). As can be seen from the results, one object was judged as two or three objects. Object boxes overlapped. I want AlexeyAB to judge one object as one.

yacad commented 4 years ago

@AlexeyAB.

If you need more samples, I will capture and upload more from the video file. I hope this solves the problem.

Thank you for always helping.

AlexeyAB commented 4 years ago

Show command which you used for detection

AlexeyAB commented 4 years ago

Set in cfg file

[net]
width=608
height=608

and run detection with -letter_box flag

yacad commented 4 years ago

Thanks for your reply @AlexeyAB.

I used the following command for detection. I used the same command for AlexeyAB and pjreddie. video : ./darknet detector demo cfg /coco.data cfg/yolov3.cfg yolov3.weights ../video/videodemo.mp4 image : ./darknet detect cfg/yolov3.cfg yolov3.weights ../image/source.jpg

yacad commented 4 years ago

and run detection with -letter_box flag

result( ./darknet detect cfg/yolov3.cfg yolov3.weights ../image/source.jpg -letter_box) image

The problem was not solved.

xjohnxjohn commented 4 years ago

@yacad you use thresh 0.5 can solve this problem

yacad commented 4 years ago

Thanks for your reply @xjohnxjohn

Changing the threshold value did not completely solve the problem.

yacad commented 4 years ago

I found a solution.

In demo.c

// if (nms) do_nms_obj (local_dets, local_nboxes, l.classes, nms); // bad results if (nms) { if (l.nms_kind == DEFAULT_NMS) do_nms_sort (local_dets, local_nboxes, l.classes, nms); else diounms_sort (local_dets, local_nboxes, l.classes, nms, l.nms_kind, l.beta_nms); }

It was changed as follows.

if (nms) do_nms_obj(local_dets, local_nboxes, l.classes, nms); / if (nms) { if (l.nms_kind == DEFAULT_NMS) do_nms_sort(local_dets, local_nboxes, l.classes, nms); else diounms_sort(local_dets, local_nboxes, l.classes, nms, l.nms_kind, l.beta_nms); } /

There may be a reason for the change, but using the previous function solved the problem. I want to know why you changed the existing function (do_nms_obj) without using it.

RollingIsland commented 4 years ago

Hello @yacad, @AlexeyAB . Here meet the same problem while using yolo as dll: 1 2 How can I make nms work correctly in dll?