Darknet: caluate object total number in one pic

Created on 26 Dec 2018  Â·  6Comments  Â·  Source: AlexeyAB/darknet

ubuntu 16.04+python 2.7 + no GPU

./darknet detector test /home/toor/4/darknet/cfg/coco.data /home/toor/4/darknet/cfg/yolov3.cfg /home/toor/4/darknet/yolov3.weights -dont_show < 01.txt > result1.txt

output example:
Total BFLOPS 65.864
seen 64

Enter Image Path: /home/toor/5/darknet/data/pic/2.jpg,
Enter Image Path: /home/toor/5/darknet/data/pic/1.png,person: 98%,
Enter Image Path: /home/toor/5/darknet/data/pic/4.jpg,person: 99%,person: 94%,person: 55%,traffic light:52%
Enter Image Path: /home/toor/5/darknet/data/pic/3.png,person: 100%,person: 100%,person: 100%,person: 46%,
Enter Image Path: 

have question:

1.how to  caluate person total in pic by change src code? 
  Enter Image Path: /home/toor/5/darknet/data/pic/3.png,

> total person :4

 ,person: 100%,person: 100%,person: 100%,person: 46%, 
2.how to `comment total BFLOPS ` seen 64  in which src file ?
3.if  result no person, how to dont print this line ?

no clue in web.
thanks for any suggestion.

Solved

Most helpful comment

All 6 comments

works.thanks !
result output is :

_Enter Image Path: /home/toor/5/darknet/data/pic/2.jpg, total object = 0_
Enter Image Path: /home/toor/5/darknet/data/pic/1.png,person: 98%, total object = 1
Enter Image Path: /home/toor/5/darknet/data/pic/4.jpg,person: 99%,person: 94%,person: 55%, total object = 3
Enter Image Path: /home/toor/5/darknet/data/pic/3.png,person: 100%,person: 100%,person: 100%,person: 46%, total object = 4
Enter Image Path:


there is a little issue ,
if total object=0 ,then dont display this line by change the src code?
for example

Enter Image Path: /home/toor/5/darknet/data/pic/1.png,person: 98%, total object = 1
Enter Image Path: /home/toor/5/darknet/data/pic/4.jpg,person: 99%,person: 94%,person: 55%, total object = 3
Enter Image Path: /home/toor/5/darknet/data/pic/3.png,person: 100%,person: 100%,person: 100%,person: 46%, total object = 4
Enter Image Path:

Use
if(selected_detections_num > 0) printf(" total objects = %d \n", selected_detections_num);

instead of
printf(" total objects = %d \n", selected_detections_num);

thanks a lot. @AlexeyAB
please forgive me for my unclear expression. correction as below

if total number =0 , then dont display full line Enter Image Path: /home/toor/5/darknet/data/pic/2.jpg,

Is possiable change src code to achieve the above effect ?

Considering that this is a new problem, so i reopening new issue(#2113).

@AlexeyAB , Please suggest
Here how can we count :
total number of person
total number of traffic light
??
and display both counts on the predicted image ??

Resolved, thanxs

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Yumin-Sun-00 picture Yumin-Sun-00  Â·  3Comments

shootingliu picture shootingliu  Â·  3Comments

kebundsc picture kebundsc  Â·  3Comments

HilmiK picture HilmiK  Â·  3Comments

jasleen137 picture jasleen137  Â·  3Comments