一.修改源代碼
(1)修改cfg/voc.data
classess=20 改成 classes = 1
(2)修改data/voc.names
只留下person這一類
(3)修改examples/detector.c
1 void run_detector(int argc, char **argv)//該函數中,倒數第三行.line=542 2 int classes = option_find_int(options, "classes", 1);//最后一個參數修改成1 3 4 void test_detector(char *datacfg, char *cfgfile, char *weightfile, char *filename, float thresh)函數中 5 draw_detections(im, l.w*l.h*l.n, thresh, boxes, probs, names, alphabet, 1); //最后一個參數修改成1。line=481
二.重新編譯和測試
(1)重新編譯
make clean
make
(2)測試
./darknet detect cfg/yolo.cfg yolo.weights /home/260158/pictures-data/mark-pic/video1/images/491.jpg
上面為我的圖片路徑