darknet yolov3 output result in one line as pattern

Created on 21 Dec 2018  Â·  4Comments  Â·  Source: AlexeyAB/darknet

ubuntu 16.04 python 2.7 +CPU+no opencv

#./darknet detector test cfg/coco.data cfg/yolov3.cfg yolov3.weights -dont_show < t3.txt > result3.txt

more result3.txt

Enter Image Path:/home/1/ftp/3/2018.09.03/IPC_192.168.7.231_180903162818_53_MD_ALARM.jpg: Predicted in 0.000000 milli-seconds.
Enter Image Path: /home/1/ftp/3/2018.09.03/IPC_192.168.7.231_180903162552_51_MD_ALARM.jpg: Predicted in 0.000000 milli-seconds.
person: 94%

Enter Image Path: /home/1/ftp/3/2018.09.03/IPC_192.168.7.231_180903162550_49_MD_ALARM.jpg: Predicted in 0.000000 milli-seconds.
person: 30%
person: 94%

Enter Image Path: /home/1/ftp/3/2018.09.03/IPC_192.168.7.231_180903162551_50_MD_ALARM.jpg: Predicted in 0.000000 milli-seconds.
Enter Image Path: /home/1/ftp/3/2018.09.03/IPC_192.168.7.231_180903162553_52_MD_ALARM.jpg: Predicted in 0.000000 milli-seconds.
person: 94%
Enter Image Path: /home/1/ftp/3/2018.09.03/IPC_192.168.7.231_180903162819_54_MD_ALARM.jpg: Predicted in 0.000000 milli-seconds.

================================================
how to change the src code .(image.c/detect.c),one result one line without \n.
output result like below txt :

Enter Image Path:/home/1/ftp/3/2018.09.03/IPC_192.168.7.231_180903162818_53_MD_ALARM.jpg: Predicted in 0.000000 milli-seconds.
Enter Image Path: /home/1/ftp/3/2018.09.03/IPC_192.168.7.231_180903162552_51_MD_ALARM.jpg: Predicted in 0.000000 milli-seconds.person: 94%

Enter Image Path: /home/1/ftp/3/2018.09.03/IPC_192.168.7.231_180903162550_49_MD_ALARM.jpg: Predicted in 0.000000 milli-seconds.person: 30% ,person: 94%

Enter Image Path: /home/1/ftp/3/2018.09.03/IPC_192.168.7.231_180903162551_50_MD_ALARM.jpg: Predicted in 0.000000 milli-seconds.
Enter Image Path: /home/1/ftp/3/2018.09.03/IPC_192.168.7.231_180903162553_52_MD_ALARM.jpg: Predicted in 0.000000 milli-seconds,person: 94%
Enter Image Path: /home/1/ftp/3/2018.09.03/IPC_192.168.7.231_180903162819_54_MD_ALARM.jpg: Predicted in 0.000000 milli-seconds.

search web,find bash \python \ ,,,no clue

thanks for any sugestion.

Solved

Most helpful comment

after test ,done.thanks @AlexeyAB

organize the record as follows

  1. detector.c in [void test_detector ] function

printf("Enter Image Path: "); ---》 printf("\nEnter Image Path: ");

2.detector.c

printf("%s: Predicted in %lf milli-seconds.\n", input, ((double)get_time_point() - time) / 1000);
change to
printf("%s,", input);

3.image.c in [draw_detections_v3 ] function

printf("\n"); ----> printf(", ");


for (j = 0; j < classes; ++j) {
if (selected_detections[i].det.prob[j] > thresh && j != best_class)
{printf("%s: %.0f%%\n", names[j], selected_detections[i].det.prob[j] * 100);

-->printf("%s: %.0f%%", names[j], selected_detections[i].det.prob[j] * 100);


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: 

All 4 comments

thanks very much.
just a little question. hope reserved full file path, like below .

Enter Image Path: /home/1/ftp/3/00001.jpg,person: 30% ,person: 94%

how to change detetctor.c ?

after test ,done.thanks @AlexeyAB

organize the record as follows

  1. detector.c in [void test_detector ] function

printf("Enter Image Path: "); ---》 printf("\nEnter Image Path: ");

2.detector.c

printf("%s: Predicted in %lf milli-seconds.\n", input, ((double)get_time_point() - time) / 1000);
change to
printf("%s,", input);

3.image.c in [draw_detections_v3 ] function

printf("\n"); ----> printf(", ");


for (j = 0; j < classes; ++j) {
if (selected_detections[i].det.prob[j] > thresh && j != best_class)
{printf("%s: %.0f%%\n", names[j], selected_detections[i].det.prob[j] * 100);

-->printf("%s: %.0f%%", names[j], selected_detections[i].det.prob[j] * 100);


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: 

close the issue temporarily and wait for time to better method.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shootingliu picture shootingliu  Â·  3Comments

hemp110 picture hemp110  Â·  3Comments

qianyunw picture qianyunw  Â·  3Comments

zihaozhang9 picture zihaozhang9  Â·  3Comments

louisondumont picture louisondumont  Â·  3Comments