0

I'm trying to use the coco dataset, just to make detections for 4 classes. I use the YOLOv4 network. I changed the coco.data file like this:

classes= 4
train = /home/pjreddie/data/coco/trainvalno5k.txt
valid = coco_testdev
#valid = data/coco_val_5k.list
names = data/coco.names
backup = /home/pjreddie/backup/
eval=coco

, and the coco.names like this:

person
car
bus
truck

I also changed all the classes lines from 80 to 4 in the yolov4.cfg file and changed filters according to the 3*(classes+5) formula. When I pass a movie to the detector by using:

./darknet detector demo cfg/coco.data cfg/yolov4.cfg yolov4.weights -dont_show /mydrive/praca/videoname1.mkv -thresh 0.4 -i 0 -out_filename results.avi

It doesn't detect anything. What could be the issue?

AbdelAziz AbdelLatef
  • 3,650
  • 6
  • 24
  • 52
Kuba Głowacz
  • 49
  • 1
  • 6
  • This is not a programming question. It seems to be either a question about how to use a particular piece of software, or a question about the mathematics that underly that particular piece of software. – gspr Feb 01 '21 at 14:10
  • Can you provide the details how you compiled Darknet? Did you write OPENCV=1 in your Makefile? – Addie Ira B. Parico Feb 01 '21 at 14:33
  • @A.Parico I used a colab notebook to compile darknet, and I wrote this OPENCV=1 argument in the makefile – Kuba Głowacz Feb 01 '21 at 21:19

2 Answers2

2

If you do not have the time or resources to train, you can prevent the bounding boxes of other 76 objects from being drawn by replacing the unwanted classes with dont_show in the original coco.names file

person
dont_show
car
dont_show
dont_show
bus
dont_show
truck
dont_show
.
.
.
(and so on)

Reference: https://github.com/AlexeyAB/darknet/issues/7318#issuecomment-771603265

1

You can't only change these files, you need to retrain your network for the chosen classes only like this.

AbdelAziz AbdelLatef
  • 3,650
  • 6
  • 24
  • 52